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

Harrison Hao via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 01:10:57 PDT 2024


================
@@ -16890,3 +16889,13 @@ SITargetLowering::lowerIdempotentRMWIntoFencedLoad(AtomicRMWInst *AI) const {
   AI->eraseFromParent();
   return LI;
 }
+
+bool SITargetLowering::hasAndNot(SDValue Op) const {
+  // Return false if the operation is divergent, as AND-NOT is a scalar-only
+  // instruction.
+  if (Op->isDivergent() || !Op->isMachineOpcode())
+    return false;
+
+  EVT VT = Op.getValueType();
+  return VT == MVT::i32 || VT == MVT::i64;
+}
----------------
harrisonGPU wrote:

Hi Vikash, I think AMDGPU has supported the AndNot instruction for a long time because I noticed there have been many lit tests for it. This PR just aims to implement hasAndNot. :)

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


More information about the llvm-commits mailing list