mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 14:47:00 +00:00
7c9c6ed761
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
60 lines
2.0 KiB
LLVM
60 lines
2.0 KiB
LLVM
; test for more complicated forms of lea operands which can be generated
|
|
; in loop optimized cases.
|
|
; See also http://llvm.org/bugs/show_bug.cgi?id=20016
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-linux -O2 | FileCheck %s
|
|
; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -O2 | FileCheck %s -check-prefix=X32
|
|
; RUN: llc < %s -mtriple=x86_64-nacl -O2 | FileCheck %s -check-prefix=X32
|
|
|
|
; Function Attrs: nounwind readnone uwtable
|
|
define void @foo(i32 %x, i32 %d) #0 {
|
|
entry:
|
|
%a = alloca [8 x i32], align 16
|
|
br label %while.cond
|
|
|
|
while.cond: ; preds = %while.cond, %entry
|
|
%d.addr.0 = phi i32 [ %d, %entry ], [ %inc, %while.cond ]
|
|
%arrayidx = getelementptr inbounds [8 x i32], [8 x i32]* %a, i32 0, i32 %d.addr.0
|
|
|
|
; CHECK: leaq -40(%rsp,%r{{[^,]*}},4), %rax
|
|
; X32: leal -40(%rsp,%r{{[^,]*}},4), %eax
|
|
%0 = load i32, i32* %arrayidx, align 4
|
|
%cmp1 = icmp eq i32 %0, 0
|
|
%inc = add nsw i32 %d.addr.0, 1
|
|
|
|
; CHECK: leaq 4(%r{{[^,]*}}), %r{{[^,]*}}
|
|
; X32: leal 4(%r{{[^,]*}}), %e{{[^,]*}}
|
|
br i1 %cmp1, label %while.end, label %while.cond
|
|
|
|
while.end: ; preds = %while.cond
|
|
ret void
|
|
}
|
|
|
|
; The same test as above but with enforsed stack realignment (%a aligned by 64)
|
|
; to check one more case of correct lea generation.
|
|
|
|
; Function Attrs: nounwind readnone uwtable
|
|
define void @bar(i32 %x, i32 %d) #0 {
|
|
entry:
|
|
%a = alloca [8 x i32], align 64
|
|
br label %while.cond
|
|
|
|
while.cond: ; preds = %while.cond, %entry
|
|
%d.addr.0 = phi i32 [ %d, %entry ], [ %inc, %while.cond ]
|
|
%arrayidx = getelementptr inbounds [8 x i32], [8 x i32]* %a, i32 0, i32 %d.addr.0
|
|
|
|
; CHECK: leaq (%rsp,%r{{[^,]*}},4), %rax
|
|
; X32: leal (%rsp,%r{{[^,]*}},4), %eax
|
|
%0 = load i32, i32* %arrayidx, align 4
|
|
%cmp1 = icmp eq i32 %0, 0
|
|
%inc = add nsw i32 %d.addr.0, 1
|
|
|
|
; CHECK: leaq 4(%r{{[^,]*}}), %r{{[^,]*}}
|
|
; X32: leal 4(%r{{[^,]*}}), %e{{[^,]*}}
|
|
br i1 %cmp1, label %while.end, label %while.cond
|
|
|
|
while.end: ; preds = %while.cond
|
|
ret void
|
|
}
|
|
|