2014-04-03 16:01:44 +00:00
|
|
|
; RUN: llc -mtriple=arm-eabi -float-abi=soft -mattr=+neon %s -o - | FileCheck %s
|
|
|
|
|
|
|
|
; RUN: llc -mtriple=arm-eabi -float-abi=soft -mattr=+neon -regalloc=basic %s -o - \
|
|
|
|
; RUN: | FileCheck %s
|
2009-09-01 04:27:10 +00:00
|
|
|
|
2010-11-01 22:04:05 +00:00
|
|
|
define <8 x i8> @vld1lanei8(i8* %A, <8 x i8>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1lanei8:
|
2010-11-01 23:40:51 +00:00
|
|
|
;Check the (default) alignment value.
|
2010-11-01 22:04:05 +00:00
|
|
|
;CHECK: vld1.8 {d16[3]}, [r0]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i8>, <8 x i8>* %B
|
|
|
|
%tmp2 = load i8, i8* %A, align 8
|
2010-11-01 22:04:05 +00:00
|
|
|
%tmp3 = insertelement <8 x i8> %tmp1, i8 %tmp2, i32 3
|
|
|
|
ret <8 x i8> %tmp3
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i16> @vld1lanei16(i16* %A, <4 x i16>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1lanei16:
|
2010-11-01 23:40:51 +00:00
|
|
|
;Check the alignment value. Max for this instruction is 16 bits:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld1.16 {d16[2]}, [r0:16]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x i16>, <4 x i16>* %B
|
|
|
|
%tmp2 = load i16, i16* %A, align 8
|
2010-11-01 22:04:05 +00:00
|
|
|
%tmp3 = insertelement <4 x i16> %tmp1, i16 %tmp2, i32 2
|
|
|
|
ret <4 x i16> %tmp3
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x i32> @vld1lanei32(i32* %A, <2 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1lanei32:
|
2010-11-03 16:24:53 +00:00
|
|
|
;Check the alignment value. Max for this instruction is 32 bits:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld1.32 {d16[1]}, [r0:32]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x i32>, <2 x i32>* %B
|
|
|
|
%tmp2 = load i32, i32* %A, align 8
|
2010-11-01 22:04:05 +00:00
|
|
|
%tmp3 = insertelement <2 x i32> %tmp1, i32 %tmp2, i32 1
|
|
|
|
ret <2 x i32> %tmp3
|
|
|
|
}
|
|
|
|
|
2011-10-27 22:39:16 +00:00
|
|
|
define <2 x i32> @vld1lanei32a32(i32* %A, <2 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1lanei32a32:
|
2011-10-27 22:39:16 +00:00
|
|
|
;Check the alignment value. Legal values are none or :32.
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld1.32 {d16[1]}, [r0:32]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x i32>, <2 x i32>* %B
|
|
|
|
%tmp2 = load i32, i32* %A, align 4
|
2011-10-27 22:39:16 +00:00
|
|
|
%tmp3 = insertelement <2 x i32> %tmp1, i32 %tmp2, i32 1
|
|
|
|
ret <2 x i32> %tmp3
|
|
|
|
}
|
|
|
|
|
2010-12-10 22:13:32 +00:00
|
|
|
define <2 x float> @vld1lanef(float* %A, <2 x float>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1lanef:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld1.32 {d16[1]}, [r0:32]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x float>, <2 x float>* %B
|
|
|
|
%tmp2 = load float, float* %A, align 4
|
2010-12-10 22:13:32 +00:00
|
|
|
%tmp3 = insertelement <2 x float> %tmp1, float %tmp2, i32 1
|
|
|
|
ret <2 x float> %tmp3
|
|
|
|
}
|
|
|
|
|
2010-11-01 23:40:46 +00:00
|
|
|
define <16 x i8> @vld1laneQi8(i8* %A, <16 x i8>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1laneQi8:
|
2010-11-01 23:40:46 +00:00
|
|
|
;CHECK: vld1.8 {d17[1]}, [r0]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <16 x i8>, <16 x i8>* %B
|
|
|
|
%tmp2 = load i8, i8* %A, align 8
|
2010-11-01 23:40:46 +00:00
|
|
|
%tmp3 = insertelement <16 x i8> %tmp1, i8 %tmp2, i32 9
|
|
|
|
ret <16 x i8> %tmp3
|
|
|
|
}
|
|
|
|
|
|
|
|
define <8 x i16> @vld1laneQi16(i16* %A, <8 x i16>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1laneQi16:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld1.16 {d17[1]}, [r0:16]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i16>, <8 x i16>* %B
|
|
|
|
%tmp2 = load i16, i16* %A, align 8
|
2010-11-01 23:40:46 +00:00
|
|
|
%tmp3 = insertelement <8 x i16> %tmp1, i16 %tmp2, i32 5
|
|
|
|
ret <8 x i16> %tmp3
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i32> @vld1laneQi32(i32* %A, <4 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1laneQi32:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld1.32 {d17[1]}, [r0:32]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x i32>, <4 x i32>* %B
|
|
|
|
%tmp2 = load i32, i32* %A, align 8
|
2010-11-01 23:40:46 +00:00
|
|
|
%tmp3 = insertelement <4 x i32> %tmp1, i32 %tmp2, i32 3
|
|
|
|
ret <4 x i32> %tmp3
|
|
|
|
}
|
|
|
|
|
2010-12-10 22:13:32 +00:00
|
|
|
define <4 x float> @vld1laneQf(float* %A, <4 x float>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld1laneQf:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld1.32 {d16[0]}, [r0:32]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x float>, <4 x float>* %B
|
|
|
|
%tmp2 = load float, float* %A
|
2010-12-10 22:13:32 +00:00
|
|
|
%tmp3 = insertelement <4 x float> %tmp1, float %tmp2, i32 0
|
|
|
|
ret <4 x float> %tmp3
|
|
|
|
}
|
|
|
|
|
2009-10-06 21:16:19 +00:00
|
|
|
%struct.__neon_int8x8x2_t = type { <8 x i8>, <8 x i8> }
|
|
|
|
%struct.__neon_int16x4x2_t = type { <4 x i16>, <4 x i16> }
|
|
|
|
%struct.__neon_int32x2x2_t = type { <2 x i32>, <2 x i32> }
|
|
|
|
%struct.__neon_float32x2x2_t = type { <2 x float>, <2 x float> }
|
2009-09-01 04:27:10 +00:00
|
|
|
|
2009-10-08 18:56:10 +00:00
|
|
|
%struct.__neon_int16x8x2_t = type { <8 x i16>, <8 x i16> }
|
|
|
|
%struct.__neon_int32x4x2_t = type { <4 x i32>, <4 x i32> }
|
|
|
|
%struct.__neon_float32x4x2_t = type { <4 x float>, <4 x float> }
|
|
|
|
|
2009-09-01 04:27:10 +00:00
|
|
|
define <8 x i8> @vld2lanei8(i8* %A, <8 x i8>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld2lanei8:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the alignment value. Max for this instruction is 16 bits:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld2.8 {d16[1], d17[1]}, [r0:16]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i8>, <8 x i8>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int8x8x2_t @llvm.arm.neon.vld2lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1, i32 4)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int8x8x2_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int8x8x2_t %tmp2, 1
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp5 = add <8 x i8> %tmp3, %tmp4
|
|
|
|
ret <8 x i8> %tmp5
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i16> @vld2lanei16(i16* %A, <4 x i16>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld2lanei16:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the alignment value. Max for this instruction is 32 bits:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld2.16 {d16[1], d17[1]}, [r0:32]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i16* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x i16>, <4 x i16>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int16x4x2_t @llvm.arm.neon.vld2lane.v4i16(i8* %tmp0, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1, i32 8)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int16x4x2_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int16x4x2_t %tmp2, 1
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp5 = add <4 x i16> %tmp3, %tmp4
|
|
|
|
ret <4 x i16> %tmp5
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x i32> @vld2lanei32(i32* %A, <2 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld2lanei32:
|
2009-09-01 04:27:10 +00:00
|
|
|
;CHECK: vld2.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i32* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x i32>, <2 x i32>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_int32x2x2_t @llvm.arm.neon.vld2lane.v2i32(i8* %tmp0, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1, i32 1)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int32x2x2_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int32x2x2_t %tmp2, 1
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp5 = add <2 x i32> %tmp3, %tmp4
|
|
|
|
ret <2 x i32> %tmp5
|
|
|
|
}
|
|
|
|
|
2011-02-07 17:43:21 +00:00
|
|
|
;Check for a post-increment updating load.
|
|
|
|
define <2 x i32> @vld2lanei32_update(i32** %ptr, <2 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld2lanei32_update:
|
2011-05-03 22:31:21 +00:00
|
|
|
;CHECK: vld2.32 {d16[1], d17[1]}, [{{r[0-9]+}}]!
|
2015-02-27 21:17:42 +00:00
|
|
|
%A = load i32*, i32** %ptr
|
2011-02-07 17:43:21 +00:00
|
|
|
%tmp0 = bitcast i32* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x i32>, <2 x i32>* %B
|
2011-02-07 17:43:21 +00:00
|
|
|
%tmp2 = call %struct.__neon_int32x2x2_t @llvm.arm.neon.vld2lane.v2i32(i8* %tmp0, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1, i32 1)
|
|
|
|
%tmp3 = extractvalue %struct.__neon_int32x2x2_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int32x2x2_t %tmp2, 1
|
|
|
|
%tmp5 = add <2 x i32> %tmp3, %tmp4
|
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp6 = getelementptr i32, i32* %A, i32 2
|
2011-02-07 17:43:21 +00:00
|
|
|
store i32* %tmp6, i32** %ptr
|
|
|
|
ret <2 x i32> %tmp5
|
|
|
|
}
|
|
|
|
|
2009-09-01 04:27:10 +00:00
|
|
|
define <2 x float> @vld2lanef(float* %A, <2 x float>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld2lanef:
|
2009-09-01 04:27:10 +00:00
|
|
|
;CHECK: vld2.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast float* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x float>, <2 x float>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_float32x2x2_t @llvm.arm.neon.vld2lane.v2f32(i8* %tmp0, <2 x float> %tmp1, <2 x float> %tmp1, i32 1, i32 1)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_float32x2x2_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_float32x2x2_t %tmp2, 1
|
2010-05-03 22:36:46 +00:00
|
|
|
%tmp5 = fadd <2 x float> %tmp3, %tmp4
|
2009-09-01 04:27:10 +00:00
|
|
|
ret <2 x float> %tmp5
|
|
|
|
}
|
|
|
|
|
2009-10-08 18:56:10 +00:00
|
|
|
define <8 x i16> @vld2laneQi16(i16* %A, <8 x i16>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld2laneQi16:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the (default) alignment.
|
2011-05-03 22:31:21 +00:00
|
|
|
;CHECK: vld2.16 {d17[1], d19[1]}, [{{r[0-9]+}}]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i16* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i16>, <8 x i16>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int16x8x2_t @llvm.arm.neon.vld2lane.v8i16(i8* %tmp0, <8 x i16> %tmp1, <8 x i16> %tmp1, i32 5, i32 1)
|
2009-10-08 18:56:10 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int16x8x2_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int16x8x2_t %tmp2, 1
|
|
|
|
%tmp5 = add <8 x i16> %tmp3, %tmp4
|
|
|
|
ret <8 x i16> %tmp5
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i32> @vld2laneQi32(i32* %A, <4 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld2laneQi32:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the alignment value. Max for this instruction is 64 bits:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld2.32 {d17[0], d19[0]}, [{{r[0-9]+}}:64]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i32* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x i32>, <4 x i32>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int32x4x2_t @llvm.arm.neon.vld2lane.v4i32(i8* %tmp0, <4 x i32> %tmp1, <4 x i32> %tmp1, i32 2, i32 16)
|
2009-10-08 18:56:10 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int32x4x2_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int32x4x2_t %tmp2, 1
|
|
|
|
%tmp5 = add <4 x i32> %tmp3, %tmp4
|
|
|
|
ret <4 x i32> %tmp5
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @vld2laneQf(float* %A, <4 x float>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld2laneQf:
|
2009-10-08 18:56:10 +00:00
|
|
|
;CHECK: vld2.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast float* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x float>, <4 x float>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_float32x4x2_t @llvm.arm.neon.vld2lane.v4f32(i8* %tmp0, <4 x float> %tmp1, <4 x float> %tmp1, i32 1, i32 1)
|
2009-10-08 18:56:10 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_float32x4x2_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_float32x4x2_t %tmp2, 1
|
2010-05-03 22:36:46 +00:00
|
|
|
%tmp5 = fadd <4 x float> %tmp3, %tmp4
|
2009-10-08 18:56:10 +00:00
|
|
|
ret <4 x float> %tmp5
|
|
|
|
}
|
|
|
|
|
2010-08-27 17:13:24 +00:00
|
|
|
declare %struct.__neon_int8x8x2_t @llvm.arm.neon.vld2lane.v8i8(i8*, <8 x i8>, <8 x i8>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int16x4x2_t @llvm.arm.neon.vld2lane.v4i16(i8*, <4 x i16>, <4 x i16>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int32x2x2_t @llvm.arm.neon.vld2lane.v2i32(i8*, <2 x i32>, <2 x i32>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_float32x2x2_t @llvm.arm.neon.vld2lane.v2f32(i8*, <2 x float>, <2 x float>, i32, i32) nounwind readonly
|
2009-09-01 04:27:10 +00:00
|
|
|
|
2010-08-27 17:13:24 +00:00
|
|
|
declare %struct.__neon_int16x8x2_t @llvm.arm.neon.vld2lane.v8i16(i8*, <8 x i16>, <8 x i16>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int32x4x2_t @llvm.arm.neon.vld2lane.v4i32(i8*, <4 x i32>, <4 x i32>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_float32x4x2_t @llvm.arm.neon.vld2lane.v4f32(i8*, <4 x float>, <4 x float>, i32, i32) nounwind readonly
|
2009-10-08 18:56:10 +00:00
|
|
|
|
2009-10-06 21:16:19 +00:00
|
|
|
%struct.__neon_int8x8x3_t = type { <8 x i8>, <8 x i8>, <8 x i8> }
|
|
|
|
%struct.__neon_int16x4x3_t = type { <4 x i16>, <4 x i16>, <4 x i16> }
|
|
|
|
%struct.__neon_int32x2x3_t = type { <2 x i32>, <2 x i32>, <2 x i32> }
|
|
|
|
%struct.__neon_float32x2x3_t = type { <2 x float>, <2 x float>, <2 x float> }
|
2009-09-01 04:27:10 +00:00
|
|
|
|
2009-10-08 22:27:33 +00:00
|
|
|
%struct.__neon_int16x8x3_t = type { <8 x i16>, <8 x i16>, <8 x i16> }
|
|
|
|
%struct.__neon_int32x4x3_t = type { <4 x i32>, <4 x i32>, <4 x i32> }
|
|
|
|
%struct.__neon_float32x4x3_t = type { <4 x float>, <4 x float>, <4 x float> }
|
|
|
|
|
2009-09-01 04:27:10 +00:00
|
|
|
define <8 x i8> @vld3lanei8(i8* %A, <8 x i8>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld3lanei8:
|
2009-09-01 04:27:10 +00:00
|
|
|
;CHECK: vld3.8
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i8>, <8 x i8>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_int8x8x3_t @llvm.arm.neon.vld3lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1, i32 1)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int8x8x3_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int8x8x3_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int8x8x3_t %tmp2, 2
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp6 = add <8 x i8> %tmp3, %tmp4
|
|
|
|
%tmp7 = add <8 x i8> %tmp5, %tmp6
|
|
|
|
ret <8 x i8> %tmp7
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i16> @vld3lanei16(i16* %A, <4 x i16>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld3lanei16:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the (default) alignment value. VLD3 does not support alignment.
|
2011-05-16 23:50:05 +00:00
|
|
|
;CHECK: vld3.16 {d{{.*}}[1], d{{.*}}[1], d{{.*}}[1]}, [{{r[0-9]+}}]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i16* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x i16>, <4 x i16>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int16x4x3_t @llvm.arm.neon.vld3lane.v4i16(i8* %tmp0, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1, i32 8)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int16x4x3_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int16x4x3_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int16x4x3_t %tmp2, 2
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp6 = add <4 x i16> %tmp3, %tmp4
|
|
|
|
%tmp7 = add <4 x i16> %tmp5, %tmp6
|
|
|
|
ret <4 x i16> %tmp7
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x i32> @vld3lanei32(i32* %A, <2 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld3lanei32:
|
2009-09-01 04:27:10 +00:00
|
|
|
;CHECK: vld3.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i32* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x i32>, <2 x i32>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_int32x2x3_t @llvm.arm.neon.vld3lane.v2i32(i8* %tmp0, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1, i32 1)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int32x2x3_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int32x2x3_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int32x2x3_t %tmp2, 2
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp6 = add <2 x i32> %tmp3, %tmp4
|
|
|
|
%tmp7 = add <2 x i32> %tmp5, %tmp6
|
|
|
|
ret <2 x i32> %tmp7
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x float> @vld3lanef(float* %A, <2 x float>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld3lanef:
|
2009-09-01 04:27:10 +00:00
|
|
|
;CHECK: vld3.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast float* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x float>, <2 x float>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_float32x2x3_t @llvm.arm.neon.vld3lane.v2f32(i8* %tmp0, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, i32 1, i32 1)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_float32x2x3_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_float32x2x3_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_float32x2x3_t %tmp2, 2
|
2010-05-03 22:36:46 +00:00
|
|
|
%tmp6 = fadd <2 x float> %tmp3, %tmp4
|
|
|
|
%tmp7 = fadd <2 x float> %tmp5, %tmp6
|
2009-09-01 04:27:10 +00:00
|
|
|
ret <2 x float> %tmp7
|
|
|
|
}
|
|
|
|
|
2009-10-08 22:27:33 +00:00
|
|
|
define <8 x i16> @vld3laneQi16(i16* %A, <8 x i16>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld3laneQi16:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the (default) alignment value. VLD3 does not support alignment.
|
2011-05-16 23:50:05 +00:00
|
|
|
;CHECK: vld3.16 {d{{.*}}[1], d{{.*}}[1], d{{.*}}[1]}, [{{r[0-9]+}}]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i16* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i16>, <8 x i16>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int16x8x3_t @llvm.arm.neon.vld3lane.v8i16(i8* %tmp0, <8 x i16> %tmp1, <8 x i16> %tmp1, <8 x i16> %tmp1, i32 1, i32 8)
|
2009-10-08 22:27:33 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int16x8x3_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int16x8x3_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int16x8x3_t %tmp2, 2
|
|
|
|
%tmp6 = add <8 x i16> %tmp3, %tmp4
|
|
|
|
%tmp7 = add <8 x i16> %tmp5, %tmp6
|
|
|
|
ret <8 x i16> %tmp7
|
|
|
|
}
|
|
|
|
|
2011-02-07 17:43:21 +00:00
|
|
|
;Check for a post-increment updating load with register increment.
|
|
|
|
define <8 x i16> @vld3laneQi16_update(i16** %ptr, <8 x i16>* %B, i32 %inc) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld3laneQi16_update:
|
2011-05-16 23:50:05 +00:00
|
|
|
;CHECK: vld3.16 {d{{.*}}[1], d{{.*}}[1], d{{.*}}[1]}, [{{r[0-9]+}}], {{r[0-9]+}}
|
2015-02-27 21:17:42 +00:00
|
|
|
%A = load i16*, i16** %ptr
|
2011-02-07 17:43:21 +00:00
|
|
|
%tmp0 = bitcast i16* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i16>, <8 x i16>* %B
|
2011-02-07 17:43:21 +00:00
|
|
|
%tmp2 = call %struct.__neon_int16x8x3_t @llvm.arm.neon.vld3lane.v8i16(i8* %tmp0, <8 x i16> %tmp1, <8 x i16> %tmp1, <8 x i16> %tmp1, i32 1, i32 8)
|
|
|
|
%tmp3 = extractvalue %struct.__neon_int16x8x3_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int16x8x3_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int16x8x3_t %tmp2, 2
|
|
|
|
%tmp6 = add <8 x i16> %tmp3, %tmp4
|
|
|
|
%tmp7 = add <8 x i16> %tmp5, %tmp6
|
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp8 = getelementptr i16, i16* %A, i32 %inc
|
2011-02-07 17:43:21 +00:00
|
|
|
store i16* %tmp8, i16** %ptr
|
|
|
|
ret <8 x i16> %tmp7
|
|
|
|
}
|
|
|
|
|
2009-10-08 22:27:33 +00:00
|
|
|
define <4 x i32> @vld3laneQi32(i32* %A, <4 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld3laneQi32:
|
2009-10-08 22:27:33 +00:00
|
|
|
;CHECK: vld3.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i32* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x i32>, <4 x i32>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_int32x4x3_t @llvm.arm.neon.vld3lane.v4i32(i8* %tmp0, <4 x i32> %tmp1, <4 x i32> %tmp1, <4 x i32> %tmp1, i32 3, i32 1)
|
2009-10-08 22:27:33 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int32x4x3_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int32x4x3_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int32x4x3_t %tmp2, 2
|
|
|
|
%tmp6 = add <4 x i32> %tmp3, %tmp4
|
|
|
|
%tmp7 = add <4 x i32> %tmp5, %tmp6
|
|
|
|
ret <4 x i32> %tmp7
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @vld3laneQf(float* %A, <4 x float>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld3laneQf:
|
2009-10-08 22:27:33 +00:00
|
|
|
;CHECK: vld3.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast float* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x float>, <4 x float>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_float32x4x3_t @llvm.arm.neon.vld3lane.v4f32(i8* %tmp0, <4 x float> %tmp1, <4 x float> %tmp1, <4 x float> %tmp1, i32 1, i32 1)
|
2009-10-08 22:27:33 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_float32x4x3_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_float32x4x3_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_float32x4x3_t %tmp2, 2
|
2010-05-03 22:36:46 +00:00
|
|
|
%tmp6 = fadd <4 x float> %tmp3, %tmp4
|
|
|
|
%tmp7 = fadd <4 x float> %tmp5, %tmp6
|
2009-10-08 22:27:33 +00:00
|
|
|
ret <4 x float> %tmp7
|
|
|
|
}
|
|
|
|
|
2010-08-27 17:13:24 +00:00
|
|
|
declare %struct.__neon_int8x8x3_t @llvm.arm.neon.vld3lane.v8i8(i8*, <8 x i8>, <8 x i8>, <8 x i8>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int16x4x3_t @llvm.arm.neon.vld3lane.v4i16(i8*, <4 x i16>, <4 x i16>, <4 x i16>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int32x2x3_t @llvm.arm.neon.vld3lane.v2i32(i8*, <2 x i32>, <2 x i32>, <2 x i32>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_float32x2x3_t @llvm.arm.neon.vld3lane.v2f32(i8*, <2 x float>, <2 x float>, <2 x float>, i32, i32) nounwind readonly
|
2009-09-01 04:27:10 +00:00
|
|
|
|
2010-08-27 17:13:24 +00:00
|
|
|
declare %struct.__neon_int16x8x3_t @llvm.arm.neon.vld3lane.v8i16(i8*, <8 x i16>, <8 x i16>, <8 x i16>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int32x4x3_t @llvm.arm.neon.vld3lane.v4i32(i8*, <4 x i32>, <4 x i32>, <4 x i32>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_float32x4x3_t @llvm.arm.neon.vld3lane.v4f32(i8*, <4 x float>, <4 x float>, <4 x float>, i32, i32) nounwind readonly
|
2009-10-08 22:27:33 +00:00
|
|
|
|
2009-10-06 21:16:19 +00:00
|
|
|
%struct.__neon_int8x8x4_t = type { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> }
|
|
|
|
%struct.__neon_int16x4x4_t = type { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> }
|
|
|
|
%struct.__neon_int32x2x4_t = type { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> }
|
|
|
|
%struct.__neon_float32x2x4_t = type { <2 x float>, <2 x float>, <2 x float>, <2 x float> }
|
2009-09-01 04:27:10 +00:00
|
|
|
|
2009-10-08 22:53:57 +00:00
|
|
|
%struct.__neon_int16x8x4_t = type { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> }
|
|
|
|
%struct.__neon_int32x4x4_t = type { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> }
|
|
|
|
%struct.__neon_float32x4x4_t = type { <4 x float>, <4 x float>, <4 x float>, <4 x float> }
|
|
|
|
|
2009-09-01 04:27:10 +00:00
|
|
|
define <8 x i8> @vld4lanei8(i8* %A, <8 x i8>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld4lanei8:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the alignment value. Max for this instruction is 32 bits:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld4.8 {d{{.*}}[1], d{{.*}}[1], d{{.*}}[1], d{{.*}}[1]}, [{{r[0-9]+}}:32]
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i8>, <8 x i8>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int8x8x4_t @llvm.arm.neon.vld4lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1, i32 8)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int8x8x4_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int8x8x4_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int8x8x4_t %tmp2, 2
|
|
|
|
%tmp6 = extractvalue %struct.__neon_int8x8x4_t %tmp2, 3
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp7 = add <8 x i8> %tmp3, %tmp4
|
|
|
|
%tmp8 = add <8 x i8> %tmp5, %tmp6
|
|
|
|
%tmp9 = add <8 x i8> %tmp7, %tmp8
|
|
|
|
ret <8 x i8> %tmp9
|
|
|
|
}
|
|
|
|
|
2011-02-07 17:43:21 +00:00
|
|
|
;Check for a post-increment updating load.
|
|
|
|
define <8 x i8> @vld4lanei8_update(i8** %ptr, <8 x i8>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld4lanei8_update:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld4.8 {d16[1], d17[1], d18[1], d19[1]}, [{{r[0-9]+}}:32]!
|
2015-02-27 21:17:42 +00:00
|
|
|
%A = load i8*, i8** %ptr
|
|
|
|
%tmp1 = load <8 x i8>, <8 x i8>* %B
|
2011-02-07 17:43:21 +00:00
|
|
|
%tmp2 = call %struct.__neon_int8x8x4_t @llvm.arm.neon.vld4lane.v8i8(i8* %A, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, <8 x i8> %tmp1, i32 1, i32 8)
|
|
|
|
%tmp3 = extractvalue %struct.__neon_int8x8x4_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int8x8x4_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int8x8x4_t %tmp2, 2
|
|
|
|
%tmp6 = extractvalue %struct.__neon_int8x8x4_t %tmp2, 3
|
|
|
|
%tmp7 = add <8 x i8> %tmp3, %tmp4
|
|
|
|
%tmp8 = add <8 x i8> %tmp5, %tmp6
|
|
|
|
%tmp9 = add <8 x i8> %tmp7, %tmp8
|
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp10 = getelementptr i8, i8* %A, i32 4
|
2011-02-07 17:43:21 +00:00
|
|
|
store i8* %tmp10, i8** %ptr
|
|
|
|
ret <8 x i8> %tmp9
|
|
|
|
}
|
|
|
|
|
2009-09-01 04:27:10 +00:00
|
|
|
define <4 x i16> @vld4lanei16(i16* %A, <4 x i16>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld4lanei16:
|
2010-12-10 19:37:42 +00:00
|
|
|
;Check that a power-of-two alignment smaller than the total size of the memory
|
|
|
|
;being loaded is ignored.
|
2011-05-03 22:31:21 +00:00
|
|
|
;CHECK: vld4.16 {d16[1], d17[1], d18[1], d19[1]}, [{{r[0-9]+}}]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i16* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x i16>, <4 x i16>* %B
|
2010-12-10 19:37:42 +00:00
|
|
|
%tmp2 = call %struct.__neon_int16x4x4_t @llvm.arm.neon.vld4lane.v4i16(i8* %tmp0, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, <4 x i16> %tmp1, i32 1, i32 4)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int16x4x4_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int16x4x4_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int16x4x4_t %tmp2, 2
|
|
|
|
%tmp6 = extractvalue %struct.__neon_int16x4x4_t %tmp2, 3
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp7 = add <4 x i16> %tmp3, %tmp4
|
|
|
|
%tmp8 = add <4 x i16> %tmp5, %tmp6
|
|
|
|
%tmp9 = add <4 x i16> %tmp7, %tmp8
|
|
|
|
ret <4 x i16> %tmp9
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x i32> @vld4lanei32(i32* %A, <2 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld4lanei32:
|
2010-12-10 19:37:42 +00:00
|
|
|
;Check the alignment value. An 8-byte alignment is allowed here even though
|
|
|
|
;it is smaller than the total size of the memory being loaded.
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld4.32 {d16[1], d17[1], d18[1], d19[1]}, [{{r[0-9]+}}:64]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i32* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x i32>, <2 x i32>* %B
|
2010-12-10 19:37:42 +00:00
|
|
|
%tmp2 = call %struct.__neon_int32x2x4_t @llvm.arm.neon.vld4lane.v2i32(i8* %tmp0, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, <2 x i32> %tmp1, i32 1, i32 8)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int32x2x4_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int32x2x4_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int32x2x4_t %tmp2, 2
|
|
|
|
%tmp6 = extractvalue %struct.__neon_int32x2x4_t %tmp2, 3
|
2009-09-01 04:27:10 +00:00
|
|
|
%tmp7 = add <2 x i32> %tmp3, %tmp4
|
|
|
|
%tmp8 = add <2 x i32> %tmp5, %tmp6
|
|
|
|
%tmp9 = add <2 x i32> %tmp7, %tmp8
|
|
|
|
ret <2 x i32> %tmp9
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x float> @vld4lanef(float* %A, <2 x float>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld4lanef:
|
2009-09-01 04:27:10 +00:00
|
|
|
;CHECK: vld4.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast float* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <2 x float>, <2 x float>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_float32x2x4_t @llvm.arm.neon.vld4lane.v2f32(i8* %tmp0, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, <2 x float> %tmp1, i32 1, i32 1)
|
2009-10-06 21:16:19 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_float32x2x4_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_float32x2x4_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_float32x2x4_t %tmp2, 2
|
|
|
|
%tmp6 = extractvalue %struct.__neon_float32x2x4_t %tmp2, 3
|
2010-05-03 22:36:46 +00:00
|
|
|
%tmp7 = fadd <2 x float> %tmp3, %tmp4
|
|
|
|
%tmp8 = fadd <2 x float> %tmp5, %tmp6
|
|
|
|
%tmp9 = fadd <2 x float> %tmp7, %tmp8
|
2009-09-01 04:27:10 +00:00
|
|
|
ret <2 x float> %tmp9
|
|
|
|
}
|
|
|
|
|
2009-10-08 22:53:57 +00:00
|
|
|
define <8 x i16> @vld4laneQi16(i16* %A, <8 x i16>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld4laneQi16:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the alignment value. Max for this instruction is 64 bits:
|
2013-02-22 10:01:33 +00:00
|
|
|
;CHECK: vld4.16 {d16[1], d18[1], d20[1], d22[1]}, [{{r[0-9]+}}:64]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i16* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <8 x i16>, <8 x i16>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int16x8x4_t @llvm.arm.neon.vld4lane.v8i16(i8* %tmp0, <8 x i16> %tmp1, <8 x i16> %tmp1, <8 x i16> %tmp1, <8 x i16> %tmp1, i32 1, i32 16)
|
2009-10-08 22:53:57 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int16x8x4_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int16x8x4_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int16x8x4_t %tmp2, 2
|
|
|
|
%tmp6 = extractvalue %struct.__neon_int16x8x4_t %tmp2, 3
|
|
|
|
%tmp7 = add <8 x i16> %tmp3, %tmp4
|
|
|
|
%tmp8 = add <8 x i16> %tmp5, %tmp6
|
|
|
|
%tmp9 = add <8 x i16> %tmp7, %tmp8
|
|
|
|
ret <8 x i16> %tmp9
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i32> @vld4laneQi32(i32* %A, <4 x i32>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld4laneQi32:
|
2010-10-19 00:16:32 +00:00
|
|
|
;Check the (default) alignment.
|
2011-05-03 22:31:21 +00:00
|
|
|
;CHECK: vld4.32 {d17[0], d19[0], d21[0], d23[0]}, [{{r[0-9]+}}]
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast i32* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x i32>, <4 x i32>* %B
|
2010-10-19 00:16:32 +00:00
|
|
|
%tmp2 = call %struct.__neon_int32x4x4_t @llvm.arm.neon.vld4lane.v4i32(i8* %tmp0, <4 x i32> %tmp1, <4 x i32> %tmp1, <4 x i32> %tmp1, <4 x i32> %tmp1, i32 2, i32 1)
|
2009-10-08 22:53:57 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int32x4x4_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int32x4x4_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int32x4x4_t %tmp2, 2
|
|
|
|
%tmp6 = extractvalue %struct.__neon_int32x4x4_t %tmp2, 3
|
|
|
|
%tmp7 = add <4 x i32> %tmp3, %tmp4
|
|
|
|
%tmp8 = add <4 x i32> %tmp5, %tmp6
|
|
|
|
%tmp9 = add <4 x i32> %tmp7, %tmp8
|
|
|
|
ret <4 x i32> %tmp9
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @vld4laneQf(float* %A, <4 x float>* %B) nounwind {
|
2013-07-14 06:24:09 +00:00
|
|
|
;CHECK-LABEL: vld4laneQf:
|
2009-10-08 22:53:57 +00:00
|
|
|
;CHECK: vld4.32
|
2010-04-20 00:17:16 +00:00
|
|
|
%tmp0 = bitcast float* %A to i8*
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load <4 x float>, <4 x float>* %B
|
2010-08-27 17:13:24 +00:00
|
|
|
%tmp2 = call %struct.__neon_float32x4x4_t @llvm.arm.neon.vld4lane.v4f32(i8* %tmp0, <4 x float> %tmp1, <4 x float> %tmp1, <4 x float> %tmp1, <4 x float> %tmp1, i32 1, i32 1)
|
2009-10-08 22:53:57 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_float32x4x4_t %tmp2, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_float32x4x4_t %tmp2, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_float32x4x4_t %tmp2, 2
|
|
|
|
%tmp6 = extractvalue %struct.__neon_float32x4x4_t %tmp2, 3
|
2010-05-03 22:36:46 +00:00
|
|
|
%tmp7 = fadd <4 x float> %tmp3, %tmp4
|
|
|
|
%tmp8 = fadd <4 x float> %tmp5, %tmp6
|
|
|
|
%tmp9 = fadd <4 x float> %tmp7, %tmp8
|
2009-10-08 22:53:57 +00:00
|
|
|
ret <4 x float> %tmp9
|
|
|
|
}
|
|
|
|
|
2010-08-27 17:13:24 +00:00
|
|
|
declare %struct.__neon_int8x8x4_t @llvm.arm.neon.vld4lane.v8i8(i8*, <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int16x4x4_t @llvm.arm.neon.vld4lane.v4i16(i8*, <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int32x2x4_t @llvm.arm.neon.vld4lane.v2i32(i8*, <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_float32x2x4_t @llvm.arm.neon.vld4lane.v2f32(i8*, <2 x float>, <2 x float>, <2 x float>, <2 x float>, i32, i32) nounwind readonly
|
2009-10-08 22:53:57 +00:00
|
|
|
|
2010-08-27 17:13:24 +00:00
|
|
|
declare %struct.__neon_int16x8x4_t @llvm.arm.neon.vld4lane.v8i16(i8*, <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_int32x4x4_t @llvm.arm.neon.vld4lane.v4i32(i8*, <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32>, i32, i32) nounwind readonly
|
|
|
|
declare %struct.__neon_float32x4x4_t @llvm.arm.neon.vld4lane.v4f32(i8*, <4 x float>, <4 x float>, <4 x float>, <4 x float>, i32, i32) nounwind readonly
|
2010-12-17 01:21:12 +00:00
|
|
|
|
|
|
|
; Radar 8776599: If one of the operands to a QQQQ REG_SEQUENCE is a register
|
|
|
|
; in the QPR_VFP2 regclass, it needs to be copied to a QPR regclass because
|
|
|
|
; we don't currently have a QQQQ_VFP2 super-regclass. (The "0" for the low
|
|
|
|
; part of %ins67 is supposed to be loaded by a VLDRS instruction in this test.)
|
2011-04-19 00:04:03 +00:00
|
|
|
define <8 x i16> @test_qqqq_regsequence_subreg([6 x i64] %b) nounwind {
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: test_qqqq_regsequence_subreg:
|
2010-12-17 01:21:12 +00:00
|
|
|
;CHECK: vld3.16
|
|
|
|
%tmp63 = extractvalue [6 x i64] %b, 5
|
|
|
|
%tmp64 = zext i64 %tmp63 to i128
|
|
|
|
%tmp65 = shl i128 %tmp64, 64
|
|
|
|
%ins67 = or i128 %tmp65, 0
|
|
|
|
%tmp78 = bitcast i128 %ins67 to <8 x i16>
|
|
|
|
%vld3_lane = tail call %struct.__neon_int16x8x3_t @llvm.arm.neon.vld3lane.v8i16(i8* undef, <8 x i16> undef, <8 x i16> undef, <8 x i16> %tmp78, i32 1, i32 2)
|
2011-04-19 00:04:03 +00:00
|
|
|
%tmp3 = extractvalue %struct.__neon_int16x8x3_t %vld3_lane, 0
|
|
|
|
%tmp4 = extractvalue %struct.__neon_int16x8x3_t %vld3_lane, 1
|
|
|
|
%tmp5 = extractvalue %struct.__neon_int16x8x3_t %vld3_lane, 2
|
|
|
|
%tmp6 = add <8 x i16> %tmp3, %tmp4
|
|
|
|
%tmp7 = add <8 x i16> %tmp5, %tmp6
|
|
|
|
ret <8 x i16> %tmp7
|
2010-12-17 01:21:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.trap() nounwind
|