2016-02-17 06:33:27 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+avx | FileCheck %s
|
2014-10-21 07:13:30 +08:00
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
|
|
|
; For this test we used to optimize the <i1 true, i1 false, i1 false, i1 true>
|
|
|
|
; mask into <i32 2147483648, i32 0, i32 0, i32 2147483648> because we thought
|
|
|
|
; we would lower that into a blend where only the high bit is relevant.
|
|
|
|
; However, since the whole mask is constant, this is simplified incorrectly
|
|
|
|
; by the generic code, because it was expecting -1 in place of 2147483648.
|
2016-02-17 06:33:27 +08:00
|
|
|
;
|
2014-10-21 07:13:30 +08:00
|
|
|
; The problem does not occur without AVX, because vselect of v4i32 is not legal
|
|
|
|
; nor custom.
|
|
|
|
;
|
|
|
|
; <rdar://problem/18675020>
|
|
|
|
|
|
|
|
define void @test(<4 x i16>* %a, <4 x i16>* %b) {
|
2016-02-17 06:33:27 +08:00
|
|
|
; CHECK-LABEL: test:
|
|
|
|
; CHECK: ## BB#0: ## %body
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm0 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm1 = [65533,124,125,14807]
|
|
|
|
; CHECK-NEXT: vpshufb %xmm0, %xmm1, %xmm1
|
|
|
|
; CHECK-NEXT: vmovq %xmm1, (%rdi)
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm1 = [65535,0,0,65535]
|
|
|
|
; CHECK-NEXT: vpshufb %xmm0, %xmm1, %xmm0
|
|
|
|
; CHECK-NEXT: vmovq %xmm0, (%rsi)
|
|
|
|
; CHECK-NEXT: retq
|
2014-10-21 07:13:30 +08:00
|
|
|
body:
|
|
|
|
%predphi = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i16> <i16 -3, i16 545, i16 4385, i16 14807>, <4 x i16> <i16 123, i16 124, i16 125, i16 127>
|
|
|
|
%predphi42 = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1>, <4 x i16> zeroinitializer
|
|
|
|
store <4 x i16> %predphi, <4 x i16>* %a, align 8
|
|
|
|
store <4 x i16> %predphi42, <4 x i16>* %b, align 8
|
|
|
|
ret void
|
|
|
|
}
|
2014-11-06 10:25:03 +08:00
|
|
|
|
|
|
|
; Improve code coverage.
|
|
|
|
;
|
|
|
|
; When shrinking the condition used into the select to match a blend, this
|
|
|
|
; test case exercises the path where the modified node is not the root
|
|
|
|
; of the condition.
|
2016-02-17 06:33:27 +08:00
|
|
|
|
2014-11-06 10:25:03 +08:00
|
|
|
define void @test2(double** %call1559, i64 %indvars.iv4198, <4 x i1> %tmp1895) {
|
2016-02-17 06:33:27 +08:00
|
|
|
; CHECK-LABEL: test2:
|
|
|
|
; CHECK: ## BB#0: ## %bb
|
|
|
|
; CHECK-NEXT: vpslld $31, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpsrad $31, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpmovsxdq %xmm0, %xmm1
|
|
|
|
; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
|
|
|
|
; CHECK-NEXT: vpmovsxdq %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
|
|
|
|
; CHECK-NEXT: movq (%rdi,%rsi,8), %rax
|
|
|
|
; CHECK-NEXT: vmovapd {{.*#+}} ymm1 = [5.000000e-01,5.000000e-01,5.000000e-01,5.000000e-01]
|
|
|
|
; CHECK-NEXT: vblendvpd %ymm0, {{.*}}(%rip), %ymm1, %ymm0
|
|
|
|
; CHECK-NEXT: vmovupd %ymm0, (%rax)
|
|
|
|
; CHECK-NEXT: vzeroupper
|
|
|
|
; CHECK-NEXT: retq
|
2014-11-06 10:25:03 +08:00
|
|
|
bb:
|
[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
|
|
|
%arrayidx1928 = getelementptr inbounds double*, double** %call1559, i64 %indvars.iv4198
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp1888 = load double*, double** %arrayidx1928, align 8
|
2014-11-06 10:25:03 +08:00
|
|
|
%predphi.v.v = select <4 x i1> %tmp1895, <4 x double> <double -5.000000e-01, double -5.000000e-01, double -5.000000e-01, double -5.000000e-01>, <4 x double> <double 5.000000e-01, double 5.000000e-01, double 5.000000e-01, double 5.000000e-01>
|
|
|
|
%tmp1900 = bitcast double* %tmp1888 to <4 x double>*
|
|
|
|
store <4 x double> %predphi.v.v, <4 x double>* %tmp1900, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; For this test, we used to optimized the conditional mask for the blend, i.e.,
|
|
|
|
; we shrunk some of its bits.
|
|
|
|
; However, this same mask was used in another select (%predphi31) that turned out
|
|
|
|
; to be optimized into a and. In that case, the conditional mask was wrong.
|
|
|
|
;
|
|
|
|
; Make sure that the and is fed by the original mask.
|
2016-02-17 06:33:27 +08:00
|
|
|
;
|
2014-11-06 10:25:03 +08:00
|
|
|
; <rdar://problem/18819506>
|
|
|
|
|
|
|
|
define void @test3(<4 x i32> %induction30, <4 x i16>* %tmp16, <4 x i16>* %tmp17, <4 x i16> %tmp3, <4 x i16> %tmp12) {
|
2016-02-17 06:33:27 +08:00
|
|
|
; CHECK-LABEL: test3:
|
|
|
|
; CHECK: ## BB#0:
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm3 = [1431655766,1431655766,1431655766,1431655766]
|
|
|
|
; CHECK-NEXT: vpshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
|
|
; CHECK-NEXT: vpshufd {{.*#+}} xmm5 = xmm0[1,1,3,3]
|
|
|
|
; CHECK-NEXT: vpmuldq %xmm4, %xmm5, %xmm4
|
|
|
|
; CHECK-NEXT: vpmuldq %xmm3, %xmm0, %xmm3
|
|
|
|
; CHECK-NEXT: vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
|
|
|
|
; CHECK-NEXT: vpblendw {{.*#+}} xmm3 = xmm3[0,1],xmm4[2,3],xmm3[4,5],xmm4[6,7]
|
|
|
|
; CHECK-NEXT: vpsrld $31, %xmm3, %xmm4
|
|
|
|
; CHECK-NEXT: vpaddd %xmm4, %xmm3, %xmm3
|
|
|
|
; CHECK-NEXT: vpmulld {{.*}}(%rip), %xmm3, %xmm3
|
|
|
|
; CHECK-NEXT: vpsubd %xmm3, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpxor %xmm3, %xmm3, %xmm3
|
|
|
|
; CHECK-NEXT: vpcmpeqd %xmm3, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vblendvps %xmm0, %xmm1, %xmm2, %xmm1
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm2 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vmovq %xmm0, (%rdi)
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm1, %xmm0
|
|
|
|
; CHECK-NEXT: vmovq %xmm0, (%rsi)
|
|
|
|
; CHECK-NEXT: retq
|
2014-11-06 10:25:03 +08:00
|
|
|
%tmp6 = srem <4 x i32> %induction30, <i32 3, i32 3, i32 3, i32 3>
|
|
|
|
%tmp7 = icmp eq <4 x i32> %tmp6, zeroinitializer
|
|
|
|
%predphi = select <4 x i1> %tmp7, <4 x i16> %tmp3, <4 x i16> %tmp12
|
|
|
|
%predphi31 = select <4 x i1> %tmp7, <4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1>, <4 x i16> zeroinitializer
|
|
|
|
|
|
|
|
store <4 x i16> %predphi31, <4 x i16>* %tmp16, align 8
|
|
|
|
store <4 x i16> %predphi, <4 x i16>* %tmp17, align 8
|
|
|
|
ret void
|
|
|
|
}
|
2015-02-27 06:15:34 +08:00
|
|
|
|
|
|
|
; We shouldn't try to lower this directly using VSELECT because we don't have
|
|
|
|
; vpblendvb in AVX1, only in AVX2. Instead, it should be expanded.
|
2016-02-17 06:33:27 +08:00
|
|
|
|
2015-02-27 06:15:34 +08:00
|
|
|
define <32 x i8> @PR22706(<32 x i1> %x) {
|
2016-02-17 06:33:27 +08:00
|
|
|
; CHECK-LABEL: PR22706:
|
|
|
|
; CHECK: ## BB#0:
|
|
|
|
; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
|
|
|
|
; CHECK-NEXT: vpsllw $7, %xmm1, %xmm1
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm2 = [128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128]
|
|
|
|
; CHECK-NEXT: vpand %xmm2, %xmm1, %xmm1
|
|
|
|
; CHECK-NEXT: vpxor %xmm3, %xmm3, %xmm3
|
|
|
|
; CHECK-NEXT: vpcmpgtb %xmm1, %xmm3, %xmm1
|
|
|
|
; CHECK-NEXT: vpsllw $7, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpand %xmm2, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpcmpgtb %xmm0, %xmm3, %xmm0
|
|
|
|
; CHECK-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: vandnps {{.*}}(%rip), %ymm0, %ymm1
|
|
|
|
; CHECK-NEXT: vandps {{.*}}(%rip), %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: vorps %ymm1, %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: retq
|
2015-02-27 06:15:34 +08:00
|
|
|
%tmp = select <32 x i1> %x, <32 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <32 x i8> <i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2>
|
|
|
|
ret <32 x i8> %tmp
|
|
|
|
}
|