[llvm] [CodeGen] [AMDGPU] Support type-aware intrinsic feature checks (PR #205536)

Keshav Vinayak Jha via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 03:18:46 PDT 2026


================
@@ -54,6 +56,16 @@ static cl::opt<unsigned>
 
 GCNSubtarget::~GCNSubtarget() = default;
 
+StringRef GCNSubtarget::getRequiredTargetFeaturesForIntrinsic(
+    unsigned IntrinsicID, const FunctionType *FTy) const {
+  if (FTy && IntrinsicID == Intrinsic::amdgcn_ballot &&
+      FTy->getReturnType()->isIntegerTy(32))
+    return "wavefrontsize32";
+
----------------
keshavvinayak01 wrote:

Okay, I found that work. Yes, the earlier draft used a TableGen opt-in for overload-dependent feature requirements. I’ve restored that approach: `RequiresCustomTargetFeatures` marks only those intrinsics, and the target hook resolves using `FunctionType`. All other intrinsics stay on the existing intrinsic-ID cached path.

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


More information about the llvm-commits mailing list