]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Drop const_int from aarch64_maskload_else_operand
authorAlex Coplan <alex.coplan@arm.com>
Thu, 19 Jun 2025 11:38:11 +0000 (12:38 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Thu, 3 Jul 2025 08:52:00 +0000 (09:52 +0100)
The "else operand" to maskload should always be a const_vector, never a
const_int.

This was just an issue I noticed while looking through the code, I don't
have a testcase which shows a concrete problem due to this.

Testing of that change alone showed ICEs with load lanes vectorization
and SVE.  That turned out to be because the backend pattern was missing
a mode for the else operand (causing the middle-end to choose a
const_int during expansion), fixed thusly.  That in turn exposed an
issue with the unpredicated load lanes expander which was using the
wrong mode for the else operand, so fixed that too.

gcc/ChangeLog:

* config/aarch64/aarch64-sve.md
(vec_load_lanes<mode><vsingle>): Expand else operand in
subvector mode, as per optab documentation.
(vec_mask_load_lanes<mode><vsingle>): Add missing mode for
operand 3.
* config/aarch64/predicates.md (aarch64_maskload_else_operand):
Remove const_int.

gcc/config/aarch64/aarch64-sve.md
gcc/config/aarch64/predicates.md

index 450975dd088e16f16324cdb18d9cef24f77f8f7c..4aecb3a6bf8a0ef14dc84bb31537cb32627f225a 100644 (file)
   "TARGET_SVE"
   {
     operands[2] = aarch64_ptrue_reg (<VPRED>mode);
-    operands[3] = CONST0_RTX (<MODE>mode);
+    operands[3] = CONST0_RTX (<VSINGLE>mode);
   }
 )
 
        (unspec:SVE_STRUCT
          [(match_operand:<VPRED> 2 "register_operand" "Upl")
           (match_operand:SVE_STRUCT 1 "memory_operand" "m")
-          (match_operand 3 "aarch64_maskload_else_operand")]
+          (match_operand:<VSINGLE> 3 "aarch64_maskload_else_operand")]
          UNSPEC_LDN))]
   "TARGET_SVE"
   "ld<vector_count><Vesize>\t%0, %2/z, %1"
index d8e9725a1b65b9a56fa297c966fdac32d102f782..32056daf3298785eda856cf36cf7b4de7addb4ab 100644 (file)
                    && !(INTVAL (op) & 0xf)")))
 
 (define_predicate "aarch64_maskload_else_operand"
-  (and (match_code "const_int,const_vector")
+  (and (match_code "const_vector")
        (match_test "op == CONST0_RTX (GET_MODE (op))")))