[llvm] [GlobalIsel][AArch64] Select G_SCMP and G_UCMP (PR #99820)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 09:12:41 PDT 2024
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/99820 at github.com>
================
@@ -7269,6 +7272,36 @@ LegalizerHelper::LegalizeResult LegalizerHelper::lowerMinMax(MachineInstr &MI) {
return Legalized;
}
+LegalizerHelper::LegalizeResult
+LegalizerHelper::lowerThreewayCompare(MachineInstr &MI) {
+ GSUCmp *Cmp = cast<GSUCmp>(&MI);
+
+ Register Dst = Cmp->getReg(0);
+ LLT DstTy = MRI.getType(Dst);
+ LLT CmpTy = DstTy.changeElementSize(1);
+
+ CmpInst::Predicate LTPredicate = Cmp->isSigned()
+ ? CmpInst::Predicate::ICMP_SLT
+ : CmpInst::Predicate::ICMP_ULT;
+ CmpInst::Predicate GTPredicate = Cmp->isSigned()
+ ? CmpInst::Predicate::ICMP_SGT
+ : CmpInst::Predicate::ICMP_UGT;
+
+ auto One = MIRBuilder.buildConstant(DstTy, 1);
+ auto Zero = MIRBuilder.buildConstant(DstTy, 0);
+ auto MinusOne = MIRBuilder.buildConstant(DstTy, -1);
----------------
arsenm wrote:
Sink these down to just before first use?
https://github.com/llvm/llvm-project/pull/99820
More information about the llvm-commits
mailing list