Commit 2891beff by Jakub Jelinek Committed by Jakub Jelinek

re PR target/82339 (Inefficient movabs instruction)

	PR target/82339
	* config/i386/i386.md (*movdi_internal peephole2): New -Os peephole
	for movabsq $(i32 << shift), r64.

From-SVN: r253279
parent 9db33c9f
2017-09-29 Jakub Jelinek <jakub@redhat.com>
PR target/82339
* config/i386/i386.md (*movdi_internal peephole2): New -Os peephole
for movabsq $(i32 << shift), r64.
2017-09-28 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.c (ix86_print_operand_address_as): Do not check
......@@ -2379,6 +2379,28 @@
gen_lowpart (SImode, operands[1]));
})
;; movabsq $0x0012345678000000, %rax is longer
;; than movl $0x12345678, %eax; shlq $24, %rax.
(define_peephole2
[(set (match_operand:DI 0 "register_operand")
(match_operand:DI 1 "const_int_operand"))]
"TARGET_64BIT
&& optimize_insn_for_size_p ()
&& LEGACY_INT_REG_P (operands[0])
&& !x86_64_immediate_operand (operands[1], DImode)
&& !x86_64_zext_immediate_operand (operands[1], DImode)
&& !((UINTVAL (operands[1]) >> ctz_hwi (UINTVAL (operands[1])))
& ~(HOST_WIDE_INT) 0xffffffff)
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(set (match_dup 0) (match_dup 1))
(parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2)))
(clobber (reg:CC FLAGS_REG))])]
{
int shift = ctz_hwi (UINTVAL (operands[1]));
operands[1] = gen_int_mode (UINTVAL (operands[1]) >> shift, DImode);
operands[2] = gen_int_mode (shift, QImode);
})
(define_insn "*movsi_internal"
[(set (match_operand:SI 0 "nonimmediate_operand"
"=r,m ,*y,*y,?*y,?m,?r ,?*Ym,*v,*v,*v,m ,?r ,?*Yi,*k,*k ,*rm")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment