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

Side by Side Diff: tests_lit/assembler/x86/immediate_encodings.ll

Issue 1365433004: Use three-address form of imul (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Reinsert match for square operations, lost by merge. Created 5 years, 2 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 | « src/IceTargetLoweringX86BaseImpl.h ('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
1 ; Tests various aspects of x86 immediate encoding. Some encodings are shorter. 1 ; Tests various aspects of x86 immediate encoding. Some encodings are shorter.
2 ; For example, the encoding is shorter for 8-bit immediates or when using EAX. 2 ; For example, the encoding is shorter for 8-bit immediates or when using EAX.
3 ; This assumes that EAX is chosen as the first free register in O2 mode. 3 ; This assumes that EAX is chosen as the first free register in O2 mode.
4 4
5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s
6 6
7 define internal i32 @testXor8Imm8(i32 %arg) { 7 define internal i32 @testXor8Imm8(i32 %arg) {
8 entry: 8 entry:
9 %arg_i8 = trunc i32 %arg to i8 9 %arg_i8 = trunc i32 %arg to i8
10 %result_i8 = xor i8 %arg_i8, 127 10 %result_i8 = xor i8 %arg_i8, 127
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 ; CHECK: 69 c0 01 04 00 00 imul eax,eax 243 ; CHECK: 69 c0 01 04 00 00 imul eax,eax
244 244
245 define internal i32 @testMul32Imm16Neg(i32 %arg) { 245 define internal i32 @testMul32Imm16Neg(i32 %arg) {
246 entry: 246 entry:
247 %result = mul i32 %arg, -255 247 %result = mul i32 %arg, -255
248 ret i32 %result 248 ret i32 %result
249 } 249 }
250 ; CHECK-LABEL: testMul32Imm16Neg 250 ; CHECK-LABEL: testMul32Imm16Neg
251 ; CHECK: 69 c0 01 ff ff ff imul eax,eax,0xffffff01 251 ; CHECK: 69 c0 01 ff ff ff imul eax,eax,0xffffff01
252 252
253 define i32 @testMul32Imm32ThreeAddress(i32 %a) {
254 entry:
255 %mul = mul i32 232, %a
256 %add = add i32 %mul, %a
257 ret i32 %add
258 }
259 ; CHECK-LABEL: testMul32Imm32ThreeAddress
260 ; CHECK: 69 c8 e8 00 00 00 imul ecx,eax,0xe8
261
262 define i32 @testMul32Mem32Imm32ThreeAddress(i32 %addr_arg) {
263 entry:
264 %__1 = inttoptr i32 %addr_arg to i32*
265 %a = load i32, i32* %__1, align 1
266 %mul = mul i32 232, %a
267 ret i32 %mul
268 }
269 ; CHECK-LABEL: testMul32Mem32Imm32ThreeAddress
270 ; CHECK: 69 00 e8 00 00 00 imul eax,DWORD PTR [eax],0xe8
271
272 define i32 @testMul32Imm8ThreeAddress(i32 %a) {
273 entry:
274 %mul = mul i32 127, %a
275 %add = add i32 %mul, %a
276 ret i32 %add
277 }
278 ; CHECK-LABEL: testMul32Imm8ThreeAddress
279 ; CHECK: 6b c8 7f imul ecx,eax,0x7f
280
281 define i32 @testMul32Mem32Imm8ThreeAddress(i32 %addr_arg) {
282 entry:
283 %__1 = inttoptr i32 %addr_arg to i32*
284 %a = load i32, i32* %__1, align 1
285 %mul = mul i32 127, %a
286 ret i32 %mul
287 }
288 ; CHECK-LABEL: testMul32Mem32Imm8ThreeAddress
289 ; CHECK: 6b 00 7f imul eax,DWORD PTR [eax],0x7f
290
291 define i32 @testMul16Imm16ThreeAddress(i32 %a) {
292 entry:
293 %arg_i16 = trunc i32 %a to i16
294 %mul = mul i16 232, %arg_i16
295 %add = add i16 %mul, %arg_i16
296 %result = zext i16 %add to i32
297 ret i32 %result
298 }
299 ; CHECK-LABEL: testMul16Imm16ThreeAddress
300 ; CHECK: 66 69 c8 e8 00 imul cx,ax,0xe8
301
302 define i32 @testMul16Mem16Imm16ThreeAddress(i32 %addr_arg) {
303 entry:
304 %__1 = inttoptr i32 %addr_arg to i16*
305 %a = load i16, i16* %__1, align 1
306 %mul = mul i16 232, %a
307 %result = zext i16 %mul to i32
308 ret i32 %result
309 }
310 ; CHECK-LABEL: testMul16Mem16Imm16ThreeAddress
311 ; CHECK: 66 69 00 e8 00 imul ax,WORD PTR [eax],0xe8
312
313 define i32 @testMul16Imm8ThreeAddress(i32 %a) {
314 entry:
315 %arg_i16 = trunc i32 %a to i16
316 %mul = mul i16 127, %arg_i16
317 %add = add i16 %mul, %arg_i16
318 %result = zext i16 %add to i32
319 ret i32 %result
320 }
321 ; CHECK-LABEL: testMul16Imm8ThreeAddress
322 ; CHECK: 66 6b c8 7f imul cx,ax,0x7f
323
324 define i32 @testMul16Mem16Imm8ThreeAddress(i32 %addr_arg) {
325 entry:
326 %__1 = inttoptr i32 %addr_arg to i16*
327 %a = load i16, i16* %__1, align 1
328 %mul = mul i16 127, %a
329 %result = zext i16 %mul to i32
330 ret i32 %result
331 }
332 ; CHECK-LABEL: testMul16Mem16Imm8ThreeAddress
333 ; CHECK: 66 6b 00 7f imul ax,WORD PTR [eax],0x7f
334
253 ; The GPR shift instructions either allow an 8-bit immediate or 335 ; The GPR shift instructions either allow an 8-bit immediate or
254 ; have a special encoding for "1". 336 ; have a special encoding for "1".
255 define internal i32 @testShl16Imm8(i32 %arg) { 337 define internal i32 @testShl16Imm8(i32 %arg) {
256 entry: 338 entry:
257 %arg_i16 = trunc i32 %arg to i16 339 %arg_i16 = trunc i32 %arg to i16
258 %tmp = shl i16 %arg_i16, 13 340 %tmp = shl i16 %arg_i16, 13
259 %result = zext i16 %tmp to i32 341 %result = zext i16 %tmp to i32
260 ret i32 %result 342 ret i32 %result
261 } 343 }
262 ; CHECK-LABEL: testShl16Imm8 344 ; CHECK-LABEL: testShl16Imm8
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 %r4 = call i64 @llvm.ctlz.i64(i64 %w, i1 false) 381 %r4 = call i64 @llvm.ctlz.i64(i64 %w, i1 false)
300 %res1 = add i64 %r, %r2 382 %res1 = add i64 %r, %r2
301 %res2 = add i64 %r3, %r4 383 %res2 = add i64 %r3, %r4
302 %res = add i64 %res1, %res2 384 %res = add i64 %res1, %res2
303 ret i64 %res 385 ret i64 %res
304 } 386 }
305 ; CHECK-LABEL: test_via_ctlz_64 387 ; CHECK-LABEL: test_via_ctlz_64
306 ; CHECK-DAG: 85 c0 test eax,eax 388 ; CHECK-DAG: 85 c0 test eax,eax
307 ; CHECK-DAG: 85 db test ebx,ebx 389 ; CHECK-DAG: 85 db test ebx,ebx
308 ; CHECK-DAG: 85 f6 test esi,esi 390 ; CHECK-DAG: 85 f6 test esi,esi
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698