[llvm-bugs] [Bug 28849] New: AVX512: invalid code generation for scalar code when AVX512 is enabled
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 4 13:19:24 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28849
Bug ID: 28849
Summary: AVX512: invalid code generation for scalar code when
AVX512 is enabled
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: wenzel.jakob at epfl.ch
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
When AVX512 is enabled, Clang produces incorrect code for very basic scalar
programs which don't involve any vector/intrinsic code at all. This only occurs
at the lowest optimization level.
Consider the following snippet:
#include <assert.h>
int main(int argc, char *argv[]) {
float a = 1;
float b = 1;
assert(a == b);
return 0;
}
Example usage (Clang HEAD):
$ clang test.cpp -o test -mavx512f -fomit-frame-pointer
$ ./test
./Assertion failed: (a == b), function main, file test.cpp, line 6.
Looking at the assembly, there are some weird sequences of moves from
traditional registers to AVX512-style mask registers and back. Probably
something is wrong there.
_main: ## @main
.cfi_startproc
## BB#0:
subq $40, %rsp
Ltmp0:
.cfi_def_cfa_offset 48
movb $1, %al
movl $0, 36(%rsp)
movl %edi, 32(%rsp)
movq %rsi, 24(%rsp)
movl $1065353216, 20(%rsp) ## imm = 0x3F800000
movl $1065353216, 16(%rsp) ## imm = 0x3F800000
vmovss 20(%rsp), %xmm0 ## xmm0 = mem[0],zero,zero,zero
vmovss LCPI0_0(%rip), %xmm1 ## xmm1 = mem[0],zero,zero,zero
vucomiss %xmm1, %xmm0
setnp %cl
sete %dl
setne %r8b
setp %r9b
andb %cl, %dl
andb $1, %dl
movb %dl, %r10b
kmovw %r10d, %k0
orb %r9b, %r8b
andb $1, %r8b
movb %r8b, %r10b
kmovw %r10d, %k1
testb $1, %k1
movb %al, 15(%rsp) ## 1-byte Spill
kmovw %k0, 12(%rsp) ## 2-byte Spill
jne LBB0_1
jmp LBB0_2
LBB0_1:
leaq L___func__.main(%rip), %rdi
leaq L_.str(%rip), %rsi
movl $6, %edx
leaq L_.str.1(%rip), %rcx
callq ___assert_rtn
LBB0_2:
jmp LBB0_3
LBB0_3:
xorl %eax, %eax
addq $40, %rsp
retq
.cfi_endproc
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160804/d0493218/attachment.html>
More information about the llvm-bugs
mailing list