[clang] [CIR][AMDGPU] Add support for __builtin_amdgcn_alignbit (PR #242166)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 16 06:56:12 PST 2026


================
@@ -409,6 +409,15 @@ __device__ void test_lerp(unsigned int* out, unsigned int src0, unsigned int src
   *out = __builtin_amdgcn_lerp(src0, src1, src2);
 }
 
+// CIR-LABEL: @_Z13test_alignbitPjjjj
+// CIR: cir.fshr {{.*}} : !u32i
+// LLVM: define{{.*}} void @_Z13test_alignbitPjjjj
+// LLVM: call{{.*}} i32 @llvm.fshr.i32(i32 %{{.+}}, i32 %{{.+}}, i32 %{{.+}})
----------------
skc7 wrote:

Nit: could the test check the operand order? Capturing the three loaded args and matching them in `cir.fshr` and in the `llvm.fshr` call would catch a swapped `src0/src1`.
The classic test in `CodeGenOpenCL/builtins-amdgcn.cl` does this with `%src0, %src1, %src2`.

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


More information about the cfe-commits mailing list