]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: Fix wrong code with MVE V2DImode loads and stores [PR99960]
authorAlex Coplan <alex.coplan@arm.com>
Mon, 10 May 2021 08:46:45 +0000 (09:46 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Mon, 10 May 2021 08:46:45 +0000 (09:46 +0100)
As the PR shows, we currently miscompile V2DImode loads and stores for
MVE.  We're currently using 64-bit loads/stores, but need to be using
128-bit vector loads and stores. Fixed thusly.

Some intrinsics tests were checking that we (incorrectly) used the
64-bit loads/stores: these have been updated.

gcc/ChangeLog:

PR target/99960
* config/arm/mve.md (*mve_mov<mode>): Simplify output code. Use
vldrw.u32 and vstrw.32 for V2D[IF]mode loads and stores.

gcc/testsuite/ChangeLog:

PR target/99960
* gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c:
Update now that we're (correctly) using full 128-bit vector
loads/stores.
* gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c:
Likewise.
* gcc.target/arm/mve/intrinsics/vuninitializedq_int.c: Likewise.
* gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c:
Likewise.

gcc/config/arm/mve.md
gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c

index 7467d5f4d573498fe228f7002e9c50af92fbb18c..5c11885fb73f69bbcbe6565af02959202d900cfa 100644 (file)
 
   if (which_alternative == 4 || which_alternative == 7)
     {
-      rtx ops[2];
-      int regno = (which_alternative == 7)
-                 ? REGNO (operands[1]) : REGNO (operands[0]);
-
-      ops[0] = operands[0];
-      ops[1] = operands[1];
-      if (<MODE>mode == V2DFmode || <MODE>mode == V2DImode)
-       {
-         if (which_alternative == 7)
-           {
-             ops[1] = gen_rtx_REG (DImode, regno);
-             output_asm_insn ("vstr.64\t%P1, %E0",ops);
-           }
-         else
-           {
-             ops[0] = gen_rtx_REG (DImode, regno);
-             output_asm_insn ("vldr.64\t%P0, %E1",ops);
-           }
-       }
-      else if (<MODE>mode == TImode)
+      if (<MODE>mode == V2DFmode || <MODE>mode == V2DImode || <MODE>mode == TImode)
        {
          if (which_alternative == 7)
-           output_asm_insn ("vstr.64\t%q1, %E0",ops);
+           output_asm_insn ("vstrw.32\t%q1, %E0", operands);
          else
-           output_asm_insn ("vldr.64\t%q0, %E1",ops);
+           output_asm_insn ("vldrw.u32\t%q0, %E1",operands);
        }
       else
        {
          if (which_alternative == 7)
-           {
-             ops[1] = gen_rtx_REG (TImode, regno);
-             output_asm_insn ("vstr<V_sz_elem1>.<V_sz_elem>\t%q1, %E0",ops);
-           }
+           output_asm_insn ("vstr<V_sz_elem1>.<V_sz_elem>\t%q1, %E0", operands);
          else
-           {
-             ops[0] = gen_rtx_REG (TImode, regno);
-             output_asm_insn ("vldr<V_sz_elem1>.<V_sz_elem>\t%q0, %E1",ops);
-           }
+           output_asm_insn ("vldr<V_sz_elem1>.<V_sz_elem>\t%q0, %E1", operands);
        }
       return "";
     }
index 7420d0198e7450f566644a74bac925170b49d688..a9b1f81b62d9c7c360c28900d0c70d254ee76eb9 100644 (file)
@@ -11,6 +11,6 @@ foo (uint64x2_t * addr)
 }
 
 /* { dg-final { scan-assembler "vldrd.64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */
-/* { dg-final { scan-assembler-times "vldr.64" 1 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 1 } } */
+/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */
 /* { dg-final { scan-assembler-not "__ARM_undef" } } */
index ebe5b2fd70c7e9c1ebe6e2eedb185975afea36b9..e32a06695aeca2a039685a8b3fddc9c2429ca837 100644 (file)
@@ -11,6 +11,6 @@ foo (uint64x2_t * addr)
 }
 
 /* { dg-final { scan-assembler "vldrd.64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */
-/* { dg-final { scan-assembler-times "vldr.64" 1 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 1 } } */
+/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */
 /* { dg-final { scan-assembler-not "__ARM_undef" } } */
index 231a24a1e5550b444c5476bfc0d1f6802a4952c8..bb06cf88e324d3414846e0c787a384a11fb70b06 100644 (file)
@@ -10,6 +10,6 @@ int64x2_t foo (uint64x2_t * addr, mve_pred16_t p)
 
 /* { dg-final { scan-assembler "vpst" } } */
 /* { dg-final { scan-assembler "vldrdt.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */
-/* { dg-final { scan-assembler-times "vldr.64" 1 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 1 } } */
+/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */
 /* { dg-final { scan-assembler-not "__ARM_undef" } } */
index b8d9b5c139150536721b1a66636ce9b5a86bf093..558115d49efcd65500e2f1b8a2cf7c00e6e2a920 100644 (file)
@@ -10,6 +10,6 @@ uint64x2_t foo (uint64x2_t * addr, mve_pred16_t p)
 
 /* { dg-final { scan-assembler "vpst" } } */
 /* { dg-final { scan-assembler "vldrdt.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */
-/* { dg-final { scan-assembler-times "vldr.64" 1 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 1 } } */
+/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */
 /* { dg-final { scan-assembler-not "__ARM_undef" } } */
index bf6692fe57322ac9ed5c949a9697d3ed7a565acc..cc5e6358bee95637a8d58dd4fe36ac0c17315fa6 100644 (file)
@@ -27,6 +27,5 @@ foo ()
 
 /* { dg-final { scan-assembler-times "vstrb.8" 2 } } */
 /* { dg-final { scan-assembler-times "vstrh.16" 2 } } */
-/* { dg-final { scan-assembler-times "vstrw.32" 2 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 2 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 4 } } */
 /* { dg-final { scan-assembler-not "__ARM_undef" } } */
index 4f66a07ac29030482a2643e10907d0dae24743af..bfeb52b4dd66ef3cf6c2530acade3872dc2cc114 100644 (file)
@@ -28,6 +28,5 @@ foo ()
 
 /* { dg-final { scan-assembler-times "vstrb.8" 2 } } */
 /* { dg-final { scan-assembler-times "vstrh.16" 2 } } */
-/* { dg-final { scan-assembler-times "vstrw.32" 2 } } */
-/* { dg-final { scan-assembler-times "vstr.64" 2 } } */
+/* { dg-final { scan-assembler-times "vstrw.32" 4 } } */
 /* { dg-final { scan-assembler-not "__ARM_undef" } } */