| OLD | NEW |
| 1 ; test for more complicated forms of lea operands which can be generated | 1 ; test for more complicated forms of lea operands which can be generated |
| 2 ; in loop optimized cases. | 2 ; in loop optimized cases. |
| 3 ; See also http://llvm.org/bugs/show_bug.cgi?id=20016 | 3 ; See also http://llvm.org/bugs/show_bug.cgi?id=20016 |
| 4 | 4 |
| 5 ; RUN: llc < %s -mtriple=x86_64-linux -O2 | FileCheck %s | 5 ; RUN: llc < %s -mtriple=x86_64-linux -O2 | FileCheck %s |
| 6 ; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -O2 | FileCheck %s -check-prefix=X3
2 | 6 ; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -O2 | FileCheck %s -check-prefix=X3
2 |
| 7 ; RUN: llc < %s -mtriple=x86_64-nacl -O2 | FileCheck %s -check-prefix=X32 | 7 ; @LOCALMOD -- one of the leal below are left as an add for NACL64 |
| 8 ; TODO -- investigate why. |
| 9 ; RUN: llc < %s -mtriple=x86_64-nacl -O2 | FileCheck %s -check-prefix=NACL64 |
| 8 | 10 |
| 9 ; Function Attrs: nounwind readnone uwtable | 11 ; Function Attrs: nounwind readnone uwtable |
| 10 define void @foo(i32 %x, i32 %d) #0 { | 12 define void @foo(i32 %x, i32 %d) #0 { |
| 11 entry: | 13 entry: |
| 12 %a = alloca [8 x i32], align 16 | 14 %a = alloca [8 x i32], align 16 |
| 13 br label %while.cond | 15 br label %while.cond |
| 14 | 16 |
| 15 while.cond: ; preds = %while.cond, %entry | 17 while.cond: ; preds = %while.cond, %entry |
| 16 %d.addr.0 = phi i32 [ %d, %entry ], [ %inc, %while.cond ] | 18 %d.addr.0 = phi i32 [ %d, %entry ], [ %inc, %while.cond ] |
| 17 %arrayidx = getelementptr inbounds [8 x i32]* %a, i32 0, i32 %d.addr.0 | 19 %arrayidx = getelementptr inbounds [8 x i32]* %a, i32 0, i32 %d.addr.0 |
| 18 | 20 |
| 19 ; CHECK: leaq -40(%rsp,%r{{[^,]*}},4), %rax | 21 ; CHECK: leaq -40(%rsp,%r{{[^,]*}},4), %rax |
| 20 ; X32: leal -40(%rsp,%r{{[^,]*}},4), %eax | 22 ; X32: leal -40(%rsp,%r{{[^,]*}},4), %eax |
| 23 ; NACL64: leal -40(%rsp,%r{{[^,]*}},4), %eax |
| 21 %0 = load i32* %arrayidx, align 4 | 24 %0 = load i32* %arrayidx, align 4 |
| 22 %cmp1 = icmp eq i32 %0, 0 | 25 %cmp1 = icmp eq i32 %0, 0 |
| 23 %inc = add nsw i32 %d.addr.0, 1 | 26 %inc = add nsw i32 %d.addr.0, 1 |
| 24 | 27 |
| 25 ; CHECK: leaq 4(%r{{[^,]*}}), %r{{[^,]*}} | 28 ; CHECK: leaq 4(%r{{[^,]*}}), %r{{[^,]*}} |
| 26 ; X32: leal 4(%r{{[^,]*}}), %e{{[^,]*}} | 29 ; X32: leal 4(%r{{[^,]*}}), %e{{[^,]*}} |
| 30 ; NACL64: addl $4, %e{{[^,]*}} |
| 27 br i1 %cmp1, label %while.end, label %while.cond | 31 br i1 %cmp1, label %while.end, label %while.cond |
| 28 | 32 |
| 29 while.end: ; preds = %while.cond | 33 while.end: ; preds = %while.cond |
| 30 ret void | 34 ret void |
| 31 } | 35 } |
| 32 | 36 |
| 33 ; The same test as above but with enforsed stack realignment (%a aligned by 64) | 37 ; The same test as above but with enforsed stack realignment (%a aligned by 64) |
| 34 ; to check one more case of correct lea generation. | 38 ; to check one more case of correct lea generation. |
| 35 | 39 |
| 36 ; Function Attrs: nounwind readnone uwtable | 40 ; Function Attrs: nounwind readnone uwtable |
| 37 define void @bar(i32 %x, i32 %d) #0 { | 41 define void @bar(i32 %x, i32 %d) #0 { |
| 38 entry: | 42 entry: |
| 39 %a = alloca [8 x i32], align 64 | 43 %a = alloca [8 x i32], align 64 |
| 40 br label %while.cond | 44 br label %while.cond |
| 41 | 45 |
| 42 while.cond: ; preds = %while.cond, %entry | 46 while.cond: ; preds = %while.cond, %entry |
| 43 %d.addr.0 = phi i32 [ %d, %entry ], [ %inc, %while.cond ] | 47 %d.addr.0 = phi i32 [ %d, %entry ], [ %inc, %while.cond ] |
| 44 %arrayidx = getelementptr inbounds [8 x i32]* %a, i32 0, i32 %d.addr.0 | 48 %arrayidx = getelementptr inbounds [8 x i32]* %a, i32 0, i32 %d.addr.0 |
| 45 | 49 |
| 46 ; CHECK: leaq (%rsp,%r{{[^,]*}},4), %rax | 50 ; CHECK: leaq (%rsp,%r{{[^,]*}},4), %rax |
| 47 ; X32: leal (%rsp,%r{{[^,]*}},4), %eax | 51 ; X32: leal (%rsp,%r{{[^,]*}},4), %eax |
| 52 ; NACL64: leal (%rsp,%r{{[^,]*}},4), %eax |
| 48 %0 = load i32* %arrayidx, align 4 | 53 %0 = load i32* %arrayidx, align 4 |
| 49 %cmp1 = icmp eq i32 %0, 0 | 54 %cmp1 = icmp eq i32 %0, 0 |
| 50 %inc = add nsw i32 %d.addr.0, 1 | 55 %inc = add nsw i32 %d.addr.0, 1 |
| 51 | 56 |
| 52 ; CHECK: leaq 4(%r{{[^,]*}}), %r{{[^,]*}} | 57 ; CHECK: leaq 4(%r{{[^,]*}}), %r{{[^,]*}} |
| 53 ; X32: leal 4(%r{{[^,]*}}), %e{{[^,]*}} | 58 ; X32: leal 4(%r{{[^,]*}}), %e{{[^,]*}} |
| 59 ; NACL64: addl $4, %e{{[^,]*}} |
| 54 br i1 %cmp1, label %while.end, label %while.cond | 60 br i1 %cmp1, label %while.end, label %while.cond |
| 55 | 61 |
| 56 while.end: ; preds = %while.cond | 62 while.end: ; preds = %while.cond |
| 57 ret void | 63 ret void |
| 58 } | 64 } |
| 59 | 65 |
| OLD | NEW |