This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Scalarize binop followed by extractelement.
ClosedPublic

Authored by jacquesguan on Jul 12 2022, 1:13 AM.

Details

Summary

This patch adds shouldScalarizeBinop to RISCV target in order to convert an extract element of a vector binary operation into an extract element followed by a scalar binary operation.
For now, the DAGCombiner only supports to combine the fixed vectors. I will change it in the next revision.

Diff Detail

Event Timeline

jacquesguan created this revision.Jul 12 2022, 1:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2022, 1:13 AM
jacquesguan requested review of this revision.Jul 12 2022, 1:13 AM
jacquesguan edited the summary of this revision. (Show Details)Jul 12 2022, 2:07 AM

LGTM.

This is a straight forward port of the X86 logic, and is a reasonable stepping stone. However, I think framing this in terms of legality leaves some potential cases on the floor. Specifically, we can have cases where the scalar op isn't legal, but is still cheaper than the legal vector op.

An example might be a 32 bit udiv. Masking off the high bits requires two extra instructions, but that's probably still profitable over doing the vector op on a long vector.

Long term, I'd propose we frame this in terms of the expected cost of the two forms, not the legality of either side directly.

ping.

This has already been approved. Do you have commit access or do you need someone to land on your behalf?

ping.

This has already been approved. Do you have commit access or do you need someone to land on your behalf?

Phabricator does not say it’s approved. Guess you missed changing the status?

ping.

This has already been approved. Do you have commit access or do you need someone to land on your behalf?

Phabricator does not say it’s approved. Guess you missed changing the status?

Per our dev policy, review status is not authoritative. I'd previous given an "LGTM". That means "approved". This is long standing policy.

This revision is now accepted and ready to land.Jul 23 2022, 5:41 PM
This revision was landed with ongoing or failed builds.Jul 25 2022, 2:23 AM
This revision was automatically updated to reflect the committed changes.