[PATCH, MIPS] Add baddu Octeon instruction
Adam Nemet
anemet@caviumnetworks.com
Thu Aug 28 21:22:00 GMT 2008
Richard Sandiford wrote:
> (define_predicate "truncate_operator"
> (ior (and (match_code "subreg")
> (match_test "subreg_lowpart_p (op)")
> (match_test "TRULY_NOOP_TRUNCATION
> (GET_MODE_BITSIZE (GET_MODE (op)),
> GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op))))"))
> (match_code "truncate")))
>
> ? Then a single pattern:
>
> (define_insn "*baddu<mode>si3"
> [(set (match_operand:SI 0 "register_operand" "=d")
> (zero_extend:SI
> (match_operator:QI 1 "truncate_operator"
> [(plus:GPR (match_operand:GPR 2 "register_operand" "d")
> (match_operand:GPR 3 "register_operand" "d"))])))]
> "ISA_HAS_BADDU"
> "baddu\\t%0,%2,%3"
> [(set_attr "type" "arith")])
Really cool and it works too!
Surprisingly I ran into a reload assert with this. Reload wants to
unconditionally reload the argument of a subreg if it is a PLUS and we
fail badly. I am planning to submit the reload part of the patch
separately after testing it on x86 too.
I ended up not adding the TRULY_NOOP_TRUNCATION part. I think it's
legitimate to have (subreg:QI (plus:DI ...) <lowpart byte>) and
truncate_operator should match this (unlike my patterns which wouldn't).
The idea being that if we can prove that the DI addition results in a
valid SI value we can just truncate with subreg. What do you think?
Adam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: baddu-2.patch
Type: text/x-patch
Size: 3755 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080828/6cbacf0f/attachment.bin>
More information about the Gcc-patches
mailing list