2014-05-24 14:50:23 +02:00
|
|
|
; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
|
|
|
|
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -mattr=-fp-armv8 | FileCheck --check-prefix=CHECK-NOFP %s
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
@var_8bit = global i8 0
|
|
|
|
@var_16bit = global i16 0
|
|
|
|
@var_32bit = global i32 0
|
|
|
|
@var_64bit = global i64 0
|
|
|
|
|
|
|
|
@var_float = global float 0.0
|
|
|
|
@var_double = global double 0.0
|
|
|
|
|
2014-04-15 16:00:19 +02:00
|
|
|
define void @ldst_8bit(i8* %base, i32 %off32, i64 %off64) minsize {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: ldst_8bit:
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr8_sxtw = getelementptr i8, i8* %base, i32 %off32
|
2015-02-27 22:17:42 +01:00
|
|
|
%val8_sxtw = load volatile i8, i8* %addr8_sxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
%val32_signed = sext i8 %val8_sxtw to i32
|
|
|
|
store volatile i32 %val32_signed, i32* @var_32bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldrsb {{w[0-9]+}}, [{{x[0-9]+}}, {{[wx][0-9]+}}, sxtw]
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_lsl = getelementptr i8, i8* %base, i64 %off64
|
2015-02-27 22:17:42 +01:00
|
|
|
%val8_lsl = load volatile i8, i8* %addr_lsl
|
2013-01-31 13:12:40 +01:00
|
|
|
%val32_unsigned = zext i8 %val8_lsl to i32
|
|
|
|
store volatile i32 %val32_unsigned, i32* @var_32bit
|
|
|
|
; CHECK: ldrb {{w[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}]
|
|
|
|
|
|
|
|
%addrint_uxtw = ptrtoint i8* %base to i64
|
|
|
|
%offset_uxtw = zext i32 %off32 to i64
|
|
|
|
%addrint1_uxtw = add i64 %addrint_uxtw, %offset_uxtw
|
|
|
|
%addr_uxtw = inttoptr i64 %addrint1_uxtw to i8*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val8_uxtw = load volatile i8, i8* %addr_uxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
%newval8 = add i8 %val8_uxtw, 1
|
|
|
|
store volatile i8 %newval8, i8* @var_8bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldrb {{w[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-15 16:00:19 +02:00
|
|
|
define void @ldst_16bit(i16* %base, i32 %off32, i64 %off64) minsize {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: ldst_16bit:
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr8_sxtwN = getelementptr i16, i16* %base, i32 %off32
|
2015-02-27 22:17:42 +01:00
|
|
|
%val8_sxtwN = load volatile i16, i16* %addr8_sxtwN
|
2013-01-31 13:12:40 +01:00
|
|
|
%val32_signed = sext i16 %val8_sxtwN to i32
|
|
|
|
store volatile i32 %val32_signed, i32* @var_32bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldrsh {{w[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #1]
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_lslN = getelementptr i16, i16* %base, i64 %off64
|
2015-02-27 22:17:42 +01:00
|
|
|
%val8_lslN = load volatile i16, i16* %addr_lslN
|
2013-01-31 13:12:40 +01:00
|
|
|
%val32_unsigned = zext i16 %val8_lslN to i32
|
|
|
|
store volatile i32 %val32_unsigned, i32* @var_32bit
|
|
|
|
; CHECK: ldrh {{w[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}, lsl #1]
|
|
|
|
|
|
|
|
%addrint_uxtw = ptrtoint i16* %base to i64
|
|
|
|
%offset_uxtw = zext i32 %off32 to i64
|
|
|
|
%addrint1_uxtw = add i64 %addrint_uxtw, %offset_uxtw
|
|
|
|
%addr_uxtw = inttoptr i64 %addrint1_uxtw to i16*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val8_uxtw = load volatile i16, i16* %addr_uxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
%newval8 = add i16 %val8_uxtw, 1
|
|
|
|
store volatile i16 %newval8, i16* @var_16bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldrh {{w[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_sxtw = ptrtoint i16* %base to i64
|
|
|
|
%offset_sxtw = sext i32 %off32 to i64
|
|
|
|
%addrint_sxtw = add i64 %base_sxtw, %offset_sxtw
|
|
|
|
%addr_sxtw = inttoptr i64 %addrint_sxtw to i16*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val16_sxtw = load volatile i16, i16* %addr_sxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
%val64_signed = sext i16 %val16_sxtw to i64
|
|
|
|
store volatile i64 %val64_signed, i64* @var_64bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldrsh {{x[0-9]+}}, [{{x[0-9]+}}, {{[wx][0-9]+}}, sxtw]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
%base_lsl = ptrtoint i16* %base to i64
|
|
|
|
%addrint_lsl = add i64 %base_lsl, %off64
|
|
|
|
%addr_lsl = inttoptr i64 %addrint_lsl to i16*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val16_lsl = load volatile i16, i16* %addr_lsl
|
2013-01-31 13:12:40 +01:00
|
|
|
%val64_unsigned = zext i16 %val16_lsl to i64
|
|
|
|
store volatile i64 %val64_unsigned, i64* @var_64bit
|
|
|
|
; CHECK: ldrh {{w[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}]
|
|
|
|
|
|
|
|
%base_uxtwN = ptrtoint i16* %base to i64
|
|
|
|
%offset_uxtwN = zext i32 %off32 to i64
|
|
|
|
%offset2_uxtwN = shl i64 %offset_uxtwN, 1
|
|
|
|
%addrint_uxtwN = add i64 %base_uxtwN, %offset2_uxtwN
|
|
|
|
%addr_uxtwN = inttoptr i64 %addrint_uxtwN to i16*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val32 = load volatile i32, i32* @var_32bit
|
2013-01-31 13:12:40 +01:00
|
|
|
%val16_trunc32 = trunc i32 %val32 to i16
|
|
|
|
store volatile i16 %val16_trunc32, i16* %addr_uxtwN
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: strh {{w[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw #1]
|
2013-01-31 13:12:40 +01:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-04-15 16:00:19 +02:00
|
|
|
define void @ldst_32bit(i32* %base, i32 %off32, i64 %off64) minsize {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: ldst_32bit:
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_sxtwN = getelementptr i32, i32* %base, i32 %off32
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_sxtwN = load volatile i32, i32* %addr_sxtwN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile i32 %val_sxtwN, i32* @var_32bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{w[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #2]
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_lslN = getelementptr i32, i32* %base, i64 %off64
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_lslN = load volatile i32, i32* %addr_lslN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile i32 %val_lslN, i32* @var_32bit
|
|
|
|
; CHECK: ldr {{w[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}, lsl #2]
|
|
|
|
|
|
|
|
%addrint_uxtw = ptrtoint i32* %base to i64
|
|
|
|
%offset_uxtw = zext i32 %off32 to i64
|
|
|
|
%addrint1_uxtw = add i64 %addrint_uxtw, %offset_uxtw
|
|
|
|
%addr_uxtw = inttoptr i64 %addrint1_uxtw to i32*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_uxtw = load volatile i32, i32* %addr_uxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
%newval8 = add i32 %val_uxtw, 1
|
|
|
|
store volatile i32 %newval8, i32* @var_32bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{w[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
%base_sxtw = ptrtoint i32* %base to i64
|
|
|
|
%offset_sxtw = sext i32 %off32 to i64
|
|
|
|
%addrint_sxtw = add i64 %base_sxtw, %offset_sxtw
|
|
|
|
%addr_sxtw = inttoptr i64 %addrint_sxtw to i32*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val16_sxtw = load volatile i32, i32* %addr_sxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
%val64_signed = sext i32 %val16_sxtw to i64
|
|
|
|
store volatile i64 %val64_signed, i64* @var_64bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldrsw {{x[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
%base_lsl = ptrtoint i32* %base to i64
|
|
|
|
%addrint_lsl = add i64 %base_lsl, %off64
|
|
|
|
%addr_lsl = inttoptr i64 %addrint_lsl to i32*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val16_lsl = load volatile i32, i32* %addr_lsl
|
2013-01-31 13:12:40 +01:00
|
|
|
%val64_unsigned = zext i32 %val16_lsl to i64
|
|
|
|
store volatile i64 %val64_unsigned, i64* @var_64bit
|
|
|
|
; CHECK: ldr {{w[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}]
|
|
|
|
|
|
|
|
%base_uxtwN = ptrtoint i32* %base to i64
|
|
|
|
%offset_uxtwN = zext i32 %off32 to i64
|
|
|
|
%offset2_uxtwN = shl i64 %offset_uxtwN, 2
|
|
|
|
%addrint_uxtwN = add i64 %base_uxtwN, %offset2_uxtwN
|
|
|
|
%addr_uxtwN = inttoptr i64 %addrint_uxtwN to i32*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val32 = load volatile i32, i32* @var_32bit
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile i32 %val32, i32* %addr_uxtwN
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: str {{w[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw #2]
|
2013-01-31 13:12:40 +01:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-04-15 16:00:19 +02:00
|
|
|
define void @ldst_64bit(i64* %base, i32 %off32, i64 %off64) minsize {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: ldst_64bit:
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_sxtwN = getelementptr i64, i64* %base, i32 %off32
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_sxtwN = load volatile i64, i64* %addr_sxtwN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile i64 %val_sxtwN, i64* @var_64bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{x[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #3]
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_lslN = getelementptr i64, i64* %base, i64 %off64
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_lslN = load volatile i64, i64* %addr_lslN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile i64 %val_lslN, i64* @var_64bit
|
|
|
|
; CHECK: ldr {{x[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}, lsl #3]
|
|
|
|
|
|
|
|
%addrint_uxtw = ptrtoint i64* %base to i64
|
|
|
|
%offset_uxtw = zext i32 %off32 to i64
|
|
|
|
%addrint1_uxtw = add i64 %addrint_uxtw, %offset_uxtw
|
|
|
|
%addr_uxtw = inttoptr i64 %addrint1_uxtw to i64*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val8_uxtw = load volatile i64, i64* %addr_uxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
%newval8 = add i64 %val8_uxtw, 1
|
|
|
|
store volatile i64 %newval8, i64* @var_64bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{x[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_sxtw = ptrtoint i64* %base to i64
|
|
|
|
%offset_sxtw = sext i32 %off32 to i64
|
|
|
|
%addrint_sxtw = add i64 %base_sxtw, %offset_sxtw
|
|
|
|
%addr_sxtw = inttoptr i64 %addrint_sxtw to i64*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64_sxtw = load volatile i64, i64* %addr_sxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile i64 %val64_sxtw, i64* @var_64bit
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{x[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_lsl = ptrtoint i64* %base to i64
|
|
|
|
%addrint_lsl = add i64 %base_lsl, %off64
|
|
|
|
%addr_lsl = inttoptr i64 %addrint_lsl to i64*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64_lsl = load volatile i64, i64* %addr_lsl
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile i64 %val64_lsl, i64* @var_64bit
|
|
|
|
; CHECK: ldr {{x[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}]
|
|
|
|
|
|
|
|
%base_uxtwN = ptrtoint i64* %base to i64
|
|
|
|
%offset_uxtwN = zext i32 %off32 to i64
|
|
|
|
%offset2_uxtwN = shl i64 %offset_uxtwN, 3
|
|
|
|
%addrint_uxtwN = add i64 %base_uxtwN, %offset2_uxtwN
|
|
|
|
%addr_uxtwN = inttoptr i64 %addrint_uxtwN to i64*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64 = load volatile i64, i64* @var_64bit
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile i64 %val64, i64* %addr_uxtwN
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: str {{x[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw #3]
|
2013-01-31 13:12:40 +01:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-04-15 16:00:19 +02:00
|
|
|
define void @ldst_float(float* %base, i32 %off32, i64 %off64) minsize {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: ldst_float:
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_sxtwN = getelementptr float, float* %base, i32 %off32
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_sxtwN = load volatile float, float* %addr_sxtwN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile float %val_sxtwN, float* @var_float
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{s[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #2]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{s[0-9]+}},
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_lslN = getelementptr float, float* %base, i64 %off64
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_lslN = load volatile float, float* %addr_lslN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile float %val_lslN, float* @var_float
|
|
|
|
; CHECK: ldr {{s[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}, lsl #2]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{s[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%addrint_uxtw = ptrtoint float* %base to i64
|
|
|
|
%offset_uxtw = zext i32 %off32 to i64
|
|
|
|
%addrint1_uxtw = add i64 %addrint_uxtw, %offset_uxtw
|
|
|
|
%addr_uxtw = inttoptr i64 %addrint1_uxtw to float*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_uxtw = load volatile float, float* %addr_uxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile float %val_uxtw, float* @var_float
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{s[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{s[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_sxtw = ptrtoint float* %base to i64
|
|
|
|
%offset_sxtw = sext i32 %off32 to i64
|
|
|
|
%addrint_sxtw = add i64 %base_sxtw, %offset_sxtw
|
|
|
|
%addr_sxtw = inttoptr i64 %addrint_sxtw to float*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64_sxtw = load volatile float, float* %addr_sxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile float %val64_sxtw, float* @var_float
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{s[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{s[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_lsl = ptrtoint float* %base to i64
|
|
|
|
%addrint_lsl = add i64 %base_lsl, %off64
|
|
|
|
%addr_lsl = inttoptr i64 %addrint_lsl to float*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64_lsl = load volatile float, float* %addr_lsl
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile float %val64_lsl, float* @var_float
|
|
|
|
; CHECK: ldr {{s[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{s[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_uxtwN = ptrtoint float* %base to i64
|
|
|
|
%offset_uxtwN = zext i32 %off32 to i64
|
|
|
|
%offset2_uxtwN = shl i64 %offset_uxtwN, 2
|
|
|
|
%addrint_uxtwN = add i64 %base_uxtwN, %offset2_uxtwN
|
|
|
|
%addr_uxtwN = inttoptr i64 %addrint_uxtwN to float*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64 = load volatile float, float* @var_float
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile float %val64, float* %addr_uxtwN
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: str {{s[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw #2]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{s[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-04-15 16:00:19 +02:00
|
|
|
define void @ldst_double(double* %base, i32 %off32, i64 %off64) minsize {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: ldst_double:
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_sxtwN = getelementptr double, double* %base, i32 %off32
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_sxtwN = load volatile double, double* %addr_sxtwN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile double %val_sxtwN, double* @var_double
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{d[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #3]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{d[0-9]+}},
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_lslN = getelementptr double, double* %base, i64 %off64
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_lslN = load volatile double, double* %addr_lslN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile double %val_lslN, double* @var_double
|
|
|
|
; CHECK: ldr {{d[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}, lsl #3]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{d[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%addrint_uxtw = ptrtoint double* %base to i64
|
|
|
|
%offset_uxtw = zext i32 %off32 to i64
|
|
|
|
%addrint1_uxtw = add i64 %addrint_uxtw, %offset_uxtw
|
|
|
|
%addr_uxtw = inttoptr i64 %addrint1_uxtw to double*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_uxtw = load volatile double, double* %addr_uxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile double %val_uxtw, double* @var_double
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{d[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{d[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_sxtw = ptrtoint double* %base to i64
|
|
|
|
%offset_sxtw = sext i32 %off32 to i64
|
|
|
|
%addrint_sxtw = add i64 %base_sxtw, %offset_sxtw
|
|
|
|
%addr_sxtw = inttoptr i64 %addrint_sxtw to double*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64_sxtw = load volatile double, double* %addr_sxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile double %val64_sxtw, double* @var_double
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{d[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{d[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_lsl = ptrtoint double* %base to i64
|
|
|
|
%addrint_lsl = add i64 %base_lsl, %off64
|
|
|
|
%addr_lsl = inttoptr i64 %addrint_lsl to double*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64_lsl = load volatile double, double* %addr_lsl
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile double %val64_lsl, double* @var_double
|
|
|
|
; CHECK: ldr {{d[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{d[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_uxtwN = ptrtoint double* %base to i64
|
|
|
|
%offset_uxtwN = zext i32 %off32 to i64
|
|
|
|
%offset2_uxtwN = shl i64 %offset_uxtwN, 3
|
|
|
|
%addrint_uxtwN = add i64 %base_uxtwN, %offset2_uxtwN
|
|
|
|
%addr_uxtwN = inttoptr i64 %addrint_uxtwN to double*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64 = load volatile double, double* @var_double
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile double %val64, double* %addr_uxtwN
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: str {{d[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw #3]
|
2013-10-31 10:32:11 +01:00
|
|
|
; CHECK-NOFP-NOT: ldr {{d[0-9]+}},
|
2013-01-31 13:12:40 +01:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-15 16:00:19 +02:00
|
|
|
define void @ldst_128bit(fp128* %base, i32 %off32, i64 %off64) minsize {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: ldst_128bit:
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_sxtwN = getelementptr fp128, fp128* %base, i32 %off32
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_sxtwN = load volatile fp128, fp128* %addr_sxtwN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile fp128 %val_sxtwN, fp128* %base
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #4]
|
|
|
|
; CHECK-NOFP-NOT: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #4]
|
2013-01-31 13:12:40 +01: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-27 20:29:02 +01:00
|
|
|
%addr_lslN = getelementptr fp128, fp128* %base, i64 %off64
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_lslN = load volatile fp128, fp128* %addr_lslN
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile fp128 %val_lslN, fp128* %base
|
|
|
|
; CHECK: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}, lsl #4]
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK-NOFP-NOT: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #4]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%addrint_uxtw = ptrtoint fp128* %base to i64
|
|
|
|
%offset_uxtw = zext i32 %off32 to i64
|
|
|
|
%addrint1_uxtw = add i64 %addrint_uxtw, %offset_uxtw
|
|
|
|
%addr_uxtw = inttoptr i64 %addrint1_uxtw to fp128*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val_uxtw = load volatile fp128, fp128* %addr_uxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile fp128 %val_uxtw, fp128* %base
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw]
|
|
|
|
; CHECK-NOFP-NOT: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #4]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_sxtw = ptrtoint fp128* %base to i64
|
|
|
|
%offset_sxtw = sext i32 %off32 to i64
|
|
|
|
%addrint_sxtw = add i64 %base_sxtw, %offset_sxtw
|
|
|
|
%addr_sxtw = inttoptr i64 %addrint_sxtw to fp128*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64_sxtw = load volatile fp128, fp128* %addr_sxtw
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile fp128 %val64_sxtw, fp128* %base
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw]
|
|
|
|
; CHECK-NOFP-NOT: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #4]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_lsl = ptrtoint fp128* %base to i64
|
|
|
|
%addrint_lsl = add i64 %base_lsl, %off64
|
|
|
|
%addr_lsl = inttoptr i64 %addrint_lsl to fp128*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64_lsl = load volatile fp128, fp128* %addr_lsl
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile fp128 %val64_lsl, fp128* %base
|
|
|
|
; CHECK: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{x[0-9]+}}]
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK-NOFP-NOT: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #4]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
%base_uxtwN = ptrtoint fp128* %base to i64
|
|
|
|
%offset_uxtwN = zext i32 %off32 to i64
|
|
|
|
%offset2_uxtwN = shl i64 %offset_uxtwN, 4
|
|
|
|
%addrint_uxtwN = add i64 %base_uxtwN, %offset2_uxtwN
|
|
|
|
%addr_uxtwN = inttoptr i64 %addrint_uxtwN to fp128*
|
2015-02-27 22:17:42 +01:00
|
|
|
%val64 = load volatile fp128, fp128* %base
|
2013-01-31 13:12:40 +01:00
|
|
|
store volatile fp128 %val64, fp128* %addr_uxtwN
|
2014-04-15 16:00:19 +02:00
|
|
|
; CHECK: str {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, uxtw #4]
|
|
|
|
; CHECK-NOFP-NOT: ldr {{q[0-9]+}}, [{{x[0-9]+}}, {{[xw][0-9]+}}, sxtw #4]
|
2013-01-31 13:12:40 +01:00
|
|
|
ret void
|
|
|
|
}
|