llvm-project/llvm/test/CodeGen/SystemZ/frame-06.ll

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

217 lines
6.7 KiB
LLVM
Raw Normal View History

; Like frame-05.ll, but with i64s rather than i32s. Internally this
; uses a different register class, but the set of saved and restored
; registers should be the same.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
; This function should require all GPRs, but no other spill slots. The caller
; allocates room for the GPR save slots, so we shouldn't need to allocate any
; extra space.
;
; Use a different address for the final store, so that we can check that
; %r15 isn't referenced again until after that.
define void @f1(i64 *%ptr) {
; CHECK-LABEL: f1:
; CHECK: stmg %r6, %r15, 48(%r15)
; CHECK-NOT: %r15
; CHECK: .cfi_offset %r6, -112
; CHECK: .cfi_offset %r7, -104
; CHECK: .cfi_offset %r8, -96
; CHECK: .cfi_offset %r9, -88
; CHECK: .cfi_offset %r10, -80
; CHECK: .cfi_offset %r11, -72
; CHECK: .cfi_offset %r12, -64
; CHECK: .cfi_offset %r13, -56
; CHECK: .cfi_offset %r14, -48
; CHECK: .cfi_offset %r15, -40
; ...main function body...
; CHECK-NOT: %r15
; CHECK: stg {{.*}}, 8(%r2)
; CHECK: lmg %r6, %r15, 48(%r15)
; CHECK: br %r14
%l0 = load volatile i64, i64 *%ptr
%l1 = load volatile i64, i64 *%ptr
%l3 = load volatile i64, i64 *%ptr
%l4 = load volatile i64, i64 *%ptr
%l5 = load volatile i64, i64 *%ptr
%l6 = load volatile i64, i64 *%ptr
%l7 = load volatile i64, i64 *%ptr
%l8 = load volatile i64, i64 *%ptr
%l9 = load volatile i64, i64 *%ptr
%l10 = load volatile i64, i64 *%ptr
%l11 = load volatile i64, i64 *%ptr
%l12 = load volatile i64, i64 *%ptr
%l13 = load volatile i64, i64 *%ptr
%l14 = load volatile i64, i64 *%ptr
%add0 = add i64 %l0, %l0
%add1 = add i64 %l1, %add0
%add3 = add i64 %l3, %add1
%add4 = add i64 %l4, %add3
%add5 = add i64 %l5, %add4
%add6 = add i64 %l6, %add5
%add7 = add i64 %l7, %add6
%add8 = add i64 %l8, %add7
%add9 = add i64 %l9, %add8
%add10 = add i64 %l10, %add9
%add11 = add i64 %l11, %add10
%add12 = add i64 %l12, %add11
%add13 = add i64 %l13, %add12
%add14 = add i64 %l14, %add13
store volatile i64 %add0, i64 *%ptr
store volatile i64 %add1, i64 *%ptr
store volatile i64 %add3, i64 *%ptr
store volatile i64 %add4, i64 *%ptr
store volatile i64 %add5, i64 *%ptr
store volatile i64 %add6, i64 *%ptr
store volatile i64 %add7, i64 *%ptr
store volatile i64 %add8, i64 *%ptr
store volatile i64 %add9, i64 *%ptr
store volatile i64 %add10, i64 *%ptr
store volatile i64 %add11, i64 *%ptr
store volatile i64 %add12, i64 *%ptr
store volatile i64 %add13, i64 *%ptr
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction One of several parallel first steps to remove the target type of pointers, replacing them with a single opaque pointer type. This adds an explicit type parameter to the gep instruction so that when the first parameter becomes an opaque pointer type, the type to gep through is still available to the instructions. * This doesn't modify gep operators, only instructions (operators will be handled separately) * Textual IR changes only. Bitcode (including upgrade) and changing the in-memory representation will be in separate changes. * geps of vectors are transformed as: getelementptr <4 x float*> %x, ... ->getelementptr float, <4 x float*> %x, ... Then, once the opaque pointer type is introduced, this will ultimately look like: getelementptr float, <4 x ptr> %x with the unambiguous interpretation that it is a vector of pointers to float. * address spaces remain on the pointer, not the type: getelementptr float addrspace(1)* %x ->getelementptr float, float addrspace(1)* %x Then, eventually: getelementptr float, ptr addrspace(1) %x Importantly, the massive amount of test case churn has been automated by same crappy python code. I had to manually update a few test cases that wouldn't fit the script's model (r228970,r229196,r229197,r229198). The python script just massages stdin and writes the result to stdout, I then wrapped that in a shell script to handle replacing files, then using the usual find+xargs to migrate all the files. update.py: import fileinput import sys import re ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") def conv(match, line): if not match: return line line = match.groups()[0] if len(match.groups()[5]) == 0: line += match.groups()[2] line += match.groups()[3] line += ", " line += match.groups()[1] line += "\n" return line for line in sys.stdin: if line.find("getelementptr ") == line.find("getelementptr inbounds"): if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("): line = conv(re.match(ibrep, line), line) elif line.find("getelementptr ") != line.find("getelementptr ("): line = conv(re.match(normrep, line), line) sys.stdout.write(line) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh After that, check-all (with llvm, clang, clang-tools-extra, lld, compiler-rt, and polly all checked out). The extra 'rm' in the apply.sh script is due to a few files in clang's test suite using interesting unicode stuff that my python script was throwing exceptions on. None of those files needed to be migrated, so it seemed sufficient to ignore those cases. Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7636 llvm-svn: 230786
2015-02-28 03:29:02 +08:00
%final = getelementptr i64, i64 *%ptr, i64 1
store volatile i64 %add14, i64 *%final
ret void
}
; Like f1, but requires one fewer GPR. We allocate the call-saved GPRs
; from %r14 down, so that the STMG/LMG sequences aren't any longer than
; they need to be.
define void @f2(i64 *%ptr) {
; CHECK-LABEL: f2:
; CHECK: stmg %r7, %r15, 56(%r15)
; CHECK-NOT: %r15
; CHECK: .cfi_offset %r7, -104
; CHECK: .cfi_offset %r8, -96
; CHECK: .cfi_offset %r9, -88
; CHECK: .cfi_offset %r10, -80
; CHECK: .cfi_offset %r11, -72
; CHECK: .cfi_offset %r12, -64
; CHECK: .cfi_offset %r13, -56
; CHECK: .cfi_offset %r14, -48
; CHECK: .cfi_offset %r15, -40
; ...main function body...
; CHECK-NOT: %r15
; CHECK-NOT: %r6
; CHECK: stg {{.*}}, 8(%r2)
; CHECK: lmg %r7, %r15, 56(%r15)
; CHECK: br %r14
%l0 = load volatile i64, i64 *%ptr
%l1 = load volatile i64, i64 *%ptr
%l3 = load volatile i64, i64 *%ptr
%l4 = load volatile i64, i64 *%ptr
%l5 = load volatile i64, i64 *%ptr
%l7 = load volatile i64, i64 *%ptr
%l8 = load volatile i64, i64 *%ptr
%l9 = load volatile i64, i64 *%ptr
%l10 = load volatile i64, i64 *%ptr
%l11 = load volatile i64, i64 *%ptr
%l12 = load volatile i64, i64 *%ptr
%l13 = load volatile i64, i64 *%ptr
%l14 = load volatile i64, i64 *%ptr
%add0 = add i64 %l0, %l0
%add1 = add i64 %l1, %add0
%add3 = add i64 %l3, %add1
%add4 = add i64 %l4, %add3
%add5 = add i64 %l5, %add4
%add7 = add i64 %l7, %add5
%add8 = add i64 %l8, %add7
%add9 = add i64 %l9, %add8
%add10 = add i64 %l10, %add9
%add11 = add i64 %l11, %add10
%add12 = add i64 %l12, %add11
%add13 = add i64 %l13, %add12
%add14 = add i64 %l14, %add13
store volatile i64 %add0, i64 *%ptr
store volatile i64 %add1, i64 *%ptr
store volatile i64 %add3, i64 *%ptr
store volatile i64 %add4, i64 *%ptr
store volatile i64 %add5, i64 *%ptr
store volatile i64 %add7, i64 *%ptr
store volatile i64 %add8, i64 *%ptr
store volatile i64 %add9, i64 *%ptr
store volatile i64 %add10, i64 *%ptr
store volatile i64 %add11, i64 *%ptr
store volatile i64 %add12, i64 *%ptr
store volatile i64 %add13, i64 *%ptr
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction One of several parallel first steps to remove the target type of pointers, replacing them with a single opaque pointer type. This adds an explicit type parameter to the gep instruction so that when the first parameter becomes an opaque pointer type, the type to gep through is still available to the instructions. * This doesn't modify gep operators, only instructions (operators will be handled separately) * Textual IR changes only. Bitcode (including upgrade) and changing the in-memory representation will be in separate changes. * geps of vectors are transformed as: getelementptr <4 x float*> %x, ... ->getelementptr float, <4 x float*> %x, ... Then, once the opaque pointer type is introduced, this will ultimately look like: getelementptr float, <4 x ptr> %x with the unambiguous interpretation that it is a vector of pointers to float. * address spaces remain on the pointer, not the type: getelementptr float addrspace(1)* %x ->getelementptr float, float addrspace(1)* %x Then, eventually: getelementptr float, ptr addrspace(1) %x Importantly, the massive amount of test case churn has been automated by same crappy python code. I had to manually update a few test cases that wouldn't fit the script's model (r228970,r229196,r229197,r229198). The python script just massages stdin and writes the result to stdout, I then wrapped that in a shell script to handle replacing files, then using the usual find+xargs to migrate all the files. update.py: import fileinput import sys import re ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") def conv(match, line): if not match: return line line = match.groups()[0] if len(match.groups()[5]) == 0: line += match.groups()[2] line += match.groups()[3] line += ", " line += match.groups()[1] line += "\n" return line for line in sys.stdin: if line.find("getelementptr ") == line.find("getelementptr inbounds"): if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("): line = conv(re.match(ibrep, line), line) elif line.find("getelementptr ") != line.find("getelementptr ("): line = conv(re.match(normrep, line), line) sys.stdout.write(line) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh After that, check-all (with llvm, clang, clang-tools-extra, lld, compiler-rt, and polly all checked out). The extra 'rm' in the apply.sh script is due to a few files in clang's test suite using interesting unicode stuff that my python script was throwing exceptions on. None of those files needed to be migrated, so it seemed sufficient to ignore those cases. Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7636 llvm-svn: 230786
2015-02-28 03:29:02 +08:00
%final = getelementptr i64, i64 *%ptr, i64 1
store volatile i64 %add14, i64 *%final
ret void
}
; Like f1, but only needs one call-saved GPR, which ought to be %r14.
define void @f3(i64 *%ptr) {
; CHECK-LABEL: f3:
; CHECK: stmg %r14, %r15, 112(%r15)
; CHECK-NOT: %r15
; CHECK: .cfi_offset %r14, -48
; CHECK: .cfi_offset %r15, -40
; ...main function body...
; CHECK-NOT: %r15
; CHECK-NOT: %r6
; CHECK-NOT: %r7
; CHECK-NOT: %r8
; CHECK-NOT: %r9
; CHECK-NOT: %r10
; CHECK-NOT: %r11
; CHECK-NOT: %r12
; CHECK-NOT: %r13
; CHECK: stg {{.*}}, 8(%r2)
; CHECK: lmg %r14, %r15, 112(%r15)
; CHECK: br %r14
%l0 = load volatile i64, i64 *%ptr
%l1 = load volatile i64, i64 *%ptr
%l3 = load volatile i64, i64 *%ptr
%l4 = load volatile i64, i64 *%ptr
%l5 = load volatile i64, i64 *%ptr
%l14 = load volatile i64, i64 *%ptr
%add0 = add i64 %l0, %l0
%add1 = add i64 %l1, %add0
%add3 = add i64 %l3, %add1
%add4 = add i64 %l4, %add3
%add5 = add i64 %l5, %add4
%add14 = add i64 %l14, %add5
store volatile i64 %add0, i64 *%ptr
store volatile i64 %add1, i64 *%ptr
store volatile i64 %add3, i64 *%ptr
store volatile i64 %add4, i64 *%ptr
store volatile i64 %add5, i64 *%ptr
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction One of several parallel first steps to remove the target type of pointers, replacing them with a single opaque pointer type. This adds an explicit type parameter to the gep instruction so that when the first parameter becomes an opaque pointer type, the type to gep through is still available to the instructions. * This doesn't modify gep operators, only instructions (operators will be handled separately) * Textual IR changes only. Bitcode (including upgrade) and changing the in-memory representation will be in separate changes. * geps of vectors are transformed as: getelementptr <4 x float*> %x, ... ->getelementptr float, <4 x float*> %x, ... Then, once the opaque pointer type is introduced, this will ultimately look like: getelementptr float, <4 x ptr> %x with the unambiguous interpretation that it is a vector of pointers to float. * address spaces remain on the pointer, not the type: getelementptr float addrspace(1)* %x ->getelementptr float, float addrspace(1)* %x Then, eventually: getelementptr float, ptr addrspace(1) %x Importantly, the massive amount of test case churn has been automated by same crappy python code. I had to manually update a few test cases that wouldn't fit the script's model (r228970,r229196,r229197,r229198). The python script just massages stdin and writes the result to stdout, I then wrapped that in a shell script to handle replacing files, then using the usual find+xargs to migrate all the files. update.py: import fileinput import sys import re ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") def conv(match, line): if not match: return line line = match.groups()[0] if len(match.groups()[5]) == 0: line += match.groups()[2] line += match.groups()[3] line += ", " line += match.groups()[1] line += "\n" return line for line in sys.stdin: if line.find("getelementptr ") == line.find("getelementptr inbounds"): if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("): line = conv(re.match(ibrep, line), line) elif line.find("getelementptr ") != line.find("getelementptr ("): line = conv(re.match(normrep, line), line) sys.stdout.write(line) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh After that, check-all (with llvm, clang, clang-tools-extra, lld, compiler-rt, and polly all checked out). The extra 'rm' in the apply.sh script is due to a few files in clang's test suite using interesting unicode stuff that my python script was throwing exceptions on. None of those files needed to be migrated, so it seemed sufficient to ignore those cases. Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7636 llvm-svn: 230786
2015-02-28 03:29:02 +08:00
%final = getelementptr i64, i64 *%ptr, i64 1
store volatile i64 %add14, i64 *%final
ret void
}
; This function should use all call-clobbered GPRs but no call-saved ones.
; It shouldn't need to touch the stack at all.
define void @f4(i64 *%ptr) {
; CHECK-LABEL: f4:
; CHECK-NOT: %r15
; CHECK-NOT: %r6
; CHECK-NOT: %r7
; CHECK-NOT: %r8
; CHECK-NOT: %r9
; CHECK-NOT: %r10
; CHECK-NOT: %r11
; CHECK-NOT: %r12
; CHECK-NOT: %r13
; CHECK: br %r14
%l0 = load volatile i64, i64 *%ptr
%l1 = load volatile i64, i64 *%ptr
%l3 = load volatile i64, i64 *%ptr
%l4 = load volatile i64, i64 *%ptr
%l5 = load volatile i64, i64 *%ptr
%add0 = add i64 %l0, %l0
%add1 = add i64 %l1, %add0
%add3 = add i64 %l3, %add1
%add4 = add i64 %l4, %add3
%add5 = add i64 %l5, %add4
store volatile i64 %add0, i64 *%ptr
store volatile i64 %add1, i64 *%ptr
store volatile i64 %add3, i64 *%ptr
store volatile i64 %add4, i64 *%ptr
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction One of several parallel first steps to remove the target type of pointers, replacing them with a single opaque pointer type. This adds an explicit type parameter to the gep instruction so that when the first parameter becomes an opaque pointer type, the type to gep through is still available to the instructions. * This doesn't modify gep operators, only instructions (operators will be handled separately) * Textual IR changes only. Bitcode (including upgrade) and changing the in-memory representation will be in separate changes. * geps of vectors are transformed as: getelementptr <4 x float*> %x, ... ->getelementptr float, <4 x float*> %x, ... Then, once the opaque pointer type is introduced, this will ultimately look like: getelementptr float, <4 x ptr> %x with the unambiguous interpretation that it is a vector of pointers to float. * address spaces remain on the pointer, not the type: getelementptr float addrspace(1)* %x ->getelementptr float, float addrspace(1)* %x Then, eventually: getelementptr float, ptr addrspace(1) %x Importantly, the massive amount of test case churn has been automated by same crappy python code. I had to manually update a few test cases that wouldn't fit the script's model (r228970,r229196,r229197,r229198). The python script just massages stdin and writes the result to stdout, I then wrapped that in a shell script to handle replacing files, then using the usual find+xargs to migrate all the files. update.py: import fileinput import sys import re ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") def conv(match, line): if not match: return line line = match.groups()[0] if len(match.groups()[5]) == 0: line += match.groups()[2] line += match.groups()[3] line += ", " line += match.groups()[1] line += "\n" return line for line in sys.stdin: if line.find("getelementptr ") == line.find("getelementptr inbounds"): if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("): line = conv(re.match(ibrep, line), line) elif line.find("getelementptr ") != line.find("getelementptr ("): line = conv(re.match(normrep, line), line) sys.stdout.write(line) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh After that, check-all (with llvm, clang, clang-tools-extra, lld, compiler-rt, and polly all checked out). The extra 'rm' in the apply.sh script is due to a few files in clang's test suite using interesting unicode stuff that my python script was throwing exceptions on. None of those files needed to be migrated, so it seemed sufficient to ignore those cases. Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7636 llvm-svn: 230786
2015-02-28 03:29:02 +08:00
%final = getelementptr i64, i64 *%ptr, i64 1
store volatile i64 %add5, i64 *%final
ret void
}