summaryrefslogtreecommitdiff
path: root/gcc/config/rl78/constraints.md
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/rl78/constraints.md')
-rw-r--r--gcc/config/rl78/constraints.md127
1 files changed, 115 insertions, 12 deletions
diff --git a/gcc/config/rl78/constraints.md b/gcc/config/rl78/constraints.md
index 8b03cf32211..bb0e40c6a32 100644
--- a/gcc/config/rl78/constraints.md
+++ b/gcc/config/rl78/constraints.md
@@ -43,6 +43,7 @@
; Y - any valid memory
; Wxx - various memory addressing modes
; Qxx - conditionals
+; U = usual memory references mov-able to/from AX
; v = virtual registers
; Zxx = specific virtual registers
@@ -56,6 +57,56 @@
(and (match_code "const_int")
(match_test "IN_RANGE (ival, 1, 7)")))
+(define_constraint "Iv08"
+ "@internal
+ Integer constant equal to 8."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 8, 8)")))
+(define_constraint "Iv16"
+ "@internal
+ Integer constant equal to 16."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 16, 16)")))
+(define_constraint "Iv24"
+ "@internal
+ Integer constant equal to 24."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 24, 24)")))
+
+(define_constraint "Is09"
+ "@internal
+ Integer constant in the range 9 @dots{} 15 (for shifts)."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 9, 15)")))
+(define_constraint "Is17"
+ "@internal
+ Integer constant in the range 17 @dots{} 23 (for shifts)."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 17, 23)")))
+(define_constraint "Is25"
+ "@internal
+ Integer constant in the range 25 @dots{} 31 (for shifts)."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 25, 31)")))
+
+(define_constraint "ISsi"
+ "@internal
+ Integer constant with bit 31 set."
+ (and (match_code "const_int")
+ (match_test "(ival & 0x80000000) != 0")))
+
+(define_constraint "IShi"
+ "@internal
+ Integer constant with bit 15 set."
+ (and (match_code "const_int")
+ (match_test "(ival & 0x8000) != 0")))
+
+(define_constraint "ISqi"
+ "@internal
+ Integer constant with bit 7 set."
+ (and (match_code "const_int")
+ (match_test "(ival & 0x80) != 0")))
+
(define_constraint "J"
"Integer constant in the range -255 @dots{} 0"
(and (match_code "const_int")
@@ -152,17 +203,24 @@
; All the memory addressing schemes the RL78 supports
; of the form W {register} {bytes of offset}
; or W {register} {register}
+; Additionally, the Cxx forms are the same as the Wxx forms, but without
+; the ES: override.
; absolute address
-(define_memory_constraint "Wab"
+(define_memory_constraint "Cab"
"[addr]"
(and (match_code "mem")
(ior (match_test "CONSTANT_P (XEXP (op, 0))")
(match_test "GET_CODE (XEXP (op, 0)) == PLUS && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF"))
)
)
+(define_memory_constraint "Wab"
+ "es:[addr]"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Cab (rl78_es_base (op))
+ || satisfies_constraint_Cab (op)")
+ )
-(define_memory_constraint "Wbc"
+(define_memory_constraint "Cbc"
"word16[BC]"
(and (match_code "mem")
(ior
@@ -174,29 +232,49 @@
(match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
)
)
+(define_memory_constraint "Wbc"
+ "es:word16[BC]"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Cbc (rl78_es_base (op))
+ || satisfies_constraint_Cbc (op)")
+ )
-(define_memory_constraint "Wde"
+(define_memory_constraint "Cde"
"[DE]"
(and (match_code "mem")
(and (match_code "reg" "0")
(match_test "REGNO (XEXP (op, 0)) == DE_REG")))
)
+(define_memory_constraint "Wde"
+ "es:[DE]"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Cde (rl78_es_base (op))
+ || satisfies_constraint_Cde (op)")
+ )
-(define_memory_constraint "Wca"
+(define_memory_constraint "Cca"
"[AX..HL] for calls"
(and (match_code "mem")
(and (match_code "reg" "0")
(match_test "REGNO (XEXP (op, 0)) <= HL_REG")))
)
+(define_memory_constraint "Wca"
+ "es:[AX..HL] for calls"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Cca (rl78_es_base (op))
+ || satisfies_constraint_Cca (op)")
+ )
-(define_memory_constraint "Wcv"
- "[AX..HL,r8-r23] for calls"
+(define_memory_constraint "Ccv"
+ "[AX..HL,r8-r31] for calls"
(and (match_code "mem")
(and (match_code "reg" "0")
- (match_test "REGNO (XEXP (op, 0)) < 24")))
+ (match_test "REGNO (XEXP (op, 0)) < 31")))
+ )
+(define_memory_constraint "Wcv"
+ "es:[AX..HL,r8-r23] for calls"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Ccv (rl78_es_base (op))
+ || satisfies_constraint_Ccv (op)")
)
-(define_memory_constraint "Wd2"
+(define_memory_constraint "Cd2"
"word16[DE]"
(and (match_code "mem")
(ior
@@ -208,15 +286,25 @@
(match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
)
)
+(define_memory_constraint "Wd2"
+ "es:word16[DE]"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Cd2 (rl78_es_base (op))
+ || satisfies_constraint_Cd2 (op)")
+ )
-(define_memory_constraint "Whl"
+(define_memory_constraint "Chl"
"[HL]"
(and (match_code "mem")
(and (match_code "reg" "0")
(match_test "REGNO (XEXP (op, 0)) == HL_REG")))
)
+(define_memory_constraint "Whl"
+ "es:[HL]"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Chl (rl78_es_base (op))
+ || satisfies_constraint_Chl (op)")
+ )
-(define_memory_constraint "Wh1"
+(define_memory_constraint "Ch1"
"byte8[HL]"
(and (match_code "mem")
(and (match_code "plus" "0")
@@ -224,14 +312,24 @@
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == HL_REG"))
(match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
)
+(define_memory_constraint "Wh1"
+ "es:byte8[HL]"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Ch1 (rl78_es_base (op))
+ || satisfies_constraint_Ch1 (op)")
+ )
-(define_memory_constraint "Whb"
+(define_memory_constraint "Chb"
"[HL+B]"
(and (match_code "mem")
(match_test "rl78_hl_b_c_addr_p (XEXP (op, 0))"))
)
+(define_memory_constraint "Whb"
+ "es:[HL+B]"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Chb (rl78_es_base (op))
+ || satisfies_constraint_Chb (op)")
+ )
-(define_memory_constraint "Ws1"
+(define_memory_constraint "Cs1"
"word8[SP]"
(and (match_code "mem")
(ior
@@ -243,6 +341,11 @@
(match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
)
)
+(define_memory_constraint "Ws1"
+ "es:word8[SP]"
+ (match_test "rl78_es_addr (op) && satisfies_constraint_Cs1 (rl78_es_base (op))
+ || satisfies_constraint_Cs1 (op)")
+ )
(define_memory_constraint "Wfr"
"ES/CS far pointer"