]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: [MVE intrinsics] Fix moves of tuples (PR target/118131)
authorChristophe Lyon <christophe.lyon@linaro.org>
Thu, 19 Dec 2024 16:25:59 +0000 (16:25 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Fri, 20 Dec 2024 10:37:20 +0000 (10:37 +0000)
Commit r15-6245-g4f4e13dd235b introduced new modes for MVE tuples, but
missed adding support for them in a few places.

Adding them to the list in arm_attr_length_move_neon is not sufficient
since we later face another ICE where the compiler does not know how
to split move of such data.

The patch therefore enhances the define_splits for OI and XI moves in
neon.md, via the introduction of new iterators.

In addition, it seems consistent to update output_move_neon such that
VALID_NEON_*_MODE are used only when TARGET_NEON.

gcc/ChangeLog:

PR target/118131
* config/arm/arm.cc (output_move_neon): Check TARGET_NEON as
needed.
(arm_attr_length_move_neon): Add support for V2x and V4x MVE tuple
modes.
* config/arm/iterators.md (VSTRUCT2, VSTRUCT4): New.
* config/arm/neon.md: Use VSTRUCT2 instead of OI and VSTRUCT4
instead of XI in define_split.

gcc/config/arm/arm.cc
gcc/config/arm/iterators.md
gcc/config/arm/neon.md

index 7ba602afd9662842996ba2278dce7c1523f152b4..2e1c2f11e613c4200474fdaa86e46a9ee674cde7 100644 (file)
@@ -20775,11 +20775,13 @@ output_move_neon (rtx *operands)
   nregs = REG_NREGS (reg) / 2;
   gcc_assert (VFP_REGNO_OK_FOR_DOUBLE (regno)
              || NEON_REGNO_OK_FOR_QUAD (regno));
-  gcc_assert (VALID_NEON_DREG_MODE (mode)
-             || VALID_NEON_QREG_MODE (mode)
-             || VALID_NEON_STRUCT_MODE (mode)
+  gcc_assert ((TARGET_NEON
+              && (VALID_NEON_DREG_MODE (mode)
+                  || VALID_NEON_QREG_MODE (mode)
+                  || VALID_NEON_STRUCT_MODE (mode)))
              || (TARGET_HAVE_MVE
-                 && VALID_MVE_STRUCT_MODE (mode)));
+                 && (VALID_MVE_MODE (mode)
+                     || VALID_MVE_STRUCT_MODE (mode))));
   gcc_assert (MEM_P (mem));
 
   addr = XEXP (mem, 0);
@@ -20882,8 +20884,9 @@ output_move_neon (rtx *operands)
   return "";
 }
 
-/* Compute and return the length of neon_mov<mode>, where <mode> is
-   one of VSTRUCT modes: EI, OI, CI or XI.  */
+/* Compute and return the length of neon_mov<mode>, where <mode> is one of
+   VSTRUCT modes: EI, OI, CI or XI for Neon, and V2x16QI, V2x8HI, V2x4SI,
+   V2x8HF, V2x4SF, V2x16QI, V2x8HI, V2x4SI, V2x8HF, V2x4SF for MVE.  */
 int
 arm_attr_length_move_neon (rtx_insn *insn)
 {
@@ -20900,10 +20903,20 @@ arm_attr_length_move_neon (rtx_insn *insn)
        {
        case E_EImode:
        case E_OImode:
+       case E_V2x16QImode:
+       case E_V2x8HImode:
+       case E_V2x4SImode:
+       case E_V2x8HFmode:
+       case E_V2x4SFmode:
          return 8;
        case E_CImode:
          return 12;
        case E_XImode:
+       case E_V4x16QImode:
+       case E_V4x8HImode:
+       case E_V4x4SImode:
+       case E_V4x8HFmode:
+       case E_V4x4SFmode:
          return 16;
        default:
          gcc_unreachable ();
index cfe712ceda988b53a20eff475c0857f096b72856..6756e29721cad556609126a8dd0541859dbf49c7 100644 (file)
                               (V4x4SF "TARGET_HAVE_MVE_FLOAT")
                               ])
 
+;; Structure types of the same size as OImode
+(define_mode_iterator VSTRUCT2 [OI
+                              (V2x16QI "TARGET_HAVE_MVE")
+                              (V2x8HI "TARGET_HAVE_MVE")
+                              (V2x4SI "TARGET_HAVE_MVE")
+                              (V2x8HF "TARGET_HAVE_MVE_FLOAT")
+                              (V2x4SF "TARGET_HAVE_MVE_FLOAT")
+                              ])
+
+;; Structure types of the same size as XImode
+(define_mode_iterator VSTRUCT4 [XI
+                              (V4x16QI "TARGET_HAVE_MVE")
+                              (V4x8HI "TARGET_HAVE_MVE")
+                              (V4x4SI "TARGET_HAVE_MVE")
+                              (V4x8HF "TARGET_HAVE_MVE_FLOAT")
+                              (V4x4SF "TARGET_HAVE_MVE_FLOAT")
+                              ])
+
 ;; Opaque structure types used in table lookups (except vtbl1/vtbx1).
 (define_mode_iterator VTAB [TI EI OI])
 
index 6892b7b0f44a6822f3be760e809941574374d049..cfd8520c2ea17b7ba3b7d941309a851214d7917e 100644 (file)
 })
 
 (define_split
-  [(set (match_operand:OI 0 "s_register_operand" "")
-       (match_operand:OI 1 "s_register_operand" ""))]
+  [(set (match_operand:VSTRUCT2 0 "s_register_operand" "")
+       (match_operand:VSTRUCT2 1 "s_register_operand" ""))]
   "(TARGET_NEON || TARGET_HAVE_MVE)&& reload_completed"
   [(set (match_dup 0) (match_dup 1))
    (set (match_dup 2) (match_dup 3))]
 })
 
 (define_split
-  [(set (match_operand:XI 0 "s_register_operand" "")
-       (match_operand:XI 1 "s_register_operand" ""))]
+  [(set (match_operand:VSTRUCT4 0 "s_register_operand" "")
+       (match_operand:VSTRUCT4 1 "s_register_operand" ""))]
   "(TARGET_NEON || TARGET_HAVE_MVE) && reload_completed"
   [(set (match_dup 0) (match_dup 1))
    (set (match_dup 2) (match_dup 3))