[PATCH] Canonicalize splats as build_vectors (PR22283)
Sanjay Patel
spatel at rotateright.com
Tue Feb 3 13:29:34 PST 2015
Hi rengolin, andreadb, mkuper, RKSimon,
This is a minimal follow-on patch to:
http://reviews.llvm.org/D7093
That patch canonicalized constant splats as build_vectors, and this patch just removes the constant check so we can canonicalize all splats as build_vectors.
This fixes the 2nd test case in PR22283 ( http://llvm.org/bugs/show_bug.cgi?id=22283 ).
The unfortunate code duplication between SelectionDAG and DAGCombiner is discussed in the earlier patch. At least this patch is just removing code...
This improves an existing x86 AVX test and changes codegen in an ARM test. I don't know enough about ARM implementations to know if the new codegen is an improvement or not.
For the changed ARM tests, we currently generate something like this:
ldrsh r12, [sp] <--- load scalar
vmov d17, r2, r3
vmov d16, r0, r1
vmov s0, r12
vcvt.f32.s32 s0, s0
vdup.32 q9, d0[0] <--- splat register value
vsub.f32 q8, q9, q8
vmov r0, r1, d16
vmov r2, r3, d17
mov pc, lr
With this patch, we'll generate a 'vld1' to splat instead:
mov r12, sp
vmov d19, r2, r3
vld1.16 {d16[]}, [r12:16] <--- load and splat
vmov d18, r0, r1
vmovl.s16 q8, d16
vcvt.f32.s32 q8, q8
vsub.f32 q8, q8, q9
vmov r0, r1, d16
vmov r2, r3, d17
mov pc, lr
http://reviews.llvm.org/D7389
Files:
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/ARM/vdup.ll
test/CodeGen/X86/vector-shuffle-256-v4.ll
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7389.19261.patch
Type: text/x-patch
Size: 4904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150203/2c4234bf/attachment.bin>
More information about the llvm-commits
mailing list