1 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
3 ; SI-LABEL: {{^}}s_clear_msb:
4 ; SI: s_bitset0_b32 s{{[0-9]+}}, 31
5 define amdgpu_kernel void @s_clear_msb(i32 addrspace(1)* %out, i32 %in) {
6 %x = and i32 %in, 2147483647
7 store i32 %x, i32 addrspace(1)* %out
11 ; SI-LABEL: {{^}}s_set_msb:
12 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
13 define amdgpu_kernel void @s_set_msb(i32 addrspace(1)* %out, i32 %in) {
14 %x = or i32 %in, 2147483648
15 store i32 %x, i32 addrspace(1)* %out
19 ; SI-LABEL: {{^}}s_clear_lsb:
20 ; SI: s_and_b32 s{{[0-9]+}}, s{{[0-9]+}}, -2
21 define amdgpu_kernel void @s_clear_lsb(i32 addrspace(1)* %out, i32 %in) {
22 %x = and i32 %in, 4294967294
23 store i32 %x, i32 addrspace(1)* %out
27 ; SI-LABEL: {{^}}s_set_lsb:
28 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, 1
29 define amdgpu_kernel void @s_set_lsb(i32 addrspace(1)* %out, i32 %in) {
31 store i32 %x, i32 addrspace(1)* %out
35 ; SI-LABEL: {{^}}s_clear_midbit:
36 ; SI: s_bitset0_b32 s{{[0-9]+}}, 8
37 define amdgpu_kernel void @s_clear_midbit(i32 addrspace(1)* %out, i32 %in) {
38 %x = and i32 %in, 4294967039
39 store i32 %x, i32 addrspace(1)* %out
43 ; SI-LABEL: {{^}}s_set_midbit:
44 ; SI: s_bitset1_b32 s{{[0-9]+}}, 8
45 define amdgpu_kernel void @s_set_midbit(i32 addrspace(1)* %out, i32 %in) {
47 store i32 %x, i32 addrspace(1)* %out
51 ; Make sure there's no verifier error with an undef source.
52 ; SI-LABEL: {{^}}bitset_verifier_error:
53 ; SI: s_bitset0_b32 s{{[0-9]+}}, 31
54 define void @bitset_verifier_error() local_unnamed_addr #0 {
56 %i = call float @llvm.fabs.f32(float undef) #0
57 %i1 = bitcast float %i to i32
61 %i3 = call float @llvm.fabs.f32(float undef) #0
62 %i4 = fcmp fast ult float %i3, 0x3FEFF7CEE0000000
63 br i1 %i4, label %bb5, label %bb6
72 declare float @llvm.fabs.f32(float) #0
74 attributes #0 = { nounwind readnone speculatable willreturn }