]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[committed] Fix MIPS bootstrap
authorJeff Law <jlaw@ventanamicro.com>
Sun, 14 Jan 2024 14:53:49 +0000 (07:53 -0700)
committerJeff Law <jlaw@ventanamicro.com>
Sun, 14 Jan 2024 14:53:49 +0000 (07:53 -0700)
mips bootstraps have been broken for a while.  They've been triggering an error
about mutually exclusive equal-tests always being false when building
gencondmd.

This was ultimately tracked down to the ior<mode>3_mips16_asmacro pattern.  The
pattern uses the GPR mode iterator which looks like this:

(define_mode_iterator GPR [SI (DI "TARGET_64BIT")])

The condition for the pattern looks like this:

  "ISA_HAS_MIPS16E2"

And if you dig into ISA_HAS_MIPS16E2:

/* The MIPS16e V2 instructions are available.  */
                                && !TARGET_64BIT)

The way the mode iterator is handled is by adding its condition to the
pattern's condition when we expand copies of the pattern resulting in this
condition for one of the two generated patterns:

(TARGET_MIPS16 && TARGET_MIPS16E2 && !TARGET_64BIT) && TARGET_64BIT

This can never be true because of the TARGET_64BIT tests.

The fix is trivial.  Don't use a mode iterator on that pattern.

Bootstrapped on mips64el.  I don't have any tests to compare against, so no
regression test data.

gcc/
* config/mips/mips.md (ior<mode>3_mips16_asmacro): Use SImode,
not the GPR iterator.  Adjust pattern name and mode attribute
accordingly.

gcc/config/mips/mips.md

index 17dfcbd67223f4e9121eb5f6dc8956a88563910f..b0fb5850a9ee07f456449d08f1f7babd7bedcaac 100644 (file)
    (set_attr "compression" "micromips,*,*")
    (set_attr "mode" "<MODE>")])
 
-(define_insn "*ior<mode>3_mips16_asmacro"
-  [(set (match_operand:GPR 0 "register_operand" "=d,d")
-       (ior:GPR (match_operand:GPR 1 "register_operand" "%0,0")
-                (match_operand:GPR 2 "uns_arith_operand" "d,K")))]
+(define_insn "*iorsi3_mips16_asmacro"
+  [(set (match_operand:SI 0 "register_operand" "=d,d")
+       (ior:SI (match_operand:SI 1 "register_operand" "%0,0")
+               (match_operand:SI 2 "uns_arith_operand" "d,K")))]
   "ISA_HAS_MIPS16E2"
   "@
    or\t%0,%2
    ori\t%0,%x2"
    [(set_attr "alu_type" "or")
-    (set_attr "mode" "<MODE>")
+    (set_attr "mode" "SI")
     (set_attr "extended_mips16" "*,yes")])
 
 (define_insn "*ior<mode>3_mips16"