If we're going to end up expanding anyway, we should do it early
so we don't create extra operations to handle the bytes added by
promotion.
Simlilar was done for BSWAP previously.
Paths
| Differential D96681
[RISCV][LegalizeTypes] Try to expand BITREVERSE before promoting if the promoted BITREVERSE would expand anyway. ClosedPublic Authored by craig.topper on Feb 14 2021, 7:42 PM.
Details Summary If we're going to end up expanding anyway, we should do it early Simlilar was done for BSWAP previously.
Diff Detail
Event TimelineHerald added subscribers: StephenFan, vkmr, evandro and 23 others. · View Herald TranscriptFeb 14 2021, 7:42 PM
This revision is now accepted and ready to land.Feb 15 2021, 3:12 AM This revision was landed with ongoing or failed builds.Feb 15 2021, 12:42 PM Closed by commit rGeb75f250feb6: [RISCV][LegalizeTypes] Try to expand BITREVERSE before promoting if the… (authored by craig.topper). · Explain Why This revision was automatically updated to reflect the committed changes. Comment Actions Is it possible to disable this expansion on a architecture which has 64 bit bitreverse and want to promote 32 bit bitreverse to 64 bit? VE expected promotion which generateed 2 instructions for 32 bit bitreverse previously. But now, bitreverse is expanded with bswap which generates 27 isntructions. I tried to fix it by VE implementation like trying to add isel patterns, but it doesn't work well. If there is some kind option to avoid bswap expansion, please let me know. Thanks! Comment Actions
I just commited 913229983633cd4c19b9e5534018f9a42e274b30 which restores VE's previous codegen for i8 and i16 bitreverse. I restored bitreverse.ll to its previous state. Comment Actions
Thank you. This modifications fix the issue. I appreciate it.
Revision Contents
Diff 323821 llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/RISCV/rv32Zbp.ll
llvm/test/CodeGen/RISCV/rv64Zbp.ll
|
Isn't this dealt with at the bottom of the function?