re PR target/66922 (wrong code for bit-field struct at -O1 and above on x86_64-linux...
authorUros Bizjak <ubizjak@gmail.com>
Sat, 18 Jul 2015 09:50:37 +0000 (11:50 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Sat, 18 Jul 2015 09:50:37 +0000 (11:50 +0200)
PR target/66922
* config/i386/i386.c (ix86_expand_pextr): Reject extractions
from misaligned positions.
(ix86_expand_pinsr): Reject insertions to misaligned positions.

testsuite/ChangeLog:

PR target/66922
* gcc.target/i386/pr66922.c: New test.

From-SVN: r225980

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr66922.c [new file with mode: 0644]

index 98fb37bb2a8e5f754d7af2687093260ccc0d77f8..095713d9dffca10c77168c583ba0185c208a0628 100644 (file)
@@ -1,3 +1,10 @@
+2015-07-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/66922
+       * config/i386/i386.c (ix86_expand_pextr): Reject extractions
+       from misaligned positions.
+       (ix86_expand_pinsr): Reject insertions to misaligned positions.
+
 2015-07-18  Sebastian Pop  <s.pop@samsung.com>
 
        PR middle-end/46851
index 01a1cb94a7c99d757e8f7ed5cbf1278617c61295..7901a4f17d7c16fb4e86b9bc4f6a0cf278b879fa 100644 (file)
@@ -50591,6 +50591,10 @@ ix86_expand_pextr (rtx *operands)
            return false;
          }
 
+       /* Reject extractions from misaligned positions.  */
+       if (pos & (size-1))
+         return false;
+
        if (GET_MODE (dst) == dstmode)
          d = dst;
        else
@@ -50687,6 +50691,10 @@ ix86_expand_pinsr (rtx *operands)
            return false;
          }
 
+       /* Reject insertions to misaligned positions.  */
+       if (pos & (size-1))
+         return false;
+
        if (GET_CODE (src) == SUBREG)
          {
            unsigned int srcpos = SUBREG_BYTE (src);
index a9b34ba71f1623920a9db1c5e425d3da2b8276db..214ad673d89a18d56468ee2c9abf539e73e81d01 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/66922
+       * gcc.target/i386/pr66922.c: New test.
+
 2015-07-18  Sebastian Pop  <s.pop@samsung.com>
 
        PR middle-end/46851
diff --git a/gcc/testsuite/gcc.target/i386/pr66922.c b/gcc/testsuite/gcc.target/i386/pr66922.c
new file mode 100644 (file)
index 0000000..46274b2
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -msse2" } */
+/* { dg-require-effective-target sse2 } */
+
+#include "sse2-check.h"
+
+struct S 
+{
+  int:31;
+  int:2;
+  int f0:16;
+  int f1;
+  int f2;
+};
+
+static void 
+sse2_test (void)
+{
+  struct S a = { 1, 0, 0 };
+
+  if (a.f0 != 1)
+    __builtin_abort(); 
+}