Page MenuHomePhabricator

[DAG] Legalize umin(x,y) -> sub(x,usubsat(x,y)) and umax(x,y) -> add(x,usubsat(y,x)) iff usubsat is legal
ClosedPublic

Authored by RKSimon on Nov 26 2020, 8:05 AM.

Details

Summary

If usubsat() is legal, this is likely to result in smaller codegen expansion than the default cmp+select codegen expansion.

Allows us to move the x86-specific lowering to the generic expansion code.

Diff Detail

Event Timeline

RKSimon created this revision.Nov 26 2020, 8:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 26 2020, 8:05 AM
RKSimon requested review of this revision.Nov 26 2020, 8:05 AM
dmgreen accepted this revision.Nov 26 2020, 10:58 AM

LGTM. Thanks for updating the costs too.

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
227

LLVM_FALLTHROUGH seems to usually (perhaps always?) be written with a semicolon on the end, even if it needn't.

This revision is now accepted and ready to land.Nov 26 2020, 10:58 AM
pengfei added inline comments.Nov 26 2020, 5:36 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
26969

Nit: is it better to remove the custom declaration for them?

RKSimon added inline comments.Nov 27 2020, 1:56 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
26969

That's the plan (see D91876) - theres a horrible set of isOperationLegalOrCustom dependencies on other opcode expansions that I'm working to get fixed once and for all.

This revision was landed with ongoing or failed builds.Nov 27 2020, 3:19 AM
This revision was automatically updated to reflect the committed changes.