i386: Fix zero/sign extend expanders [PR95229]
authorUros Bizjak <ubizjak@gmail.com>
Wed, 20 May 2020 17:00:39 +0000 (19:00 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Wed, 20 May 2020 17:00:39 +0000 (19:00 +0200)
2020-05-20  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/95229
* config/i386/sse.md (<code>v8qiv8hi2): Use
simplify_gen_subreg instead of simplify_subreg.
(<code>v8qiv8si2): Ditto.
(<code>v4qiv4si2): Ditto.
(<code>v4hiv4si2): Ditto.
(<code>v8qiv8di2): Ditto.
(<code>v4qiv4di2): Ditto.
(<code>v2qiv2di2): Ditto.
(<code>v4hiv4di2): Ditto.
(<code>v2hiv2di2): Ditto.
(<code>v2siv2di2): Ditto.

gcc/testsuite/ChangeLog:
PR target/95229
* g++.target/i386/pr95229.C: New test.

gcc/ChangeLog
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/i386/pr95229.C [new file with mode: 0644]

index 3348424..3368d86 100644 (file)
@@ -1,5 +1,20 @@
 2020-05-20  Uroš Bizjak  <ubizjak@gmail.com>
 
+       PR target/95229
+       * config/i386/sse.md (<code>v8qiv8hi2): Use
+       simplify_gen_subreg instead of simplify_subreg.
+       (<code>v8qiv8si2): Ditto.
+       (<code>v4qiv4si2): Ditto.
+       (<code>v4hiv4si2): Ditto.
+       (<code>v8qiv8di2): Ditto.
+       (<code>v4qiv4di2): Ditto.
+       (<code>v2qiv2di2): Ditto.
+       (<code>v4hiv4di2): Ditto.
+       (<code>v2hiv2di2): Ditto.
+       (<code>v2siv2di2): Ditto.
+
+2020-05-20  Uroš Bizjak  <ubizjak@gmail.com>
+
        PR target/95238
        * config/i386/i386.md (*pushsi2_rex64):
        Use "e" constraint instead of "i".
index 9bf4361..c831543 100644 (file)
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V16QImode, operands[1], V8QImode, 0);
+      operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0);
       emit_insn (gen_sse4_1_<code>v8qiv8hi2 (operands[0], operands[1]));
       DONE;
     }
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V16QImode, operands[1], V8QImode, 0);
+      operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0);
       emit_insn (gen_avx2_<code>v8qiv8si2 (operands[0], operands[1]));
       DONE;
     }
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V16QImode, operands[1], V4QImode, 0);
+      operands[1] = simplify_gen_subreg (V16QImode, operands[1], V4QImode, 0);
       emit_insn (gen_sse4_1_<code>v4qiv4si2 (operands[0], operands[1]));
       DONE;
     }
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V8HImode, operands[1], V4HImode, 0);
+      operands[1] = simplify_gen_subreg (V8HImode, operands[1], V4HImode, 0);
       emit_insn (gen_sse4_1_<code>v4hiv4si2 (operands[0], operands[1]));
       DONE;
     }
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V16QImode, operands[1], V8QImode, 0);
+      operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0);
       emit_insn (gen_avx512f_<code>v8qiv8di2 (operands[0], operands[1]));
       DONE;
     }
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V16QImode, operands[1], V8QImode, 0);
+      operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0);
       emit_insn (gen_avx2_<code>v4qiv4di2 (operands[0], operands[1]));
       DONE;
     }
          (match_operand:V2QI 1 "register_operand")))]
   "TARGET_SSE4_1"
 {
-  operands[1] = simplify_subreg (V16QImode, operands[1], V2QImode, 0);
+  operands[1] = simplify_gen_subreg (V16QImode, operands[1], V2QImode, 0);
   emit_insn (gen_sse4_1_<code>v2qiv2di2 (operands[0], operands[1]));
   DONE;
 })
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V8HImode, operands[1], V4HImode, 0);
+      operands[1] = simplify_gen_subreg (V8HImode, operands[1], V4HImode, 0);
       emit_insn (gen_avx2_<code>v4hiv4di2 (operands[0], operands[1]));
       DONE;
     }
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V8HImode, operands[1], V2HImode, 0);
+      operands[1] = simplify_gen_subreg (V8HImode, operands[1], V2HImode, 0);
       emit_insn (gen_sse4_1_<code>v2hiv2di2 (operands[0], operands[1]));
       DONE;
     }
 {
   if (!MEM_P (operands[1]))
     {
-      operands[1] = simplify_subreg (V4SImode, operands[1], V2SImode, 0);
+      operands[1] = simplify_gen_subreg (V4SImode, operands[1], V2SImode, 0);
       emit_insn (gen_sse4_1_<code>v2siv2di2 (operands[0], operands[1]));
       DONE;
     }
index d62db05..9d04b2d 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-20  Uroš Bizjak  <ubizjak@gmail.com>
+
+       PR target/95229
+       * g++.target/i386/pr95229.C: New test.
+
 2020-05-20  Mark Eggleston  <markeggleston@gcc.gnu.org>
 
        PR fortran/39695
diff --git a/gcc/testsuite/g++.target/i386/pr95229.C b/gcc/testsuite/g++.target/i386/pr95229.C
new file mode 100644 (file)
index 0000000..edf5aa4
--- /dev/null
@@ -0,0 +1,24 @@
+// PR target/95229
+// { dg-do compile }
+// { dg-options "-O3 -march=znver1" }
+
+struct a {
+  unsigned long long b;
+  unsigned long long c;
+};
+
+class {
+public:
+  a d;
+} e;
+
+struct f {
+  unsigned g;
+  unsigned h;
+  void i();
+};
+
+void f::i() {
+  e.d.b += g;
+  e.d.c += h;
+}