Summary: | _mm_sub_pd is incorrectly substituted with vandnps | ||
---|---|---|---|
Product: | gcc | Reporter: | Matthias Kretz (Vir) <mkretz> |
Component: | target | Assignee: | Jakub Jelinek <jakub> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | jakub |
Priority: | P3 | Keywords: | wrong-code |
Version: | 4.8.0 | ||
Target Milestone: | 4.7.3 | ||
Host: | Target: | x86_64-*-*, i?86-*-* | |
Build: | Known to work: | 4.7.3, 4.8.0 | |
Known to fail: | 4.6.2, 4.7.0, 4.7.1, 4.7.2 | Last reconfirmed: | 2012-09-25 00:00:00 |
Attachments: | gcc48-pr54703.patch |
Description
Matthias Kretz (Vir)
2012-09-25 13:29:16 UTC
Um, sorry. Forgot to note the compiler switches: gcc -O1 -march=bdver1 I can't reproduce the error with corei7-avx or any other non-AVX target. Confirmed. Looking into it. Created attachment 28270 [details] gcc48-pr54703.patch Untested fix. (In reply to comment #4) > Created attachment 28270 [details] > gcc48-pr54703.patch Since I wrote the code which breaks this, this looks good. The only question I have is why is AND allowed on non integer types anyways? Yeah, the generic code is not buggy, it seems sane to assume AND is integral/vector integer operation only, but I think i?86 isn't the only backend that uses AND on vector floating point modes extensively. Thanks for the quick response! You guys are cool! :) The pattern here is for calculation with extended precision: xh = x & mask; xl = x - xh; yh = y & mask yl = y - yh; /* x * y + small = */ xh * yh + ((xh * yl + xl * yh) + (xl * yl + small)); Other than that, yes there's a lot of ANDPS is SSE code, just this pattern which gets miscompiled is not very common. Author: jakub Date: Thu Sep 27 10:48:07 2012 New Revision: 191801 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191801 Log: PR target/54703 * simplify-rtx.c (simplify_binary_operation_1): Perform (x - (x & y)) -> (x & ~y) optimization only for integral modes. * gcc.target/i386/pr54703.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr54703.c Modified: trunk/gcc/ChangeLog trunk/gcc/simplify-rtx.c trunk/gcc/testsuite/ChangeLog Author: jakub Date: Thu Sep 27 10:53:42 2012 New Revision: 191802 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191802 Log: PR target/54703 * simplify-rtx.c (simplify_binary_operation_1): Perform (x - (x & y)) -> (x & ~y) optimization only for integral modes. * gcc.target/i386/pr54703.c: New test. Added: branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/pr54703.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/simplify-rtx.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog Fixed for 4.7.3+ so far. The 4.6 branch has been closed, fixed in GCC 4.7.3. |