]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
C-SKY: Fix patterns' condition for ck802 smart mode.
authorXianmiao Qu <cooper.qu@linux.alibaba.com>
Tue, 10 Jan 2023 13:48:15 +0000 (21:48 +0800)
committerXianmiao Qu <cooper.qu@linux.alibaba.com>
Tue, 10 Jan 2023 11:57:21 +0000 (19:57 +0800)
Ck802 smart mode should not be treated as ck801.
It do only allocate r0-r8 registers like ck801,
but support 32-bits intructions.
This bug will cause ICE when compiler pr43164.c for ck802 big-endian,
/src/gcc/gcc/testsuite/gcc.c-torture/compile/pr43164.c:16:1: error: insn does not satisfy its constraints:
(insn 48 28 30 2 (set (reg:SI 0 a0 [230])
        (ior:SI (reg:SI 2 a2 [222])
            (ashift:SI (const_int 1 [0x1])
                (const_int 24 [0x18])))) "/src/gcc/gcc/testsuite/gcc.c-torture/compile/pr43164.c":15:10 224 {smart_bseti}
     (expr_list:REG_DEAD (reg:SI 2 a2 [222])
        (nil)))

gcc/
* config/csky/csky.md (smart_bseti): Change condition to CSKY_ISA_FEATURE (E1).
(smart_bclri): Likewise.
(fast_bseti): Change condition to CSKY_ISA_FEATURE (E2).
(fast_bclri): Likewise.
(fast_cmpnesi_i): Likewise.
(*fast_cmpltsi_i): Likewise.
(*fast_cmpgeusi_i): Likewise.

gcc/config/csky/csky.md

index d7bafdbebb90d9bf66ab8a141d77907a65530ef5..8fb832f9e75ee09da44c806697f3e6de34345a5f 100644 (file)
        (ior:SI (match_operand:SI 1 "register_operand"  "0")
                (ashift:SI (const_int 1)
                           (match_operand:SI 2 "csky_literal_K_operand" "K"))))]
-  "TARGET_MINI_REGISTERS"
+  "CSKY_ISA_FEATURE (E1)"
   "bseti\t%0, %2"
   [(set_attr "length" "2")])
 
        (ior:SI (match_operand:SI 1 "register_operand"  "0,r")
                (ashift:SI (const_int 1)
                           (match_operand:SI 2 "csky_literal_K_operand" "K,K"))))]
-  "!TARGET_MINI_REGISTERS"
+  "CSKY_ISA_FEATURE (E2)"
   "bseti\t%0, %1, %2"
   [(set_attr "length" "2,4")])
 
        (and:SI (match_operand:SI 1 "register_operand"  "0")
                (not:SI (ashift:SI (const_int 1)
                                   (match_operand:SI 2 "csky_literal_K_operand" "K")))))]
-  "TARGET_MINI_REGISTERS"
+  "CSKY_ISA_FEATURE (E1)"
   "bclri\t%0, %2"
   [(set_attr "length" "2")])
 
        (and:SI (match_operand:SI 1 "register_operand"  "0,r")
                (not:SI (ashift:SI (const_int 1)
                                   (match_operand:SI 2 "csky_literal_K_operand" "K,K")))))]
-  "!TARGET_MINI_REGISTERS"
+  "CSKY_ISA_FEATURE (E2)"
   "bclri\t%0, %1, %2"
   [(set_attr "length" "2,4")])
 
   [(set (reg:CC CSKY_CC_REGNUM)
        (ne:CC (match_operand:SI 0 "register_operand"       "r")
               (match_operand:SI 1 "csky_literal_I_operand" "I")))]
-  "!TARGET_MINI_REGISTERS && CSKY_ISA_FEATURE (E2)"
+  "CSKY_ISA_FEATURE (E2)"
   "cmpnei\t%0, %1"
   [(set_attr "type" "cmp")]
 )
   [(set (reg:CC CSKY_CC_REGNUM)
        (lt:CC (match_operand:SI 0 "register_operand"        "a,r")
               (match_operand:SI 1 "csky_literal_Uk_operand" "J,Uk")))]
-  "!TARGET_MINI_REGISTERS && CSKY_ISA_FEATURE (E2)"
+  "CSKY_ISA_FEATURE (E2)"
   "cmplti\t%0, %1"
   [(set_attr "length" "2,4")
    (set_attr "type" "cmp")]
   [(set (reg:CC CSKY_CC_REGNUM)
        (geu:CC (match_operand:SI 0 "register_operand"        "a,r")
                (match_operand:SI 1 "csky_literal_Uk_operand" "J,Uk")))]
-  "!TARGET_MINI_REGISTERS && CSKY_ISA_FEATURE (E2)"
+  "CSKY_ISA_FEATURE (E2)"
   "cmphsi\t%0, %1"
   [(set_attr "length" "2,4")
    (set_attr "type" "cmp")]