2016-04-04 02:59:42 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-macosx10.6.6 -mattr=+sse4.1 | FileCheck %s
|
2011-06-01 23:50:29 +08:00
|
|
|
|
|
|
|
%0 = type { double }
|
|
|
|
%union.anon = type { float }
|
|
|
|
|
|
|
|
define i32 @double_signbit(double %d1) nounwind uwtable readnone ssp {
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-LABEL: double_signbit:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0: ## %entry
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-NEXT: movsd %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: movsd %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: movmskpd %xmm0, %eax
|
|
|
|
; CHECK-NEXT: andl $1, %eax
|
|
|
|
; CHECK-NEXT: retq
|
2011-06-01 23:50:29 +08:00
|
|
|
entry:
|
|
|
|
%__x.addr.i = alloca double, align 8
|
|
|
|
%__u.i = alloca %0, align 8
|
|
|
|
%0 = bitcast double* %__x.addr.i to i8*
|
|
|
|
%1 = bitcast %0* %__u.i to i8*
|
|
|
|
store double %d1, double* %__x.addr.i, align 8
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%__f.i = getelementptr inbounds %0, %0* %__u.i, i64 0, i32 0
|
2011-06-01 23:50:29 +08:00
|
|
|
store double %d1, double* %__f.i, align 8
|
|
|
|
%tmp = bitcast double %d1 to i64
|
|
|
|
%tmp1 = lshr i64 %tmp, 63
|
|
|
|
%shr.i = trunc i64 %tmp1 to i32
|
|
|
|
ret i32 %shr.i
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @double_add_signbit(double %d1, double %d2) nounwind uwtable readnone ssp {
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-LABEL: double_add_signbit:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0: ## %entry
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-NEXT: addsd %xmm1, %xmm0
|
|
|
|
; CHECK-NEXT: movsd %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: movsd %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: movmskpd %xmm0, %eax
|
|
|
|
; CHECK-NEXT: andl $1, %eax
|
|
|
|
; CHECK-NEXT: retq
|
2011-06-01 23:50:29 +08:00
|
|
|
entry:
|
|
|
|
%__x.addr.i = alloca double, align 8
|
|
|
|
%__u.i = alloca %0, align 8
|
|
|
|
%add = fadd double %d1, %d2
|
|
|
|
%0 = bitcast double* %__x.addr.i to i8*
|
|
|
|
%1 = bitcast %0* %__u.i to i8*
|
|
|
|
store double %add, double* %__x.addr.i, align 8
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%__f.i = getelementptr inbounds %0, %0* %__u.i, i64 0, i32 0
|
2011-06-01 23:50:29 +08:00
|
|
|
store double %add, double* %__f.i, align 8
|
|
|
|
%tmp = bitcast double %add to i64
|
|
|
|
%tmp1 = lshr i64 %tmp, 63
|
|
|
|
%shr.i = trunc i64 %tmp1 to i32
|
|
|
|
ret i32 %shr.i
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @float_signbit(float %f1) nounwind uwtable readnone ssp {
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-LABEL: float_signbit:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0: ## %entry
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-NEXT: movss %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: movss %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: movmskps %xmm0, %eax
|
|
|
|
; CHECK-NEXT: andl $1, %eax
|
|
|
|
; CHECK-NEXT: retq
|
2011-06-01 23:50:29 +08:00
|
|
|
entry:
|
|
|
|
%__x.addr.i = alloca float, align 4
|
|
|
|
%__u.i = alloca %union.anon, align 4
|
|
|
|
%0 = bitcast float* %__x.addr.i to i8*
|
|
|
|
%1 = bitcast %union.anon* %__u.i to i8*
|
|
|
|
store float %f1, float* %__x.addr.i, align 4
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%__f.i = getelementptr inbounds %union.anon, %union.anon* %__u.i, i64 0, i32 0
|
2011-06-01 23:50:29 +08:00
|
|
|
store float %f1, float* %__f.i, align 4
|
|
|
|
%2 = bitcast float %f1 to i32
|
|
|
|
%shr.i = lshr i32 %2, 31
|
|
|
|
ret i32 %shr.i
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @float_add_signbit(float %f1, float %f2) nounwind uwtable readnone ssp {
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-LABEL: float_add_signbit:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0: ## %entry
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-NEXT: addss %xmm1, %xmm0
|
|
|
|
; CHECK-NEXT: movss %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: movss %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: movmskps %xmm0, %eax
|
|
|
|
; CHECK-NEXT: andl $1, %eax
|
|
|
|
; CHECK-NEXT: retq
|
2011-06-01 23:50:29 +08:00
|
|
|
entry:
|
|
|
|
%__x.addr.i = alloca float, align 4
|
|
|
|
%__u.i = alloca %union.anon, align 4
|
|
|
|
%add = fadd float %f1, %f2
|
|
|
|
%0 = bitcast float* %__x.addr.i to i8*
|
|
|
|
%1 = bitcast %union.anon* %__u.i to i8*
|
|
|
|
store float %add, float* %__x.addr.i, align 4
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%__f.i = getelementptr inbounds %union.anon, %union.anon* %__u.i, i64 0, i32 0
|
2011-06-01 23:50:29 +08:00
|
|
|
store float %add, float* %__f.i, align 4
|
|
|
|
%2 = bitcast float %add to i32
|
|
|
|
%shr.i = lshr i32 %2, 31
|
|
|
|
ret i32 %shr.i
|
|
|
|
}
|
2011-10-08 01:21:44 +08:00
|
|
|
|
2011-12-15 10:07:20 +08:00
|
|
|
; PR11570
|
|
|
|
; FIXME: This should also use movmskps; we don't form the FGETSIGN node
|
|
|
|
; in this case, though.
|
2016-04-04 02:59:42 +08:00
|
|
|
define void @float_call_signbit(double %n) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: float_call_signbit:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0: ## %entry
|
2017-04-26 15:08:44 +08:00
|
|
|
; CHECK-NEXT: movq %xmm0, %rdi
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-NEXT: shrq $63, %rdi
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: ## kill: def $edi killed $edi killed $rdi
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-NEXT: jmp _float_call_signbit_callee ## TAILCALL
|
|
|
|
entry:
|
2011-12-15 10:07:20 +08:00
|
|
|
%t0 = bitcast double %n to i64
|
|
|
|
%tobool.i.i.i.i = icmp slt i64 %t0, 0
|
|
|
|
tail call void @float_call_signbit_callee(i1 zeroext %tobool.i.i.i.i)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
declare void @float_call_signbit_callee(i1 zeroext)
|
|
|
|
|
2018-12-05 00:01:25 +08:00
|
|
|
; Known zeros
|
|
|
|
define i32 @knownbits_v2f64(<2 x double> %x) {
|
|
|
|
; CHECK-LABEL: knownbits_v2f64:
|
|
|
|
; CHECK: ## %bb.0:
|
|
|
|
; CHECK-NEXT: movmskpd %xmm0, %eax
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%1 = tail call i32 @llvm.x86.sse2.movmsk.pd(<2 x double> %x)
|
|
|
|
%2 = and i32 %1, 3
|
|
|
|
ret i32 %2
|
|
|
|
}
|
|
|
|
|
|
|
|
; Don't demand any movmsk signbits -> zero
|
|
|
|
define i32 @demandedbits_v16i8(<16 x i8> %x) {
|
|
|
|
; CHECK-LABEL: demandedbits_v16i8:
|
|
|
|
; CHECK: ## %bb.0:
|
|
|
|
; CHECK-NEXT: xorl %eax, %eax
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%1 = tail call i32 @llvm.x86.sse2.pmovmskb.128(<16 x i8> %x)
|
|
|
|
%2 = and i32 %1, 65536
|
|
|
|
ret i32 %2
|
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:32 +08:00
|
|
|
; Simplify demanded vector elts
|
2018-12-05 00:01:25 +08:00
|
|
|
define i32 @demandedelts_v4f32(<4 x float> %x) {
|
|
|
|
; CHECK-LABEL: demandedelts_v4f32:
|
|
|
|
; CHECK: ## %bb.0:
|
|
|
|
; CHECK-NEXT: movmskps %xmm0, %eax
|
|
|
|
; CHECK-NEXT: andl $1, %eax
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%1 = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> zeroinitializer
|
|
|
|
%2 = tail call i32 @llvm.x86.sse.movmsk.ps(<4 x float> %1)
|
|
|
|
%3 = and i32 %2, 1
|
|
|
|
ret i32 %3
|
|
|
|
}
|
2011-12-15 10:07:20 +08:00
|
|
|
|
2011-10-08 01:21:44 +08:00
|
|
|
; rdar://10247336
|
|
|
|
; movmskp{s|d} only set low 4/2 bits, high bits are known zero
|
|
|
|
|
|
|
|
define i32 @t1(<4 x float> %x, i32* nocapture %indexTable) nounwind uwtable readonly ssp {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0: ## %entry
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-NEXT: movmskps %xmm0, %eax
|
|
|
|
; CHECK-NEXT: movl (%rdi,%rax,4), %eax
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
entry:
|
2011-10-08 01:21:44 +08:00
|
|
|
%0 = tail call i32 @llvm.x86.sse.movmsk.ps(<4 x float> %x) nounwind
|
|
|
|
%idxprom = sext i32 %0 to i64
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%arrayidx = getelementptr inbounds i32, i32* %indexTable, i64 %idxprom
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i32, i32* %arrayidx, align 4
|
2011-10-08 01:21:44 +08:00
|
|
|
ret i32 %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @t2(<4 x float> %x, i32* nocapture %indexTable) nounwind uwtable readonly ssp {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0: ## %entry
|
2016-04-04 02:59:42 +08:00
|
|
|
; CHECK-NEXT: movmskpd %xmm0, %eax
|
|
|
|
; CHECK-NEXT: movl (%rdi,%rax,4), %eax
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
entry:
|
2011-10-08 01:21:44 +08:00
|
|
|
%0 = bitcast <4 x float> %x to <2 x double>
|
|
|
|
%1 = tail call i32 @llvm.x86.sse2.movmsk.pd(<2 x double> %0) nounwind
|
|
|
|
%idxprom = sext i32 %1 to i64
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%arrayidx = getelementptr inbounds i32, i32* %indexTable, i64 %idxprom
|
2015-02-28 05:17:42 +08:00
|
|
|
%2 = load i32, i32* %arrayidx, align 4
|
2011-10-08 01:21:44 +08:00
|
|
|
ret i32 %2
|
|
|
|
}
|
|
|
|
|
2018-12-05 00:01:25 +08:00
|
|
|
declare i32 @llvm.x86.sse2.pmovmskb.128(<16 x i8>) nounwind readnone
|
2011-10-08 01:21:44 +08:00
|
|
|
declare i32 @llvm.x86.sse2.movmsk.pd(<2 x double>) nounwind readnone
|
|
|
|
declare i32 @llvm.x86.sse.movmsk.ps(<4 x float>) nounwind readnone
|