Miscompiles in test-suite with AVX512F
| Bugzilla Link | 29112 |
| Resolution | FIXED |
| Resolved on | Oct 04, 2016 15:45 |
| Version | trunk |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
| CC | @topperc,@delena,@hfinkel,@igor-breger,@ZviRackover |
Extended Description
The following 5 tests fail when built with AVX512F:
test-suite :: MultiSource/Applications/JM/ldecod/ldecod.test
test-suite :: MultiSource/Applications/SPASS/SPASS.test
test-suite :: MultiSource/Applications/lambda-0.1.3/lambda.test
test-suite :: MultiSource/Benchmarks/MallocBench/gs/gs.test
test-suite :: SingleSource/UnitTests/Vector/SSE/Vector-sse.stepfft.test
I don't know about the other 4, but I've bisected the ldecod failure to r274613. To be more precise, with r274613 we get a sigill, but manually applying the fix from r276347 gets us to a segfault, like in trunk.
Fixed in r282690
The bug is because AVX2 instruction ( vmovdqa ) generated to spill xmm15-31 register - incorrect/illegal operation. For example we try to generate vmovdqa 160(%rsp), %xmm24 but actually the follow instruction was encoded. vmovdqa 160(%rsp), %xmm8
Elena working to fix the issue.
Reverted r274613 in r279782, not closing since Vector-sse.stepfft still fails.
Verified the reverting r274613 and its followups (r276347, r277289) will fix ldecod, SPASS, lambda and gs. Vector-sse.stepfft still fails, so that's unrelated.
I think I know what the problem with r274613 is. After SETCC, we can only assume the i1 is zero-extended up to i8, but the patterns use kmovw, which would requires it to have already been zexted to i16.
E.g. consider: define i32 @bar(i32 %b, i32 %c, i1 %d) { %cmp = icmp eq i32 %b, %c %or = or i1 %d, %cmp %z = zext i1 %or to i32 ret i32 %z }
Building on x86_64 with AVX512F, we currently get: andl $1, %edx kmovw %edx, %k0 cmpl %esi, %edi sete %al kmovw %eax, %k1 korw %k1, %k0, %k0 kmovw %k0, %eax retq
If I'm not mistaken, nothing here zeroes bits 8-15 of rax: "sete %al" zeroes bits 1-7, and "kmovw %k0, %eax" zeroes bits 15-63, but bits 8-15 are garbage.
Elena, do you see a quick fix for this? If not, we should probably revert r274613 and reopen llvm/llvm-project#29087 .