[PATCH] D157943: [GlobalISel][Mips] Correct corner case in G_UADDE legalization.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 13:26:15 PDT 2023


arsenm accepted this revision.
arsenm added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:3448
+    auto Res_ULT_LHS = MIRBuilder.buildICmp(CmpInst::ICMP_ULT, CondTy, Res, LHS);
+    MIRBuilder.buildSelect(CarryOut, Res_EQ_LHS, CarryIn, Res_ULT_LHS);
 
----------------
craig.topper wrote:
> arsenm wrote:
> > Should probably use an and here, that's more canonical for booleans plus that seems to be what the DAG does
> Are you refering to the code in LegalizeDAG?
> 
> I based my implementation off what we get from ExpandIntRes for an ADD in SelectionDAG for RISC-V. That path creates a wide setcc ult that gets legalized to select like the one I used.
> 
> You can see this in `uaddo.i64` test case in test/CodeGen/RISCV/xaluo.ll for RV32.
Yes, I think it's weird that we're inventing new bugs in code that could be more or less directly ported. In the starter case introducing select of i1 feels wrong


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157943/new/

https://reviews.llvm.org/D157943



More information about the llvm-commits mailing list