This is an archive of the discontinued LLVM Phabricator instance.

Remaining TblGen patterns for extract vector element for legal types on PPC
ClosedPublic

Authored by nemanjai on Dec 9 2015, 3:16 AM.

Details

Summary

With the introduction of VSX (P7) and subsequently direct moves (P8), we have legalized the extract vector element operation for various types. However, the TblGen patterns were not introduced to handle variable index for the element being extracted. This meant that the back end would crash when trying to match a DAG node that has the extract_vector_elt with a variable as the last operand and one of the legal types.

This patch eliminates those crashes and performs the operation with an optimal instruction sequence (avoiding stack stores and reloads).

Diff Detail

Repository
rL LLVM

Event Timeline

nemanjai updated this revision to Diff 42283.Dec 9 2015, 3:16 AM
nemanjai retitled this revision from to Remaining TblGen patterns for extract vector element for legal types on PPC.
nemanjai updated this object.
nemanjai added reviewers: hfinkel, wschmidt, kbarton, seurer.
nemanjai set the repository for this revision to rL LLVM.
nemanjai added a subscriber: llvm-commits.
nemanjai added inline comments.Dec 9 2015, 3:19 AM
lib/Target/PowerPC/PPCInstrVSX.td
1276

Just changed the name of this to reflect what the definition actually contains. Not all extractions are done with moves from VSRs (namely, the floating point ones).

1499

This was a bug originally. This is meant to be a shift left by 4 bits. I don't think there was any functional impact of this bug, but I corrected it for clarity and consistency.

hfinkel accepted this revision.Dec 10 2015, 7:29 PM
hfinkel edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Dec 10 2015, 7:29 PM
hfinkel added inline comments.Dec 10 2015, 7:33 PM
test/CodeGen/PowerPC/variable_elem_vec_extracts.ll
100

Please file a bug so we can track this; I recall seeing this in the past (and had thought it was no longer a problem, but apparently I was wrong).

nemanjai closed this revision.Dec 15 2015, 6:55 AM

Unfortunately, I made a mistake when committing the patch for:
http://reviews.llvm.org/D15286
and committed this actual patch instead (the patch landed in revision http://reviews.llvm.org/rL255246). Terribly sorry for the confusion.
For D15286:
Committed revision 255649.