[LLVMdev] Instruction Cleanup Questions

Owen Anderson resistor at mac.com
Thu Jun 7 14:10:09 PDT 2012


On Jun 7, 2012, at 1:42 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> 
> On PPC, normal moves are encoded as OR instructions where the two
> operands being ORed together are the same. These self moves, as it
> turns out, come from things like this:
> 
> %vreg18<def> = OR8To4 %vreg16, %vreg16; GPRC:%vreg18 G8RC:%vreg16
> 
> This is generated from the pattern:
> 
> def : Pat<(i32 (trunc G8RC:$in)),
>          (OR8To4 G8RC:$in, G8RC:$in)>;
> 
> So, as far as RA is concerned, this is a "real" operation (a binary OR
> which truncates the result to 32-bits (from 64-bit inputs)). In
> effect, however, this is just a self copy. 
> 
> How can I fix this?

What is this pattern trying to achieve?  Is the OR actually necessary at all, or can you use an EXTRACT_SUBREG instead?

--Owen



More information about the llvm-dev mailing list