summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/vector-idiv.ll
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-04-26 12:06:28 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-04-26 12:06:28 +0000
commit4dae598bc8787df7c38506baa1c4326484461fba (patch)
treeb93978d26224aac697a445797bba25eef000510f /llvm/test/CodeGen/X86/vector-idiv.ll
parent29139d5cb5ceaf9e257192711208711882e89fcd (diff)
downloadbcm5719-llvm-4dae598bc8787df7c38506baa1c4326484461fba.tar.gz
bcm5719-llvm-4dae598bc8787df7c38506baa1c4326484461fba.zip
DAGCombiner: Turn divs of vector splats into vectorized multiplications.
Otherwise the legalizer would just scalarize everything. Support for mulhi in the targets isn't that great yet so on most targets we get exactly the same scalarized output. Add a test for x86 vector udiv. I had to disable the mulhi nodes on ARM because there aren't any patterns for it. As far as I know ARM has instructions for getting the high part of a multiply so this should be fixed. llvm-svn: 207315
Diffstat (limited to 'llvm/test/CodeGen/X86/vector-idiv.ll')
-rw-r--r--llvm/test/CodeGen/X86/vector-idiv.ll45
1 files changed, 45 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/vector-idiv.ll b/llvm/test/CodeGen/X86/vector-idiv.ll
new file mode 100644
index 00000000000..5b8153a9685
--- /dev/null
+++ b/llvm/test/CodeGen/X86/vector-idiv.ll
@@ -0,0 +1,45 @@
+; RUN: llc -march=x86-64 -mcpu=core2 < %s | FileCheck %s -check-prefix=SSE
+; RUN: llc -march=x86-64 -mcpu=core-avx2 < %s | FileCheck %s -check-prefix=AVX
+
+define <4 x i32> @test1(<4 x i32> %a) {
+ %div = udiv <4 x i32> %a, <i32 7, i32 7, i32 7, i32 7>
+ ret <4 x i32> %div
+
+; SSE-LABEL: test1:
+; SSE: pmuludq
+; SSE: pshufd $57
+; SSE: pmuludq
+; SSE: shufps $-35
+; SSE: psubd
+; SSE: psrld $1
+; SSE: padd
+; SSE: psrld $2
+
+; AVX-LABEL: test1:
+; AVX: vpmuludq
+; AVX: vpshufd $57
+; AVX: vpmuludq
+; AVX: vshufps $-35
+; AVX: vpsubd
+; AVX: vpsrld $1
+; AVX: vpadd
+; AVX: vpsrld $2
+}
+
+define <8 x i32> @test2(<8 x i32> %a) {
+ %div = udiv <8 x i32> %a, <i32 7, i32 7, i32 7, i32 7,i32 7, i32 7, i32 7, i32 7>
+ ret <8 x i32> %div
+
+; AVX-LABEL: test2:
+; AVX: vpermd
+; AVX: vpmuludq
+; AVX: vshufps $-35
+; AVX: vpmuludq
+; AVX: vshufps $-35
+; AVX: vpsubd
+; AVX: vpsrld $1
+; AVX: vpadd
+; AVX: vpsrld $2
+}
+
+; TODO: sdiv -> pmuldq
OpenPOWER on IntegriCloud