@@ -5432,6 +5432,34 @@
[(set_attr "type" "alu")
(set_attr "mode" "QI")])
+;; Used by reload to support addresses with complex expressions.
+(define_insn_and_split "*lea_0_x32"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (plus:SI
+ (subreg:SI
+ (plus:DI
+ (match_operand:DI 1 "pointer_register_operand" "r")
+ (match_operand:DI 2 "immediate_operand" "n")) 0)
+ (match_operand:SI 3 "immediate_operand" "n")))]
+ "TARGET_X32 && !can_create_pseudo_p ()"
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ rtx pat, src, insn;
+ pat = gen_rtx_PLUS (DImode, operands[1], operands[2]);
+ src = gen_rtx_PLUS (SImode, gen_rtx_SUBREG (SImode, pat, 0),
+ operands[3]);
+ operands[1] = gen_lowpart (SImode, operands[1]);
+ operands[2] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[3]));
+ pat = gen_rtx_PLUS (SImode, operands[1], operands[2]);
+ insn = emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
+ set_unique_reg_note (insn, REG_EQUIV, src);
+ DONE;
+}
+ [(set_attr "type" "lea")
+ (set_attr "mode" "SI")])
+
(define_insn "*lea_1"
[(set (match_operand:P 0 "register_operand" "=r")
(match_operand:P 1 "no_seg_address_operand" "p"))]
@@ -1219,3 +1219,8 @@
{
return !TARGET_X32 || !SYMBOLIC_CONST (op);
})
+
+;; Test for pointer register operand
+(define_predicate "pointer_register_operand"
+ (and (match_code "reg")
+ (match_test "REG_POINTER (op)")))