[LLVMdev] Patterns with Multiple Stores
Dan Gohman
gohman at apple.com
Mon Nov 17 17:39:41 PST 2008
On Nov 17, 2008, at 3:50 PM, David Greene wrote:
> On Monday 17 November 2008 14:28, David Greene wrote:
>> I want to write a pattern that looks something like this:
>>
>> def : Pat<(unalignedstore (v2f64 VR128:$src), addr:$dst),
>> (MOVSDmr ADD64ri8(addr:$dst, imm:8), ( SHUFPDrri
>> (VR128:$src,
>> (MOVSDmr addr:$dst, FR64:$src))), imm:3)
>>
>> So I want to convert an unaligned vector store to a scalar store, a
>> shuffle
>> and a scalar store.
>
> I got a little further with this:
>
> def : Pat<(unalignedstore (v2f64 VR128:$src), addr:$dst),
> (MOVSDmr (ADD64ri8 (LEA64r addr:$dst), 8), (MOVPD2SDrr
> (SHUFPDrri
> (v2f64 VR128:$src), (v2f64 VR128:$src), 3)), (MOVSDmr addr:$dst, FR64:
> $src))>;
>
> Now tblgen (rightly) complains about MOVSDmr having too many
> operands. How do
> I specify the dependency MOVSD->SHUFPD->MOVSD?
>
> I'm a little nervous about the extra MOVPD2SDrr. It exists only to
> get the t
> typing correct. I tried forcing the output of the SHUFPD to be
> typed f64 but
> I couldn't get anything to work. As an alternative I could write a
> special
> MOVSDrr pattern that accepts a v2f64. I'm hoping the MOVPD2SDrr will
> just be coalesced away.
>
> The bare "3" and "8" seem to be accepted.
>
> So the only remaining problem is how to specify the dependencies.
> Is there an
> example in another target that does this sort of thing?
No, there is currently no way to refer to the chain result of a node
in a pattern. Patches welcome :-).
Dan
More information about the llvm-dev
mailing list