1 ; RUN: llc -mtriple=amdgcn -stop-after=amdgpu-isel < %s | FileCheck -check-prefix=GCN %s
2 ; RUN: llc -mtriple=amdgcn -enable-new-pm -stop-after=amdgpu-isel < %s | FileCheck -check-prefix=GCN %s
4 ; GCN-LABEL: name: uniform_bitreverse_i32
6 define amdgpu_kernel void @uniform_bitreverse_i32(i32 %val, ptr addrspace(1) %out) {
7 %res = call i32 @llvm.bitreverse.i32(i32 %val)
8 store i32 %res, ptr addrspace(1) %out
12 ; GCN-LABEL: name: divergent_bitreverse_i32
14 define amdgpu_kernel void @divergent_bitreverse_i32(i32 %val, ptr addrspace(1) %out) {
15 %tid = call i32 @llvm.amdgcn.workitem.id.x()
16 %divergent = add i32 %val, %tid
17 %res = call i32 @llvm.bitreverse.i32(i32 %divergent)
18 store i32 %res, ptr addrspace(1) %out
22 ; GCN-LABEL: name: uniform_bitreverse_i64
24 define amdgpu_kernel void @uniform_bitreverse_i64(i64 %val, ptr addrspace(1) %out) {
25 %res = call i64 @llvm.bitreverse.i64(i64 %val)
26 store i64 %res, ptr addrspace(1) %out
30 ; GCN-LABEL: name: divergent_bitreverse_i64
33 define amdgpu_kernel void @divergent_bitreverse_i64(i64 %val, ptr addrspace(1) %out) {
34 %tid = call i32 @llvm.amdgcn.workitem.id.x()
35 %ext = zext i32 %tid to i64
36 %divergent = add i64 %val, %ext
37 %res = call i64 @llvm.bitreverse.i64(i64 %divergent)
38 store i64 %res, ptr addrspace(1) %out
42 declare i32 @llvm.amdgcn.workitem.id.x()
43 declare i32 @llvm.bitreverse.i32(i32)
44 declare i64 @llvm.bitreverse.i64(i64)