[Bug target/77628] New: avx512: unnecessary GR extending after kmovw

2016-09-17 Thread wojciech.mula at microgen dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77628

Bug ID: 77628
   Summary: avx512: unnecessary GR extending after kmovw
   Product: gcc
   Version: 5.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: wojciech.mula at microgen dot com
  Target Milestone: ---

According to the latests documentation from Intel, the kmovw instruction
zeros the higher part of a GP register:

KMOVW
IF *destination is a memory location*
DEST[15:0] <- SRC[15:0]
IF *destination is a mask register or a GPR *
DEST <- ZeroExtension(SRC[15:0])

GCC adds superfluous movzwl after kmovw:

Program:

#include 
#include 

uint32_t test(__m512i a, __m512i b) {

uint32_t c = _mm512_cmpeq_epi32_mask(a, b);
return c;
}

Invocation:

$ gcc-5 --version
gcc-5 (Debian 5.3.1-13) 5.3.1 20160323
$ gcc-5 -O3 -S -mavx512f report.cpp

Assembly output:

vpcmpeqd%zmm1, %zmm0, %k1
kmovw   %k1, %eax
movzwl  %ax, %eax <<<< HERE
ret

[Bug c++/67368] New: Inlining failed due to no_sanitize_address and always_inline conflict

2015-08-27 Thread wojciech.mula at microgen dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368

Bug ID: 67368
   Summary: Inlining failed due to no_sanitize_address and
always_inline conflict
   Product: gcc
   Version: 4.9.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: wojciech.mula at microgen dot com
  Target Milestone: ---

When compiling program

-- bug.cpp --
#include 

__attribute__((no_sanitize_address))   
 void foo() {
   __m128i z = _mm_setzero_si128();
}
-- eof --

using following command

$ g++ -c -fsanitize=address bug.cpp

GCC reports:

In file included from bug.cpp:1:0:
[...]/x86_64-unknown-linux-gnu/4.9.2/include/emmintrin.h: In function ‘void
foo()’:
[...]/x86_64-unknown-linux-gnu/4.9.2/include/emmintrin.h:749:1: error: inlining
failed in call to always_inline ‘__m128i _mm_setzero_si128()’: function
attribute mismatch
 _mm_setzero_si128 (void)
 ^
bug.cpp:5:36: error: called from here
  __m128i z = _mm_setzero_si128();

Compiler version (built from the sources):

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=[...]/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: [...]/source/gcc-4.9.2/configure --prefix=[...]
--with-local-prefix=[...] --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 4.9.2 (GCC)

I've checked the sample program on https://gcc.godbolt.org/ and for versions
5.1.0 & 5.2.0 there is the same problem. However 4.9.2 from Ubuntu is not
affected.