[llvm] [AMDGPU][GlobalISel] Add register bank legalize rules for amdgcn_icmp, amdgcn_fcmp (PR #172017)

Petar Avramovic via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 6 05:03:49 PDT 2026


================
@@ -1449,6 +1449,18 @@ bool RegBankLegalizeHelper::lower(MachineInstr &MI,
     return lowerAbsToNegMax(MI);
   case AbsToS32:
     return lowerAbsToS32(MI);
+  case IcmpI1ToBallot: {
+    // amdgcn.icmp(i1 src, i1 0, NE) -> ballot(src)
----------------
petar-avramovic wrote:

there no check for src1 being i1 false, nor the compare type being !=
this will lower many cases into `B.buildIntrinsic(Intrinsic::amdgcn_ballot, Dst).addUse(Src);` where we should just fail to compile like SDAG.

https://github.com/llvm/llvm-project/pull/172017


More information about the llvm-commits mailing list