[llvm] [AMDGPU] Implement hasAndNot for scalar bitwise AND-NOT operations. (PR #112647)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 03:05:24 PDT 2025


================
@@ -17577,3 +17577,13 @@ SITargetLowering::lowerIdempotentRMWIntoFencedLoad(AtomicRMWInst *AI) const {
   AI->eraseFromParent();
   return LI;
 }
+
+bool SITargetLowering::hasAndNot(SDValue Op) const {
+  // AND-NOT is only valid on uniform (SGPR) values; divergent values live in
+  // VGPRs.
+  if (Op->isDivergent())
+    return false;
+
+  EVT VT = Op.getValueType();
+  return VT == MVT::i32 || VT == MVT::i64;
----------------
arsenm wrote:

If it's a different type and then is legalized, there will be intermediate instructions that break the and not pattern 

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


More information about the llvm-commits mailing list