xref: /llvm-project/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.prng.ll (revision 9afaf9c6c89efb22bccab39677e8dff47da91a00)
1; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx950 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN %s
2; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx950 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3
4declare i32 @llvm.amdgcn.prng.b32(i32) #0
5
6; GCN-LABEL: {{^}}prng_b32:
7; GCN: v_prng_b32_e32 {{v[0-9]+}}, {{s[0-9]+}}
8define amdgpu_kernel void @prng_b32(ptr addrspace(1) %out, i32 %src) #1 {
9  %prng = call i32 @llvm.amdgcn.prng.b32(i32 %src) #0
10  store i32 %prng, ptr addrspace(1) %out, align 4
11  ret void
12}
13
14; GCN-LABEL: {{^}}prng_b32_constant_4
15; GCN: v_prng_b32_e32 {{v[0-9]+}}, 4
16define amdgpu_kernel void @prng_b32_constant_4(ptr addrspace(1) %out) #1 {
17  %prng = call i32 @llvm.amdgcn.prng.b32(i32 4) #0
18  store i32 %prng, ptr addrspace(1) %out, align 4
19  ret void
20}
21
22; GCN-LABEL: {{^}}prng_b32_constant_100
23; GCN: v_prng_b32_e32 {{v[0-9]+}}, 0x64
24define amdgpu_kernel void @prng_b32_constant_100(ptr addrspace(1) %out) #1 {
25  %prng = call i32 @llvm.amdgcn.prng.b32(i32 100) #0
26  store i32 %prng, ptr addrspace(1) %out, align 4
27  ret void
28}
29
30
31attributes #0 = { nounwind readnone }
32attributes #1 = { nounwind }