1 ; RUN: llc -march=amdgcn -stop-after=amdgpu-isel < %s | FileCheck -check-prefix=GCN %s
3 ; GCN-LABEL: name: uniform_bitreverse_i32
5 define amdgpu_kernel void @uniform_bitreverse_i32(i32 %val, ptr addrspace(1) %out) {
6 %res = call i32 @llvm.bitreverse.i32(i32 %val)
7 store i32 %res, ptr addrspace(1) %out
11 ; GCN-LABEL: name: divergent_bitreverse_i32
13 define amdgpu_kernel void @divergent_bitreverse_i32(i32 %val, ptr addrspace(1) %out) {
14 %tid = call i32 @llvm.amdgcn.workitem.id.x()
15 %divergent = add i32 %val, %tid
16 %res = call i32 @llvm.bitreverse.i32(i32 %divergent)
17 store i32 %res, ptr addrspace(1) %out
21 ; GCN-LABEL: name: uniform_bitreverse_i64
23 define amdgpu_kernel void @uniform_bitreverse_i64(i64 %val, ptr addrspace(1) %out) {
24 %res = call i64 @llvm.bitreverse.i64(i64 %val)
25 store i64 %res, ptr addrspace(1) %out
29 ; GCN-LABEL: name: divergent_bitreverse_i64
32 define amdgpu_kernel void @divergent_bitreverse_i64(i64 %val, ptr addrspace(1) %out) {
33 %tid = call i32 @llvm.amdgcn.workitem.id.x()
34 %ext = zext i32 %tid to i64
35 %divergent = add i64 %val, %ext
36 %res = call i64 @llvm.bitreverse.i64(i64 %divergent)
37 store i64 %res, ptr addrspace(1) %out
41 declare i32 @llvm.amdgcn.workitem.id.x()
42 declare i32 @llvm.bitreverse.i32(i32)
43 declare i64 @llvm.bitreverse.i64(i64)