[committed] C-SKY: Fix patterns' condition for ck802 smart mode.

Message ID 20230113124223.75333-1-cooper.qu@linux.alibaba.com
State Committed
Headers
Series [committed] C-SKY: Fix patterns' condition for ck802 smart mode. |

Commit Message

瞿仙淼 Jan. 13, 2023, 12:42 p.m. UTC
  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 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gcc/config/csky/csky.md b/gcc/config/csky/csky.md
index d7bafdbebb9..8fb832f9e75 100644
--- a/gcc/config/csky/csky.md
+++ b/gcc/config/csky/csky.md
@@ -573,7 +573,7 @@ 
 	(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")])
 
@@ -582,7 +582,7 @@ 
 	(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")])
 
@@ -599,7 +599,7 @@ 
 	(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")])
 
@@ -608,7 +608,7 @@ 
 	(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")])
 
@@ -3014,7 +3014,7 @@ 
   [(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")]
 )
@@ -3056,7 +3056,7 @@ 
   [(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")]
@@ -3149,7 +3149,7 @@ 
   [(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")]