summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveRegMatrix.cpp
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2014-08-13 16:09:40 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2014-08-13 16:09:40 +0000
commitace8e1e3d44399de3933b068726eb90b11578ccf (patch)
tree15e9a0bb4aed8533a656eee10c013156c95d4ad0 /llvm/lib/CodeGen/LiveRegMatrix.cpp
parentf67672e41c8972f7a0e9f503e0cf58b21af24788 (diff)
downloadbcm5719-llvm-ace8e1e3d44399de3933b068726eb90b11578ccf.tar.gz
bcm5719-llvm-ace8e1e3d44399de3933b068726eb90b11578ccf.zip
[DAGCombiner] Improved target independent vector shuffle combine rule.
This patch improves the existing algorithm in DAGCombiner that attempts to fold shuffles according to rule: shuffle(shuffle(x, y, M1), undef, M2) -> shuffle(y, undef, M3) Before this change, there were cases where the DAGCombiner conservatively avoided folding shuffles even if the resulting mask would have been legal. That is because the algorithm wrongly assumed that commuting an illegal shuffle mask would always produce an illegal mask. With this change, we now correctly compute the commuted shuffle mask before calling method 'isShuffleMaskLegal' on it. On X86, this improves for example the codegen for the following function: define <4 x i32> @test(<4 x i32> %A, <4 x i32> %B) { %1 = shufflevector <4 x i32> %B, <4 x i32> %A, <4 x i32> <i32 1, i32 2, i32 6, i32 7> %2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 2, i32 3> ret <4 x i32> %2 } Before this change the X86 backend (-mcpu=corei7) generated the following assembly code for function @test: shufps $-23, %xmm0, %xmm1 # xmm1 = xmm1[1,2],xmm0[2,3] movhlps %xmm1, %xmm1 # xmm1 = xmm1[1,1] movaps %xmm1, %xmm0 Now we produce: movhlps %xmm0, %xmm0 # xmm0 = xmm0[1,1] Added extra test cases in combine-vec-shuffle-2.ll to verify that we correctly fold according to the above-mentioned rule. llvm-svn: 215555
Diffstat (limited to 'llvm/lib/CodeGen/LiveRegMatrix.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud