This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/66866] [miscompile] incorrect load address on manual vector shuffle


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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
"Safe" fix:

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c      (revision 225768)
+++ gcc/config/i386/i386.c      (working copy)
@@ -50528,7 +50528,11 @@ ix86_expand_pinsr (rtx *operands)
     }

   if (GET_CODE (src) == SUBREG)
-    src = SUBREG_REG (src);
+    {
+      if (SUBREG_BYTE (src) != 0)
+       return false;
+      src = SUBREG_REG (src);
+    }

   switch (GET_MODE (dst))
     {

but with awful consequences for code-generation (-O2, for the reduced
testcase):

_Z4shufDv2_x:
.LFB0:
        .cfi_startproc
        pxor    %xmm1, %xmm1
        movabsq $-4294901761, %rdx
        movaps  %xmm0, -24(%rsp)
        movq    -16(%rsp), %rax
        movaps  %xmm1, -24(%rsp)
        movzwl  %ax, %eax
        salq    $16, %rax
        movq    -16(%rsp), %rcx
        andq    %rcx, %rdx
        orq     %rax, %rdx
        movq    %rdx, -16(%rsp)
        movdqa  -24(%rsp), %xmm0
        ret


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]