This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Combine performance regression (was: Fix PR target/18701)
On Thu, Jan 20, 2005 at 08:11:06PM +0100, Ulrich Weigand wrote:
> Unfortunately I cannot use an immediate operand for the constant 255,
> so I have to reload it into a register (or use memory), which means
> I have to expose this detail before reload ...
Or do either
(define_insn "zero_extendqisi2"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(zero_extend:QI (match_operand:QI 1 "nonimmediate_operand" "m,r")))
(clobber (match_scratch:SI 2 "=X,r"))]
""
"@
load %0 = %1
#")
(define_split
[(set (match_operand:SI 0 "register_operand" "")
(zero_extend:QI (match_operand:QI 1 "register_operand" "")))
(clobber (match_scratch:SI 2 ""))]
"reload_completed"
[(set (match_dup 2) (const_int 255))
(set (match_dup 0) (and:SI (match_dup 1) (match_dup 2)))]
{
operands[1] = gen_lowpart (SImode, operands[1]);
})
or
(define_expand "*zero_extendqisi2"
[(set (match_operand:SI 0 "register_operand" "")
(zero_extend:QI (match_operand:QI 1 "nonimmediate_operand" "")))
(use (match_dup 2))]
""
{
operands[2] = force_reg (SImode, GEN_INT (255));
})
(define_insn "*zero_extendqisi2"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(zero_extend:QI (match_operand:QI 1 "nonimmediate_operand" "m,r")))
(use (match_operand:SI 2 "register_operand" "=X,r"))
""
"@
load %0 = %1
and %0 = %1, %2")
Mostly depending on whether you've got two-address insns or three.
The later form will work harder to CSE the immediate.
r~