Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll

Issue 321993002: Add a few Subzero intrinsics (not the atomic ones yet). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: tweak test some Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« szdiff.py ('K') | « szdiff.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; This tests the NaCl intrinsics not related to atomic operations.
2
3 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2REM
5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
7
8 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
9 ; Some of the cast-eliding for the PNaCl version throws things off.
10 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
11 ; RUN: | FileCheck --check-prefix=DUMP %s
12
13 declare i8* @llvm.nacl.read.tp()
14 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
15 declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
16 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1)
17 declare void @llvm.nacl.longjmp(i8*, i32)
18 declare i32 @llvm.nacl.setjmp(i8*)
19 declare void @llvm.trap()
20
21 define i32 @test_nacl_read_tp() {
22 entry:
23 %ptr = call i8* @llvm.nacl.read.tp()
24 %__1 = ptrtoint i8* %ptr to i32
25 ret i32 %__1
26 }
27 ; CHECK-LABEL: test_nacl_read_tp
28 ; CHECK: mov e{{.*}}, dword ptr gs:[0]
29 ; CHECKO2REM-LABEL: test_nacl_read_tp
30 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
31
32 define i32 @test_nacl_read_tp_more_addressing() {
33 entry:
34 %ptr = call i8* @llvm.nacl.read.tp()
35 %__1 = ptrtoint i8* %ptr to i32
36 %x = add i32 %__1, %__1
37 %__3 = inttoptr i32 %x to i32*
38 %v = load i32* %__3, align 1
39 %ptr2 = call i8* @llvm.nacl.read.tp()
40 %__6 = ptrtoint i8* %ptr2 to i32
41 %y = add i32 %__6, 4
42 %__8 = inttoptr i32 %y to i32*
43 store i32 %v, i32* %__8, align 1
44 ret i32 %v
45 }
46 ; CHECK-LABEL: test_nacl_read_tp_more_addressing
47 ; CHECK: mov e{{.*}}, dword ptr gs:[0]
48 ; CHECK: mov e{{.*}}, dword ptr gs:[0]
49 ; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing
50 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
51 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
52
53 define i32 @test_nacl_read_tp_dead(i32 %a) {
54 entry:
55 %ptr = call i8* @llvm.nacl.read.tp()
56 ; Not actually using the result of nacl read tp call.
57 ; In O2 mode this should be DCE'ed.
58 ret i32 %a
59 }
60 ; Consider nacl.read.tp side-effect free, so it can be eliminated.
61 ; CHECKO2REM-LABEL: test_nacl_read_tp_dead
62 ; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0]
63
64 define void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) {
65 entry:
66 %dst = inttoptr i32 %iptr_dst to i8*
67 %src = inttoptr i32 %iptr_src to i8*
68 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
69 i32 %len, i32 1, i1 0)
70 ret void
71 }
72 ; CHECK-LABEL: test_memcpy
73 ; CHECK: call memcpy
74
75 ; TODO(jvoung) -- if we want to be clever, we can do this and the memmove,
76 ; memset without a function call.
77 define void @test_memcpy_const_len_align(i32 %iptr_dst, i32 %iptr_src) {
78 entry:
79 %dst = inttoptr i32 %iptr_dst to i8*
80 %src = inttoptr i32 %iptr_src to i8*
81 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
82 i32 8, i32 1, i1 0)
83 ret void
84 }
85 ; CHECK-LABEL: test_memcpy_const_len_align
86 ; CHECK: call memcpy
87
88 define void @test_memmove(i32 %iptr_dst, i32 %iptr_src, i32 %len) {
89 entry:
90 %dst = inttoptr i32 %iptr_dst to i8*
91 %src = inttoptr i32 %iptr_src to i8*
92 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
93 i32 %len, i32 1, i1 0)
94 ret void
95 }
96 ; CHECK-LABEL: test_memmove
97 ; CHECK: call memmove
98
99 define void @test_memmove_const_len_align(i32 %iptr_dst, i32 %iptr_src) {
100 entry:
101 %dst = inttoptr i32 %iptr_dst to i8*
102 %src = inttoptr i32 %iptr_src to i8*
103 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
104 i32 8, i32 1, i1 0)
105 ret void
106 }
107 ; CHECK-LABEL: test_memmove_const_len_align
108 ; CHECK: call memmove
109
110 define void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) {
111 entry:
112 %val = trunc i32 %wide_val to i8
113 %dst = inttoptr i32 %iptr_dst to i8*
114 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val,
115 i32 %len, i32 1, i1 0)
116 ret void
117 }
118 ; CHECK-LABEL: test_memset
119 ; CHECK: call memset
120
121 define void @test_memset_const_len_align(i32 %iptr_dst, i32 %wide_val) {
122 entry:
123 %val = trunc i32 %wide_val to i8
124 %dst = inttoptr i32 %iptr_dst to i8*
125 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val,
126 i32 8, i32 1, i1 0)
127 ret void
128 }
129 ; CHECK-LABEL: test_memset_const_len_align
130 ; CHECK: call memset
131
132 define i32 @test_setjmplongjmp(i32 %iptr_env) {
133 entry:
134 %env = inttoptr i32 %iptr_env to i8*
135 %i = call i32 @llvm.nacl.setjmp(i8* %env)
136 %r1 = icmp eq i32 %i, 0
137 br i1 %r1, label %Zero, label %NonZero
138 Zero:
139 ; Redundant inttoptr, to make --pnacl cast-eliding/re-insertion happy.
140 %env2 = inttoptr i32 %iptr_env to i8*
141 call void @llvm.nacl.longjmp(i8* %env2, i32 1)
142 ret i32 0
143 NonZero:
144 ret i32 1
145 }
146 ; CHECK-LABEL: test_setjmplongjmp
147 ; CHECK: call setjmp
148 ; CHECK: call longjmp
149 ; CHECKO2REM-LABEL: test_setjmplongjmp
150 ; CHECKO2REM: call setjmp
151 ; CHECKO2REM: call longjmp
152
153 define i32 @test_setjmp_unused(i32 %iptr_env, i32 %i_other) {
154 entry:
155 %env = inttoptr i32 %iptr_env to i8*
156 %i = call i32 @llvm.nacl.setjmp(i8* %env)
157 ret i32 %i_other
158 }
159 ; Don't consider setjmp side-effect free, so it's not eliminated if
160 ; result unused.
161 ; CHECKO2REM-LABEL: test_setjmp_unused
162 ; CHECKO2REM: call setjmp
163
164 define i32 @test_trap(i32 %br) {
165 entry:
166 %r1 = icmp eq i32 %br, 0
167 br i1 %r1, label %Zero, label %NonZero
168 Zero:
169 call void @llvm.trap()
170 unreachable
171 NonZero:
172 ret i32 1
173 }
174 ; CHECK-LABEL: test_trap
175 ; CHECK: ud2
176
177 ; ERRORS-NOT: ICE translation error
178 ; DUMP-NOT: SZ
OLDNEW
« szdiff.py ('K') | « szdiff.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698