]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix bootstrap failure on SPARC with -O3 -mvis3
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 18 Dec 2024 20:48:36 +0000 (21:48 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 18 Dec 2024 21:18:02 +0000 (22:18 +0100)
This replaces the use of FAIL in the new vec_cmp[u] expanders by that of a
predicate for the operator, which is (apparently) required for the optabs
machinery to properly compute the set of supported vector comparisons.

gcc/
PR target/118096
* config/sparc/predicates.md (vec_cmp_operator): New predicate.
(vec_cmpu_operator): Likewise.
* config/sparc/sparc.md (vec_cmp<FPCMP:mode><P:mode>): Use the
vec_cmp_operator predicate instead of FAILing the expansion.
(vec_cmpu<FPCMP:mode><P:mode>): Likewise for vec_cmpu_operator.

gcc/config/sparc/predicates.md
gcc/config/sparc/sparc.md

index 1be76a62f576f1da89385385b4cba8b2085ecad7..067659b0ce20096dd3809a25435a16e6a3623fa8 100644 (file)
 ;; and (xor ... (not ...)) to (not (xor ...)).
 (define_predicate "cc_arith_not_operator"
   (match_code "and,ior"))
+
+;; Return true if OP is an operator for a vec_cmp pattern
+;; VIS 4 is required for ordering comparisons if the mode is V8QI
+(define_predicate "vec_cmp_operator"
+  (match_operand 0 "comparison_operator")
+{
+  const enum rtx_code code = GET_CODE (op);
+
+  switch (GET_MODE (XEXP (op, 0)))
+    {
+    case V8QImode:
+      return code == EQ || code == NE || TARGET_VIS4;
+
+    default:
+      return true;
+    }
+})
+
+;; Return true if OP is an operator for a vec_cmpu pattern
+;; VIS 4 is required for ordering comparisons if the mode is not V8QI
+(define_predicate "vec_cmpu_operator"
+  (match_operand 0 "comparison_operator")
+{
+  const enum rtx_code code = GET_CODE (op);
+
+  switch (GET_MODE (XEXP (op, 0)))
+    {
+    case V8QImode:
+      return true;
+
+    default:
+      return code == EQ || code == NE || TARGET_VIS4;
+    }
+})
index 159518d4b8fd3913e5633990662df5fed1b82c2f..1d78172571cfffd99cd6ef5bba224e20985602f9 100644 (file)
 
 (define_expand "vec_cmp<FPCMP:mode><P:mode>"
   [(set (match_operand:P 0 "register_operand" "")
-        (match_operator:P 1 "comparison_operator"
+        (match_operator:P 1 "vec_cmp_operator"
           [(match_operand:FPCMP 2 "register_operand" "")
            (match_operand:FPCMP 3 "register_operand" "")]))]
   "TARGET_VIS3"
 {
   enum rtx_code code = GET_CODE (operands[1]);
 
-  /* VIS 4 is required for ordering comparisons if the mode is V8QI.  */
-  if (<FPCMP:MODE>mode == V8QImode && code != EQ && code != NE && !TARGET_VIS4)
-    FAIL;
-
   if (code == LT || code == GE)
     {
       PUT_CODE (operands[1], swap_condition (code));
 
 (define_expand "vec_cmpu<FPCMP:mode><P:mode>"
   [(set (match_operand:P 0 "register_operand" "")
-        (match_operator:P 1 "comparison_operator"
+        (match_operator:P 1 "vec_cmpu_operator"
           [(match_operand:FPCMP 2 "register_operand" "")
            (match_operand:FPCMP 3 "register_operand" "")]))]
   "TARGET_VIS3"
 {
   enum rtx_code code = GET_CODE (operands[1]);
 
-  /* VIS 4 is required for ordering comparisons if the mode is not V8QI.  */
-  if (<FPCMP:MODE>mode != V8QImode && code != EQ && code != NE && !TARGET_VIS4)
-    FAIL;
-
   if (code == LTU || code == GEU)
     {
       PUT_CODE (operands[1], swap_condition (code));