aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sh/constraints.md
diff options
context:
space:
mode:
authorOleg Endo <olegendo@gcc.gnu.org>2012-04-11 11:35:32 +0000
committerOleg Endo <olegendo@gcc.gnu.org>2012-04-11 11:35:32 +0000
commit8c2a3f3b6cc7bc38af483ac4923258d376f90954 (patch)
tree07b8b694f4fd16b55292cb37ed731c28edfb17ed /gcc/config/sh/constraints.md
parentb16212bd3c3ecd421c09c3a632b43ec68674b6bf (diff)
downloadgcc-8c2a3f3b6cc7bc38af483ac4923258d376f90954.zip
gcc-8c2a3f3b6cc7bc38af483ac4923258d376f90954.tar.gz
gcc-8c2a3f3b6cc7bc38af483ac4923258d376f90954.tar.bz2
re PR target/50751 (SH Target: Displacement addressing does not work for QImode and HImode)
PR target/50751 * config/sh/sh-protos.h (sh_legitimate_index_p): Add new arguments consider_sh2a and allow_zero. * config/sh/sh.c (sh_legitimate_index_p): Likewise. (disp_addr_displacement): New function. (sh_address_cost): Use disp_addr_displacement function instead of DISP_ADDR_OFFSET. (sh_legitimate_address_p): Adapt to changed sh_legitimate_index_p declaration. (sh_find_mov_disp_adjust): Remove HImode check. (sh_secondary_reload): Add HImode case. Use satisfies_constraint_Sdd, disp_addr_displacement and max_mov_insn_displacement. (max_mov_insn_displacement): Remove HImode check. * config/sh/sh.h (CONST_OK_FOR_K04, CONST_OK_FOR_K12, DISP_ADDR_P, DISP_ADDR_OFFSET): Remove. * config/sh/constraints.md (K05, K13): New constraints. (K12): Correct comment. (Sdd): Do not use DISP_ADDR_P macro. (Snd, Sbw): Use satisfies_constraint_Sdd. * config/sh/sh.md (extendhisi2): Remove constraints from expander. (*extendhisi2_compact, movhi_i): Remove. (*extendhisi2_compact_reg, *extendhisi2_compact_mem_disp, *extendhisi2_compact_mem_disp, *extendhisi2_compact_snd, *movhi_reg_reg, *movhi_store_mem_disp05, *movhi_store_mem_disp13, *movhi_load_mem_disp, *movhi_load_mem_disp, *movhi): New insns. (*extendqisi2_compact_mem_disp, *extendqisi2_compact_mem_disp, *movqi_store_mem_disp04, *movqi_store_mem_disp12, *movqi_load_mem_disp, *movqi_load_mem_disp): Use sh_legitimate_index_p instead of CONST_OK_FOR_Kxx. Add new peepholes for HImode displacement addressing. From-SVN: r186311
Diffstat (limited to 'gcc/config/sh/constraints.md')
-rw-r--r--gcc/config/sh/constraints.md36
1 files changed, 25 insertions, 11 deletions
diff --git a/gcc/config/sh/constraints.md b/gcc/config/sh/constraints.md
index 3a5fc36..6c9bc5e 100644
--- a/gcc/config/sh/constraints.md
+++ b/gcc/config/sh/constraints.md
@@ -145,16 +145,28 @@
(and (match_code "const_int")
(match_test "ival >= 0 && ival <= 15")))
+(define_constraint "K05"
+ "An unsigned 5-bit constant, as used in mov.w displacement addressing."
+ (and (match_code "const_int")
+ (match_test "ival >= 0 && ival <= 31")))
+
(define_constraint "K08"
"An unsigned 8-bit constant, as used in and, or, etc."
(and (match_code "const_int")
(match_test "ival >= 0 && ival <= 255")))
(define_constraint "K12"
- "An unsigned 12-bit constant, as used in SH2A 12-bit displacement addressing."
+ "An unsigned 12-bit constant, as used in SH2A 12-bit mov.b displacement
+ addressing."
(and (match_code "const_int")
(match_test "ival >= 0 && ival <= 4095")))
+(define_constraint "K13"
+ "An unsigned 13-bit constant, as used in SH2A 12-bit mov.w displacement
+ addressing."
+ (and (match_code "const_int")
+ (match_test "ival >= 0 && ival <= 8191")))
+
(define_constraint "K16"
"An unsigned 16-bit constant, as used in SHmedia shori."
(and (match_code "const_int")
@@ -262,6 +274,16 @@
(and (match_test "memory_operand (op, GET_MODE (op))")
(match_test "GET_CODE (XEXP (op, 0)) != PLUS")))
+(define_memory_constraint "Sdd"
+ "A memory reference that uses displacement addressing."
+ (and (match_test "MEM_P (op) && GET_CODE (XEXP (op, 0)) == PLUS")
+ (match_test "REG_P (XEXP (XEXP (op, 0), 0))")
+ (match_test "CONST_INT_P (XEXP (XEXP (op, 0), 1))")))
+
+(define_memory_constraint "Snd"
+ "A memory reference that excludes displacement addressing."
+ (match_test "! satisfies_constraint_Sdd (op)"))
+
(define_memory_constraint "Sbv"
"A memory reference, as used in SH2A bclr.b, bset.b, etc."
(and (match_test "MEM_P (op) && GET_MODE (op) == QImode")
@@ -269,15 +291,7 @@
(define_memory_constraint "Sbw"
"A memory reference, as used in SH2A bclr.b, bset.b, etc."
- (and (match_test "MEM_P (op) && GET_MODE (op) == QImode")
- (match_test "GET_CODE (XEXP (op, 0)) == PLUS")
- (match_test "REG_P (XEXP (XEXP (op, 0), 0))")
+ (and (match_test "satisfies_constraint_Sdd (op)")
+ (match_test "GET_MODE (op) == QImode")
(match_test "satisfies_constraint_K12 (XEXP (XEXP (op, 0), 1))")))
-(define_memory_constraint "Snd"
- "A memory reference that excludes displacement addressing."
- (match_test "! DISP_ADDR_P (op)"))
-
-(define_memory_constraint "Sdd"
- "A memory reference that uses displacement addressing."
- (match_test "DISP_ADDR_P (op)"))