thomas@1461: gcc svn 142778: thomas@1461: thomas@1461: PR target/37436 thomas@1461: * arm.c (arm_legitimate_index): Only accept addresses that are in thomas@1461: canonical form. thomas@1461: * predicates.md (arm_reg_or_extendqisi_mem_op): New predicate. thomas@1461: * arm.md (extendqihi2): Use arm_reg_or_extendqisi_mem_op predicate thomas@1461: for operand1. thomas@1461: (extendqisi2): Likewise. thomas@1461: (arm_extendqisi, arm_extendqisi_v6): Use arm_extendqisi_mem_op thomas@1461: predicate for operand1. thomas@1461: thomas@1461: diff -Nura gcc-4.3.3.orig/gcc/config/arm/arm.c gcc-4.3.3/gcc/config/arm/arm.c thomas@1461: --- gcc-4.3.3.orig/gcc/config/arm/arm.c 2008-06-11 07:52:55.000000000 -0300 thomas@1461: +++ gcc-4.3.3/gcc/config/arm/arm.c 2009-05-21 16:06:45.000000000 -0300 thomas@1461: @@ -3769,6 +3769,7 @@ thomas@1461: rtx xop1 = XEXP (x, 1); thomas@1461: thomas@1461: return ((arm_address_register_rtx_p (xop0, strict_p) thomas@1461: + && GET_CODE(xop1) == CONST_INT thomas@1461: && arm_legitimate_index_p (mode, xop1, outer, strict_p)) thomas@1461: || (arm_address_register_rtx_p (xop1, strict_p) thomas@1461: && arm_legitimate_index_p (mode, xop0, outer, strict_p))); thomas@1461: diff -Nura gcc-4.3.3.orig/gcc/config/arm/arm.md gcc-4.3.3/gcc/config/arm/arm.md thomas@1461: --- gcc-4.3.3.orig/gcc/config/arm/arm.md 2007-09-04 01:44:47.000000000 -0300 thomas@1461: +++ gcc-4.3.3/gcc/config/arm/arm.md 2009-05-21 16:06:45.000000000 -0300 thomas@1461: @@ -4199,7 +4199,7 @@ thomas@1461: thomas@1461: (define_expand "extendqihi2" thomas@1461: [(set (match_dup 2) thomas@1461: - (ashift:SI (match_operand:QI 1 "general_operand" "") thomas@1461: + (ashift:SI (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op" "") thomas@1461: (const_int 24))) thomas@1461: (set (match_operand:HI 0 "s_register_operand" "") thomas@1461: (ashiftrt:SI (match_dup 2) thomas@1461: @@ -4224,7 +4224,7 @@ thomas@1461: thomas@1461: (define_insn "*arm_extendqihi_insn" thomas@1461: [(set (match_operand:HI 0 "s_register_operand" "=r") thomas@1461: - (sign_extend:HI (match_operand:QI 1 "memory_operand" "Uq")))] thomas@1461: + (sign_extend:HI (match_operand:QI 1 "arm_extendqisi_mem_op" "Uq")))] thomas@1461: "TARGET_ARM && arm_arch4" thomas@1461: "ldr%(sb%)\\t%0, %1" thomas@1461: [(set_attr "type" "load_byte") thomas@1461: @@ -4235,7 +4235,7 @@ thomas@1461: thomas@1461: (define_expand "extendqisi2" thomas@1461: [(set (match_dup 2) thomas@1461: - (ashift:SI (match_operand:QI 1 "general_operand" "") thomas@1461: + (ashift:SI (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op" "") thomas@1461: (const_int 24))) thomas@1461: (set (match_operand:SI 0 "s_register_operand" "") thomas@1461: (ashiftrt:SI (match_dup 2) thomas@1461: @@ -4267,7 +4267,7 @@ thomas@1461: thomas@1461: (define_insn "*arm_extendqisi" thomas@1461: [(set (match_operand:SI 0 "s_register_operand" "=r") thomas@1461: - (sign_extend:SI (match_operand:QI 1 "memory_operand" "Uq")))] thomas@1461: + (sign_extend:SI (match_operand:QI 1 "arm_extendqisi_mem_op" "Uq")))] thomas@1461: "TARGET_ARM && arm_arch4 && !arm_arch6" thomas@1461: "ldr%(sb%)\\t%0, %1" thomas@1461: [(set_attr "type" "load_byte") thomas@1461: @@ -4278,7 +4278,8 @@ thomas@1461: thomas@1461: (define_insn "*arm_extendqisi_v6" thomas@1461: [(set (match_operand:SI 0 "s_register_operand" "=r,r") thomas@1461: - (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,Uq")))] thomas@1461: + (sign_extend:SI thomas@1461: + (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op" "r,Uq")))] thomas@1461: "TARGET_ARM && arm_arch6" thomas@1461: "@ thomas@1461: sxtb%?\\t%0, %1 thomas@1461: diff -Nura gcc-4.3.3.orig/gcc/config/arm/predicates.md gcc-4.3.3/gcc/config/arm/predicates.md thomas@1461: --- gcc-4.3.3.orig/gcc/config/arm/predicates.md 2007-08-02 07:49:31.000000000 -0300 thomas@1461: +++ gcc-4.3.3/gcc/config/arm/predicates.md 2009-05-21 16:06:45.000000000 -0300 thomas@1461: @@ -234,6 +234,10 @@ thomas@1461: (match_test "arm_legitimate_address_p (mode, XEXP (op, 0), SIGN_EXTEND, thomas@1461: 0)"))) thomas@1461: thomas@1461: +(define_special_predicate "arm_reg_or_extendqisi_mem_op" thomas@1461: + (ior (match_operand 0 "arm_extendqisi_mem_op") thomas@1461: + (match_operand 0 "s_register_operand"))) thomas@1461: + thomas@1461: (define_predicate "power_of_two_operand" thomas@1461: (match_code "const_int") thomas@1461: {