[PATCH, H8/300]: Peephole for generating BSET and BCLR instructions in H8/300 target
Paolo Bonzini
paolo.bonzini@lu.unisi.ch
Tue Feb 14 15:15:00 GMT 2006
Naveen H.S. wrote:
> Hi,
>
> Please find the patch as below for H8/300 (ELF) targets H8300, H8S for
> both normal and advanced modes. This patch enhances the code by
> introducing two important bit instructions i.e. "BSET" and "BCLR" which
> are not generated directly in GCC 4.2 for the above mentioned H8
> targets; instead four separate instructions are generated to implement
> the above mentioned instructions respectively.
Please use define_peephole2 + define_insn. In peephole2 you can match
[(set (match_operand:QI 0 "register_operand" "")
(match_operand:QI 1 "memory_operand" ""))
(set (match_dup 0)
(and (match_dup 0)
(match_operand 2 "const_int_operand" "")))
(set (match_dup 1) (match_dup 0))]
And test for operands[0] to be dead after the third instruction. You
can then to transform it into a single set. You will need a define_insn
like this
[(set (match_operand:QI 1 "memory_operand" "+m")
(and (match_dup 0) (match_operand 1 "single_zero_operand" "n")))]
and convert operand 1 to a bit number using %W1 (likewise,
single_one_operand and %V1 for the ior peephole.
Paolo
More information about the Gcc-patches
mailing list