1 ; RUN: opt -S -lowertypetests -mtriple=i686-unknown-linux-gnu < %s | FileCheck --check-prefixes=X86,X86-LINUX,NATIVE %s
2 ; RUN: opt -S -lowertypetests -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck --check-prefixes=X86,X86-LINUX,NATIVE %s
3 ; RUN: opt -S -lowertypetests -mtriple=i686-pc-win32 < %s | FileCheck --check-prefixes=X86,X86-WIN32,NATIVE %s
4 ; RUN: opt -S -lowertypetests -mtriple=x86_64-pc-win32 < %s | FileCheck --check-prefixes=X86,X86-WIN32,NATIVE %s
5 ; RUN: opt -S -lowertypetests -mtriple=arm-unknown-linux-gnu < %s | FileCheck --check-prefixes=ARM,NATIVE %s
6 ; RUN: opt -S -lowertypetests -mtriple=thumb-unknown-linux-gnu < %s | FileCheck --check-prefixes=THUMB,NATIVE %s
7 ; RUN: opt -S -lowertypetests -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck --check-prefixes=ARM,NATIVE %s
8 ; RUN: opt -S -lowertypetests -mtriple=wasm32-unknown-unknown < %s | FileCheck --check-prefix=WASM32 %s
10 ; Tests that we correctly handle bitsets containing 2 or more functions.
12 target datalayout = "e-p:64:64"
15 ; NATIVE: @0 = private unnamed_addr constant [2 x void (...)*] [void (...)* bitcast (void ()* @f to void (...)*), void (...)* bitcast (void ()* @g to void (...)*)], align 16
16 @0 = private unnamed_addr constant [2 x void (...)*] [void (...)* bitcast (void ()* @f to void (...)*), void (...)* bitcast (void ()* @g to void (...)*)], align 16
18 ; NATIVE: private constant [0 x i8] zeroinitializer
19 ; WASM32: private constant [0 x i8] zeroinitializer
21 ; NATIVE: @f = alias void (), void ()* @[[JT:.*]]
23 ; X86: @g = internal alias void (), bitcast ([8 x i8]* getelementptr inbounds ([2 x [8 x i8]], [2 x [8 x i8]]* bitcast (void ()* @[[JT]] to [2 x [8 x i8]]*), i64 0, i64 1) to void ()*)
24 ; ARM: @g = internal alias void (), bitcast ([4 x i8]* getelementptr inbounds ([2 x [4 x i8]], [2 x [4 x i8]]* bitcast (void ()* @[[JT]] to [2 x [4 x i8]]*), i64 0, i64 1) to void ()*)
25 ; THUMB: @g = internal alias void (), bitcast ([4 x i8]* getelementptr inbounds ([2 x [4 x i8]], [2 x [4 x i8]]* bitcast (void ()* @[[JT]] to [2 x [4 x i8]]*), i64 0, i64 1) to void ()*)
27 ; NATIVE: define hidden void @f.cfi()
28 ; WASM32: define void @f() !type !{{[0-9]+}} !wasm.index ![[I0:[0-9]+]]
29 define void @f() !type !0 {
33 ; NATIVE: define internal void @g.cfi()
34 ; WASM32: define internal void @g() !type !{{[0-9]+}} !wasm.index ![[I1:[0-9]+]]
35 define internal void @g() !type !0 {
39 !0 = !{i32 0, !"typeid1"}
41 declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
43 define i1 @foo(i8* %p) {
44 ; NATIVE: sub i64 {{.*}}, ptrtoint (void ()* @[[JT]] to i64)
45 ; WASM32: sub i64 {{.*}}, ptrtoint (i8* getelementptr (i8, i8* null, i64 1) to i64)
46 ; WASM32: icmp ule i64 {{.*}}, 1
47 %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1")
51 ; X86-LINUX: define private void @[[JT]]() #[[ATTR:.*]] align 8 {
52 ; X86-WIN32: define private void @[[JT]]() #[[ATTR:.*]] align 8 {
53 ; ARM: define private void @[[JT]]() #[[ATTR:.*]] align 4 {
54 ; THUMB: define private void @[[JT]]() #[[ATTR:.*]] align 4 {
60 ; X86-SAME: jmp ${1:c}@plt
71 ; NATIVE-SAME: "s,s"(void ()* @f.cfi, void ()* @g.cfi)
73 ; X86-LINUX: attributes #[[ATTR]] = { naked nounwind }
74 ; X86-WIN32: attributes #[[ATTR]] = { nounwind }
75 ; ARM: attributes #[[ATTR]] = { naked nounwind
76 ; THUMB: attributes #[[ATTR]] = { naked nounwind "target-cpu"="cortex-a8" "target-features"="+thumb-mode" }
78 ; WASM32: ![[I0]] = !{i64 1}
79 ; WASM32: ![[I1]] = !{i64 2}