1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
5 define i32 @test1(i32 %x) nounwind ssp {
8 ; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
9 ; CHECK-NEXT: shll $5, %edi
10 ; CHECK-NEXT: leal 3(%rdi), %eax
17 ; This test no longer requires or to be converted to 3 addr form because we are
18 ; are able to use a zero extend instead of an 'and' which gives the register
20 define i64 @test2(i8 %A, i8 %B) nounwind {
23 ; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
24 ; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
25 ; CHECK-NEXT: shll $4, %edi
26 ; CHECK-NEXT: andl $48, %edi
27 ; CHECK-NEXT: movzbl %sil, %eax
28 ; CHECK-NEXT: shrq $4, %rax
29 ; CHECK-NEXT: orq %rdi, %rax
31 %C = zext i8 %A to i64
34 %F = zext i8 %B to i64
40 ;; Test that OR is only emitted as LEA, not as ADD.
42 ; No reason to emit an add here, should be an or.
43 define void @test3(i32 %x, i32* %P) nounwind readnone ssp {
46 ; CHECK-NEXT: shll $5, %edi
47 ; CHECK-NEXT: orl $3, %edi
48 ; CHECK-NEXT: movl %edi, (%rsi)
52 store i32 %t1, i32* %P
56 define i32 @test4(i32 %a, i32 %b) nounwind readnone ssp {
59 ; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
60 ; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
61 ; CHECK-NEXT: andl $6, %edi
62 ; CHECK-NEXT: andl $16, %esi
63 ; CHECK-NEXT: leal (%rsi,%rdi), %eax
66 %and2 = and i32 %b, 16
67 %or = or i32 %and2, %and
71 define void @test5(i32 %a, i32 %b, i32* nocapture %P) nounwind ssp {
74 ; CHECK-NEXT: andl $6, %edi
75 ; CHECK-NEXT: andl $16, %esi
76 ; CHECK-NEXT: orl %edi, %esi
77 ; CHECK-NEXT: movl %esi, (%rdx)
80 %and2 = and i32 %b, 16
81 %or = or i32 %and2, %and
82 store i32 %or, i32* %P, align 4