[Bug target/78794] [7 Regression] We noticed ~9% regression in 32-bit mode for 462.libquntum on Avoton after r243202

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Dec 13 13:54:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78794

--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 1cd1cd8..f718040 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3417,7 +3417,10 @@ dimode_scalar_chain::compute_convert_gain ()
               || GET_CODE (src) == AND)
        {
          gain += ix86_cost->add;
-         if (CONST_INT_P (XEXP (src, 0)))
+         /* Additional gain for andnot.  */
+         if (GET_CODE (XEXP (src, 0)) == NOT)
+           gain += ix86_cost->add;
+         else if (CONST_INT_P (XEXP (src, 0)))
            gain -= vector_const_cost (XEXP (src, 0));
          if (CONST_INT_P (XEXP (src, 1)))
            gain -= vector_const_cost (XEXP (src, 1));

results in:

.L4:
        movq    (%eax), %xmm1
        movdqa  %xmm1, %xmm4
        pandn   %xmm2, %xmm4
        movdqa  %xmm4, %xmm0
        punpcklqdq      %xmm4, %xmm0
        ptest   %xmm0, %xmm0
        jne     .L3
        pxor    %xmm3, %xmm1
        movq    %xmm1, (%eax)
.L3:
        addl    $12, %eax
        cmpl    %edx, %eax
        jne     .L4

Please note pandn that replaces pand/pxor.

Can you please test the patch on your codebase?


More information about the Gcc-bugs mailing list