aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/DAGDeltaAlgorithm.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-06-03 14:42:07 +0000
committerSanjay Patel <spatel@rotateright.com>2016-06-03 14:42:07 +0000
commit6cf18af1c5041c69a8c483db7979c0c1a073e0e5 (patch)
treee9c443bb6437c99363674c0726f37a849aa6e860 /llvm/lib/Support/DAGDeltaAlgorithm.cpp
parentf88397c84cf50c683f6a48db503ee0303c3c530c (diff)
downloadllvm-6cf18af1c5041c69a8c483db7979c0c1a073e0e5.zip
llvm-6cf18af1c5041c69a8c483db7979c0c1a073e0e5.tar.gz
llvm-6cf18af1c5041c69a8c483db7979c0c1a073e0e5.tar.bz2
[InstCombine] look through bitcasts to find selects
There was concern that creating bitcasts for the simpler potential select pattern: define <2 x i64> @vecBitcastOp1(<4 x i1> %cmp, <2 x i64> %a) { %a2 = add <2 x i64> %a, %a %sext = sext <4 x i1> %cmp to <4 x i32> %bc = bitcast <4 x i32> %sext to <2 x i64> %and = and <2 x i64> %a2, %bc ret <2 x i64> %and } might lead to worse code for some targets, so this patch is matching the larger patterns seen in the test cases. The motivating example for this patch is this IR produced via SSE intrinsics in C: define <2 x i64> @gibson(<2 x i64> %a, <2 x i64> %b) { %t0 = bitcast <2 x i64> %a to <4 x i32> %t1 = bitcast <2 x i64> %b to <4 x i32> %cmp = icmp sgt <4 x i32> %t0, %t1 %sext = sext <4 x i1> %cmp to <4 x i32> %t2 = bitcast <4 x i32> %sext to <2 x i64> %and = and <2 x i64> %t2, %a %neg = xor <4 x i32> %sext, <i32 -1, i32 -1, i32 -1, i32 -1> %neg2 = bitcast <4 x i32> %neg to <2 x i64> %and2 = and <2 x i64> %neg2, %b %or = or <2 x i64> %and, %and2 ret <2 x i64> %or } For an AVX target, this is currently: vpcmpgtd %xmm1, %xmm0, %xmm2 vpand %xmm0, %xmm2, %xmm0 vpandn %xmm1, %xmm2, %xmm1 vpor %xmm1, %xmm0, %xmm0 retq With this patch, it becomes: vpmaxsd %xmm1, %xmm0, %xmm0 Differential Revision: http://reviews.llvm.org/D20774 llvm-svn: 271676
Diffstat (limited to 'llvm/lib/Support/DAGDeltaAlgorithm.cpp')
0 files changed, 0 insertions, 0 deletions