From: Renlin Li Date: Tue, 5 May 2015 10:16:46 +0000 (+0000) Subject: [PATCH][AARCH64]Use mov for add with large immediate. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=53e38f0275f495b20e274cedeaf8647b8005feca;p=gcc.git [PATCH][AARCH64]Use mov for add with large immediate. gcc/ 2015-05-05 Renlin Li * config/aarch64/aarch64.md (add3): Use mov when allowed. From-SVN: r222800 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 83509a04b39..5667dd45f73 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-05-05 Renlin Li + + * config/aarch64/aarch64.md (add3): Use mov when allowed. + 2015-05-05 Yvan Roux * config/aarch64/aarch64-elf-raw.h (CA53_ERR_843419_SPEC): Define. diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 11c470951dc..1c2c5fba4c3 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -1414,18 +1414,28 @@ " if (! aarch64_plus_operand (operands[2], VOIDmode)) { - rtx subtarget = ((optimize && can_create_pseudo_p ()) - ? gen_reg_rtx (mode) : operands[0]); HOST_WIDE_INT imm = INTVAL (operands[2]); - if (imm < 0) - imm = -(-imm & ~0xfff); + if (aarch64_move_imm (imm, mode) && can_create_pseudo_p ()) + { + rtx tmp = gen_reg_rtx (mode); + emit_move_insn (tmp, operands[2]); + operands[2] = tmp; + } else - imm &= ~0xfff; - - emit_insn (gen_add3 (subtarget, operands[1], GEN_INT (imm))); - operands[1] = subtarget; - operands[2] = GEN_INT (INTVAL (operands[2]) - imm); + { + rtx subtarget = ((optimize && can_create_pseudo_p ()) + ? gen_reg_rtx (mode) : operands[0]); + + if (imm < 0) + imm = -(-imm & ~0xfff); + else + imm &= ~0xfff; + + emit_insn (gen_add3 (subtarget, operands[1], GEN_INT (imm))); + operands[1] = subtarget; + operands[2] = GEN_INT (INTVAL (operands[2]) - imm); + } } " )