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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 03:05:08 PDT 2026


================
@@ -0,0 +1,29 @@
+; RUN: split-file %s %t
+; RUN: not llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=null %t/ballot-i32.ll 2>&1 | FileCheck %s --check-prefix=ERR
+; RUN: not llc -global-isel=1 -global-isel-abort=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=null %t/ballot-i32.ll 2>&1 | FileCheck %s --check-prefix=ERR
+; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=null %t/ballot-i64.ll
+; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=null %t/ballot-i64.ll
+; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -filetype=null %t/ballot-i32.ll
+; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -filetype=null %t/ballot-i32.ll
+
+; ERR: error: {{.*}}: in function {{@?}}ballot_i32{{.*}}: llvm.amdgcn.ballot requires target feature 'wavefrontsize32'
+
+;--- ballot-i32.ll
+declare i32 @llvm.amdgcn.ballot.i32(i1)
+
+define amdgpu_kernel void @ballot_i32(i32 %x, ptr addrspace(1) %out) {
+  %trunc = trunc i32 %x to i1
+  %ballot = call i32 @llvm.amdgcn.ballot.i32(i1 %trunc)
+  store i32 %ballot, ptr addrspace(1) %out
+  ret void
+}
+
+;--- ballot-i64.ll
----------------
arsenm wrote:

This should already be covered by existing tests, avoid the split file 

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


More information about the llvm-commits mailing list