[LLVMdev] 2-address and 3-address instructions
Matt Arsenault
Matthew.Arsenault at amd.com
Fri Jul 17 13:44:47 PDT 2015
On 07/17/2015 01:34 PM, bagel wrote:
>
> 2. Or do I generate 2-address and have to have a custom pass that
> peepholes to see if a mov reg-to-reg proceeds or follows a 2-address
> instruction and turn it into a 3-address version?
>
The way I think this is supposed to work is you select to the 2 address
version, set the isConvertibleToThreeAddress bit on it, and
thenimplement TargetInstrInfo::convertToThreeAddress for the instruction
to do the replacement.
> 3. Or do I generate 3-address and have a custom pass that checks if a
> source
> and destination register in a 3-address is the same and turn it into a
> 2-address?
>
> Anybody done this already?
AMDGPU recently added this in r242038 for choosing between v_mac_f32 and
v_mad_f32, although that is a bit more complicated since it sometimes
does select v_mad_f32 to begin with if it can use source modifiers
-Matt
More information about the llvm-dev
mailing list