1 ; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI %s
2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI %s
4 ; GCN-LABEL: {{^}}mbcnt_intrinsics:
5 ; GCN: v_mbcnt_lo_u32_b32{{(_e64)*}} [[LO:v[0-9]+]], -1, 0
6 ; SI: v_mbcnt_hi_u32_b32_e32 {{v[0-9]+}}, -1, [[LO]]
7 ; VI: v_mbcnt_hi_u32_b32 {{v[0-9]+}}, -1, [[LO]]
8 define amdgpu_ps void @mbcnt_intrinsics(ptr addrspace(4) inreg %arg, ptr addrspace(4) inreg %arg1, ptr addrspace(4) inreg %arg2, i32 inreg %arg3) {
10 %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 -1, i32 0) #0
11 %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 %lo) #0
12 %tmp = bitcast i32 %hi to float
13 call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %tmp, float %tmp, float %tmp, float %tmp, i1 true, i1 true) #1
17 ; GCN-LABEL: {{^}}mbcnt_lo_known_bits_1:
18 ; GCN: v_mbcnt_lo_u32_b32
20 define i32 @mbcnt_lo_known_bits_1(i32 %x, i32 %y) #0 {
21 %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 %x, i32 %y)
22 %mask = and i32 %lo, 63
26 ; GCN-LABEL: {{^}}mbcnt_lo_known_bits_2:
27 ; GCN: v_mbcnt_lo_u32_b32
29 define i32 @mbcnt_lo_known_bits_2(i32 %x) #0 {
30 %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 %x, i32 0)
31 %mask = and i32 %lo, 63
35 ; GCN-LABEL: {{^}}mbcnt_lo_known_bits_3:
36 ; GCN: v_mbcnt_lo_u32_b32
38 define i32 @mbcnt_lo_known_bits_3(i32 %x) #0 {
39 %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 %x, i32 15)
40 %mask = and i32 %lo, 127
44 ; GCN-LABEL: {{^}}mbcnt_lo_known_bits_4:
45 ; GCN: v_mbcnt_lo_u32_b32
47 define i32 @mbcnt_lo_known_bits_4(i32 %x) #0 {
48 %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 %x, i32 15)
49 %mask = and i32 %lo, 63
54 ; GCN-LABEL: {{^}}mbcnt_hi_known_bits_1:
55 ; GCN: v_mbcnt_hi_u32_b32
57 define i32 @mbcnt_hi_known_bits_1(i32 %x, i32 %y) #0 {
58 %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 %x, i32 %y)
59 %mask = and i32 %hi, 63
63 ; GCN-LABEL: {{^}}mbcnt_hi_known_bits_2:
64 ; GCN: v_mbcnt_hi_u32_b32
66 define i32 @mbcnt_hi_known_bits_2(i32 %x) #0 {
67 %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 %x, i32 0)
68 %mask = and i32 %hi, 63
72 ; GCN-LABEL: {{^}}mbcnt_hi_known_bits_3:
73 ; GCN: v_mbcnt_hi_u32_b32
75 define i32 @mbcnt_hi_known_bits_3(i32 %x) #0 {
76 %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 %x, i32 15)
77 %mask = and i32 %hi, 127
81 ; GCN-LABEL: {{^}}mbcnt_hi_known_bits_4:
82 ; GCN: v_mbcnt_hi_u32_b32
84 define i32 @mbcnt_hi_known_bits_4(i32 %x) #0 {
85 %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 %x, i32 15)
86 %mask = and i32 %hi, 63
90 declare i32 @llvm.amdgcn.mbcnt.lo(i32, i32) #0
91 declare i32 @llvm.amdgcn.mbcnt.hi(i32, i32) #0
92 declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1
94 attributes #0 = { nounwind readnone }
95 attributes #1 = { nounwind }