File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,31 @@ define i32 @test1(i32 %A, i32 %B) {
26
26
ret i32 %t4
27
27
}
28
28
29
+ ; TODO: The addlike OR instruction should fold into the LEA.
29
30
31
+ define i64 @test2 (i32 %a0 , i64 %a1 ) {
32
+ ; X32-LABEL: test2:
33
+ ; X32: # %bb.0:
34
+ ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
35
+ ; X32-NEXT: movl %edx, %eax
36
+ ; X32-NEXT: andl $2147483640, %eax # imm = 0x7FFFFFF8
37
+ ; X32-NEXT: shrl $31, %edx
38
+ ; X32-NEXT: leal 4(%eax,%eax), %eax
39
+ ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
40
+ ; X32-NEXT: adcl {{[0-9]+}}(%esp), %edx
41
+ ; X32-NEXT: retl
42
+ ;
43
+ ; X64-LABEL: test2:
44
+ ; X64: # %bb.0:
45
+ ; X64-NEXT: # kill: def $edi killed $edi def $rdi
46
+ ; X64-NEXT: andl $-8, %edi
47
+ ; X64-NEXT: orl $2, %edi
48
+ ; X64-NEXT: leaq (%rsi,%rdi,2), %rax
49
+ ; X64-NEXT: retq
50
+ %x1 = and i32 %a0 , -8
51
+ %x2 = or i32 %x1 , 2
52
+ %x3 = zext i32 %x2 to i64
53
+ %x4 = shl i64 %x3 , 1
54
+ %x5 = add i64 %a1 , %x4
55
+ ret i64 %x5
56
+ }
You can’t perform that action at this time.
0 commit comments