1 ; RUN: opt -S -lowerbitsets < %s | FileCheck %s
3 target datalayout = "e-p:32:32"
5 ; CHECK: [[G:@[^ ]*]] = private constant { i32, i32 }
9 !0 = !{!"bitset1", i32* @a, i32 0}
10 !1 = !{!"bitset1", i32* @b, i32 0}
11 !2 = !{!"bitset2", i32* @a, i32 0}
12 !3 = !{!"bitset3", i32* @b, i32 0}
14 !llvm.bitsets = !{ !0, !1, !2, !3 }
16 declare i1 @llvm.bitset.test(i8* %ptr, metadata %bitset) nounwind readnone
18 ; CHECK: @foo(i8* [[A0:%[^ ]*]])
19 define i1 @foo(i8* %p) {
20 ; CHECK: [[R0:%[^ ]*]] = ptrtoint i8* [[A0]] to i32
21 ; CHECK: [[R1:%[^ ]*]] = icmp eq i32 [[R0]], ptrtoint ({ i32, i32 }* [[G]] to i32)
22 %x = call i1 @llvm.bitset.test(i8* %p, metadata !"bitset2")
23 ; CHECK: ret i1 [[R1]]
27 ; CHECK: @bar(i8* [[B0:%[^ ]*]])
28 define i1 @bar(i8* %p) {
29 ; CHECK: [[S0:%[^ ]*]] = ptrtoint i8* [[B0]] to i32
30 ; CHECK: [[S1:%[^ ]*]] = icmp eq i32 [[S0]], add (i32 ptrtoint ({ i32, i32 }* [[G]] to i32), i32 4)
31 %x = call i1 @llvm.bitset.test(i8* %p, metadata !"bitset3")
32 ; CHECK: ret i1 [[S1]]
37 define i1 @x(i8* %p) {
38 %x = call i1 @llvm.bitset.test(i8* %p, metadata !"bitset1")