1 ; RUN: opt -S -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%S/Inputs/import.yaml < %s | FileCheck %s
3 target datalayout = "e-p:64:64"
4 target triple = "x86_64-unknown-linux"
6 declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
8 ; CHECK: define i1 @bytearray7(i8* [[p:%.*]])
9 define i1 @bytearray7(i8* %p) {
10 ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64
11 ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_bytearray7_global_addr to i64)
12 ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint ([0 x i8]* @__typeid_bytearray7_align to i8) to i64)
13 ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint ([0 x i8]* @__typeid_bytearray7_align to i8)) to i64)
14 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]]
15 ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint ([0 x i8]* @__typeid_bytearray7_size_m1 to i64)
16 ; CHECK-NEXT: br i1 [[ule]], label %[[t1:.*]], label %[[f:.*]]
19 ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @__typeid_bytearray7_byte_array, i32 0, i32 0), i64 [[or]]
20 ; CHECK-NEXT: [[load:%.*]] = load i8, i8* [[gep]]
21 ; CHECK-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint ([0 x i8]* @__typeid_bytearray7_bit_mask to i8)
22 ; CHECK-NEXT: [[ne:%.*]] = icmp ne i8 [[and]], 0
23 ; CHECK-NEXT: br i1 [[ne]], label %[[t:.*]], label %[[f:.*]]
26 ; CHECK-NEXT: ret i1 true
29 ; CHECK-NEXT: ret i1 false
30 %x = call i1 @llvm.type.test(i8* %p, metadata !"bytearray7")
31 br i1 %x, label %t, label %f