2014-05-24 20:50:23 +08:00
|
|
|
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck --check-prefix=CHECK %s
|
|
|
|
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -mattr=-fp-armv8 | FileCheck --check-prefix=CHECK-NOFP %s
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%myStruct = type { i64 , i8, i32 }
|
|
|
|
|
|
|
|
@var8 = global i8 0
|
|
|
|
@var32 = global i32 0
|
|
|
|
@var64 = global i64 0
|
|
|
|
@var128 = global i128 0
|
|
|
|
@varfloat = global float 0.0
|
|
|
|
@vardouble = global double 0.0
|
|
|
|
@varstruct = global %myStruct zeroinitializer
|
|
|
|
|
|
|
|
define void @take_i8s(i8 %val1, i8 %val2) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: take_i8s:
|
2013-01-31 20:12:40 +08:00
|
|
|
store i8 %val2, i8* @var8
|
|
|
|
; Not using w1 may be technically allowed, but it would indicate a
|
|
|
|
; problem in itself.
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: strb w1, [{{x[0-9]+}}, {{#?}}:lo12:var8]
|
2013-01-31 20:12:40 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @add_floats(float %val1, float %val2) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: add_floats:
|
2013-01-31 20:12:40 +08:00
|
|
|
%newval = fadd float %val1, %val2
|
|
|
|
; CHECK: fadd [[ADDRES:s[0-9]+]], s0, s1
|
2013-10-31 17:32:11 +08:00
|
|
|
; CHECK-NOFP-NOT: fadd
|
2013-01-31 20:12:40 +08:00
|
|
|
store float %newval, float* @varfloat
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: str [[ADDRES]], [{{x[0-9]+}}, {{#?}}:lo12:varfloat]
|
2013-01-31 20:12:40 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; byval pointers should be allocated to the stack and copied as if
|
|
|
|
; with memcpy.
|
|
|
|
define void @take_struct(%myStruct* byval %structval) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: take_struct:
|
[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
|
|
|
%addr0 = getelementptr %myStruct, %myStruct* %structval, i64 0, i32 2
|
|
|
|
%addr1 = getelementptr %myStruct, %myStruct* %structval, i64 0, i32 0
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%val0 = load volatile i32, i32* %addr0
|
2013-01-31 20:12:40 +08:00
|
|
|
; Some weird move means x0 is used for one access
|
|
|
|
; CHECK: ldr [[REG32:w[0-9]+]], [{{x[0-9]+|sp}}, #12]
|
2013-10-09 15:53:57 +08:00
|
|
|
store volatile i32 %val0, i32* @var32
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: str [[REG32]], [{{x[0-9]+}}, {{#?}}:lo12:var32]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%val1 = load volatile i64, i64* %addr1
|
2013-01-31 20:12:40 +08:00
|
|
|
; CHECK: ldr [[REG64:x[0-9]+]], [{{x[0-9]+|sp}}]
|
2013-10-09 15:53:57 +08:00
|
|
|
store volatile i64 %val1, i64* @var64
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: str [[REG64]], [{{x[0-9]+}}, {{#?}}:lo12:var64]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; %structval should be at sp + 16
|
|
|
|
define void @check_byval_align(i32* byval %ignore, %myStruct* byval align 16 %structval) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: check_byval_align:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
[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
|
|
|
%addr0 = getelementptr %myStruct, %myStruct* %structval, i64 0, i32 2
|
|
|
|
%addr1 = getelementptr %myStruct, %myStruct* %structval, i64 0, i32 0
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%val0 = load volatile i32, i32* %addr0
|
2013-01-31 20:12:40 +08:00
|
|
|
; Some weird move means x0 is used for one access
|
2014-05-24 20:50:23 +08:00
|
|
|
; CHECK: ldr [[REG32:w[0-9]+]], [sp, #28]
|
2013-01-31 20:12:40 +08:00
|
|
|
store i32 %val0, i32* @var32
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: str [[REG32]], [{{x[0-9]+}}, {{#?}}:lo12:var32]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%val1 = load volatile i64, i64* %addr1
|
2013-01-31 20:12:40 +08:00
|
|
|
; CHECK: ldr [[REG64:x[0-9]+]], [sp, #16]
|
|
|
|
store i64 %val1, i64* @var64
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: str [[REG64]], [{{x[0-9]+}}, {{#?}}:lo12:var64]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @return_int() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: return_int:
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32* @var32
|
2013-01-31 20:12:40 +08:00
|
|
|
ret i32 %val
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: ldr w0, [{{x[0-9]+}}, {{#?}}:lo12:var32]
|
2013-01-31 20:12:40 +08:00
|
|
|
; Make sure epilogue follows
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @return_double() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: return_double:
|
2013-01-31 20:12:40 +08:00
|
|
|
ret double 3.14
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: ldr d0, [{{x[0-9]+}}, {{#?}}:lo12:.LCPI
|
2013-10-31 17:32:11 +08:00
|
|
|
; CHECK-NOFP-NOT: ldr d0,
|
2013-01-31 20:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; This is the kind of IR clang will produce for returning a struct
|
|
|
|
; small enough to go into registers. Not all that pretty, but it
|
|
|
|
; works.
|
|
|
|
define [2 x i64] @return_struct() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: return_struct:
|
2013-01-31 20:12:40 +08:00
|
|
|
%addr = bitcast %myStruct* @varstruct to [2 x i64]*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load [2 x i64], [2 x i64]* %addr
|
2013-01-31 20:12:40 +08:00
|
|
|
ret [2 x i64] %val
|
2014-12-03 07:13:39 +08:00
|
|
|
; CHECK: add x[[VARSTRUCT:[0-9]+]], {{x[0-9]+}}, :lo12:varstruct
|
|
|
|
; CHECK: ldp x0, x1, [x[[VARSTRUCT]]]
|
2013-01-31 20:12:40 +08:00
|
|
|
; Make sure epilogue immediately follows
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; Large structs are passed by reference (storage allocated by caller
|
|
|
|
; to preserve value semantics) in x8. Strictly this only applies to
|
|
|
|
; structs larger than 16 bytes, but C semantics can still be provided
|
|
|
|
; if LLVM does it to %myStruct too. So this is the simplest check
|
|
|
|
define void @return_large_struct(%myStruct* sret %retval) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: return_large_struct:
|
[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
|
|
|
%addr0 = getelementptr %myStruct, %myStruct* %retval, i64 0, i32 0
|
|
|
|
%addr1 = getelementptr %myStruct, %myStruct* %retval, i64 0, i32 1
|
|
|
|
%addr2 = getelementptr %myStruct, %myStruct* %retval, i64 0, i32 2
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
store i64 42, i64* %addr0
|
|
|
|
store i8 2, i8* %addr1
|
|
|
|
store i32 9, i32* %addr2
|
|
|
|
; CHECK: str {{x[0-9]+}}, [x8]
|
|
|
|
; CHECK: strb {{w[0-9]+}}, [x8, #8]
|
|
|
|
; CHECK: str {{w[0-9]+}}, [x8, #12]
|
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; This struct is just too far along to go into registers: (only x7 is
|
|
|
|
; available, but it needs two). Also make sure that %stacked doesn't
|
|
|
|
; sneak into x7 behind.
|
|
|
|
define i32 @struct_on_stack(i8 %var0, i16 %var1, i32 %var2, i64 %var3, i128 %var45,
|
|
|
|
i32* %var6, %myStruct* byval %struct, i32* byval %stacked,
|
|
|
|
double %notstacked) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: struct_on_stack:
|
[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
|
|
|
%addr = getelementptr %myStruct, %myStruct* %struct, i64 0, i32 0
|
2015-02-28 05:17:42 +08:00
|
|
|
%val64 = load volatile i64, i64* %addr
|
2013-10-09 15:53:57 +08:00
|
|
|
store volatile i64 %val64, i64* @var64
|
2013-01-31 20:12:40 +08:00
|
|
|
; Currently nothing on local stack, so struct should be at sp
|
|
|
|
; CHECK: ldr [[VAL64:x[0-9]+]], [sp]
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: str [[VAL64]], [{{x[0-9]+}}, {{#?}}:lo12:var64]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2013-10-09 15:53:57 +08:00
|
|
|
store volatile double %notstacked, double* @vardouble
|
2013-01-31 20:12:40 +08:00
|
|
|
; CHECK-NOT: ldr d0
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK: str d0, [{{x[0-9]+}}, {{#?}}:lo12:vardouble
|
2013-10-31 17:32:11 +08:00
|
|
|
; CHECK-NOFP-NOT: str d0,
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%retval = load volatile i32, i32* %stacked
|
2013-01-31 20:12:40 +08:00
|
|
|
ret i32 %retval
|
2014-03-26 22:51:22 +08:00
|
|
|
; CHECK-LE: ldr w0, [sp, #16]
|
2013-01-31 20:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
define void @stacked_fpu(float %var0, double %var1, float %var2, float %var3,
|
|
|
|
float %var4, float %var5, float %var6, float %var7,
|
|
|
|
float %var8) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: stacked_fpu:
|
2013-01-31 20:12:40 +08:00
|
|
|
store float %var8, float* @varfloat
|
|
|
|
; Beware as above: the offset would be different on big-endian
|
|
|
|
; machines if the first ldr were changed to use s-registers.
|
2014-05-24 20:50:23 +08:00
|
|
|
; CHECK: ldr {{[ds]}}[[VALFLOAT:[0-9]+]], [sp]
|
|
|
|
; CHECK: str s[[VALFLOAT]], [{{x[0-9]+}}, {{#?}}:lo12:varfloat]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; 128-bit integer types should be passed in xEVEN, xODD rather than
|
|
|
|
; the reverse. In this case x2 and x3. Nothing should use x1.
|
2014-04-18 17:30:52 +08:00
|
|
|
define i64 @check_i128_regalign(i32 %val0, i128 %val1, i64 %val2) {
|
|
|
|
; CHECK-LABEL: check_i128_regalign
|
2013-01-31 20:12:40 +08:00
|
|
|
store i128 %val1, i128* @var128
|
2014-12-03 07:13:39 +08:00
|
|
|
; CHECK: add x[[VAR128:[0-9]+]], {{x[0-9]+}}, :lo12:var128
|
|
|
|
; CHECK-DAG: stp x2, x3, [x[[VAR128]]]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2014-04-18 17:30:52 +08:00
|
|
|
ret i64 %val2
|
2013-01-31 20:12:40 +08:00
|
|
|
; CHECK: mov x0, x4
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @check_i128_stackalign(i32 %val0, i32 %val1, i32 %val2, i32 %val3,
|
|
|
|
i32 %val4, i32 %val5, i32 %val6, i32 %val7,
|
|
|
|
i32 %stack1, i128 %stack2) {
|
2014-04-18 17:30:52 +08:00
|
|
|
; CHECK-LABEL: check_i128_stackalign
|
2013-01-31 20:12:40 +08:00
|
|
|
store i128 %stack2, i128* @var128
|
|
|
|
; Nothing local on stack in current codegen, so first stack is 16 away
|
2014-03-26 22:51:22 +08:00
|
|
|
; CHECK-LE: add x[[REG:[0-9]+]], sp, #16
|
|
|
|
; CHECK-LE: ldr {{x[0-9]+}}, [x[[REG]], #8]
|
|
|
|
|
2013-01-31 20:12:40 +08:00
|
|
|
; Important point is that we address sp+24 for second dword
|
2014-04-18 17:30:52 +08:00
|
|
|
|
2014-05-24 20:50:23 +08:00
|
|
|
; CHECK: ldp {{x[0-9]+}}, {{x[0-9]+}}, [sp, #16]
|
2013-01-31 20:12:40 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
|
|
|
|
|
|
|
|
define i32 @test_extern() {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test_extern:
|
2013-01-31 20:12:40 +08:00
|
|
|
call void @llvm.memcpy.p0i8.p0i8.i32(i8* undef, i8* undef, i32 undef, i32 4, i1 0)
|
|
|
|
; CHECK: bl memcpy
|
|
|
|
ret i32 0
|
|
|
|
}
|
2014-05-07 19:28:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
; A sub-i32 stack argument must be loaded on big endian with ldr{h,b}, not just
|
|
|
|
; implicitly extended to a 32-bit load.
|
|
|
|
define i16 @stacked_i16(i32 %val0, i32 %val1, i32 %val2, i32 %val3,
|
|
|
|
i32 %val4, i32 %val5, i32 %val6, i32 %val7,
|
|
|
|
i16 %stack1) {
|
|
|
|
; CHECK-LABEL: stacked_i16
|
|
|
|
ret i16 %stack1
|
|
|
|
}
|