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

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: doesn't matter if eax or not 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
« src/llvm2ice.cpp ('K') | « src/llvm2ice.cpp ('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 ; Don't actually do the szdiff test: Subzero treats pointers as i32,
Jim Stichnoth 2014/06/10 22:58:28 Could probably add "i8 \*" to ignore_pattern in sz
jvoung (off chromium) 2014/06/12 05:48:30 Ignoring "@llvm." lines instead of i8\* -- Unfortu
Jim Stichnoth 2014/06/12 20:52:06 Ouch. At some point we may want to just retire sz
9 ; but llvm's intrinsics may use i8* in its intrinsics that take pointer
10 ; parameters. So, there is a diff in the way pointer types are printed.
11 ; RUIN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
12 ; RUIN: %llvm2iceinsts --pnacl %s | %szdiff %s \
13 ; RUIN: | FileCheck --check-prefix=DUMP %s
14
15 declare i8* @llvm.nacl.read.tp()
16 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
17 declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
18 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1)
19 declare void @llvm.nacl.longjmp(i8*, i32)
20 declare i32 @llvm.nacl.setjmp(i8*)
21 declare void @llvm.trap()
22
23 define i32 @test_nacl_read_tp() {
24 entry:
25 %ptr = call i8* @llvm.nacl.read.tp()
26 %r = ptrtoint i8* %ptr to i32
27 ret i32 %r
28 }
29 ; CHECK-LABEL: test_nacl_read_tp
30 ; CHECK: mov e{{.*}}, dword ptr gs:[0]
31 ; CHECKO2REM-LABEL: test_nacl_read_tp
32 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
33
34 define i32 @test_nacl_read_tp_dead(i32 %a) {
35 entry:
36 %ptr = call i8* @llvm.nacl.read.tp()
37 ; Not actually using the result of nacl read tp call.
38 ; In O2 mode this should be DCE'ed.
39 ret i32 %a
40 }
41 ; Consider nacl.read.tp side-effect free, so it can be eliminated.
42 ; CHECKO2REM-LABEL: test_nacl_read_tp_dead
43 ; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0]
44
45 define void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) {
46 entry:
47 %dst = inttoptr i32 %iptr_dst to i8*
48 %src = inttoptr i32 %iptr_src to i8*
49 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
50 i32 %len, i32 1, i1 0)
51 ret void
52 }
53 ; CHECK-LABEL: test_memcpy
54 ; CHECK: call memcpy
55
56 ; TODO(jvoung) -- if we want to be clever, we can do this and the memmove,
57 ; memset without a function call.
58 define void @test_memcpy_const_len_align(i32 %iptr_dst, i32 %iptr_src) {
59 entry:
60 %dst = inttoptr i32 %iptr_dst to i8*
61 %src = inttoptr i32 %iptr_src to i8*
62 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
63 i32 8, i32 1, i1 0)
64 ret void
65 }
66 ; CHECK-LABEL: test_memcpy_const_len_align
67 ; CHECK: call memcpy
68
69 define void @test_memmove(i32 %iptr_dst, i32 %iptr_src, i32 %len) {
70 entry:
71 %dst = inttoptr i32 %iptr_dst to i8*
72 %src = inttoptr i32 %iptr_src to i8*
73 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
74 i32 %len, i32 1, i1 0)
75 ret void
76 }
77 ; CHECK-LABEL: test_memmove
78 ; CHECK: call memmove
79
80 define void @test_memmove_const_len_align(i32 %iptr_dst, i32 %iptr_src) {
81 entry:
82 %dst = inttoptr i32 %iptr_dst to i8*
83 %src = inttoptr i32 %iptr_src to i8*
84 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
85 i32 8, i32 1, i1 0)
86 ret void
87 }
88 ; CHECK-LABEL: test_memmove_const_len_align
89 ; CHECK: call memmove
90
91 define void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) {
92 entry:
93 %dst = inttoptr i32 %iptr_dst to i8*
94 %val = trunc i32 %wide_val to i8
95 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val,
96 i32 %len, i32 1, i1 0)
97 ret void
98 }
99 ; CHECK-LABEL: test_memset
100 ; CHECK: call memset
101
102 define void @test_memset_const_len_align(i32 %iptr_dst, i32 %wide_val) {
103 entry:
104 %dst = inttoptr i32 %iptr_dst to i8*
105 %val = trunc i32 %wide_val to i8
106 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val,
107 i32 8, i32 1, i1 0)
108 ret void
109 }
110 ; CHECK-LABEL: test_memset_const_len_align
111 ; CHECK: call memset
112
113 define i32 @test_setjmplongjmp(i32 %iptr_env) {
114 entry:
115 %env = inttoptr i32 %iptr_env to i8*
116 %i = call i32 @llvm.nacl.setjmp(i8* %env)
117 %r1 = icmp eq i32 %i, 0
118 br i1 %r1, label %Zero, label %NonZero
119 Zero:
120 call void @llvm.nacl.longjmp(i8* %env, i32 1)
121 ret i32 0
122 NonZero:
123 ret i32 1
124 }
125 ; CHECK-LABEL: test_setjmplongjmp
126 ; CHECK: call setjmp
127 ; CHECK: call longjmp
128 ; CHECKO2REM-LABEL: test_setjmplongjmp
129 ; CHECKO2REM: call setjmp
130 ; CHECKO2REM: call longjmp
131
132 define i32 @test_setjmp_unused(i32 %iptr_env, i32 %i_other) {
133 entry:
134 %env = inttoptr i32 %iptr_env to i8*
135 %i = call i32 @llvm.nacl.setjmp(i8* %env)
136 ret i32 %i_other
137 }
138 ; Don't consider setjmp side-effect free, so it's not eliminated if
139 ; result unused.
140 ; CHECKO2REM-LABEL: test_setjmp_unused
141 ; CHECKO2REM: call setjmp
142
143 define i32 @test_trap(i32 %br) {
144 entry:
145 %r1 = icmp eq i32 %br, 0
146 br i1 %r1, label %Zero, label %NonZero
147 Zero:
148 call void @llvm.trap()
149 unreachable
150 NonZero:
151 ret i32 1
152 }
153 ; CHECK-LABEL: test_trap
154 ; CHECK: ud2
155
156 ; ERRORS-NOT: ICE translation error
OLDNEW
« src/llvm2ice.cpp ('K') | « src/llvm2ice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698