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

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

Issue 2317653004: Subzero, MIPS32: Introduction of genTargetHelperCallFor (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: FREM resolved Created 4 years, 3 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
« no previous file with comments | « tests_lit/llvm2ice_tests/fp.arith.ll ('k') | tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; This tests the NaCl intrinsics memset, memcpy and memmove. 1 ; This tests the NaCl intrinsics memset, memcpy and memmove.
2 2
3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
4 ; RUN: --target x8632 --sandbox -i %s --args -O2 \ 4 ; RUN: --target x8632 --sandbox -i %s --args -O2 \
5 ; RUN: | %if --need=target_X8632 --command FileCheck %s 5 ; RUN: | %if --need=target_X8632 --command FileCheck %s
6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
7 ; RUN: --target x8632 --sandbox -i %s --args -Om1 --fmem-intrin-opt \ 7 ; RUN: --target x8632 --sandbox -i %s --args -Om1 --fmem-intrin-opt \
8 ; RUN: | %if --need=target_X8632 --command FileCheck %s 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s
9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
10 ; RUN: --target x8632 --sandbox -i %s --args -Om1 \ 10 ; RUN: --target x8632 --sandbox -i %s --args -Om1 \
11 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix OM1 %s 11 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix OM1 %s
12 12
13 ; RUN: %if --need=target_ARM32 --need=allow_dump \ 13 ; RUN: %if --need=target_ARM32 --need=allow_dump \
14 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target arm32 \ 14 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target arm32 \
15 ; RUN: -i %s --args -O2 --skip-unimplemented \ 15 ; RUN: -i %s --args -O2 --skip-unimplemented \
16 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ 16 ; RUN: | %if --need=target_ARM32 --need=allow_dump \
17 ; RUN: --command FileCheck --check-prefix ARM32 %s 17 ; RUN: --command FileCheck --check-prefix ARM32 %s
18 18
19 ; RUN: %if --need=target_MIPS32 --need=allow_dump \
20 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target mips32\
21 ; RUN: -i %s --args -Om1 --skip-unimplemented \
22 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \
23 ; RUN: --command FileCheck --check-prefix MIPS32 %s
24
19 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) 25 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
20 declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) 26 declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
21 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) 27 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1)
22 28
23 define internal void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { 29 define internal void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) {
24 entry: 30 entry:
25 %dst = inttoptr i32 %iptr_dst to i8* 31 %dst = inttoptr i32 %iptr_dst to i8*
26 %src = inttoptr i32 %iptr_src to i8* 32 %src = inttoptr i32 %iptr_src to i8*
27 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, 33 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
28 i32 %len, i32 1, i1 false) 34 i32 %len, i32 1, i1 false)
29 ret void 35 ret void
30 } 36 }
31 ; CHECK-LABEL: test_memcpy 37 ; CHECK-LABEL: test_memcpy
32 ; CHECK: call {{.*}} R_{{.*}} memcpy 38 ; CHECK: call {{.*}} R_{{.*}} memcpy
33 ; OM1-LABEL: test_memcpy 39 ; OM1-LABEL: test_memcpy
34 ; OM1: call {{.*}} memcpy 40 ; OM1: call {{.*}} memcpy
35 ; ARM32-LABEL: test_memcpy 41 ; ARM32-LABEL: test_memcpy
36 ; ARM32: bl {{.*}} memcpy 42 ; ARM32: bl {{.*}} memcpy
43 ; MIPS32-LABEL: test_memcpy
44 ; MIPS32: jal {{.*}} memcpy
37 45
38 define internal void @test_memcpy_long_const_len(i32 %iptr_dst, i32 %iptr_src) { 46 define internal void @test_memcpy_long_const_len(i32 %iptr_dst, i32 %iptr_src) {
39 entry: 47 entry:
40 %dst = inttoptr i32 %iptr_dst to i8* 48 %dst = inttoptr i32 %iptr_dst to i8*
41 %src = inttoptr i32 %iptr_src to i8* 49 %src = inttoptr i32 %iptr_src to i8*
42 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, 50 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
43 i32 4876, i32 1, i1 false) 51 i32 4876, i32 1, i1 false)
44 ret void 52 ret void
45 } 53 }
46 ; CHECK-LABEL: test_memcpy_long_const_len 54 ; CHECK-LABEL: test_memcpy_long_const_len
47 ; CHECK: call {{.*}} R_{{.*}} memcpy 55 ; CHECK: call {{.*}} R_{{.*}} memcpy
48 ; OM1-LABEL: test_memcpy_long_const_len 56 ; OM1-LABEL: test_memcpy_long_const_len
49 ; OM1: call {{.*}} memcpy 57 ; OM1: call {{.*}} memcpy
50 ; ARM32-LABEL: test_memcpy_long_const_len 58 ; ARM32-LABEL: test_memcpy_long_const_len
51 ; ARM32: bl {{.*}} memcpy 59 ; ARM32: bl {{.*}} memcpy
60 ; MIPS32-LABEL: test_memcpy_long_const_len
61 ; MIPS32: jal {{.*}} memcpy
52 62
53 define internal void @test_memcpy_very_small_const_len(i32 %iptr_dst, 63 define internal void @test_memcpy_very_small_const_len(i32 %iptr_dst,
54 i32 %iptr_src) { 64 i32 %iptr_src) {
55 entry: 65 entry:
56 %dst = inttoptr i32 %iptr_dst to i8* 66 %dst = inttoptr i32 %iptr_dst to i8*
57 %src = inttoptr i32 %iptr_src to i8* 67 %src = inttoptr i32 %iptr_src to i8*
58 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, 68 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
59 i32 2, i32 1, i1 false) 69 i32 2, i32 1, i1 false)
60 ret void 70 ret void
61 } 71 }
62 ; CHECK-LABEL: test_memcpy_very_small_const_len 72 ; CHECK-LABEL: test_memcpy_very_small_const_len
63 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] 73 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}]
64 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] 74 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]]
65 ; CHECK-NOT: mov 75 ; CHECK-NOT: mov
66 ; OM1-LABEL: test_memcpy_very_small_const_len 76 ; OM1-LABEL: test_memcpy_very_small_const_len
67 ; OM1: call {{.*}} memcpy 77 ; OM1: call {{.*}} memcpy
68 ; ARM32-LABEL: test_memcpy_very_small_const_len 78 ; ARM32-LABEL: test_memcpy_very_small_const_len
69 ; ARM32: bl {{.*}} memcpy 79 ; ARM32: bl {{.*}} memcpy
80 ; MIPS32-LABEL: test_memcpy_very_small_const_len
81 ; MIPS32: jal {{.*}} memcpy
70 82
71 define internal void @test_memcpy_const_len_3(i32 %iptr_dst, i32 %iptr_src) { 83 define internal void @test_memcpy_const_len_3(i32 %iptr_dst, i32 %iptr_src) {
72 entry: 84 entry:
73 %dst = inttoptr i32 %iptr_dst to i8* 85 %dst = inttoptr i32 %iptr_dst to i8*
74 %src = inttoptr i32 %iptr_src to i8* 86 %src = inttoptr i32 %iptr_src to i8*
75 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, 87 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
76 i32 3, i32 1, i1 false) 88 i32 3, i32 1, i1 false)
77 ret void 89 ret void
78 } 90 }
79 ; CHECK-LABEL: test_memcpy_const_len_3 91 ; CHECK-LABEL: test_memcpy_const_len_3
80 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] 92 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}]
81 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] 93 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]]
82 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x2] 94 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x2]
83 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],[[REG]] 95 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],[[REG]]
84 ; CHECK-NOT: mov 96 ; CHECK-NOT: mov
85 ; OM1-LABEL: test_memcpy_const_len_3 97 ; OM1-LABEL: test_memcpy_const_len_3
86 ; OM1: call {{.*}} memcpy 98 ; OM1: call {{.*}} memcpy
87 ; ARM32-LABEL: test_memcpy_const_len_3 99 ; ARM32-LABEL: test_memcpy_const_len_3
88 ; ARM32: bl {{.*}} memcpy 100 ; ARM32: bl {{.*}} memcpy
101 ; MIPS32-LABEL: test_memcpy_const_len_3
102 ; MIPS32: jal {{.*}} memcpy
89 103
90 define internal void @test_memcpy_mid_const_len(i32 %iptr_dst, i32 %iptr_src) { 104 define internal void @test_memcpy_mid_const_len(i32 %iptr_dst, i32 %iptr_src) {
91 entry: 105 entry:
92 %dst = inttoptr i32 %iptr_dst to i8* 106 %dst = inttoptr i32 %iptr_dst to i8*
93 %src = inttoptr i32 %iptr_src to i8* 107 %src = inttoptr i32 %iptr_src to i8*
94 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, 108 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
95 i32 9, i32 1, i1 false) 109 i32 9, i32 1, i1 false)
96 ret void 110 ret void
97 } 111 }
98 ; CHECK-LABEL: test_memcpy_mid_const_len 112 ; CHECK-LABEL: test_memcpy_mid_const_len
99 ; CHECK: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}] 113 ; CHECK: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}]
100 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG]] 114 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG]]
101 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x8] 115 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x8]
102 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],[[REG]] 116 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],[[REG]]
103 ; CHECK-NOT: mov 117 ; CHECK-NOT: mov
104 ; OM1-LABEL: test_memcpy_mid_const_len 118 ; OM1-LABEL: test_memcpy_mid_const_len
105 ; OM1: call {{.*}} memcpy 119 ; OM1: call {{.*}} memcpy
106 ; ARM32-LABEL: test_memcpy_mid_const_len 120 ; ARM32-LABEL: test_memcpy_mid_const_len
107 ; ARM32: bl {{.*}} memcpy 121 ; ARM32: bl {{.*}} memcpy
122 ; MIPS32-LABEL: test_memcpy_mid_const_len
123 ; MIPS32: jal {{.*}} memcpy
108 124
109 define internal void @test_memcpy_mid_const_len_overlap(i32 %iptr_dst, 125 define internal void @test_memcpy_mid_const_len_overlap(i32 %iptr_dst,
110 i32 %iptr_src) { 126 i32 %iptr_src) {
111 entry: 127 entry:
112 %dst = inttoptr i32 %iptr_dst to i8* 128 %dst = inttoptr i32 %iptr_dst to i8*
113 %src = inttoptr i32 %iptr_src to i8* 129 %src = inttoptr i32 %iptr_src to i8*
114 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, 130 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
115 i32 15, i32 1, i1 false) 131 i32 15, i32 1, i1 false)
116 ret void 132 ret void
117 } 133 }
118 ; CHECK-LABEL: test_memcpy_mid_const_len_overlap 134 ; CHECK-LABEL: test_memcpy_mid_const_len_overlap
119 ; CHECK: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}] 135 ; CHECK: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}]
120 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG]] 136 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG]]
121 ; CHECK-NEXT: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}+0x7] 137 ; CHECK-NEXT: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}+0x7]
122 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[REG]] 138 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[REG]]
123 ; CHECK-NOT: mov 139 ; CHECK-NOT: mov
124 ; OM1-LABEL: test_memcpy_mid_const_len_overlap 140 ; OM1-LABEL: test_memcpy_mid_const_len_overlap
125 ; OM1: call {{.*}} memcpy 141 ; OM1: call {{.*}} memcpy
126 ; ARM32-LABEL: test_memcpy_mid_const_len_overlap 142 ; ARM32-LABEL: test_memcpy_mid_const_len_overlap
127 ; ARM32: bl {{.*}} memcpy 143 ; ARM32: bl {{.*}} memcpy
144 ; MIPS32-LABEL: test_memcpy_mid_const_len_overlap
145 ; MIPS32: jal {{.*}} memcpy
128 146
129 define internal void @test_memcpy_big_const_len_overlap(i32 %iptr_dst, 147 define internal void @test_memcpy_big_const_len_overlap(i32 %iptr_dst,
130 i32 %iptr_src) { 148 i32 %iptr_src) {
131 entry: 149 entry:
132 %dst = inttoptr i32 %iptr_dst to i8* 150 %dst = inttoptr i32 %iptr_dst to i8*
133 %src = inttoptr i32 %iptr_src to i8* 151 %src = inttoptr i32 %iptr_src to i8*
134 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, 152 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
135 i32 30, i32 1, i1 false) 153 i32 30, i32 1, i1 false)
136 ret void 154 ret void
137 } 155 }
138 ; CHECK-LABEL: test_memcpy_big_const_len_overlap 156 ; CHECK-LABEL: test_memcpy_big_const_len_overlap
139 ; CHECK: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}] 157 ; CHECK: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}]
140 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG]] 158 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG]]
141 ; CHECK-NEXT: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0xe] 159 ; CHECK-NEXT: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0xe]
142 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[REG]] 160 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[REG]]
143 ; CHECK-NOT: mov 161 ; CHECK-NOT: mov
144 ; OM1-LABEL: test_memcpy_big_const_len_overlap 162 ; OM1-LABEL: test_memcpy_big_const_len_overlap
145 ; OM1: call {{.*}} memcpy 163 ; OM1: call {{.*}} memcpy
146 ; ARM32-LABEL: test_memcpy_big_const_len_overlap 164 ; ARM32-LABEL: test_memcpy_big_const_len_overlap
147 ; ARM32: bl {{.*}} memcpy 165 ; ARM32: bl {{.*}} memcpy
166 ; MIPS32-LABEL: test_memcpy_big_const_len_overlap
167 ; MIPS32: jal {{.*}} memcpy
148 168
149 define internal void @test_memcpy_large_const_len(i32 %iptr_dst, 169 define internal void @test_memcpy_large_const_len(i32 %iptr_dst,
150 i32 %iptr_src) { 170 i32 %iptr_src) {
151 entry: 171 entry:
152 %dst = inttoptr i32 %iptr_dst to i8* 172 %dst = inttoptr i32 %iptr_dst to i8*
153 %src = inttoptr i32 %iptr_src to i8* 173 %src = inttoptr i32 %iptr_src to i8*
154 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, 174 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
155 i32 33, i32 1, i1 false) 175 i32 33, i32 1, i1 false)
156 ret void 176 ret void
157 } 177 }
158 ; CHECK-LABEL: test_memcpy_large_const_len 178 ; CHECK-LABEL: test_memcpy_large_const_len
159 ; CHECK: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0x10] 179 ; CHECK: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0x10]
160 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[REG]] 180 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[REG]]
161 ; CHECK-NEXT: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}] 181 ; CHECK-NEXT: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}]
162 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG]] 182 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG]]
163 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x20] 183 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x20]
164 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],[[REG]] 184 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],[[REG]]
165 ; CHECK-NOT: mov 185 ; CHECK-NOT: mov
166 ; OM1-LABEL: test_memcpy_large_const_len 186 ; OM1-LABEL: test_memcpy_large_const_len
167 ; OM1: call {{.*}} memcpy 187 ; OM1: call {{.*}} memcpy
168 ; ARM32-LABEL: test_memcpy_large_const_len 188 ; ARM32-LABEL: test_memcpy_large_const_len
169 ; ARM32: bl {{.*}} memcpy 189 ; ARM32: bl {{.*}} memcpy
190 ; MIPS32-LABEL: test_memcpy_large_const_len
191 ; MIPS32: jal {{.*}} memcpy
170 192
171 define internal void @test_memmove(i32 %iptr_dst, i32 %iptr_src, i32 %len) { 193 define internal void @test_memmove(i32 %iptr_dst, i32 %iptr_src, i32 %len) {
172 entry: 194 entry:
173 %dst = inttoptr i32 %iptr_dst to i8* 195 %dst = inttoptr i32 %iptr_dst to i8*
174 %src = inttoptr i32 %iptr_src to i8* 196 %src = inttoptr i32 %iptr_src to i8*
175 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, 197 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
176 i32 %len, i32 1, i1 false) 198 i32 %len, i32 1, i1 false)
177 ret void 199 ret void
178 } 200 }
179 ; CHECK-LABEL: test_memmove 201 ; CHECK-LABEL: test_memmove
180 ; CHECK: call {{.*}} R_{{.*}} memmove 202 ; CHECK: call {{.*}} R_{{.*}} memmove
181 ; OM1-LABEL: test_memmove 203 ; OM1-LABEL: test_memmove
182 ; OM1: call {{.*}} memmove 204 ; OM1: call {{.*}} memmove
183 ; ARM32-LABEL: test_memmove 205 ; ARM32-LABEL: test_memmove
184 ; ARM32: bl {{.*}} memmove 206 ; ARM32: bl {{.*}} memmove
207 ; MIPS32-LABEL: test_memmove
208 ; MIPS32: jal {{.*}} memmove
185 209
186 define internal void @test_memmove_long_const_len(i32 %iptr_dst, 210 define internal void @test_memmove_long_const_len(i32 %iptr_dst,
187 i32 %iptr_src) { 211 i32 %iptr_src) {
188 entry: 212 entry:
189 %dst = inttoptr i32 %iptr_dst to i8* 213 %dst = inttoptr i32 %iptr_dst to i8*
190 %src = inttoptr i32 %iptr_src to i8* 214 %src = inttoptr i32 %iptr_src to i8*
191 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, 215 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
192 i32 4876, i32 1, i1 false) 216 i32 4876, i32 1, i1 false)
193 ret void 217 ret void
194 } 218 }
195 ; CHECK-LABEL: test_memmove_long_const_len 219 ; CHECK-LABEL: test_memmove_long_const_len
196 ; CHECK: call {{.*}} R_{{.*}} memmove 220 ; CHECK: call {{.*}} R_{{.*}} memmove
197 ; OM1-LABEL: test_memmove_long_const_len 221 ; OM1-LABEL: test_memmove_long_const_len
198 ; OM1: call {{.*}} memmove 222 ; OM1: call {{.*}} memmove
199 ; ARM32-LABEL: test_memmove_long_const_len 223 ; ARM32-LABEL: test_memmove_long_const_len
200 ; ARM32: bl {{.*}} memmove 224 ; ARM32: bl {{.*}} memmove
225 ; MIPS32-LABEL: test_memmove_long_const_len
226 ; MIPS32: jal {{.*}} memmove
201 227
202 define internal void @test_memmove_very_small_const_len(i32 %iptr_dst, 228 define internal void @test_memmove_very_small_const_len(i32 %iptr_dst,
203 i32 %iptr_src) { 229 i32 %iptr_src) {
204 entry: 230 entry:
205 %dst = inttoptr i32 %iptr_dst to i8* 231 %dst = inttoptr i32 %iptr_dst to i8*
206 %src = inttoptr i32 %iptr_src to i8* 232 %src = inttoptr i32 %iptr_src to i8*
207 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, 233 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
208 i32 2, i32 1, i1 false) 234 i32 2, i32 1, i1 false)
209 ret void 235 ret void
210 } 236 }
211 ; CHECK-LABEL: test_memmove_very_small_const_len 237 ; CHECK-LABEL: test_memmove_very_small_const_len
212 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] 238 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}]
213 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] 239 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]]
214 ; CHECK-NOT: mov 240 ; CHECK-NOT: mov
215 ; OM1-LABEL: test_memmove_very_small_const_len 241 ; OM1-LABEL: test_memmove_very_small_const_len
216 ; OM1: call {{.*}} memmove 242 ; OM1: call {{.*}} memmove
217 ; ARM32-LABEL: test_memmove_very_small_const_len 243 ; ARM32-LABEL: test_memmove_very_small_const_len
218 ; ARM32: bl {{.*}} memmove 244 ; ARM32: bl {{.*}} memmove
245 ; MIPS32-LABEL: test_memmove_very_small_const_len
246 ; MIPS32: jal {{.*}} memmove
219 247
220 define internal void @test_memmove_const_len_3(i32 %iptr_dst, i32 %iptr_src) { 248 define internal void @test_memmove_const_len_3(i32 %iptr_dst, i32 %iptr_src) {
221 entry: 249 entry:
222 %dst = inttoptr i32 %iptr_dst to i8* 250 %dst = inttoptr i32 %iptr_dst to i8*
223 %src = inttoptr i32 %iptr_src to i8* 251 %src = inttoptr i32 %iptr_src to i8*
224 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, 252 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
225 i32 3, i32 1, i1 false) 253 i32 3, i32 1, i1 false)
226 ret void 254 ret void
227 } 255 }
228 ; CHECK-LABEL: test_memmove_const_len_3 256 ; CHECK-LABEL: test_memmove_const_len_3
229 ; CHECK: mov [[REG0:[^,]*]],WORD PTR [{{.*}}] 257 ; CHECK: mov [[REG0:[^,]*]],WORD PTR [{{.*}}]
230 ; CHECK-NEXT: mov [[REG1:[^,]*]],BYTE PTR [{{.*}}+0x2] 258 ; CHECK-NEXT: mov [[REG1:[^,]*]],BYTE PTR [{{.*}}+0x2]
231 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG0]] 259 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG0]]
232 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],[[REG1]] 260 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],[[REG1]]
233 ; CHECK-NOT: mov 261 ; CHECK-NOT: mov
234 ; OM1-LABEL: test_memmove_const_len_3 262 ; OM1-LABEL: test_memmove_const_len_3
235 ; OM1: call {{.*}} memmove 263 ; OM1: call {{.*}} memmove
236 ; ARM32-LABEL: test_memmove_const_len_3 264 ; ARM32-LABEL: test_memmove_const_len_3
237 ; ARM32: bl {{.*}} memmove 265 ; ARM32: bl {{.*}} memmove
266 ; MIPS32-LABEL: test_memmove_const_len_3
267 ; MIPS32: jal {{.*}} memmove
238 268
239 define internal void @test_memmove_mid_const_len(i32 %iptr_dst, i32 %iptr_src) { 269 define internal void @test_memmove_mid_const_len(i32 %iptr_dst, i32 %iptr_src) {
240 entry: 270 entry:
241 %dst = inttoptr i32 %iptr_dst to i8* 271 %dst = inttoptr i32 %iptr_dst to i8*
242 %src = inttoptr i32 %iptr_src to i8* 272 %src = inttoptr i32 %iptr_src to i8*
243 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, 273 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
244 i32 9, i32 1, i1 false) 274 i32 9, i32 1, i1 false)
245 ret void 275 ret void
246 } 276 }
247 ; CHECK-LABEL: test_memmove_mid_const_len 277 ; CHECK-LABEL: test_memmove_mid_const_len
248 ; CHECK: movq [[REG0:xmm[0-9]+]],QWORD PTR [{{.*}}] 278 ; CHECK: movq [[REG0:xmm[0-9]+]],QWORD PTR [{{.*}}]
249 ; CHECK-NEXT: mov [[REG1:[^,]*]],BYTE PTR [{{.*}}+0x8] 279 ; CHECK-NEXT: mov [[REG1:[^,]*]],BYTE PTR [{{.*}}+0x8]
250 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG0]] 280 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG0]]
251 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],[[REG1]] 281 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],[[REG1]]
252 ; CHECK-NOT: mov 282 ; CHECK-NOT: mov
253 ; OM1-LABEL: test_memmove_mid_const_len 283 ; OM1-LABEL: test_memmove_mid_const_len
254 ; OM1: call {{.*}} memmove 284 ; OM1: call {{.*}} memmove
255 ; ARM32-LABEL: test_memmove_mid_const_len 285 ; ARM32-LABEL: test_memmove_mid_const_len
256 ; ARM32: bl {{.*}} memmove 286 ; ARM32: bl {{.*}} memmove
287 ; MIPS32-LABEL: test_memmove_mid_const_len
288 ; MIPS32: jal {{.*}} memmove
257 289
258 define internal void @test_memmove_mid_const_len_overlap(i32 %iptr_dst, 290 define internal void @test_memmove_mid_const_len_overlap(i32 %iptr_dst,
259 i32 %iptr_src) { 291 i32 %iptr_src) {
260 entry: 292 entry:
261 %dst = inttoptr i32 %iptr_dst to i8* 293 %dst = inttoptr i32 %iptr_dst to i8*
262 %src = inttoptr i32 %iptr_src to i8* 294 %src = inttoptr i32 %iptr_src to i8*
263 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, 295 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
264 i32 15, i32 1, i1 false) 296 i32 15, i32 1, i1 false)
265 ret void 297 ret void
266 } 298 }
267 ; CHECK-LABEL: test_memmove_mid_const_len_overlap 299 ; CHECK-LABEL: test_memmove_mid_const_len_overlap
268 ; CHECK: movq [[REG0:xmm[0-9]+]],QWORD PTR [{{.*}}] 300 ; CHECK: movq [[REG0:xmm[0-9]+]],QWORD PTR [{{.*}}]
269 ; CHECK-NEXT: movq [[REG1:xmm[0-9]+]],QWORD PTR [{{.*}}+0x7] 301 ; CHECK-NEXT: movq [[REG1:xmm[0-9]+]],QWORD PTR [{{.*}}+0x7]
270 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG0]] 302 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG0]]
271 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[REG1]] 303 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[REG1]]
272 ; CHECK-NOT: mov 304 ; CHECK-NOT: mov
273 ; OM1-LABEL: test_memmove_mid_const_len_overlap 305 ; OM1-LABEL: test_memmove_mid_const_len_overlap
274 ; OM1: call {{.*}} memmove 306 ; OM1: call {{.*}} memmove
275 ; ARM32-LABEL: test_memmove_mid_const_len_overlap 307 ; ARM32-LABEL: test_memmove_mid_const_len_overlap
276 ; ARM32: bl {{.*}} memmove 308 ; ARM32: bl {{.*}} memmove
309 ; MIPS32-LABEL: test_memmove_mid_const_len_overlap
310 ; MIPS32: jal {{.*}} memmove
277 311
278 define internal void @test_memmove_big_const_len_overlap(i32 %iptr_dst, 312 define internal void @test_memmove_big_const_len_overlap(i32 %iptr_dst,
279 i32 %iptr_src) { 313 i32 %iptr_src) {
280 entry: 314 entry:
281 %dst = inttoptr i32 %iptr_dst to i8* 315 %dst = inttoptr i32 %iptr_dst to i8*
282 %src = inttoptr i32 %iptr_src to i8* 316 %src = inttoptr i32 %iptr_src to i8*
283 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, 317 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
284 i32 30, i32 1, i1 false) 318 i32 30, i32 1, i1 false)
285 ret void 319 ret void
286 } 320 }
287 ; CHECK-LABEL: test_memmove_big_const_len_overlap 321 ; CHECK-LABEL: test_memmove_big_const_len_overlap
288 ; CHECK: movups [[REG0:xmm[0-9]+]],XMMWORD PTR [{{.*}}] 322 ; CHECK: movups [[REG0:xmm[0-9]+]],XMMWORD PTR [{{.*}}]
289 ; CHECK-NEXT: movups [[REG1:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0xe] 323 ; CHECK-NEXT: movups [[REG1:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0xe]
290 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG0]] 324 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG0]]
291 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[REG1]] 325 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[REG1]]
292 ; CHECK-NOT: mov 326 ; CHECK-NOT: mov
293 ; OM1-LABEL: test_memmove_big_const_len_overlap 327 ; OM1-LABEL: test_memmove_big_const_len_overlap
294 ; OM1: call {{.*}} memmove 328 ; OM1: call {{.*}} memmove
295 ; ARM32-LABEL: test_memmove_big_const_len_overlap 329 ; ARM32-LABEL: test_memmove_big_const_len_overlap
296 ; ARM32: bl {{.*}} memmove 330 ; ARM32: bl {{.*}} memmove
331 ; MIPS32-LABEL: test_memmove_big_const_len_overlap
332 ; MIPS32: jal {{.*}} memmove
297 333
298 define internal void @test_memmove_large_const_len(i32 %iptr_dst, 334 define internal void @test_memmove_large_const_len(i32 %iptr_dst,
299 i32 %iptr_src) { 335 i32 %iptr_src) {
300 entry: 336 entry:
301 %dst = inttoptr i32 %iptr_dst to i8* 337 %dst = inttoptr i32 %iptr_dst to i8*
302 %src = inttoptr i32 %iptr_src to i8* 338 %src = inttoptr i32 %iptr_src to i8*
303 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, 339 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src,
304 i32 33, i32 1, i1 false) 340 i32 33, i32 1, i1 false)
305 ret void 341 ret void
306 } 342 }
307 ; CHECK-LABEL: test_memmove_large_const_len 343 ; CHECK-LABEL: test_memmove_large_const_len
308 ; CHECK: movups [[REG0:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0x10] 344 ; CHECK: movups [[REG0:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0x10]
309 ; CHECK-NEXT: movups [[REG1:xmm[0-9]+]],XMMWORD PTR [{{.*}}] 345 ; CHECK-NEXT: movups [[REG1:xmm[0-9]+]],XMMWORD PTR [{{.*}}]
310 ; CHECK-NEXT: mov [[REG2:[^,]*]],BYTE PTR [{{.*}}+0x20] 346 ; CHECK-NEXT: mov [[REG2:[^,]*]],BYTE PTR [{{.*}}+0x20]
311 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[REG0]] 347 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[REG0]]
312 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG1]] 348 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG1]]
313 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],[[REG2]] 349 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],[[REG2]]
314 ; CHECK-NOT: mov 350 ; CHECK-NOT: mov
315 ; OM1-LABEL: test_memmove_large_const_len 351 ; OM1-LABEL: test_memmove_large_const_len
316 ; OM1: call {{.*}} memmove 352 ; OM1: call {{.*}} memmove
317 ; ARM32-LABEL: test_memmove_large_const_len 353 ; ARM32-LABEL: test_memmove_large_const_len
318 ; ARM32: bl {{.*}} memmove 354 ; ARM32: bl {{.*}} memmove
355 ; MIPS32-LABEL: test_memmove_large_const_len
356 ; MIPS32: jal {{.*}} memmove
319 357
320 define internal void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) { 358 define internal void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) {
321 entry: 359 entry:
322 %val = trunc i32 %wide_val to i8 360 %val = trunc i32 %wide_val to i8
323 %dst = inttoptr i32 %iptr_dst to i8* 361 %dst = inttoptr i32 %iptr_dst to i8*
324 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, 362 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val,
325 i32 %len, i32 1, i1 false) 363 i32 %len, i32 1, i1 false)
326 ret void 364 ret void
327 } 365 }
328 ; CHECK-LABEL: test_memset 366 ; CHECK-LABEL: test_memset
329 ; CHECK: movzx 367 ; CHECK: movzx
330 ; CHECK: call {{.*}} R_{{.*}} memset 368 ; CHECK: call {{.*}} R_{{.*}} memset
331 ; OM1-LABEL: test_memset 369 ; OM1-LABEL: test_memset
332 ; OM1: movzx 370 ; OM1: movzx
333 ; OM1: call {{.*}} R_{{.*}} memset 371 ; OM1: call {{.*}} R_{{.*}} memset
334 ; ARM32-LABEL: test_memset 372 ; ARM32-LABEL: test_memset
335 ; ARM32: uxtb 373 ; ARM32: uxtb
336 ; ARM32: bl {{.*}} memset 374 ; ARM32: bl {{.*}} memset
375 ; MIPS32-LABEL: test_memset
376 ; MIPS32: jal {{.*}} memset
337 377
338 define internal void @test_memset_const_len_align(i32 %iptr_dst, 378 define internal void @test_memset_const_len_align(i32 %iptr_dst,
339 i32 %wide_val) { 379 i32 %wide_val) {
340 entry: 380 entry:
341 %val = trunc i32 %wide_val to i8 381 %val = trunc i32 %wide_val to i8
342 %dst = inttoptr i32 %iptr_dst to i8* 382 %dst = inttoptr i32 %iptr_dst to i8*
343 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, 383 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val,
344 i32 32, i32 1, i1 false) 384 i32 32, i32 1, i1 false)
345 ret void 385 ret void
346 } 386 }
347 ; CHECK-LABEL: test_memset_const_len_align 387 ; CHECK-LABEL: test_memset_const_len_align
348 ; CHECK: movzx 388 ; CHECK: movzx
349 ; CHECK: call {{.*}} R_{{.*}} memset 389 ; CHECK: call {{.*}} R_{{.*}} memset
350 ; OM1-LABEL: test_memset_const_len_align 390 ; OM1-LABEL: test_memset_const_len_align
351 ; OM1: movzx 391 ; OM1: movzx
352 ; OM1: call {{.*}} R_{{.*}} memset 392 ; OM1: call {{.*}} R_{{.*}} memset
353 ; ARM32-LABEL: test_memset_const_len_align 393 ; ARM32-LABEL: test_memset_const_len_align
354 ; ARM32: uxtb 394 ; ARM32: uxtb
355 ; ARM32: bl {{.*}} memset 395 ; ARM32: bl {{.*}} memset
396 ; MIPS32-LABEL: test_memset_const_len_align
397 ; MIPS32: jal {{.*}} memset
356 398
357 define internal void @test_memset_long_const_len_zero_val_align( 399 define internal void @test_memset_long_const_len_zero_val_align(
358 i32 %iptr_dst) { 400 i32 %iptr_dst) {
359 entry: 401 entry:
360 %dst = inttoptr i32 %iptr_dst to i8* 402 %dst = inttoptr i32 %iptr_dst to i8*
361 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, 403 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0,
362 i32 4876, i32 1, i1 false) 404 i32 4876, i32 1, i1 false)
363 ret void 405 ret void
364 } 406 }
365 ; CHECK-LABEL: test_memset_long_const_len_zero_val_align 407 ; CHECK-LABEL: test_memset_long_const_len_zero_val_align
366 ; CHECK: call {{.*}} R_{{.*}} memset 408 ; CHECK: call {{.*}} R_{{.*}} memset
367 ; OM1-LABEL: test_memset_long_const_len_zero_val_align 409 ; OM1-LABEL: test_memset_long_const_len_zero_val_align
368 ; OM1: call {{.*}} R_{{.*}} memset 410 ; OM1: call {{.*}} R_{{.*}} memset
369 ; ARM32-LABEL: test_memset_long_const_len_zero_val_align 411 ; ARM32-LABEL: test_memset_long_const_len_zero_val_align
370 ; ARM32: uxtb 412 ; ARM32: uxtb
371 ; ARM32: bl {{.*}} memset 413 ; ARM32: bl {{.*}} memset
414 ; MIPS32-LABEL: test_memset_long_const_len_zero_val_align
415 ; MIPS32: jal {{.*}} memset
372 416
373 define internal void @test_memset_const_val(i32 %iptr_dst, i32 %len) { 417 define internal void @test_memset_const_val(i32 %iptr_dst, i32 %len) {
374 entry: 418 entry:
375 %dst = inttoptr i32 %iptr_dst to i8* 419 %dst = inttoptr i32 %iptr_dst to i8*
376 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 %len, i32 1, i1 false) 420 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 %len, i32 1, i1 false)
377 ret void 421 ret void
378 } 422 }
379 ; CHECK-LABEL: test_memset_const_val 423 ; CHECK-LABEL: test_memset_const_val
380 ; CHECK-NOT: movzx 424 ; CHECK-NOT: movzx
381 ; CHECK: call {{.*}} R_{{.*}} memset 425 ; CHECK: call {{.*}} R_{{.*}} memset
382 ; OM1-LABEL: test_memset_const_val 426 ; OM1-LABEL: test_memset_const_val
383 ; OM1: call {{.*}} R_{{.*}} memset 427 ; OM1: call {{.*}} R_{{.*}} memset
384 ; ARM32-LABEL: test_memset_const_val 428 ; ARM32-LABEL: test_memset_const_val
385 ; ARM32: uxtb 429 ; ARM32: uxtb
386 ; ARM32: bl {{.*}} memset 430 ; ARM32: bl {{.*}} memset
431 ; MIPS32-LABEL: test_memset_const_val
432 ; MIPS32: jal {{.*}} memset
387 433
388 define internal void @test_memset_const_val_len_very_small(i32 %iptr_dst) { 434 define internal void @test_memset_const_val_len_very_small(i32 %iptr_dst) {
389 entry: 435 entry:
390 %dst = inttoptr i32 %iptr_dst to i8* 436 %dst = inttoptr i32 %iptr_dst to i8*
391 call void @llvm.memset.p0i8.i32(i8* %dst, i8 10, i32 2, i32 1, i1 false) 437 call void @llvm.memset.p0i8.i32(i8* %dst, i8 10, i32 2, i32 1, i1 false)
392 ret void 438 ret void
393 } 439 }
394 ; CHECK-LABEL: test_memset_const_val_len_very_small 440 ; CHECK-LABEL: test_memset_const_val_len_very_small
395 ; CHECK: mov WORD PTR [{{.*}}],0xa0a 441 ; CHECK: mov WORD PTR [{{.*}}],0xa0a
396 ; CHECK-NOT: mov 442 ; CHECK-NOT: mov
397 ; OM1-LABEL: test_memset_const_val_len_very_small 443 ; OM1-LABEL: test_memset_const_val_len_very_small
398 ; OM1: call {{.*}} R_{{.*}} memset 444 ; OM1: call {{.*}} R_{{.*}} memset
399 ; ARM32-LABEL: test_memset_const_val_len_very_small 445 ; ARM32-LABEL: test_memset_const_val_len_very_small
400 ; ARM32: uxtb 446 ; ARM32: uxtb
401 ; ARM32: bl {{.*}} memset 447 ; ARM32: bl {{.*}} memset
448 ; MIPS32-LABEL: test_memset_const_val_len_very_small
449 ; MIPS32: jal {{.*}} memset
402 450
403 define internal void @test_memset_const_val_len_3(i32 %iptr_dst) { 451 define internal void @test_memset_const_val_len_3(i32 %iptr_dst) {
404 entry: 452 entry:
405 %dst = inttoptr i32 %iptr_dst to i8* 453 %dst = inttoptr i32 %iptr_dst to i8*
406 call void @llvm.memset.p0i8.i32(i8* %dst, i8 16, i32 3, i32 1, i1 false) 454 call void @llvm.memset.p0i8.i32(i8* %dst, i8 16, i32 3, i32 1, i1 false)
407 ret void 455 ret void
408 } 456 }
409 ; CHECK-LABEL: test_memset_const_val_len_3 457 ; CHECK-LABEL: test_memset_const_val_len_3
410 ; CHECK: mov WORD PTR [{{.*}}],0x1010 458 ; CHECK: mov WORD PTR [{{.*}}],0x1010
411 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],0x10 459 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],0x10
412 ; CHECK-NOT: mov 460 ; CHECK-NOT: mov
413 ; OM1-LABEL: test_memset_const_val_len_3 461 ; OM1-LABEL: test_memset_const_val_len_3
414 ; OM1: call {{.*}} R_{{.*}} memset 462 ; OM1: call {{.*}} R_{{.*}} memset
415 ; ARM32-LABEL: test_memset_const_val_len_3 463 ; ARM32-LABEL: test_memset_const_val_len_3
416 ; ARM32: uxtb 464 ; ARM32: uxtb
417 ; ARM32: bl {{.*}} memset 465 ; ARM32: bl {{.*}} memset
466 ; MIPS32-LABEL: test_memset_const_val_len_3
467 ; MIPS32: jal {{.*}} memset
418 468
419 define internal void @test_memset_const_val_len_mid(i32 %iptr_dst) { 469 define internal void @test_memset_const_val_len_mid(i32 %iptr_dst) {
420 entry: 470 entry:
421 %dst = inttoptr i32 %iptr_dst to i8* 471 %dst = inttoptr i32 %iptr_dst to i8*
422 call void @llvm.memset.p0i8.i32(i8* %dst, i8 32, i32 9, i32 1, i1 false) 472 call void @llvm.memset.p0i8.i32(i8* %dst, i8 32, i32 9, i32 1, i1 false)
423 ret void 473 ret void
424 } 474 }
425 ; CHECK-LABEL: test_memset_const_val_len_mid 475 ; CHECK-LABEL: test_memset_const_val_len_mid
426 ; CHECK: mov DWORD PTR [{{.*}}+0x4],0x20202020 476 ; CHECK: mov DWORD PTR [{{.*}}+0x4],0x20202020
427 ; CHECK: mov DWORD PTR [{{.*}}],0x20202020 477 ; CHECK: mov DWORD PTR [{{.*}}],0x20202020
428 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],0x20 478 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],0x20
429 ; CHECK-NOT: mov 479 ; CHECK-NOT: mov
430 ; OM1-LABEL: test_memset_const_val_len_mid 480 ; OM1-LABEL: test_memset_const_val_len_mid
431 ; OM1: call {{.*}} R_{{.*}} memset 481 ; OM1: call {{.*}} R_{{.*}} memset
432 ; ARM32-LABEL: test_memset_const_val_len_mid 482 ; ARM32-LABEL: test_memset_const_val_len_mid
433 ; ARM32: uxtb 483 ; ARM32: uxtb
434 ; ARM32: bl {{.*}} memset 484 ; ARM32: bl {{.*}} memset
485 ; MIPS32-LABEL: test_memset_const_val_len_mid
486 ; MIPS32: jal {{.*}} memset
435 487
436 ; Same as above, but with a negative value. 488 ; Same as above, but with a negative value.
437 define internal void @test_memset_const_neg_val_len_mid(i32 %iptr_dst) { 489 define internal void @test_memset_const_neg_val_len_mid(i32 %iptr_dst) {
438 entry: 490 entry:
439 %dst = inttoptr i32 %iptr_dst to i8* 491 %dst = inttoptr i32 %iptr_dst to i8*
440 call void @llvm.memset.p0i8.i32(i8* %dst, i8 -128, i32 9, i32 1, i1 false) 492 call void @llvm.memset.p0i8.i32(i8* %dst, i8 -128, i32 9, i32 1, i1 false)
441 ret void 493 ret void
442 } 494 }
443 ; CHECK-LABEL: test_memset_const_neg_val_len_mid 495 ; CHECK-LABEL: test_memset_const_neg_val_len_mid
444 ; CHECK: mov DWORD PTR [{{.*}}+0x4],0x80808080 496 ; CHECK: mov DWORD PTR [{{.*}}+0x4],0x80808080
445 ; CHECK: mov DWORD PTR [{{.*}}],0x80808080 497 ; CHECK: mov DWORD PTR [{{.*}}],0x80808080
446 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],0x80 498 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],0x80
447 ; CHECK-NOT: mov 499 ; CHECK-NOT: mov
448 ; OM1-LABEL: test_memset_const_neg_val_len_mid 500 ; OM1-LABEL: test_memset_const_neg_val_len_mid
449 ; OM1: call {{.*}} R_{{.*}} memset 501 ; OM1: call {{.*}} R_{{.*}} memset
450 ; ARM32-LABEL: test_memset_const_neg_val_len_mid 502 ; ARM32-LABEL: test_memset_const_neg_val_len_mid
451 ; ARM32: uxtb 503 ; ARM32: uxtb
452 ; ARM32: bl {{.*}} memset 504 ; ARM32: bl {{.*}} memset
505 ; MIPS32-LABEL: test_memset_const_neg_val_len_mid
506 ; MIPS32: jal {{.*}} memset
453 507
454 define internal void @test_memset_zero_const_len_small(i32 %iptr_dst) { 508 define internal void @test_memset_zero_const_len_small(i32 %iptr_dst) {
455 entry: 509 entry:
456 %dst = inttoptr i32 %iptr_dst to i8* 510 %dst = inttoptr i32 %iptr_dst to i8*
457 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 12, i32 1, i1 false) 511 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 12, i32 1, i1 false)
458 ret void 512 ret void
459 } 513 }
460 ; CHECK-LABEL: test_memset_zero_const_len_small 514 ; CHECK-LABEL: test_memset_zero_const_len_small
461 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] 515 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]]
462 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[ZERO]] 516 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[ZERO]]
463 ; CHECK-NEXT: mov DWORD PTR [{{.*}}+0x8],0x0 517 ; CHECK-NEXT: mov DWORD PTR [{{.*}}+0x8],0x0
464 ; CHECK-NOT: mov 518 ; CHECK-NOT: mov
465 ; OM1-LABEL: test_memset_zero_const_len_small 519 ; OM1-LABEL: test_memset_zero_const_len_small
466 ; OM1: call {{.*}} R_{{.*}} memset 520 ; OM1: call {{.*}} R_{{.*}} memset
467 ; ARM32-LABEL: test_memset_zero_const_len_small 521 ; ARM32-LABEL: test_memset_zero_const_len_small
468 ; ARM32: uxtb 522 ; ARM32: uxtb
469 ; ARM32: bl {{.*}} memset 523 ; ARM32: bl {{.*}} memset
524 ; MIPS32-LABEL: test_memset_zero_const_len_small
525 ; MIPS32: jal {{.*}} memset
470 526
471 define internal void @test_memset_zero_const_len_small_overlap(i32 %iptr_dst) { 527 define internal void @test_memset_zero_const_len_small_overlap(i32 %iptr_dst) {
472 entry: 528 entry:
473 %dst = inttoptr i32 %iptr_dst to i8* 529 %dst = inttoptr i32 %iptr_dst to i8*
474 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 15, i32 1, i1 false) 530 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 15, i32 1, i1 false)
475 ret void 531 ret void
476 } 532 }
477 ; CHECK-LABEL: test_memset_zero_const_len_small_overlap 533 ; CHECK-LABEL: test_memset_zero_const_len_small_overlap
478 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] 534 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]]
479 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[ZERO]] 535 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[ZERO]]
480 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[ZERO]] 536 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[ZERO]]
481 ; CHECK-NOT: mov 537 ; CHECK-NOT: mov
482 ; OM1-LABEL: test_memset_zero_const_len_small_overlap 538 ; OM1-LABEL: test_memset_zero_const_len_small_overlap
483 ; OM1: call {{.*}} R_{{.*}} memset 539 ; OM1: call {{.*}} R_{{.*}} memset
484 ; ARM32-LABEL: test_memset_zero_const_len_small_overlap 540 ; ARM32-LABEL: test_memset_zero_const_len_small_overlap
485 ; ARM32: uxtb 541 ; ARM32: uxtb
486 ; ARM32: bl {{.*}} memset 542 ; ARM32: bl {{.*}} memset
543 ; MIPS32-LABEL: test_memset_zero_const_len_small_overlap
544 ; MIPS32: jal {{.*}} memset
487 545
488 define internal void @test_memset_zero_const_len_big_overlap(i32 %iptr_dst) { 546 define internal void @test_memset_zero_const_len_big_overlap(i32 %iptr_dst) {
489 entry: 547 entry:
490 %dst = inttoptr i32 %iptr_dst to i8* 548 %dst = inttoptr i32 %iptr_dst to i8*
491 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 30, i32 1, i1 false) 549 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 30, i32 1, i1 false)
492 ret void 550 ret void
493 } 551 }
494 ; CHECK-LABEL: test_memset_zero_const_len_big_overlap 552 ; CHECK-LABEL: test_memset_zero_const_len_big_overlap
495 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] 553 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]]
496 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[ZERO]] 554 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[ZERO]]
497 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[ZERO]] 555 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[ZERO]]
498 ; CHECK-NOT: mov 556 ; CHECK-NOT: mov
499 ; OM1-LABEL: test_memset_zero_const_len_big_overlap 557 ; OM1-LABEL: test_memset_zero_const_len_big_overlap
500 ; OM1: call {{.*}} R_{{.*}} memset 558 ; OM1: call {{.*}} R_{{.*}} memset
501 ; ARM32-LABEL: test_memset_zero_const_len_big_overlap 559 ; ARM32-LABEL: test_memset_zero_const_len_big_overlap
502 ; ARM32: uxtb 560 ; ARM32: uxtb
503 ; ARM32: bl {{.*}} memset 561 ; ARM32: bl {{.*}} memset
562 ; MIPS32-LABEL: test_memset_zero_const_len_big_overlap
563 ; MIPS32: jal {{.*}} memset
504 564
505 define internal void @test_memset_zero_const_len_large(i32 %iptr_dst) { 565 define internal void @test_memset_zero_const_len_large(i32 %iptr_dst) {
506 entry: 566 entry:
507 %dst = inttoptr i32 %iptr_dst to i8* 567 %dst = inttoptr i32 %iptr_dst to i8*
508 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 33, i32 1, i1 false) 568 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 33, i32 1, i1 false)
509 ret void 569 ret void
510 } 570 }
511 ; CHECK-LABEL: test_memset_zero_const_len_large 571 ; CHECK-LABEL: test_memset_zero_const_len_large
512 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] 572 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]]
513 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[ZERO]] 573 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[ZERO]]
514 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[ZERO]] 574 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[ZERO]]
515 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],0x0 575 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],0x0
516 ; CHECK-NOT: mov 576 ; CHECK-NOT: mov
517 ; OM1-LABEL: test_memset_zero_const_len_large 577 ; OM1-LABEL: test_memset_zero_const_len_large
518 ; OM1: call {{.*}} R_{{.*}} memset 578 ; OM1: call {{.*}} R_{{.*}} memset
519 ; ARM32-LABEL: test_memset_zero_const_len_large 579 ; ARM32-LABEL: test_memset_zero_const_len_large
520 ; ARM32: uxtb 580 ; ARM32: uxtb
521 ; ARM32: bl {{.*}} memset 581 ; ARM32: bl {{.*}} memset
582 ; MIPS32-LABEL: test_memset_zero_const_len_large
583 ; MIPS32: jal {{.*}} memset
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/fp.arith.ll ('k') | tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698