This is an archive of the discontinued LLVM Phabricator instance.

[DAG] NFC: Add getBitcasedExtOrTrunc
ClosedPublic

Authored by jrbyrnes on Aug 11 2023, 9:29 AM.

Details

Summary

Simple function which scalarizes Ops then ExtOrTruncs them according to function parameters

Diff Detail

Event Timeline

jrbyrnes created this revision.Aug 11 2023, 9:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2023, 9:29 AM
jrbyrnes requested review of this revision.Aug 11 2023, 9:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2023, 9:29 AM
arsenm added inline comments.Aug 11 2023, 9:42 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
1464–1467

Is this just getExtOrTrunc plus a bitcast (plus support for any_extend?) a get*ExtOrTrunc with the extension type as an argument would be more general

jrbyrnes added inline comments.Aug 11 2023, 10:18 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
1464–1467

It sounds like you are suggesting getAnyExtOrTrunc getZExtOrTrunc etc ? These already exist, so then I should just abandon this.

Or did you perhaps mean getScalarizeZExtOrTrunc getScalarizeAnyExtOrTrunc which does the above but first converts potential vector VT to scalar ?

arsenm added inline comments.Aug 11 2023, 10:34 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
1464–1467

No, there's still a gap to be filled here. There isn't one that handles sext zext and anyext. Not quite sure if bitcast should be worked into it

jrbyrnes updated this revision to Diff 549484.Aug 11 2023, 12:09 PM

Add getExtOrTrunc for Any/Z/S.

Separate out getScalarizedExtOrTrunc into individual getScalarizedZext / getScalarizedAny ..

arsenm added inline comments.Aug 11 2023, 12:15 PM
llvm/include/llvm/CodeGen/SelectionDAG.h
952

Instead of isAny / isSigned, I'de expect it to take the extend opcode

968

I'm not sure scalarized is the right name, you aren't unrolling a vector operation

jrbyrnes updated this revision to Diff 549501.Aug 11 2023, 12:54 PM

Naming + function API

arsenm added inline comments.Aug 16 2023, 5:31 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
1461–1462

Redundant with check in getBitcast

1476–1477

Redundant with check in getBitcast

1491–1492

Redundant with check in getBitcast

jrbyrnes updated this revision to Diff 550911.Aug 16 2023, 3:40 PM

Clean up getBitcasted* implementations

arsenm accepted this revision.Aug 16 2023, 4:39 PM
This revision is now accepted and ready to land.Aug 16 2023, 4:39 PM

Should fix title before submit

jrbyrnes retitled this revision from [DAG] NFC: Add getScalarizeExtOrTrunc to [DAG] NFC: Add getBitcasedExtOrTrunc.Aug 17 2023, 2:28 PM
This revision was landed with ongoing or failed builds.Aug 17 2023, 2:30 PM
This revision was automatically updated to reflect the committed changes.