aboutsummaryrefslogtreecommitdiff
path: root/test/NaCl/PNaClABI/intrinsics.ll
blob: 57edd4031f7b6f80e4e806f1cd42e422b281f0e4 (plain)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
; RUN: pnacl-abicheck -pnaclabi-allow-dev-intrinsics=0 < %s | FileCheck %s
; RUN: pnacl-abicheck -pnaclabi-allow-dev-intrinsics=0 \
; RUN:   -pnaclabi-allow-debug-metadata < %s | FileCheck %s --check-prefix=DBG
; RUN: pnacl-abicheck -pnaclabi-allow-dev-intrinsics=1 < %s | \
; RUN:   FileCheck %s --check-prefix=DEV

; Test that only white-listed intrinsics are allowed.

; ===================================
; Some disallowed "Dev" intrinsics.
; CHECK: Function llvm.dbg.value is a disallowed LLVM intrinsic
; DBG-NOT: Function llvm.dbg.value is a disallowed LLVM intrinsic
; DEV-NOT: Function llvm.dbg.value is a disallowed LLVM intrinsic
declare void @llvm.dbg.value(metadata, i64, metadata)

; ===================================
; Always allowed intrinsics.

; CHECK-NOT: Function llvm.memcpy.p0i8.p0i8.i32 is a disallowed LLVM intrinsic
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src,
                                        i32 %len, i32 %align, i1 %isvolatile)
; CHECK-NOT: Function llvm.memmove.p0i8.p0i8.i32 is a disallowed LLVM intrinsic
declare void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src,
                                         i32 %len, i32 %align, i1 %isvolatile)
; CHECK-NOT: Function llvm.memset.p0i8.i32 is a disallowed LLVM intrinsic
declare void @llvm.memset.p0i8.i32(i8* %dest, i8 %val,
                                    i32 %len, i32 %align, i1 %isvolatile)

; CHECK-NOT: Function llvm.nacl.read.tp is a disallowed LLVM intrinsic
declare i8* @llvm.nacl.read.tp()

; CHECK-NOT: Function llvm.bswap.i16 is a disallowed LLVM intrinsic
declare i16 @llvm.bswap.i16(i16)

; CHECK-NOT: Function llvm.bswap.i32 is a disallowed LLVM intrinsic
declare i32 @llvm.bswap.i32(i32)

; CHECK-NOT: Function llvm.bswap.i64 is a disallowed LLVM intrinsic
declare i64 @llvm.bswap.i64(i64)

; CHECK-NOT: Function llvm.cttz.i32 is a disallowed LLVM intrinsic
declare i32 @llvm.cttz.i32(i32, i1)

; CHECK-NOT: Function llvm.cttz.i64 is a disallowed LLVM intrinsic
declare i64 @llvm.cttz.i64(i64, i1)

; CHECK-NOT: Function llvm.ctlz.i32 is a disallowed LLVM intrinsic
declare i32 @llvm.ctlz.i32(i32, i1)

; CHECK-NOT: Function llvm.ctlz.i64 is a disallowed LLVM intrinsic
declare i64 @llvm.ctlz.i64(i64, i1)

; CHECK-NOT: Function llvm.ctpop.i32 is a disallowed LLVM intrinsic
declare i32 @llvm.ctpop.i32(i32)

; CHECK-NOT: Function llvm.ctpop.i64 is a disallowed LLVM intrinsic
declare i64 @llvm.ctpop.i64(i64)

; CHECK-NOT: Function llvm.trap is a disallowed LLVM intrinsic
declare void @llvm.trap()

; ===================================
; Always disallowed intrinsics.

; CHECK: Function llvm.adjust.trampoline is a disallowed LLVM intrinsic
; DBG: Function llvm.adjust.trampoline is a disallowed LLVM intrinsic
; DEV: Function llvm.adjust.trampoline is a disallowed LLVM intrinsic
declare i8* @llvm.adjust.trampoline(i8*)

; CHECK: Function llvm.init.trampoline is a disallowed LLVM intrinsic
; DBG: Function llvm.init.trampoline is a disallowed LLVM intrinsic
; DEV: Function llvm.init.trampoline is a disallowed LLVM intrinsic
declare void @llvm.init.trampoline(i8*, i8*, i8*)

; CHECK: Function llvm.x86.aesni.aeskeygenassist is a disallowed LLVM intrinsic
; DBG: Function llvm.x86.aesni.aeskeygenassist is a disallowed LLVM intrinsic
; DEV: Function llvm.x86.aesni.aeskeygenassist is a disallowed LLVM intrinsic
declare <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64>, i8)

; CHECK: Function llvm.va_copy is a disallowed LLVM intrinsic
; DBG: Function llvm.va_copy is a disallowed LLVM intrinsic
; DEV: Function llvm.va_copy is a disallowed LLVM intrinsic
declare void @llvm.va_copy(i8*, i8*)

; CHECK: Function llvm.bswap.i1 is a disallowed LLVM intrinsic
declare i1 @llvm.bswap.i1(i1)

; CHECK: Function llvm.bswap.i8 is a disallowed LLVM intrinsic
declare i8 @llvm.bswap.i8(i8)

; CHECK: Function llvm.ctlz.i16 is a disallowed LLVM intrinsic
declare i16 @llvm.ctlz.i16(i16, i1)

; CHECK: Function llvm.cttz.i16 is a disallowed LLVM intrinsic
declare i16 @llvm.cttz.i16(i16, i1)

; CHECK: Function llvm.ctpop.i16 is a disallowed LLVM intrinsic
declare i16 @llvm.ctpop.i16(i16)

; CHECK: Function llvm.lifetime.start is a disallowed LLVM intrinsic
declare void @llvm.lifetime.start(i64, i8* nocapture)

; CHECK: Function llvm.lifetime.end is a disallowed LLVM intrinsic
declare void @llvm.lifetime.end(i64, i8* nocapture)

; CHECK: Function llvm.frameaddress is a disallowed LLVM intrinsic
declare i8* @llvm.frameaddress(i32 %level)

; CHECK: Function llvm.returnaddress is a disallowed LLVM intrinsic
declare i8* @llvm.returnaddress(i32 %level)

; The variants with 64-bit %len arguments are disallowed.
; CHECK: Function llvm.memcpy.p0i8.p0i8.i64 is a disallowed LLVM intrinsic
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest, i8* %src,
                                        i64 %len, i32 %align, i1 %isvolatile)
; CHECK: Function llvm.memmove.p0i8.p0i8.i64 is a disallowed LLVM intrinsic
declare void @llvm.memmove.p0i8.p0i8.i64(i8* %dest, i8* %src,
                                         i64 %len, i32 %align, i1 %isvolatile)
; CHECK: Function llvm.memset.p0i8.i64 is a disallowed LLVM intrinsic
declare void @llvm.memset.p0i8.i64(i8* %dest, i8 %val,
                                    i64 %len, i32 %align, i1 %isvolatile)