[PATCH] D150279: [LegalizeTypes][RISCV][VE] Add a special case to IntegerExpandSetCCOperands.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 10:46:26 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: efriedma, reames, RKSimon.
Herald added subscribers: jobnoorman, luke, VincentWu, armkevincheng, sjarus, eric-k256, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, steven.zhang, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

This code handles splitting setccs where the type is 2x the size of
a legal integer type. For example, i64 on RV32.

For a setcc like (x u< -256U), we used to try to emit
(hi(x) == -1U) ? (lo(x) u< -256U) : (hi(x) u< -1U)

The (hi(x) u< -1U) part simplies to (hi(x) != -1U) since -1U is the largest
unsigned value.

This leaves
(hi(x) == -1U) ? (lo(x) u< -256U) : (hi(x) != -1U)

Notice that the false value is the inverse of the condition. We can
simplify this to ((lo(x) u< -256U) | (hi(x) != -1U)). Add this as a special
case.

I could do this in DAGCombine, but it would probably require more code and
I don't know if this pattern occurs anywhere else.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150279

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  llvm/test/CodeGen/RISCV/forced-atomics.ll
  llvm/test/CodeGen/RISCV/fpclamptosat.ll
  llvm/test/CodeGen/RISCV/lack-of-signed-truncation-check.ll
  llvm/test/CodeGen/VE/Scalar/br_cc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150279.521035.patch
Type: text/x-patch
Size: 15184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230510/7914a431/attachment.bin>


More information about the llvm-commits mailing list