1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI %s
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI %s
; GCN-LABEL: {{^}}mbcnt_intrinsics:
; GCN: v_mbcnt_lo_u32_b32{{(_e64)*}} [[LO:v[0-9]+]], -1, 0
; SI: v_mbcnt_hi_u32_b32_e32 {{v[0-9]+}}, -1, [[LO]]
; VI: v_mbcnt_hi_u32_b32 {{v[0-9]+}}, -1, [[LO]]
define amdgpu_ps void @mbcnt_intrinsics(ptr addrspace(4) inreg %arg, ptr addrspace(4) inreg %arg1, ptr addrspace(4) inreg %arg2, i32 inreg %arg3) {
main_body:
%lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 -1, i32 0) #0
%hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 %lo) #0
%tmp = bitcast i32 %hi to float
call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %tmp, float %tmp, float %tmp, float %tmp, i1 true, i1 true) #1
ret void
}
; GCN-LABEL: {{^}}mbcnt_lo_known_bits_1:
; GCN: v_mbcnt_lo_u32_b32
; GCN: v_and_b32_e32
define i32 @mbcnt_lo_known_bits_1(i32 %x, i32 %y) #0 {
%lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 %x, i32 %y)
%mask = and i32 %lo, 63
ret i32 %mask
}
; GCN-LABEL: {{^}}mbcnt_lo_known_bits_2:
; GCN: v_mbcnt_lo_u32_b32
; GCN-NOT: and
define i32 @mbcnt_lo_known_bits_2(i32 %x) #0 {
%lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 %x, i32 0)
%mask = and i32 %lo, 63
ret i32 %mask
}
; GCN-LABEL: {{^}}mbcnt_lo_known_bits_3:
; GCN: v_mbcnt_lo_u32_b32
; GCN-NOT: and
define i32 @mbcnt_lo_known_bits_3(i32 %x) #0 {
%lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 %x, i32 15)
%mask = and i32 %lo, 127
ret i32 %mask
}
; GCN-LABEL: {{^}}mbcnt_lo_known_bits_4:
; GCN: v_mbcnt_lo_u32_b32
; GCN: v_and_b32_e32
define i32 @mbcnt_lo_known_bits_4(i32 %x) #0 {
%lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 %x, i32 15)
%mask = and i32 %lo, 63
ret i32 %mask
}
; GCN-LABEL: {{^}}mbcnt_hi_known_bits_1:
; GCN: v_mbcnt_hi_u32_b32
; GCN: v_and_b32_e32
define i32 @mbcnt_hi_known_bits_1(i32 %x, i32 %y) #0 {
%hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 %x, i32 %y)
%mask = and i32 %hi, 63
ret i32 %mask
}
; GCN-LABEL: {{^}}mbcnt_hi_known_bits_2:
; GCN: v_mbcnt_hi_u32_b32
; GCN-NOT: and
define i32 @mbcnt_hi_known_bits_2(i32 %x) #0 {
%hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 %x, i32 0)
%mask = and i32 %hi, 63
ret i32 %mask
}
; GCN-LABEL: {{^}}mbcnt_hi_known_bits_3:
; GCN: v_mbcnt_hi_u32_b32
; GCN-NOT: and
define i32 @mbcnt_hi_known_bits_3(i32 %x) #0 {
%hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 %x, i32 15)
%mask = and i32 %hi, 127
ret i32 %mask
}
; GCN-LABEL: {{^}}mbcnt_hi_known_bits_4:
; GCN: v_mbcnt_hi_u32_b32
; GCN: v_and_b32_e32
define i32 @mbcnt_hi_known_bits_4(i32 %x) #0 {
%hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 %x, i32 15)
%mask = and i32 %hi, 63
ret i32 %mask
}
declare i32 @llvm.amdgcn.mbcnt.lo(i32, i32) #0
declare i32 @llvm.amdgcn.mbcnt.hi(i32, i32) #0
declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1
attributes #0 = { nounwind readnone }
attributes #1 = { nounwind }
|