[llvm] [X86] Replace custom minmax reduction pattern matching with ISD::VEC_REDUCE_*MIN/MAX support (PR #194473)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu May 21 01:25:47 PDT 2026
https://github.com/RKSimon updated https://github.com/llvm/llvm-project/pull/194473
>From aab2f2015eeb311027f2c45ffa8feec15a123dc4 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Mon, 27 Apr 2026 23:10:12 +0100
Subject: [PATCH] [X86] Replace custom minmax reduction pattern matching with
ISD::VEC_REDUCE_*MIN/MAX support
Support middle-end reduction integer min/max patterns instead of relying on the ExpandReductions pass and then matching the expanded pattern in DAG
---
llvm/lib/Target/X86/X86ISelLowering.cpp | 37 -
.../lib/Target/X86/X86TargetTransformInfo.cpp | 12 +
llvm/lib/Target/X86/X86TargetTransformInfo.h | 2 +
llvm/test/CodeGen/X86/combine-reductions.ll | 16 +-
.../CodeGen/X86/horizontal-reduce-smax.ll | 2220 ----------------
.../CodeGen/X86/horizontal-reduce-smin.ll | 2223 ----------------
.../CodeGen/X86/horizontal-reduce-umax.ll | 2353 -----------------
.../CodeGen/X86/horizontal-reduce-umin.ll | 2099 ---------------
.../X86/vector-reductions-expanded.ll | 16 +-
9 files changed, 20 insertions(+), 8958 deletions(-)
delete mode 100644 llvm/test/CodeGen/X86/horizontal-reduce-smax.ll
delete mode 100644 llvm/test/CodeGen/X86/horizontal-reduce-smin.ll
delete mode 100644 llvm/test/CodeGen/X86/horizontal-reduce-umax.ll
delete mode 100644 llvm/test/CodeGen/X86/horizontal-reduce-umin.ll
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6694441468bb4..3514981dbd256 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -47191,38 +47191,6 @@ static SDValue createPSADBW(SelectionDAG &DAG, SDValue N0, SDValue N1,
PSADBWBuilder);
}
-// Attempt to replace an integer min/max horizontal reduction with
-// ISD::VECREDUCE_SMIN/SMAX/UMIN/UMAX.
-static SDValue combineMinMaxReduction(SDNode *Extract, SelectionDAG &DAG,
- const X86Subtarget &Subtarget) {
- // Check for SMAX/SMIN/UMAX/UMIN horizontal reduction patterns.
- ISD::NodeType BinOp;
- SDValue Src = DAG.matchBinOpReduction(
- Extract, BinOp, {ISD::SMAX, ISD::SMIN, ISD::UMAX, ISD::UMIN}, true);
- if (!Src)
- return SDValue();
-
- ISD::NodeType RdxOp;
- switch (BinOp) {
- case ISD::SMAX:
- RdxOp = ISD::VECREDUCE_SMAX;
- break;
- case ISD::SMIN:
- RdxOp = ISD::VECREDUCE_SMIN;
- break;
- case ISD::UMAX:
- RdxOp = ISD::VECREDUCE_UMAX;
- break;
- case ISD::UMIN:
- RdxOp = ISD::VECREDUCE_UMIN;
- break;
- default:
- llvm_unreachable("Unexpected reduction");
- }
-
- return DAG.getNode(RdxOp, SDLoc(Extract), Extract->getValueType(0), Src);
-}
-
// Attempt to replace an all_of/any_of/parity style horizontal reduction with a MOVMSK.
static SDValue combinePredicateReduction(SDNode *Extract, SelectionDAG &DAG,
const X86Subtarget &Subtarget) {
@@ -48175,11 +48143,6 @@ static SDValue combineExtractVectorElt(SDNode *N, SelectionDAG &DAG,
if (SDValue Cmp = combinePredicateReduction(N, DAG, Subtarget))
return Cmp;
- // Attempt to replace min/max v8i16/v16i8 reductions with ISD::VECREDUCE.
- if (DCI.isBeforeLegalizeOps())
- if (SDValue MinMax = combineMinMaxReduction(N, DAG, Subtarget))
- return MinMax;
-
// Attempt to optimize ADD/FADD/MUL reductions with HADD, promotion etc..
if (SDValue V = combineArithReduction(N, DAG, Subtarget))
return V;
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index 698be1615a04b..bd0f6a2a4ae74 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -6720,6 +6720,18 @@ bool X86TTIImpl::enableInterleavedAccessVectorization() const {
return !(ST->isAtom());
}
+bool X86TTIImpl::shouldExpandReduction(const IntrinsicInst *II) const {
+ switch (II->getIntrinsicID()) {
+ default:
+ return true;
+ case Intrinsic::vector_reduce_smax:
+ case Intrinsic::vector_reduce_smin:
+ case Intrinsic::vector_reduce_umax:
+ case Intrinsic::vector_reduce_umin:
+ return false;
+ }
+}
+
// Get estimation for interleaved load/store operations and strided load.
// \p Indices contains indices for strided load.
// \p Factor - the factor of interleaving.
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.h b/llvm/lib/Target/X86/X86TargetTransformInfo.h
index ea277bfeab560..4120421622b21 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.h
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.h
@@ -327,6 +327,8 @@ class X86TTIImpl final : public BasicTTIImplBase<X86TTIImpl> {
bool supportsEfficientVectorElementLoadStore() const override;
bool enableInterleavedAccessVectorization() const override;
+ bool shouldExpandReduction(const IntrinsicInst *II) const override;
+
InstructionCost getBranchMispredictPenalty() const override;
bool isProfitableToSinkOperands(Instruction *I,
diff --git a/llvm/test/CodeGen/X86/combine-reductions.ll b/llvm/test/CodeGen/X86/combine-reductions.ll
index 2106dae8fd769..844cd13e71d49 100644
--- a/llvm/test/CodeGen/X86/combine-reductions.ll
+++ b/llvm/test/CodeGen/X86/combine-reductions.ll
@@ -9,16 +9,9 @@ define { i16, i16 } @test_reduce_v16i16_with_umin(<16 x i16> %x, <16 x i16> %y)
; SSE41: # %bb.0:
; SSE41-NEXT: movdqa %xmm0, %xmm4
; SSE41-NEXT: pminuw %xmm1, %xmm4
-; SSE41-NEXT: pshufd {{.*#+}} xmm5 = xmm4[2,3,2,3]
-; SSE41-NEXT: pminuw %xmm4, %xmm5
-; SSE41-NEXT: pshufd {{.*#+}} xmm6 = xmm5[1,1,1,1]
-; SSE41-NEXT: pminuw %xmm5, %xmm6
-; SSE41-NEXT: movdqa %xmm6, %xmm5
-; SSE41-NEXT: psrld $16, %xmm5
-; SSE41-NEXT: pminuw %xmm6, %xmm5
; SSE41-NEXT: phminposuw %xmm4, %xmm4
; SSE41-NEXT: movd %xmm4, %eax
-; SSE41-NEXT: pshuflw {{.*#+}} xmm4 = xmm5[0,0,0,0,4,5,6,7]
+; SSE41-NEXT: pshuflw {{.*#+}} xmm4 = xmm4[0,0,0,0,4,5,6,7]
; SSE41-NEXT: pshufd {{.*#+}} xmm4 = xmm4[0,1,0,1]
; SSE41-NEXT: pcmpeqw %xmm4, %xmm1
; SSE41-NEXT: pcmpeqd %xmm5, %xmm5
@@ -38,14 +31,9 @@ define { i16, i16 } @test_reduce_v16i16_with_umin(<16 x i16> %x, <16 x i16> %y)
; AVX2: # %bb.0:
; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm2
; AVX2-NEXT: vpminuw %xmm2, %xmm0, %xmm2
-; AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm2[2,3,2,3]
-; AVX2-NEXT: vpminuw %xmm3, %xmm2, %xmm3
-; AVX2-NEXT: vpshufd {{.*#+}} xmm4 = xmm3[1,1,1,1]
-; AVX2-NEXT: vpminuw %xmm4, %xmm3, %xmm3
-; AVX2-NEXT: vpsrld $16, %xmm3, %xmm4
; AVX2-NEXT: vphminposuw %xmm2, %xmm2
; AVX2-NEXT: vmovd %xmm2, %eax
-; AVX2-NEXT: vpminuw %xmm4, %xmm3, %xmm2
+; AVX2-NEXT: vmovd %eax, %xmm2
; AVX2-NEXT: vpbroadcastw %xmm2, %ymm2
; AVX2-NEXT: vpcmpeqw %ymm2, %ymm0, %ymm0
; AVX2-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
diff --git a/llvm/test/CodeGen/X86/horizontal-reduce-smax.ll b/llvm/test/CodeGen/X86/horizontal-reduce-smax.ll
deleted file mode 100644
index 8dc76308edfc0..0000000000000
--- a/llvm/test/CodeGen/X86/horizontal-reduce-smax.ll
+++ /dev/null
@@ -1,2220 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X86-SSE2
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse4.2 | FileCheck %s --check-prefix=X86-SSE42
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx | FileCheck %s --check-prefixes=X86-AVX,X86-AVX1
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx2 | FileCheck %s --check-prefixes=X86-AVX,X86-AVX2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X64-SSE2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse4.2 | FileCheck %s --check-prefix=X64-SSE42
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx | FileCheck %s --check-prefixes=X64-AVX,X64-AVX1OR2,X64-AVX1
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx2 | FileCheck %s --check-prefixes=X64-AVX,X64-AVX1OR2,X64-AVX2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X64-AVX,X64-AVX512
-
-;
-; 128-bit Vectors
-;
-
-define i64 @test_reduce_v2i64(<2 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v2i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,0,2147483648,0]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm2, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movd %xmm3, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v2i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm2
-; X86-SSE42-NEXT: movd %xmm2, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm2, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v2i64:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X86-AVX-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v2i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movq %xmm0, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovgq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v2i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pextrq $1, %xmm0, %rax
-; X64-SSE42-NEXT: movq %xmm0, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovgq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v2i64:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1OR2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1OR2-NEXT: cmpq %rax, %rcx
-; X64-AVX1OR2-NEXT: cmovgq %rcx, %rax
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v2i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <2 x i64> %a0, <2 x i64> undef, <2 x i32> <i32 1, i32 undef>
- %2 = icmp sgt <2 x i64> %a0, %1
- %3 = select <2 x i1> %2, <2 x i64> %a0, <2 x i64> %1
- %4 = extractelement <2 x i64> %3, i32 0
- ret i64 %4
-}
-
-define i32 @test_reduce_v4i32(<4 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v4i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovgl %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v4i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pmaxsd %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v4i32:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v4i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovgl %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v4i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pmaxsd %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v4i32:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: retq
- %1 = shufflevector <4 x i32> %a0, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
- %2 = icmp sgt <4 x i32> %a0, %1
- %3 = select <4 x i1> %2, <4 x i32> %a0, <4 x i32> %1
- %4 = shufflevector <4 x i32> %3, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <4 x i32> %3, %4
- %6 = select <4 x i1> %5, <4 x i32> %3, <4 x i32> %4
- %7 = extractelement <4 x i32> %6, i32 0
- ret i32 %7
-}
-
-define i16 @test_reduce_v8i16(<8 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v8i16:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX1OR2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i16> %a0, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <8 x i16> %a0, %1
- %3 = select <8 x i1> %2, <8 x i16> %a0, <8 x i16> %1
- %4 = shufflevector <8 x i16> %3, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <8 x i16> %3, %4
- %6 = select <8 x i1> %5, <8 x i16> %3, <8 x i16> %4
- %7 = shufflevector <8 x i16> %6, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <8 x i16> %6, %7
- %9 = select <8 x i1> %8, <8 x i16> %6, <8 x i16> %7
- %10 = extractelement <8 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i8 @test_reduce_v16i8(<16 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovgl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorb $127, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorb $127, %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovgl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorb $127, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v16i8:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1OR2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorb $127, %al
-; X64-AVX1OR2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorb $127, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i8> %a0, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <16 x i8> %a0, %1
- %3 = select <16 x i1> %2, <16 x i8> %a0, <16 x i8> %1
- %4 = shufflevector <16 x i8> %3, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <16 x i8> %3, %4
- %6 = select <16 x i1> %5, <16 x i8> %3, <16 x i8> %4
- %7 = shufflevector <16 x i8> %6, <16 x i8> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <16 x i8> %6, %7
- %9 = select <16 x i1> %8, <16 x i8> %6, <16 x i8> %7
- %10 = shufflevector <16 x i8> %9, <16 x i8> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp sgt <16 x i8> %9, %10
- %12 = select <16 x i1> %11, <16 x i8> %9, <16 x i8> %10
- %13 = extractelement <16 x i8> %12, i32 0
- ret i8 %13
-}
-
-;
-; 256-bit Vectors
-;
-
-define i64 @test_reduce_v4i64(<4 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v4i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,0,2147483648,0]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm4
-; X86-SSE2-NEXT: pxor %xmm2, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm4, %xmm5
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm5
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm6, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm5[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm4, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm1
-; X86-SSE2-NEXT: pxor %xmm2, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm0, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm1, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm3
-; X86-SSE2-NEXT: pandn %xmm0, %xmm2
-; X86-SSE2-NEXT: por %xmm3, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v4i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE42-NEXT: pcmpgtq %xmm1, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm2 = xmm1[2,3,2,3]
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm2
-; X86-SSE42-NEXT: movd %xmm2, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm2, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v4i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X86-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X86-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v4i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vshufps {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v4i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm3
-; X64-SSE2-NEXT: pxor %xmm2, %xmm3
-; X64-SSE2-NEXT: pxor %xmm0, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm5, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm2, %xmm3
-; X64-SSE2-NEXT: pand %xmm3, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm3
-; X64-SSE2-NEXT: por %xmm0, %xmm3
-; X64-SSE2-NEXT: movq %xmm3, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovgq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v4i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE42-NEXT: pcmpgtq %xmm1, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
-; X64-SSE42-NEXT: pextrq $1, %xmm1, %rax
-; X64-SSE42-NEXT: movq %xmm1, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovgq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v4i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X64-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovgq %rcx, %rax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v4i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X64-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovgq %rcx, %rax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v4i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <4 x i64> %a0, <4 x i64> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
- %2 = icmp sgt <4 x i64> %a0, %1
- %3 = select <4 x i1> %2, <4 x i64> %a0, <4 x i64> %1
- %4 = shufflevector <4 x i64> %3, <4 x i64> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <4 x i64> %3, %4
- %6 = select <4 x i1> %5, <4 x i64> %3, <4 x i64> %4
- %7 = extractelement <4 x i64> %6, i32 0
- ret i64 %7
-}
-
-define i32 @test_reduce_v8i32(<8 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm2
-; X86-SSE2-NEXT: pandn %xmm0, %xmm1
-; X86-SSE2-NEXT: por %xmm2, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovgl %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pmaxsd %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v8i32:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v8i32:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovgl %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pmaxsd %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i32:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i32:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i32:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX512-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i32> %a0, <8 x i32> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <8 x i32> %a0, %1
- %3 = select <8 x i1> %2, <8 x i32> %a0, <8 x i32> %1
- %4 = shufflevector <8 x i32> %3, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <8 x i32> %3, %4
- %6 = select <8 x i1> %5, <8 x i32> %3, <8 x i32> %4
- %7 = shufflevector <8 x i32> %6, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <8 x i32> %6, %7
- %9 = select <8 x i1> %8, <8 x i32> %6, <8 x i32> %7
- %10 = extractelement <8 x i32> %9, i32 0
- ret i32 %10
-}
-
-define i16 @test_reduce_v16i16(<16 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v16i16:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v16i16:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <16 x i16> %a0, %1
- %3 = select <16 x i1> %2, <16 x i16> %a0, <16 x i16> %1
- %4 = shufflevector <16 x i16> %3, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <16 x i16> %3, %4
- %6 = select <16 x i1> %5, <16 x i16> %3, <16 x i16> %4
- %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <16 x i16> %6, %7
- %9 = select <16 x i1> %8, <16 x i16> %6, <16 x i16> %7
- %10 = shufflevector <16 x i16> %9, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp sgt <16 x i16> %9, %10
- %12 = select <16 x i1> %11, <16 x i16> %9, <16 x i16> %10
- %13 = extractelement <16 x i16> %12, i32 0
- ret i16 %13
-}
-
-define i8 @test_reduce_v32i8(<32 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm2
-; X86-SSE2-NEXT: pandn %xmm0, %xmm1
-; X86-SSE2-NEXT: por %xmm2, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm2, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm2, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovgl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxsb %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorb $127, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v32i8:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: xorb $127, %al
-; X86-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v32i8:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: xorb $127, %al
-; X86-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovgl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxsb %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorb $127, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: xorb $127, %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: xorb $127, %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorb $127, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <32 x i8> %a0, %1
- %3 = select <32 x i1> %2, <32 x i8> %a0, <32 x i8> %1
- %4 = shufflevector <32 x i8> %3, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <32 x i8> %3, %4
- %6 = select <32 x i1> %5, <32 x i8> %3, <32 x i8> %4
- %7 = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <32 x i8> %6, %7
- %9 = select <32 x i1> %8, <32 x i8> %6, <32 x i8> %7
- %10 = shufflevector <32 x i8> %9, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp sgt <32 x i8> %9, %10
- %12 = select <32 x i1> %11, <32 x i8> %9, <32 x i8> %10
- %13 = shufflevector <32 x i8> %12, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp sgt <32 x i8> %12, %13
- %15 = select <32 x i1> %14, <32 x i8> %12, <32 x i8> %13
- %16 = extractelement <32 x i8> %15, i32 0
- ret i8 %16
-}
-
-;
-; 512-bit Vectors
-;
-
-define i64 @test_reduce_v8i64(<8 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,0,2147483648,0]
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm5
-; X86-SSE2-NEXT: pxor %xmm4, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm6
-; X86-SSE2-NEXT: pxor %xmm4, %xmm6
-; X86-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X86-SSE2-NEXT: pcmpgtd %xmm5, %xmm7
-; X86-SSE2-NEXT: pcmpeqd %xmm5, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm6[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm6, %xmm5
-; X86-SSE2-NEXT: pand %xmm5, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm5
-; X86-SSE2-NEXT: por %xmm1, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X86-SSE2-NEXT: pxor %xmm4, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: pxor %xmm4, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm6
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm6
-; X86-SSE2-NEXT: pcmpeqd %xmm1, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm6[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm1, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm6[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm3, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm5, %xmm3
-; X86-SSE2-NEXT: pxor %xmm4, %xmm3
-; X86-SSE2-NEXT: pand %xmm1, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm1
-; X86-SSE2-NEXT: por %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm2
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm0[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm3, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm6, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm5, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pxor %xmm4, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm3
-; X86-SSE2-NEXT: pcmpgtd %xmm4, %xmm3
-; X86-SSE2-NEXT: pcmpeqd %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm4, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm4
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm3, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X86-SSE42-NEXT: movdqa %xmm4, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
-; X86-SSE42-NEXT: movapd %xmm2, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm3, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm3
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm3[2,3,2,3]
-; X86-SSE42-NEXT: movdqa %xmm3, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm1, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm3, %xmm1
-; X86-SSE42-NEXT: movd %xmm1, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm1, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v8i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm4
-; X86-AVX1-NEXT: vblendvpd %xmm4, %xmm3, %xmm2, %xmm2
-; X86-AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm3
-; X86-AVX1-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm2, %xmm0
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X86-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v8i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpcmpgtq %ymm1, %ymm0, %ymm2
-; X86-AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
-; X86-AVX2-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vshufps {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm3, %xmm5
-; X64-SSE2-NEXT: pxor %xmm4, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X64-SSE2-NEXT: pcmpgtd %xmm5, %xmm7
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm5, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm6[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm8, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm6, %xmm5
-; X64-SSE2-NEXT: pand %xmm5, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm5
-; X64-SSE2-NEXT: por %xmm1, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm5, %xmm1
-; X64-SSE2-NEXT: pxor %xmm4, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm3
-; X64-SSE2-NEXT: pxor %xmm4, %xmm3
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm7
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm3, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm6[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm8, %xmm3
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm3, %xmm6
-; X64-SSE2-NEXT: pand %xmm6, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm6
-; X64-SSE2-NEXT: por %xmm0, %xmm6
-; X64-SSE2-NEXT: pxor %xmm6, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm4, %xmm0
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm1, %xmm4
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm4[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm1, %xmm0
-; X64-SSE2-NEXT: pand %xmm0, %xmm6
-; X64-SSE2-NEXT: pandn %xmm5, %xmm0
-; X64-SSE2-NEXT: por %xmm6, %xmm0
-; X64-SSE2-NEXT: movq %xmm0, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovgq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm4
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm3, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X64-SSE42-NEXT: movdqa %xmm4, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
-; X64-SSE42-NEXT: movapd %xmm2, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm3, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm3
-; X64-SSE42-NEXT: pextrq $1, %xmm3, %rax
-; X64-SSE42-NEXT: movq %xmm3, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovgq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm4
-; X64-AVX1-NEXT: vblendvpd %xmm4, %xmm3, %xmm2, %xmm2
-; X64-AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm3
-; X64-AVX1-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm0
-; X64-AVX1-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm1
-; X64-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm2, %xmm0
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovgq %rcx, %rax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpcmpgtq %ymm1, %ymm0, %ymm2
-; X64-AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
-; X64-AVX2-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm2
-; X64-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovgq %rcx, %rax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpmaxsq %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i64> %a0, <8 x i64> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <8 x i64> %a0, %1
- %3 = select <8 x i1> %2, <8 x i64> %a0, <8 x i64> %1
- %4 = shufflevector <8 x i64> %3, <8 x i64> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <8 x i64> %3, %4
- %6 = select <8 x i1> %5, <8 x i64> %3, <8 x i64> %4
- %7 = shufflevector <8 x i64> %6, <8 x i64> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <8 x i64> %6, %7
- %9 = select <8 x i1> %8, <8 x i64> %6, <8 x i64> %7
- %10 = extractelement <8 x i64> %9, i32 0
- ret i64 %10
-}
-
-define i32 @test_reduce_v16i32(<16 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X86-SSE2-NEXT: pand %xmm4, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm4
-; X86-SSE2-NEXT: por %xmm1, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm1
-; X86-SSE2-NEXT: por %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pcmpgtd %xmm4, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm4, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovgl %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxsd %xmm3, %xmm1
-; X86-SSE42-NEXT: pmaxsd %xmm2, %xmm0
-; X86-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pmaxsd %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v16i32:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpmaxsd %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpmaxsd %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v16i32:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X64-SSE2-NEXT: pand %xmm4, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm4
-; X64-SSE2-NEXT: por %xmm1, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm1
-; X64-SSE2-NEXT: por %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: pcmpgtd %xmm4, %xmm0
-; X64-SSE2-NEXT: pand %xmm0, %xmm1
-; X64-SSE2-NEXT: pandn %xmm4, %xmm0
-; X64-SSE2-NEXT: por %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovgl %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxsd %xmm3, %xmm1
-; X64-SSE42-NEXT: pmaxsd %xmm2, %xmm0
-; X64-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pmaxsd %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pmaxsd %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i32:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpmaxsd %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpmaxsd %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX1-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i32:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX2-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i32:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX512-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i32> %a0, <16 x i32> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <16 x i32> %a0, %1
- %3 = select <16 x i1> %2, <16 x i32> %a0, <16 x i32> %1
- %4 = shufflevector <16 x i32> %3, <16 x i32> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <16 x i32> %3, %4
- %6 = select <16 x i1> %5, <16 x i32> %3, <16 x i32> %4
- %7 = shufflevector <16 x i32> %6, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <16 x i32> %6, %7
- %9 = select <16 x i1> %8, <16 x i32> %6, <16 x i32> %7
- %10 = shufflevector <16 x i32> %9, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp sgt <16 x i32> %9, %10
- %12 = select <16 x i1> %11, <16 x i32> %9, <16 x i32> %10
- %13 = extractelement <16 x i32> %12, i32 0
- ret i32 %13
-}
-
-define i16 @test_reduce_v32i16(<32 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pmaxsw %xmm3, %xmm1
-; X86-SSE2-NEXT: pmaxsw %xmm2, %xmm0
-; X86-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxsw %xmm3, %xmm1
-; X86-SSE42-NEXT: pmaxsw %xmm2, %xmm0
-; X86-SSE42-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v32i16:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpmaxsw %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpmaxsw %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v32i16:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pmaxsw %xmm3, %xmm1
-; X64-SSE2-NEXT: pmaxsw %xmm2, %xmm0
-; X64-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxsw %xmm3, %xmm1
-; X64-SSE42-NEXT: pmaxsw %xmm2, %xmm0
-; X64-SSE42-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpmaxsw %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpmaxsw %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxsw %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <32 x i16> %a0, %1
- %3 = select <32 x i1> %2, <32 x i16> %a0, <32 x i16> %1
- %4 = shufflevector <32 x i16> %3, <32 x i16> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <32 x i16> %3, %4
- %6 = select <32 x i1> %5, <32 x i16> %3, <32 x i16> %4
- %7 = shufflevector <32 x i16> %6, <32 x i16> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <32 x i16> %6, %7
- %9 = select <32 x i1> %8, <32 x i16> %6, <32 x i16> %7
- %10 = shufflevector <32 x i16> %9, <32 x i16> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp sgt <32 x i16> %9, %10
- %12 = select <32 x i1> %11, <32 x i16> %9, <32 x i16> %10
- %13 = shufflevector <32 x i16> %12, <32 x i16> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp sgt <32 x i16> %12, %13
- %15 = select <32 x i1> %14, <32 x i16> %12, <32 x i16> %13
- %16 = extractelement <32 x i16> %15, i32 0
- ret i16 %16
-}
-
-define i8 @test_reduce_v64i8(<64 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v64i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE2-NEXT: pcmpgtb %xmm3, %xmm4
-; X86-SSE2-NEXT: pand %xmm4, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm4
-; X86-SSE2-NEXT: por %xmm1, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm1
-; X86-SSE2-NEXT: por %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm4, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm4, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovgl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v64i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxsb %xmm3, %xmm1
-; X86-SSE42-NEXT: pmaxsb %xmm2, %xmm0
-; X86-SSE42-NEXT: pmaxsb %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorb $127, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v64i8:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpmaxsb %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpmaxsb %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: xorb $127, %al
-; X86-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v64i8:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: xorb $127, %al
-; X86-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v64i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X64-SSE2-NEXT: pcmpgtb %xmm3, %xmm4
-; X64-SSE2-NEXT: pand %xmm4, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm4
-; X64-SSE2-NEXT: por %xmm1, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm1
-; X64-SSE2-NEXT: por %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: pcmpgtb %xmm4, %xmm0
-; X64-SSE2-NEXT: pand %xmm0, %xmm1
-; X64-SSE2-NEXT: pandn %xmm4, %xmm0
-; X64-SSE2-NEXT: por %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovgl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v64i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxsb %xmm3, %xmm1
-; X64-SSE42-NEXT: pmaxsb %xmm2, %xmm0
-; X64-SSE42-NEXT: pmaxsb %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorb $127, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v64i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpmaxsb %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpmaxsb %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: xorb $127, %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v64i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: xorb $127, %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v64i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorb $127, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <64 x i8> %a0, <64 x i8> undef, <64 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <64 x i8> %a0, %1
- %3 = select <64 x i1> %2, <64 x i8> %a0, <64 x i8> %1
- %4 = shufflevector <64 x i8> %3, <64 x i8> undef, <64 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <64 x i8> %3, %4
- %6 = select <64 x i1> %5, <64 x i8> %3, <64 x i8> %4
- %7 = shufflevector <64 x i8> %6, <64 x i8> undef, <64 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <64 x i8> %6, %7
- %9 = select <64 x i1> %8, <64 x i8> %6, <64 x i8> %7
- %10 = shufflevector <64 x i8> %9, <64 x i8> undef, <64 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp sgt <64 x i8> %9, %10
- %12 = select <64 x i1> %11, <64 x i8> %9, <64 x i8> %10
- %13 = shufflevector <64 x i8> %12, <64 x i8> undef, <64 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp sgt <64 x i8> %12, %13
- %15 = select <64 x i1> %14, <64 x i8> %12, <64 x i8> %13
- %16 = shufflevector <64 x i8> %15, <64 x i8> undef, <64 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %17 = icmp sgt <64 x i8> %15, %16
- %18 = select <64 x i1> %17, <64 x i8> %15, <64 x i8> %16
- %19 = extractelement <64 x i8> %18, i32 0
- ret i8 %19
-}
-
-;
-; Partial Vector Reductions
-;
-
-define i16 @test_reduce_v16i16_v8i16(<16 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i16_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i16_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v16i16_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i16_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i16_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v16i16_v8i16:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX1OR2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1OR2-NEXT: vzeroupper
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i16_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <16 x i16> %a0, %1
- %3 = select <16 x i1> %2, <16 x i16> %a0, <16 x i16> %1
- %4 = shufflevector <16 x i16> %3, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <16 x i16> %3, %4
- %6 = select <16 x i1> %5, <16 x i16> %3, <16 x i16> %4
- %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <16 x i16> %6, %7
- %9 = select <16 x i1> %8, <16 x i16> %6, <16 x i16> %7
- %10 = extractelement <16 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i16 @test_reduce_v32i16_v8i16(<32 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i16_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i16_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v32i16_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i16_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i16_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v32i16_v8i16:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX1OR2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1OR2-NEXT: vzeroupper
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i16_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32767, %eax ## imm = 0x7FFF
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <32 x i16> %a0, %1
- %3 = select <32 x i1> %2, <32 x i16> %a0, <32 x i16> %1
- %4 = shufflevector <32 x i16> %3, <32 x i16> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <32 x i16> %3, %4
- %6 = select <32 x i1> %5, <32 x i16> %3, <32 x i16> %4
- %7 = shufflevector <32 x i16> %6, <32 x i16> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <32 x i16> %6, %7
- %9 = select <32 x i1> %8, <32 x i16> %6, <32 x i16> %7
- %10 = extractelement <32 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i8 @test_reduce_v32i8_v16i8(<32 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i8_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovgl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i8_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorb $127, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v32i8_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorb $127, %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i8_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovgl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i8_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorb $127, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v32i8_v16i8:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1OR2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorb $127, %al
-; X64-AVX1OR2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1OR2-NEXT: vzeroupper
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i8_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorb $127, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <32 x i8> %a0, %1
- %3 = select <32 x i1> %2, <32 x i8> %a0, <32 x i8> %1
- %4 = shufflevector <32 x i8> %3, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <32 x i8> %3, %4
- %6 = select <32 x i1> %5, <32 x i8> %3, <32 x i8> %4
- %7 = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <32 x i8> %6, %7
- %9 = select <32 x i1> %8, <32 x i8> %6, <32 x i8> %7
- %10 = shufflevector <32 x i8> %9, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp sgt <32 x i8> %9, %10
- %12 = select <32 x i1> %11, <32 x i8> %9, <32 x i8> %10
- %13 = extractelement <32 x i8> %12, i32 0
- ret i8 %13
-}
-
-define i8 @test_reduce_v64i8_v16i8(<64 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v64i8_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovgl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v64i8_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorb $127, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v64i8_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorb $127, %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v64i8_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovgl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v64i8_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorb $127, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v64i8_v16i8:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1OR2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorb $127, %al
-; X64-AVX1OR2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1OR2-NEXT: vzeroupper
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v64i8_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorb $127, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <64 x i8> %a0, <64 x i8> undef, <64 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp sgt <64 x i8> %a0, %1
- %3 = select <64 x i1> %2, <64 x i8> %a0, <64 x i8> %1
- %4 = shufflevector <64 x i8> %3, <64 x i8> undef, <64 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp sgt <64 x i8> %3, %4
- %6 = select <64 x i1> %5, <64 x i8> %3, <64 x i8> %4
- %7 = shufflevector <64 x i8> %6, <64 x i8> undef, <64 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp sgt <64 x i8> %6, %7
- %9 = select <64 x i1> %8, <64 x i8> %6, <64 x i8> %7
- %10 = shufflevector <64 x i8> %9, <64 x i8> undef, <64 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp sgt <64 x i8> %9, %10
- %12 = select <64 x i1> %11, <64 x i8> %9, <64 x i8> %10
- %13 = extractelement <64 x i8> %12, i32 0
- ret i8 %13
-}
diff --git a/llvm/test/CodeGen/X86/horizontal-reduce-smin.ll b/llvm/test/CodeGen/X86/horizontal-reduce-smin.ll
deleted file mode 100644
index 197f3ecf2290d..0000000000000
--- a/llvm/test/CodeGen/X86/horizontal-reduce-smin.ll
+++ /dev/null
@@ -1,2223 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X86-SSE2
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse4.2 | FileCheck %s --check-prefix=X86-SSE42
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx | FileCheck %s --check-prefixes=X86-AVX,X86-AVX1
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx2 | FileCheck %s --check-prefixes=X86-AVX,X86-AVX2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X64-SSE2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse4.2 | FileCheck %s --check-prefix=X64-SSE42
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx | FileCheck %s --check-prefixes=X64-AVX,X64-AVX1OR2,X64-AVX1
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx2 | FileCheck %s --check-prefixes=X64-AVX,X64-AVX1OR2,X64-AVX2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X64-AVX,X64-AVX512
-
-;
-; 128-bit Vectors
-;
-
-define i64 @test_reduce_v2i64(<2 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v2i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,0,2147483648,0]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm2, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movd %xmm3, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v2i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm1, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm2
-; X86-SSE42-NEXT: movd %xmm2, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm2, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v2i64:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v2i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movq %xmm0, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovlq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v2i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pextrq $1, %xmm0, %rax
-; X64-SSE42-NEXT: movq %xmm0, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovlq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v2i64:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1OR2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1OR2-NEXT: cmpq %rax, %rcx
-; X64-AVX1OR2-NEXT: cmovlq %rcx, %rax
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v2i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <2 x i64> %a0, <2 x i64> undef, <2 x i32> <i32 1, i32 undef>
- %2 = icmp slt <2 x i64> %a0, %1
- %3 = select <2 x i1> %2, <2 x i64> %a0, <2 x i64> %1
- %4 = extractelement <2 x i64> %3, i32 0
- ret i64 %4
-}
-
-define i32 @test_reduce_v4i32(<4 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v4i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovll %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v4i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pminsd %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v4i32:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v4i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovll %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v4i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pminsd %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v4i32:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: retq
- %1 = shufflevector <4 x i32> %a0, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
- %2 = icmp slt <4 x i32> %a0, %1
- %3 = select <4 x i1> %2, <4 x i32> %a0, <4 x i32> %1
- %4 = shufflevector <4 x i32> %3, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <4 x i32> %3, %4
- %6 = select <4 x i1> %5, <4 x i32> %3, <4 x i32> %4
- %7 = extractelement <4 x i32> %6, i32 0
- ret i32 %7
-}
-
-define i16 @test_reduce_v8i16(<8 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v8i16:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX1OR2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i16> %a0, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <8 x i16> %a0, %1
- %3 = select <8 x i1> %2, <8 x i16> %a0, <8 x i16> %1
- %4 = shufflevector <8 x i16> %3, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <8 x i16> %3, %4
- %6 = select <8 x i1> %5, <8 x i16> %3, <8 x i16> %4
- %7 = shufflevector <8 x i16> %6, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <8 x i16> %6, %7
- %9 = select <8 x i1> %8, <8 x i16> %6, <8 x i16> %7
- %10 = extractelement <8 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i8 @test_reduce_v16i8(<16 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm2, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovll %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: addb $-128, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: addb $-128, %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovll %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: addb $-128, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v16i8:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1OR2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: addb $-128, %al
-; X64-AVX1OR2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: addb $-128, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i8> %a0, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <16 x i8> %a0, %1
- %3 = select <16 x i1> %2, <16 x i8> %a0, <16 x i8> %1
- %4 = shufflevector <16 x i8> %3, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <16 x i8> %3, %4
- %6 = select <16 x i1> %5, <16 x i8> %3, <16 x i8> %4
- %7 = shufflevector <16 x i8> %6, <16 x i8> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <16 x i8> %6, %7
- %9 = select <16 x i1> %8, <16 x i8> %6, <16 x i8> %7
- %10 = shufflevector <16 x i8> %9, <16 x i8> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp slt <16 x i8> %9, %10
- %12 = select <16 x i1> %11, <16 x i8> %9, <16 x i8> %10
- %13 = extractelement <16 x i8> %12, i32 0
- ret i8 %13
-}
-
-;
-; 256-bit Vectors
-;
-
-define i64 @test_reduce_v4i64(<4 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v4i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,0,2147483648,0]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE2-NEXT: pxor %xmm2, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm4, %xmm5
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm5
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm6, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm5[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm4, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm1
-; X86-SSE2-NEXT: pxor %xmm2, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm0, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm1, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm3
-; X86-SSE2-NEXT: pandn %xmm0, %xmm2
-; X86-SSE2-NEXT: por %xmm3, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v4i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm2 = xmm1[2,3,2,3]
-; X86-SSE42-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm1, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm2
-; X86-SSE42-NEXT: movd %xmm2, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm2, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v4i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v4i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vshufps {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v4i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X64-SSE2-NEXT: pxor %xmm2, %xmm3
-; X64-SSE2-NEXT: pxor %xmm1, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm5, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm2, %xmm3
-; X64-SSE2-NEXT: pand %xmm3, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm3
-; X64-SSE2-NEXT: por %xmm0, %xmm3
-; X64-SSE2-NEXT: movq %xmm3, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovlq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v4i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
-; X64-SSE42-NEXT: pextrq $1, %xmm1, %rax
-; X64-SSE42-NEXT: movq %xmm1, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovlq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v4i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X64-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovlq %rcx, %rax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v4i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X64-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovlq %rcx, %rax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v4i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <4 x i64> %a0, <4 x i64> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
- %2 = icmp slt <4 x i64> %a0, %1
- %3 = select <4 x i1> %2, <4 x i64> %a0, <4 x i64> %1
- %4 = shufflevector <4 x i64> %3, <4 x i64> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <4 x i64> %3, %4
- %6 = select <4 x i1> %5, <4 x i64> %3, <4 x i64> %4
- %7 = extractelement <4 x i64> %6, i32 0
- ret i64 %7
-}
-
-define i32 @test_reduce_v8i32(<8 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm2
-; X86-SSE2-NEXT: pandn %xmm0, %xmm1
-; X86-SSE2-NEXT: por %xmm2, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovll %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pminsd %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v8i32:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v8i32:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovll %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pminsd %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i32:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i32:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i32:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX512-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i32> %a0, <8 x i32> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <8 x i32> %a0, %1
- %3 = select <8 x i1> %2, <8 x i32> %a0, <8 x i32> %1
- %4 = shufflevector <8 x i32> %3, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <8 x i32> %3, %4
- %6 = select <8 x i1> %5, <8 x i32> %3, <8 x i32> %4
- %7 = shufflevector <8 x i32> %6, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <8 x i32> %6, %7
- %9 = select <8 x i1> %8, <8 x i32> %6, <8 x i32> %7
- %10 = extractelement <8 x i32> %9, i32 0
- ret i32 %10
-}
-
-define i16 @test_reduce_v16i16(<16 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v16i16:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v16i16:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <16 x i16> %a0, %1
- %3 = select <16 x i1> %2, <16 x i16> %a0, <16 x i16> %1
- %4 = shufflevector <16 x i16> %3, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <16 x i16> %3, %4
- %6 = select <16 x i1> %5, <16 x i16> %3, <16 x i16> %4
- %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <16 x i16> %6, %7
- %9 = select <16 x i1> %8, <16 x i16> %6, <16 x i16> %7
- %10 = shufflevector <16 x i16> %9, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp slt <16 x i16> %9, %10
- %12 = select <16 x i1> %11, <16 x i16> %9, <16 x i16> %10
- %13 = extractelement <16 x i16> %12, i32 0
- ret i16 %13
-}
-
-define i8 @test_reduce_v32i8(<32 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm2
-; X86-SSE2-NEXT: pandn %xmm0, %xmm1
-; X86-SSE2-NEXT: por %xmm2, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm2, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovll %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminsb %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: addb $-128, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v32i8:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: addb $-128, %al
-; X86-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v32i8:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: addb $-128, %al
-; X86-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovll %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminsb %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: addb $-128, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: addb $-128, %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: addb $-128, %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: addb $-128, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <32 x i8> %a0, %1
- %3 = select <32 x i1> %2, <32 x i8> %a0, <32 x i8> %1
- %4 = shufflevector <32 x i8> %3, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <32 x i8> %3, %4
- %6 = select <32 x i1> %5, <32 x i8> %3, <32 x i8> %4
- %7 = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <32 x i8> %6, %7
- %9 = select <32 x i1> %8, <32 x i8> %6, <32 x i8> %7
- %10 = shufflevector <32 x i8> %9, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp slt <32 x i8> %9, %10
- %12 = select <32 x i1> %11, <32 x i8> %9, <32 x i8> %10
- %13 = shufflevector <32 x i8> %12, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp slt <32 x i8> %12, %13
- %15 = select <32 x i1> %14, <32 x i8> %12, <32 x i8> %13
- %16 = extractelement <32 x i8> %15, i32 0
- ret i8 %16
-}
-
-;
-; 512-bit Vectors
-;
-
-define i64 @test_reduce_v8i64(<8 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,0,2147483648,0]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm5
-; X86-SSE2-NEXT: pxor %xmm4, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm6
-; X86-SSE2-NEXT: pxor %xmm4, %xmm6
-; X86-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X86-SSE2-NEXT: pcmpgtd %xmm5, %xmm7
-; X86-SSE2-NEXT: pcmpeqd %xmm5, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm6[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm6, %xmm5
-; X86-SSE2-NEXT: pand %xmm5, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm5
-; X86-SSE2-NEXT: por %xmm0, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm2
-; X86-SSE2-NEXT: pxor %xmm4, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm6
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm6
-; X86-SSE2-NEXT: pcmpeqd %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm6[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm7 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm0, %xmm7
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm6[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm7, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm5, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: pand %xmm2, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm2
-; X86-SSE2-NEXT: por %xmm1, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X86-SSE2-NEXT: pxor %xmm4, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm3
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm3
-; X86-SSE2-NEXT: pcmpeqd %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm5
-; X86-SSE2-NEXT: pandn %xmm2, %xmm0
-; X86-SSE2-NEXT: por %xmm5, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pxor %xmm4, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm4, %xmm3
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm3
-; X86-SSE2-NEXT: pcmpeqd %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm4, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm4
-; X86-SSE42-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm4, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
-; X86-SSE42-NEXT: movdqa %xmm3, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm1, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X86-SSE42-NEXT: movapd %xmm3, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm3
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm3[2,3,2,3]
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm3, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm3, %xmm1
-; X86-SSE42-NEXT: movd %xmm1, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm1, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v8i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
-; X86-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm3
-; X86-AVX1-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v8i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpcmpgtq %ymm0, %ymm1, %ymm2
-; X86-AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
-; X86-AVX2-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vshufps {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm5
-; X64-SSE2-NEXT: pxor %xmm4, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X64-SSE2-NEXT: pcmpgtd %xmm5, %xmm7
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm5, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm6[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm8, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm6, %xmm5
-; X64-SSE2-NEXT: pand %xmm5, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm5
-; X64-SSE2-NEXT: por %xmm0, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm5, %xmm0
-; X64-SSE2-NEXT: pxor %xmm4, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pxor %xmm4, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm3, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X64-SSE2-NEXT: pcmpgtd %xmm2, %xmm7
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm2, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm6[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm8, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm2, %xmm6
-; X64-SSE2-NEXT: pand %xmm6, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm6
-; X64-SSE2-NEXT: por %xmm1, %xmm6
-; X64-SSE2-NEXT: pxor %xmm6, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm4, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm0, %xmm4
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm4[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm5
-; X64-SSE2-NEXT: pandn %xmm6, %xmm1
-; X64-SSE2-NEXT: por %xmm5, %xmm1
-; X64-SSE2-NEXT: movq %xmm1, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovlq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm4
-; X64-SSE42-NEXT: movdqa %xmm2, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm4, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
-; X64-SSE42-NEXT: movdqa %xmm3, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm1, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X64-SSE42-NEXT: movapd %xmm3, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm3
-; X64-SSE42-NEXT: pextrq $1, %xmm3, %rax
-; X64-SSE42-NEXT: movq %xmm3, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovlq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X64-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
-; X64-AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm3
-; X64-AVX1-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm0
-; X64-AVX1-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm1
-; X64-AVX1-NEXT: vblendvpd %xmm1, %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovlq %rcx, %rax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpcmpgtq %ymm0, %ymm1, %ymm2
-; X64-AVX2-NEXT: vblendvpd %ymm2, %ymm0, %ymm1, %ymm0
-; X64-AVX2-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm2
-; X64-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovlq %rcx, %rax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpminsq %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminsq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i64> %a0, <8 x i64> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <8 x i64> %a0, %1
- %3 = select <8 x i1> %2, <8 x i64> %a0, <8 x i64> %1
- %4 = shufflevector <8 x i64> %3, <8 x i64> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <8 x i64> %3, %4
- %6 = select <8 x i1> %5, <8 x i64> %3, <8 x i64> %4
- %7 = shufflevector <8 x i64> %6, <8 x i64> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <8 x i64> %6, %7
- %9 = select <8 x i1> %8, <8 x i64> %6, <8 x i64> %7
- %10 = extractelement <8 x i64> %9, i32 0
- ret i64 %10
-}
-
-define i32 @test_reduce_v16i32(<16 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm4
-; X86-SSE2-NEXT: pand %xmm4, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm4
-; X86-SSE2-NEXT: por %xmm0, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm0
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pcmpgtd %xmm4, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm4
-; X86-SSE2-NEXT: pandn %xmm0, %xmm1
-; X86-SSE2-NEXT: por %xmm4, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm1
-; X86-SSE2-NEXT: pandn %xmm0, %xmm2
-; X86-SSE2-NEXT: por %xmm1, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovll %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminsd %xmm3, %xmm1
-; X86-SSE42-NEXT: pminsd %xmm2, %xmm0
-; X86-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pminsd %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v16i32:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpminsd %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpminsd %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v16i32:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpminsd %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm4
-; X64-SSE2-NEXT: pand %xmm4, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm4
-; X64-SSE2-NEXT: por %xmm0, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm3, %xmm0
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm0
-; X64-SSE2-NEXT: pand %xmm0, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm0
-; X64-SSE2-NEXT: por %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm4, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm4
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm4, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovll %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminsd %xmm3, %xmm1
-; X64-SSE42-NEXT: pminsd %xmm2, %xmm0
-; X64-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pminsd %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pminsd %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i32:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpminsd %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpminsd %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX1-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i32:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpminsd %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX2-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i32:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpminsd %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX512-NEXT: vpminsd %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i32> %a0, <16 x i32> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <16 x i32> %a0, %1
- %3 = select <16 x i1> %2, <16 x i32> %a0, <16 x i32> %1
- %4 = shufflevector <16 x i32> %3, <16 x i32> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <16 x i32> %3, %4
- %6 = select <16 x i1> %5, <16 x i32> %3, <16 x i32> %4
- %7 = shufflevector <16 x i32> %6, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <16 x i32> %6, %7
- %9 = select <16 x i1> %8, <16 x i32> %6, <16 x i32> %7
- %10 = shufflevector <16 x i32> %9, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp slt <16 x i32> %9, %10
- %12 = select <16 x i1> %11, <16 x i32> %9, <16 x i32> %10
- %13 = extractelement <16 x i32> %12, i32 0
- ret i32 %13
-}
-
-define i16 @test_reduce_v32i16(<32 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pminsw %xmm3, %xmm1
-; X86-SSE2-NEXT: pminsw %xmm2, %xmm0
-; X86-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminsw %xmm3, %xmm1
-; X86-SSE42-NEXT: pminsw %xmm2, %xmm0
-; X86-SSE42-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v32i16:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpminsw %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpminsw %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v32i16:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpminsw %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pminsw %xmm3, %xmm1
-; X64-SSE2-NEXT: pminsw %xmm2, %xmm0
-; X64-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminsw %xmm3, %xmm1
-; X64-SSE42-NEXT: pminsw %xmm2, %xmm0
-; X64-SSE42-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpminsw %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpminsw %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpminsw %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpminsw %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminsw %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <32 x i16> %a0, %1
- %3 = select <32 x i1> %2, <32 x i16> %a0, <32 x i16> %1
- %4 = shufflevector <32 x i16> %3, <32 x i16> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <32 x i16> %3, %4
- %6 = select <32 x i1> %5, <32 x i16> %3, <32 x i16> %4
- %7 = shufflevector <32 x i16> %6, <32 x i16> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <32 x i16> %6, %7
- %9 = select <32 x i1> %8, <32 x i16> %6, <32 x i16> %7
- %10 = shufflevector <32 x i16> %9, <32 x i16> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp slt <32 x i16> %9, %10
- %12 = select <32 x i1> %11, <32 x i16> %9, <32 x i16> %10
- %13 = shufflevector <32 x i16> %12, <32 x i16> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp slt <32 x i16> %12, %13
- %15 = select <32 x i1> %14, <32 x i16> %12, <32 x i16> %13
- %16 = extractelement <32 x i16> %15, i32 0
- ret i16 %16
-}
-
-define i8 @test_reduce_v64i8(<64 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v64i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm4
-; X86-SSE2-NEXT: pand %xmm4, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm4
-; X86-SSE2-NEXT: por %xmm0, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pcmpgtb %xmm4, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm4
-; X86-SSE2-NEXT: pandn %xmm0, %xmm1
-; X86-SSE2-NEXT: por %xmm4, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm1
-; X86-SSE2-NEXT: pandn %xmm0, %xmm2
-; X86-SSE2-NEXT: por %xmm1, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm2, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovll %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v64i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminsb %xmm3, %xmm1
-; X86-SSE42-NEXT: pminsb %xmm2, %xmm0
-; X86-SSE42-NEXT: pminsb %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: addb $-128, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v64i8:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpminsb %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpminsb %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: addb $-128, %al
-; X86-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v64i8:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpminsb %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: addb $-128, %al
-; X86-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v64i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm4
-; X64-SSE2-NEXT: pand %xmm4, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm4
-; X64-SSE2-NEXT: por %xmm0, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm3, %xmm0
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm0
-; X64-SSE2-NEXT: pand %xmm0, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm0
-; X64-SSE2-NEXT: por %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm4, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm4
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm4, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovll %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v64i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminsb %xmm3, %xmm1
-; X64-SSE42-NEXT: pminsb %xmm2, %xmm0
-; X64-SSE42-NEXT: pminsb %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: addb $-128, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v64i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpminsb %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpminsb %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: addb $-128, %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v64i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpminsb %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: addb $-128, %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v64i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpminsb %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminsb %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: addb $-128, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <64 x i8> %a0, <64 x i8> undef, <64 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <64 x i8> %a0, %1
- %3 = select <64 x i1> %2, <64 x i8> %a0, <64 x i8> %1
- %4 = shufflevector <64 x i8> %3, <64 x i8> undef, <64 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <64 x i8> %3, %4
- %6 = select <64 x i1> %5, <64 x i8> %3, <64 x i8> %4
- %7 = shufflevector <64 x i8> %6, <64 x i8> undef, <64 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <64 x i8> %6, %7
- %9 = select <64 x i1> %8, <64 x i8> %6, <64 x i8> %7
- %10 = shufflevector <64 x i8> %9, <64 x i8> undef, <64 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp slt <64 x i8> %9, %10
- %12 = select <64 x i1> %11, <64 x i8> %9, <64 x i8> %10
- %13 = shufflevector <64 x i8> %12, <64 x i8> undef, <64 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp slt <64 x i8> %12, %13
- %15 = select <64 x i1> %14, <64 x i8> %12, <64 x i8> %13
- %16 = shufflevector <64 x i8> %15, <64 x i8> undef, <64 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %17 = icmp slt <64 x i8> %15, %16
- %18 = select <64 x i1> %17, <64 x i8> %15, <64 x i8> %16
- %19 = extractelement <64 x i8> %18, i32 0
- ret i8 %19
-}
-
-;
-; Partial Vector Reductions
-;
-
-define i16 @test_reduce_v16i16_v8i16(<16 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i16_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i16_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v16i16_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i16_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i16_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v16i16_v8i16:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX1OR2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1OR2-NEXT: vzeroupper
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i16_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <16 x i16> %a0, %1
- %3 = select <16 x i1> %2, <16 x i16> %a0, <16 x i16> %1
- %4 = shufflevector <16 x i16> %3, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <16 x i16> %3, %4
- %6 = select <16 x i1> %5, <16 x i16> %3, <16 x i16> %4
- %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <16 x i16> %6, %7
- %9 = select <16 x i1> %8, <16 x i16> %6, <16 x i16> %7
- %10 = extractelement <16 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i16 @test_reduce_v32i16_v8i16(<32 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i16_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i16_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v32i16_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i16_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminsw %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminsw %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i16_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v32i16_v8i16:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX1OR2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1OR2-NEXT: vzeroupper
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i16_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: xorl $32768, %eax ## imm = 0x8000
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <32 x i16> %a0, %1
- %3 = select <32 x i1> %2, <32 x i16> %a0, <32 x i16> %1
- %4 = shufflevector <32 x i16> %3, <32 x i16> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <32 x i16> %3, %4
- %6 = select <32 x i1> %5, <32 x i16> %3, <32 x i16> %4
- %7 = shufflevector <32 x i16> %6, <32 x i16> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <32 x i16> %6, %7
- %9 = select <32 x i1> %8, <32 x i16> %6, <32 x i16> %7
- %10 = extractelement <32 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i8 @test_reduce_v32i8_v16i8(<32 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i8_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm2, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovll %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i8_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: addb $-128, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v32i8_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: addb $-128, %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i8_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovll %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i8_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: addb $-128, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v32i8_v16i8:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1OR2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: addb $-128, %al
-; X64-AVX1OR2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1OR2-NEXT: vzeroupper
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i8_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: addb $-128, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <32 x i8> %a0, %1
- %3 = select <32 x i1> %2, <32 x i8> %a0, <32 x i8> %1
- %4 = shufflevector <32 x i8> %3, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <32 x i8> %3, %4
- %6 = select <32 x i1> %5, <32 x i8> %3, <32 x i8> %4
- %7 = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <32 x i8> %6, %7
- %9 = select <32 x i1> %8, <32 x i8> %6, <32 x i8> %7
- %10 = shufflevector <32 x i8> %9, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp slt <32 x i8> %9, %10
- %12 = select <32 x i1> %11, <32 x i8> %9, <32 x i8> %10
- %13 = extractelement <32 x i8> %12, i32 0
- ret i8 %13
-}
-
-define i8 @test_reduce_v64i8_v16i8(<64 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v64i8_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pcmpgtb %xmm2, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: movl %ecx, %eax
-; X86-SSE2-NEXT: shrl $8, %eax
-; X86-SSE2-NEXT: cmpb %al, %cl
-; X86-SSE2-NEXT: cmovll %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v64i8_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: addb $-128, %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v64i8_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: addb $-128, %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v64i8_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pcmpgtb %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm2
-; X64-SSE2-NEXT: pandn %xmm0, %xmm1
-; X64-SSE2-NEXT: por %xmm2, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrld $16, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pcmpgtb %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pandn %xmm0, %xmm2
-; X64-SSE2-NEXT: por %xmm1, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: movl %ecx, %eax
-; X64-SSE2-NEXT: shrl $8, %eax
-; X64-SSE2-NEXT: cmpb %al, %cl
-; X64-SSE2-NEXT: cmovll %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v64i8_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: addb $-128, %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1OR2-LABEL: test_reduce_v64i8_v16i8:
-; X64-AVX1OR2: ## %bb.0:
-; X64-AVX1OR2-NEXT: vpxor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1OR2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1OR2-NEXT: vmovd %xmm0, %eax
-; X64-AVX1OR2-NEXT: addb $-128, %al
-; X64-AVX1OR2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1OR2-NEXT: vzeroupper
-; X64-AVX1OR2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v64i8_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: addb $-128, %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <64 x i8> %a0, <64 x i8> undef, <64 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp slt <64 x i8> %a0, %1
- %3 = select <64 x i1> %2, <64 x i8> %a0, <64 x i8> %1
- %4 = shufflevector <64 x i8> %3, <64 x i8> undef, <64 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp slt <64 x i8> %3, %4
- %6 = select <64 x i1> %5, <64 x i8> %3, <64 x i8> %4
- %7 = shufflevector <64 x i8> %6, <64 x i8> undef, <64 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp slt <64 x i8> %6, %7
- %9 = select <64 x i1> %8, <64 x i8> %6, <64 x i8> %7
- %10 = shufflevector <64 x i8> %9, <64 x i8> undef, <64 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp slt <64 x i8> %9, %10
- %12 = select <64 x i1> %11, <64 x i8> %9, <64 x i8> %10
- %13 = extractelement <64 x i8> %12, i32 0
- ret i8 %13
-}
diff --git a/llvm/test/CodeGen/X86/horizontal-reduce-umax.ll b/llvm/test/CodeGen/X86/horizontal-reduce-umax.ll
deleted file mode 100644
index 29fa565023c26..0000000000000
--- a/llvm/test/CodeGen/X86/horizontal-reduce-umax.ll
+++ /dev/null
@@ -1,2353 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X86-SSE2
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse4.2 | FileCheck %s --check-prefix=X86-SSE42
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx | FileCheck %s --check-prefixes=X86-AVX,X86-AVX1
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx2 | FileCheck %s --check-prefixes=X86-AVX,X86-AVX2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X64-SSE2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse4.2 | FileCheck %s --check-prefix=X64-SSE42
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx | FileCheck %s --check-prefixes=X64-AVX,X64-AVX1
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx2 | FileCheck %s --check-prefixes=X64-AVX,X64-AVX2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X64-AVX,X64-AVX512
-
-;
-; 128-bit Vectors
-;
-
-define i64 @test_reduce_v2i64(<2 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v2i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm2, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movd %xmm3, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v2i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: movdqa {{.*#+}} xmm2 = [0,2147483648,0,2147483648]
-; X86-SSE42-NEXT: pxor %xmm2, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; X86-SSE42-NEXT: pxor %xmm3, %xmm2
-; X86-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X86-SSE42-NEXT: movd %xmm3, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm3, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v2i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vmovddup {{.*#+}} xmm1 = [0,2147483648,0,2147483648]
-; X86-AVX1-NEXT: ## xmm1 = mem[0,0]
-; X86-AVX1-NEXT: vxorps %xmm1, %xmm0, %xmm2
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vxorps %xmm1, %xmm3, %xmm1
-; X86-AVX1-NEXT: vpcmpgtq %xmm1, %xmm2, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v2i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpbroadcastq {{.*#+}} xmm1 = [0,2147483648,0,2147483648]
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm2
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm3, %xmm1
-; X86-AVX2-NEXT: vpcmpgtq %xmm1, %xmm2, %xmm1
-; X86-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v2i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movq %xmm0, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovaq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v2i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pextrq $1, %xmm0, %rax
-; X64-SSE42-NEXT: movq %xmm0, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovaq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v2i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovaq %rcx, %rax
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v2i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovaq %rcx, %rax
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v2i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <2 x i64> %a0, <2 x i64> undef, <2 x i32> <i32 1, i32 undef>
- %2 = icmp ugt <2 x i64> %a0, %1
- %3 = select <2 x i1> %2, <2 x i64> %a0, <2 x i64> %1
- %4 = extractelement <2 x i64> %3, i32 0
- ret i64 %4
-}
-
-define i32 @test_reduce_v4i32(<4 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v4i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pxor %xmm1, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm3, %xmm1
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm3, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmoval %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v4i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pmaxud %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v4i32:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v4i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2147483648,2147483648,2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pxor %xmm1, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pxor %xmm3, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pandn %xmm3, %xmm2
-; X64-SSE2-NEXT: por %xmm0, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmoval %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v4i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pmaxud %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v4i32:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: retq
- %1 = shufflevector <4 x i32> %a0, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
- %2 = icmp ugt <4 x i32> %a0, %1
- %3 = select <4 x i1> %2, <4 x i32> %a0, <4 x i32> %1
- %4 = shufflevector <4 x i32> %3, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <4 x i32> %3, %4
- %6 = select <4 x i1> %5, <4 x i32> %3, <4 x i32> %4
- %7 = extractelement <4 x i32> %6, i32 0
- ret i32 %7
-}
-
-define i16 @test_reduce_v8i16(<8 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X86-SSE2-NEXT: paddw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm0
-; X86-SSE2-NEXT: paddw %xmm1, %xmm0
-; X86-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmoval %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notl %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: notl %eax
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X64-SSE2-NEXT: paddw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm0
-; X64-SSE2-NEXT: paddw %xmm1, %xmm0
-; X64-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmoval %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notl %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notl %eax
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notl %eax
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notl %eax
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i16> %a0, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <8 x i16> %a0, %1
- %3 = select <8 x i1> %2, <8 x i16> %a0, <8 x i16> %1
- %4 = shufflevector <8 x i16> %3, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <8 x i16> %3, %4
- %6 = select <8 x i1> %5, <8 x i16> %3, <8 x i16> %4
- %7 = shufflevector <8 x i16> %6, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <8 x i16> %6, %7
- %9 = select <8 x i1> %8, <8 x i16> %6, <8 x i16> %7
- %10 = extractelement <8 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i8 @test_reduce_v16i8(<16 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: psrlw $8, %xmm0
-; X86-SSE42-NEXT: pminub %xmm1, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notb %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: notb %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE42-NEXT: psrlw $8, %xmm0
-; X64-SSE42-NEXT: pminub %xmm1, %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notb %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notb %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notb %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notb %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i8> %a0, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <16 x i8> %a0, %1
- %3 = select <16 x i1> %2, <16 x i8> %a0, <16 x i8> %1
- %4 = shufflevector <16 x i8> %3, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <16 x i8> %3, %4
- %6 = select <16 x i1> %5, <16 x i8> %3, <16 x i8> %4
- %7 = shufflevector <16 x i8> %6, <16 x i8> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <16 x i8> %6, %7
- %9 = select <16 x i1> %8, <16 x i8> %6, <16 x i8> %7
- %10 = shufflevector <16 x i8> %9, <16 x i8> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ugt <16 x i8> %9, %10
- %12 = select <16 x i1> %11, <16 x i8> %9, <16 x i8> %10
- %13 = extractelement <16 x i8> %12, i32 0
- ret i8 %13
-}
-
-;
-; 256-bit Vectors
-;
-
-define i64 @test_reduce_v4i64(<4 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v4i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm4
-; X86-SSE2-NEXT: pxor %xmm2, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm4, %xmm5
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm5
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm6, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm5[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm4, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm1
-; X86-SSE2-NEXT: pxor %xmm2, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm0, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm1, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm3
-; X86-SSE2-NEXT: pandn %xmm0, %xmm2
-; X86-SSE2-NEXT: por %xmm3, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v4i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE42-NEXT: movdqa {{.*#+}} xmm3 = [0,2147483648,0,2147483648]
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE42-NEXT: pxor %xmm3, %xmm4
-; X86-SSE42-NEXT: pxor %xmm3, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm4, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
-; X86-SSE42-NEXT: movapd %xmm1, %xmm0
-; X86-SSE42-NEXT: xorpd %xmm3, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm2 = xmm1[2,3,2,3]
-; X86-SSE42-NEXT: pxor %xmm2, %xmm3
-; X86-SSE42-NEXT: pcmpgtq %xmm3, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm2
-; X86-SSE42-NEXT: movd %xmm2, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm2, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v4i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vmovddup {{.*#+}} xmm2 = [0,2147483648,0,2147483648]
-; X86-AVX1-NEXT: ## xmm2 = mem[0,0]
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm1, %xmm3
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm0, %xmm4
-; X86-AVX1-NEXT: vpcmpgtq %xmm3, %xmm4, %xmm3
-; X86-AVX1-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v4i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpbroadcastq {{.*#+}} xmm2 = [0,2147483648,0,2147483648]
-; X86-AVX2-NEXT: vpxor %xmm2, %xmm1, %xmm3
-; X86-AVX2-NEXT: vpxor %xmm2, %xmm0, %xmm4
-; X86-AVX2-NEXT: vpcmpgtq %xmm3, %xmm4, %xmm3
-; X86-AVX2-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX2-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm3, %xmm2
-; X86-AVX2-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X86-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v4i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [9223372039002259456,9223372039002259456]
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm3
-; X64-SSE2-NEXT: pxor %xmm2, %xmm3
-; X64-SSE2-NEXT: pxor %xmm0, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm5, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm2, %xmm3
-; X64-SSE2-NEXT: pand %xmm3, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm3
-; X64-SSE2-NEXT: por %xmm0, %xmm3
-; X64-SSE2-NEXT: movq %xmm3, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovaq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v4i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE42-NEXT: movdqa {{.*#+}} xmm0 = [9223372036854775808,9223372036854775808]
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm3
-; X64-SSE42-NEXT: pxor %xmm0, %xmm3
-; X64-SSE42-NEXT: pxor %xmm2, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm3, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
-; X64-SSE42-NEXT: pextrq $1, %xmm1, %rax
-; X64-SSE42-NEXT: movq %xmm1, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovaq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v4i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vmovddup {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
-; X64-AVX1-NEXT: ## xmm2 = mem[0,0]
-; X64-AVX1-NEXT: vpxor %xmm2, %xmm1, %xmm3
-; X64-AVX1-NEXT: vpxor %xmm2, %xmm0, %xmm2
-; X64-AVX1-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
-; X64-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovaq %rcx, %rax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v4i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpbroadcastq {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
-; X64-AVX2-NEXT: vpxor %xmm2, %xmm1, %xmm3
-; X64-AVX2-NEXT: vpxor %xmm2, %xmm0, %xmm2
-; X64-AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
-; X64-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovaq %rcx, %rax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v4i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <4 x i64> %a0, <4 x i64> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
- %2 = icmp ugt <4 x i64> %a0, %1
- %3 = select <4 x i1> %2, <4 x i64> %a0, <4 x i64> %1
- %4 = shufflevector <4 x i64> %3, <4 x i64> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <4 x i64> %3, %4
- %6 = select <4 x i1> %5, <4 x i64> %3, <4 x i64> %4
- %7 = extractelement <4 x i64> %6, i32 0
- ret i64 %7
-}
-
-define i32 @test_reduce_v8i32(<8 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm3 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE2-NEXT: pxor %xmm3, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pxor %xmm3, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm4, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE2-NEXT: pxor %xmm3, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm3
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm2
-; X86-SSE2-NEXT: pandn %xmm1, %xmm0
-; X86-SSE2-NEXT: por %xmm2, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmoval %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pmaxud %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v8i32:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v8i32:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm3
-; X64-SSE2-NEXT: pxor %xmm2, %xmm3
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm4
-; X64-SSE2-NEXT: pxor %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X64-SSE2-NEXT: pand %xmm4, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm4
-; X64-SSE2-NEXT: por %xmm0, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm4, %xmm0
-; X64-SSE2-NEXT: pxor %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm4[2,3,2,3]
-; X64-SSE2-NEXT: pxor %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtd %xmm2, %xmm0
-; X64-SSE2-NEXT: pand %xmm0, %xmm4
-; X64-SSE2-NEXT: pandn %xmm1, %xmm0
-; X64-SSE2-NEXT: por %xmm4, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmoval %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pmaxud %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i32:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i32:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i32:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX512-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i32> %a0, <8 x i32> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <8 x i32> %a0, %1
- %3 = select <8 x i1> %2, <8 x i32> %a0, <8 x i32> %1
- %4 = shufflevector <8 x i32> %3, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <8 x i32> %3, %4
- %6 = select <8 x i1> %5, <8 x i32> %3, <8 x i32> %4
- %7 = shufflevector <8 x i32> %6, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <8 x i32> %6, %7
- %9 = select <8 x i1> %8, <8 x i32> %6, <8 x i32> %7
- %10 = extractelement <8 x i32> %9, i32 0
- ret i32 %10
-}
-
-define i16 @test_reduce_v16i16(<16 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X86-SSE2-NEXT: paddw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm0
-; X86-SSE2-NEXT: paddw %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X86-SSE2-NEXT: paddw %xmm0, %xmm1
-; X86-SSE2-NEXT: pextrw $1, %xmm1, %eax
-; X86-SSE2-NEXT: movd %xmm1, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmoval %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxuw %xmm1, %xmm0
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notl %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v16i16:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: notl %eax
-; X86-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v16i16:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: notl %eax
-; X86-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X64-SSE2-NEXT: paddw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm0
-; X64-SSE2-NEXT: paddw %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X64-SSE2-NEXT: paddw %xmm0, %xmm1
-; X64-SSE2-NEXT: pextrw $1, %xmm1, %eax
-; X64-SSE2-NEXT: movd %xmm1, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmoval %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxuw %xmm1, %xmm0
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notl %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notl %eax
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notl %eax
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notl %eax
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <16 x i16> %a0, %1
- %3 = select <16 x i1> %2, <16 x i16> %a0, <16 x i16> %1
- %4 = shufflevector <16 x i16> %3, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <16 x i16> %3, %4
- %6 = select <16 x i1> %5, <16 x i16> %3, <16 x i16> %4
- %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <16 x i16> %6, %7
- %9 = select <16 x i1> %8, <16 x i16> %6, <16 x i16> %7
- %10 = shufflevector <16 x i16> %9, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ugt <16 x i16> %9, %10
- %12 = select <16 x i1> %11, <16 x i16> %9, <16 x i16> %10
- %13 = extractelement <16 x i16> %12, i32 0
- ret i16 %13
-}
-
-define i8 @test_reduce_v32i8(<32 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: psrlw $8, %xmm0
-; X86-SSE42-NEXT: pminub %xmm1, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notb %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v32i8:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: notb %al
-; X86-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v32i8:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: notb %al
-; X86-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE42-NEXT: psrlw $8, %xmm0
-; X64-SSE42-NEXT: pminub %xmm1, %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notb %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notb %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notb %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notb %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <32 x i8> %a0, %1
- %3 = select <32 x i1> %2, <32 x i8> %a0, <32 x i8> %1
- %4 = shufflevector <32 x i8> %3, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <32 x i8> %3, %4
- %6 = select <32 x i1> %5, <32 x i8> %3, <32 x i8> %4
- %7 = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <32 x i8> %6, %7
- %9 = select <32 x i1> %8, <32 x i8> %6, <32 x i8> %7
- %10 = shufflevector <32 x i8> %9, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ugt <32 x i8> %9, %10
- %12 = select <32 x i1> %11, <32 x i8> %9, <32 x i8> %10
- %13 = shufflevector <32 x i8> %12, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp ugt <32 x i8> %12, %13
- %15 = select <32 x i1> %14, <32 x i8> %12, <32 x i8> %13
- %16 = extractelement <32 x i8> %15, i32 0
- ret i8 %16
-}
-
-;
-; 512-bit Vectors
-;
-
-define i64 @test_reduce_v8i64(<8 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm5
-; X86-SSE2-NEXT: pxor %xmm4, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm6
-; X86-SSE2-NEXT: pxor %xmm4, %xmm6
-; X86-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X86-SSE2-NEXT: pcmpgtd %xmm5, %xmm7
-; X86-SSE2-NEXT: pcmpeqd %xmm5, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm6[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm6, %xmm5
-; X86-SSE2-NEXT: pand %xmm5, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm5
-; X86-SSE2-NEXT: por %xmm1, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X86-SSE2-NEXT: pxor %xmm4, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: pxor %xmm4, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm6
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm6
-; X86-SSE2-NEXT: pcmpeqd %xmm1, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm6[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm1, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm6[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm3, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm5, %xmm3
-; X86-SSE2-NEXT: pxor %xmm4, %xmm3
-; X86-SSE2-NEXT: pand %xmm1, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm1
-; X86-SSE2-NEXT: por %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm2
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm0[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm3, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm6, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm5, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pxor %xmm4, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm3
-; X86-SSE2-NEXT: pcmpgtd %xmm4, %xmm3
-; X86-SSE2-NEXT: pcmpeqd %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm4, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm4
-; X86-SSE42-NEXT: movdqa {{.*#+}} xmm5 = [0,2147483648,0,2147483648]
-; X86-SSE42-NEXT: movdqa %xmm3, %xmm6
-; X86-SSE42-NEXT: pxor %xmm5, %xmm6
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor %xmm5, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm6, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X86-SSE42-NEXT: movapd %xmm3, %xmm1
-; X86-SSE42-NEXT: xorpd %xmm5, %xmm1
-; X86-SSE42-NEXT: movdqa %xmm2, %xmm6
-; X86-SSE42-NEXT: pxor %xmm5, %xmm6
-; X86-SSE42-NEXT: movdqa %xmm4, %xmm0
-; X86-SSE42-NEXT: pxor %xmm5, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm6, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
-; X86-SSE42-NEXT: movapd %xmm2, %xmm0
-; X86-SSE42-NEXT: xorpd %xmm5, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm1, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm3
-; X86-SSE42-NEXT: movapd %xmm3, %xmm0
-; X86-SSE42-NEXT: xorpd %xmm5, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm3[2,3,2,3]
-; X86-SSE42-NEXT: pxor %xmm1, %xmm5
-; X86-SSE42-NEXT: pcmpgtq %xmm5, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm3, %xmm1
-; X86-SSE42-NEXT: movd %xmm1, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm1, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v8i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
-; X86-AVX1-NEXT: vmovddup {{.*#+}} xmm2 = [0,2147483648,0,2147483648]
-; X86-AVX1-NEXT: ## xmm2 = mem[0,0]
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm3, %xmm4
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm5
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm5, %xmm6
-; X86-AVX1-NEXT: vpcmpgtq %xmm4, %xmm6, %xmm4
-; X86-AVX1-NEXT: vblendvpd %xmm4, %xmm5, %xmm3, %xmm3
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm3, %xmm4
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm1, %xmm5
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm0, %xmm6
-; X86-AVX1-NEXT: vpcmpgtq %xmm5, %xmm6, %xmm5
-; X86-AVX1-NEXT: vblendvpd %xmm5, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpcmpgtq %xmm4, %xmm1, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v8i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [0,2147483648,0,2147483648,0,2147483648,0,2147483648]
-; X86-AVX2-NEXT: vpxor %ymm2, %ymm1, %ymm3
-; X86-AVX2-NEXT: vpxor %ymm2, %ymm0, %ymm4
-; X86-AVX2-NEXT: vpcmpgtq %ymm3, %ymm4, %ymm3
-; X86-AVX2-NEXT: vblendvpd %ymm3, %ymm0, %ymm1, %ymm0
-; X86-AVX2-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm1, %xmm3
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm0, %xmm4
-; X86-AVX2-NEXT: vpcmpgtq %xmm3, %xmm4, %xmm3
-; X86-AVX2-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm0
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX2-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm3, %xmm2
-; X86-AVX2-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X86-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [9223372039002259456,9223372039002259456]
-; X64-SSE2-NEXT: movdqa %xmm3, %xmm5
-; X64-SSE2-NEXT: pxor %xmm4, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X64-SSE2-NEXT: pcmpgtd %xmm5, %xmm7
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm5, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm6[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm8, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm6, %xmm5
-; X64-SSE2-NEXT: pand %xmm5, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm5
-; X64-SSE2-NEXT: por %xmm1, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm5, %xmm1
-; X64-SSE2-NEXT: pxor %xmm4, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm3
-; X64-SSE2-NEXT: pxor %xmm4, %xmm3
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm7
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm3, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm6[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm8, %xmm3
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm3, %xmm6
-; X64-SSE2-NEXT: pand %xmm6, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm6
-; X64-SSE2-NEXT: por %xmm0, %xmm6
-; X64-SSE2-NEXT: pxor %xmm6, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm4, %xmm0
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm1, %xmm4
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm4[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm2, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm1, %xmm0
-; X64-SSE2-NEXT: pand %xmm0, %xmm6
-; X64-SSE2-NEXT: pandn %xmm5, %xmm0
-; X64-SSE2-NEXT: por %xmm6, %xmm0
-; X64-SSE2-NEXT: movq %xmm0, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovaq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm4
-; X64-SSE42-NEXT: movdqa {{.*#+}} xmm5 = [9223372036854775808,9223372036854775808]
-; X64-SSE42-NEXT: movdqa %xmm3, %xmm6
-; X64-SSE42-NEXT: pxor %xmm5, %xmm6
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE42-NEXT: pxor %xmm5, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm6, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X64-SSE42-NEXT: movapd %xmm3, %xmm1
-; X64-SSE42-NEXT: xorpd %xmm5, %xmm1
-; X64-SSE42-NEXT: movdqa %xmm2, %xmm6
-; X64-SSE42-NEXT: pxor %xmm5, %xmm6
-; X64-SSE42-NEXT: movdqa %xmm4, %xmm0
-; X64-SSE42-NEXT: pxor %xmm5, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm6, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
-; X64-SSE42-NEXT: xorpd %xmm2, %xmm5
-; X64-SSE42-NEXT: pcmpgtq %xmm1, %xmm5
-; X64-SSE42-NEXT: movdqa %xmm5, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm3
-; X64-SSE42-NEXT: pextrq $1, %xmm3, %rax
-; X64-SSE42-NEXT: movq %xmm3, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovaq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vmovddup {{.*#+}} xmm3 = [9223372036854775808,9223372036854775808]
-; X64-AVX1-NEXT: ## xmm3 = mem[0,0]
-; X64-AVX1-NEXT: vpxor %xmm3, %xmm2, %xmm4
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm5
-; X64-AVX1-NEXT: vpxor %xmm3, %xmm5, %xmm6
-; X64-AVX1-NEXT: vpcmpgtq %xmm4, %xmm6, %xmm4
-; X64-AVX1-NEXT: vblendvpd %xmm4, %xmm5, %xmm2, %xmm2
-; X64-AVX1-NEXT: vxorpd %xmm3, %xmm2, %xmm4
-; X64-AVX1-NEXT: vpxor %xmm3, %xmm1, %xmm5
-; X64-AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm6
-; X64-AVX1-NEXT: vpcmpgtq %xmm5, %xmm6, %xmm5
-; X64-AVX1-NEXT: vblendvpd %xmm5, %xmm0, %xmm1, %xmm0
-; X64-AVX1-NEXT: vxorpd %xmm3, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpcmpgtq %xmm4, %xmm1, %xmm1
-; X64-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm2, %xmm0
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovaq %rcx, %rax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [9223372036854775808,9223372036854775808,9223372036854775808,9223372036854775808]
-; X64-AVX2-NEXT: vpxor %ymm2, %ymm1, %ymm3
-; X64-AVX2-NEXT: vpxor %ymm2, %ymm0, %ymm4
-; X64-AVX2-NEXT: vpcmpgtq %ymm3, %ymm4, %ymm3
-; X64-AVX2-NEXT: vblendvpd %ymm3, %ymm0, %ymm1, %ymm0
-; X64-AVX2-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vxorpd %xmm2, %xmm1, %xmm3
-; X64-AVX2-NEXT: vxorpd %xmm2, %xmm0, %xmm2
-; X64-AVX2-NEXT: vpcmpgtq %xmm3, %xmm2, %xmm2
-; X64-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm1, %xmm0
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovaq %rcx, %rax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpmaxuq %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i64> %a0, <8 x i64> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <8 x i64> %a0, %1
- %3 = select <8 x i1> %2, <8 x i64> %a0, <8 x i64> %1
- %4 = shufflevector <8 x i64> %3, <8 x i64> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <8 x i64> %3, %4
- %6 = select <8 x i1> %5, <8 x i64> %3, <8 x i64> %4
- %7 = shufflevector <8 x i64> %6, <8 x i64> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <8 x i64> %6, %7
- %9 = select <8 x i1> %8, <8 x i64> %6, <8 x i64> %7
- %10 = extractelement <8 x i64> %9, i32 0
- ret i64 %10
-}
-
-define i32 @test_reduce_v16i32(<16 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm6
-; X86-SSE2-NEXT: pxor %xmm4, %xmm6
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm5
-; X86-SSE2-NEXT: pxor %xmm4, %xmm5
-; X86-SSE2-NEXT: pcmpgtd %xmm6, %xmm5
-; X86-SSE2-NEXT: pand %xmm5, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm5
-; X86-SSE2-NEXT: por %xmm1, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm5, %xmm3
-; X86-SSE2-NEXT: pxor %xmm4, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm6
-; X86-SSE2-NEXT: pxor %xmm4, %xmm6
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pxor %xmm4, %xmm1
-; X86-SSE2-NEXT: pcmpgtd %xmm6, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm1
-; X86-SSE2-NEXT: por %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pandn %xmm5, %xmm0
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pxor %xmm4, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm2, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm4, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm1
-; X86-SSE2-NEXT: por %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmoval %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxud %xmm3, %xmm1
-; X86-SSE42-NEXT: pmaxud %xmm2, %xmm0
-; X86-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pmaxud %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v16i32:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpmaxud %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpmaxud %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v16i32:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpmaxud %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm3, %xmm5
-; X64-SSE2-NEXT: pxor %xmm4, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: pcmpgtd %xmm5, %xmm6
-; X64-SSE2-NEXT: pand %xmm6, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm6
-; X64-SSE2-NEXT: por %xmm1, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm1
-; X64-SSE2-NEXT: pxor %xmm4, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm3
-; X64-SSE2-NEXT: pxor %xmm4, %xmm3
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm5
-; X64-SSE2-NEXT: pxor %xmm4, %xmm5
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm5
-; X64-SSE2-NEXT: pand %xmm5, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm5
-; X64-SSE2-NEXT: por %xmm0, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm5, %xmm0
-; X64-SSE2-NEXT: pxor %xmm4, %xmm0
-; X64-SSE2-NEXT: pcmpgtd %xmm1, %xmm0
-; X64-SSE2-NEXT: pand %xmm0, %xmm5
-; X64-SSE2-NEXT: pandn %xmm6, %xmm0
-; X64-SSE2-NEXT: por %xmm5, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: pxor %xmm4, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pxor %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm4, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm1
-; X64-SSE2-NEXT: por %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmoval %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxud %xmm3, %xmm1
-; X64-SSE42-NEXT: pmaxud %xmm2, %xmm0
-; X64-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pmaxud %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pmaxud %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i32:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpmaxud %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpmaxud %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX1-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i32:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpmaxud %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX2-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i32:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpmaxud %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX512-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i32> %a0, <16 x i32> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <16 x i32> %a0, %1
- %3 = select <16 x i1> %2, <16 x i32> %a0, <16 x i32> %1
- %4 = shufflevector <16 x i32> %3, <16 x i32> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <16 x i32> %3, %4
- %6 = select <16 x i1> %5, <16 x i32> %3, <16 x i32> %4
- %7 = shufflevector <16 x i32> %6, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <16 x i32> %6, %7
- %9 = select <16 x i1> %8, <16 x i32> %6, <16 x i32> %7
- %10 = shufflevector <16 x i32> %9, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ugt <16 x i32> %9, %10
- %12 = select <16 x i1> %11, <16 x i32> %9, <16 x i32> %10
- %13 = extractelement <16 x i32> %12, i32 0
- ret i32 %13
-}
-
-define i16 @test_reduce_v32i16(<32 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: psubusw %xmm0, %xmm2
-; X86-SSE2-NEXT: paddw %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm3
-; X86-SSE2-NEXT: paddw %xmm1, %xmm3
-; X86-SSE2-NEXT: psubusw %xmm2, %xmm3
-; X86-SSE2-NEXT: paddw %xmm2, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X86-SSE2-NEXT: psubusw %xmm3, %xmm0
-; X86-SSE2-NEXT: paddw %xmm3, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X86-SSE2-NEXT: paddw %xmm0, %xmm1
-; X86-SSE2-NEXT: pextrw $1, %xmm1, %eax
-; X86-SSE2-NEXT: movd %xmm1, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmoval %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxuw %xmm3, %xmm1
-; X86-SSE42-NEXT: pmaxuw %xmm2, %xmm0
-; X86-SSE42-NEXT: pmaxuw %xmm1, %xmm0
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notl %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v32i16:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpmaxuw %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpmaxuw %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: notl %eax
-; X86-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v32i16:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: notl %eax
-; X86-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: psubusw %xmm0, %xmm2
-; X64-SSE2-NEXT: paddw %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm3
-; X64-SSE2-NEXT: paddw %xmm1, %xmm3
-; X64-SSE2-NEXT: psubusw %xmm2, %xmm3
-; X64-SSE2-NEXT: paddw %xmm2, %xmm3
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X64-SSE2-NEXT: psubusw %xmm3, %xmm0
-; X64-SSE2-NEXT: paddw %xmm3, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X64-SSE2-NEXT: paddw %xmm0, %xmm1
-; X64-SSE2-NEXT: pextrw $1, %xmm1, %eax
-; X64-SSE2-NEXT: movd %xmm1, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmoval %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxuw %xmm3, %xmm1
-; X64-SSE42-NEXT: pmaxuw %xmm2, %xmm0
-; X64-SSE42-NEXT: pmaxuw %xmm1, %xmm0
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notl %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpmaxuw %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpmaxuw %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notl %eax
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notl %eax
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notl %eax
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <32 x i16> %a0, %1
- %3 = select <32 x i1> %2, <32 x i16> %a0, <32 x i16> %1
- %4 = shufflevector <32 x i16> %3, <32 x i16> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <32 x i16> %3, %4
- %6 = select <32 x i1> %5, <32 x i16> %3, <32 x i16> %4
- %7 = shufflevector <32 x i16> %6, <32 x i16> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <32 x i16> %6, %7
- %9 = select <32 x i1> %8, <32 x i16> %6, <32 x i16> %7
- %10 = shufflevector <32 x i16> %9, <32 x i16> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ugt <32 x i16> %9, %10
- %12 = select <32 x i1> %11, <32 x i16> %9, <32 x i16> %10
- %13 = shufflevector <32 x i16> %12, <32 x i16> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp ugt <32 x i16> %12, %13
- %15 = select <32 x i1> %14, <32 x i16> %12, <32 x i16> %13
- %16 = extractelement <32 x i16> %15, i32 0
- ret i16 %16
-}
-
-define i8 @test_reduce_v64i8(<64 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v64i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pmaxub %xmm3, %xmm1
-; X86-SSE2-NEXT: pmaxub %xmm2, %xmm0
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v64i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pmaxub %xmm3, %xmm1
-; X86-SSE42-NEXT: pmaxub %xmm2, %xmm0
-; X86-SSE42-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: psrlw $8, %xmm0
-; X86-SSE42-NEXT: pminub %xmm1, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notb %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v64i8:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpmaxub %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpmaxub %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: notb %al
-; X86-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v64i8:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpmaxub %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: notb %al
-; X86-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v64i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pmaxub %xmm3, %xmm1
-; X64-SSE2-NEXT: pmaxub %xmm2, %xmm0
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v64i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pmaxub %xmm3, %xmm1
-; X64-SSE42-NEXT: pmaxub %xmm2, %xmm0
-; X64-SSE42-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE42-NEXT: psrlw $8, %xmm0
-; X64-SSE42-NEXT: pminub %xmm1, %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notb %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v64i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpmaxub %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpmaxub %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notb %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v64i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpmaxub %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notb %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v64i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpmaxub %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpmaxub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notb %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <64 x i8> %a0, <64 x i8> undef, <64 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <64 x i8> %a0, %1
- %3 = select <64 x i1> %2, <64 x i8> %a0, <64 x i8> %1
- %4 = shufflevector <64 x i8> %3, <64 x i8> undef, <64 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <64 x i8> %3, %4
- %6 = select <64 x i1> %5, <64 x i8> %3, <64 x i8> %4
- %7 = shufflevector <64 x i8> %6, <64 x i8> undef, <64 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <64 x i8> %6, %7
- %9 = select <64 x i1> %8, <64 x i8> %6, <64 x i8> %7
- %10 = shufflevector <64 x i8> %9, <64 x i8> undef, <64 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ugt <64 x i8> %9, %10
- %12 = select <64 x i1> %11, <64 x i8> %9, <64 x i8> %10
- %13 = shufflevector <64 x i8> %12, <64 x i8> undef, <64 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp ugt <64 x i8> %12, %13
- %15 = select <64 x i1> %14, <64 x i8> %12, <64 x i8> %13
- %16 = shufflevector <64 x i8> %15, <64 x i8> undef, <64 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %17 = icmp ugt <64 x i8> %15, %16
- %18 = select <64 x i1> %17, <64 x i8> %15, <64 x i8> %16
- %19 = extractelement <64 x i8> %18, i32 0
- ret i8 %19
-}
-
-;
-; Partial Vector Reductions
-;
-
-define i16 @test_reduce_v16i16_v8i16(<16 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i16_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X86-SSE2-NEXT: paddw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm0
-; X86-SSE2-NEXT: paddw %xmm1, %xmm0
-; X86-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmoval %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i16_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notl %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v16i16_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: notl %eax
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i16_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X64-SSE2-NEXT: paddw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm0
-; X64-SSE2-NEXT: paddw %xmm1, %xmm0
-; X64-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmoval %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i16_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notl %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i16_v8i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notl %eax
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i16_v8i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notl %eax
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i16_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notl %eax
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <16 x i16> %a0, %1
- %3 = select <16 x i1> %2, <16 x i16> %a0, <16 x i16> %1
- %4 = shufflevector <16 x i16> %3, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <16 x i16> %3, %4
- %6 = select <16 x i1> %5, <16 x i16> %3, <16 x i16> %4
- %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <16 x i16> %6, %7
- %9 = select <16 x i1> %8, <16 x i16> %6, <16 x i16> %7
- %10 = extractelement <16 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i16 @test_reduce_v32i16_v8i16(<32 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i16_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X86-SSE2-NEXT: paddw %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm0
-; X86-SSE2-NEXT: paddw %xmm1, %xmm0
-; X86-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmoval %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i16_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notl %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v32i16_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: notl %eax
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i16_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: psubusw %xmm0, %xmm1
-; X64-SSE2-NEXT: paddw %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm0
-; X64-SSE2-NEXT: paddw %xmm1, %xmm0
-; X64-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmoval %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i16_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notl %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i16_v8i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notl %eax
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i16_v8i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notl %eax
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i16_v8i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notl %eax
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <32 x i16> %a0, %1
- %3 = select <32 x i1> %2, <32 x i16> %a0, <32 x i16> %1
- %4 = shufflevector <32 x i16> %3, <32 x i16> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <32 x i16> %3, %4
- %6 = select <32 x i1> %5, <32 x i16> %3, <32 x i16> %4
- %7 = shufflevector <32 x i16> %6, <32 x i16> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <32 x i16> %6, %7
- %9 = select <32 x i1> %8, <32 x i16> %6, <32 x i16> %7
- %10 = extractelement <32 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i8 @test_reduce_v32i8_v16i8(<32 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i8_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i8_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: psrlw $8, %xmm0
-; X86-SSE42-NEXT: pminub %xmm1, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notb %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v32i8_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: notb %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i8_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i8_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE42-NEXT: psrlw $8, %xmm0
-; X64-SSE42-NEXT: pminub %xmm1, %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notb %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i8_v16i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notb %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i8_v16i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notb %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i8_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notb %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <32 x i8> %a0, %1
- %3 = select <32 x i1> %2, <32 x i8> %a0, <32 x i8> %1
- %4 = shufflevector <32 x i8> %3, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <32 x i8> %3, %4
- %6 = select <32 x i1> %5, <32 x i8> %3, <32 x i8> %4
- %7 = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <32 x i8> %6, %7
- %9 = select <32 x i1> %8, <32 x i8> %6, <32 x i8> %7
- %10 = shufflevector <32 x i8> %9, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ugt <32 x i8> %9, %10
- %12 = select <32 x i1> %11, <32 x i8> %9, <32 x i8> %10
- %13 = extractelement <32 x i8> %12, i32 0
- ret i8 %13
-}
-
-define i8 @test_reduce_v64i8_v16i8(<64 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v64i8_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v64i8_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X86-SSE42-NEXT: pxor %xmm0, %xmm1
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: psrlw $8, %xmm0
-; X86-SSE42-NEXT: pminub %xmm1, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: notb %al
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v64i8_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X86-AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: notb %al
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v64i8_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pmaxub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pmaxub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v64i8_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pcmpeqd %xmm1, %xmm1
-; X64-SSE42-NEXT: pxor %xmm0, %xmm1
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE42-NEXT: psrlw $8, %xmm0
-; X64-SSE42-NEXT: pminub %xmm1, %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: notb %al
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v64i8_v16i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: notb %al
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v64i8_v16i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: notb %al
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v64i8_v16i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpternlogq {{.*#+}} xmm0 = ~xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: notb %al
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <64 x i8> %a0, <64 x i8> undef, <64 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ugt <64 x i8> %a0, %1
- %3 = select <64 x i1> %2, <64 x i8> %a0, <64 x i8> %1
- %4 = shufflevector <64 x i8> %3, <64 x i8> undef, <64 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ugt <64 x i8> %3, %4
- %6 = select <64 x i1> %5, <64 x i8> %3, <64 x i8> %4
- %7 = shufflevector <64 x i8> %6, <64 x i8> undef, <64 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ugt <64 x i8> %6, %7
- %9 = select <64 x i1> %8, <64 x i8> %6, <64 x i8> %7
- %10 = shufflevector <64 x i8> %9, <64 x i8> undef, <64 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ugt <64 x i8> %9, %10
- %12 = select <64 x i1> %11, <64 x i8> %9, <64 x i8> %10
- %13 = extractelement <64 x i8> %12, i32 0
- ret i8 %13
-}
diff --git a/llvm/test/CodeGen/X86/horizontal-reduce-umin.ll b/llvm/test/CodeGen/X86/horizontal-reduce-umin.ll
deleted file mode 100644
index 835b3c86a1a95..0000000000000
--- a/llvm/test/CodeGen/X86/horizontal-reduce-umin.ll
+++ /dev/null
@@ -1,2099 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X86-SSE2
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+sse4.2 | FileCheck %s --check-prefix=X86-SSE42
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx | FileCheck %s --check-prefixes=X86-AVX,X86-AVX1
-; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx2 | FileCheck %s --check-prefixes=X86-AVX,X86-AVX2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse2 | FileCheck %s --check-prefix=X64-SSE2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+sse4.2 | FileCheck %s --check-prefix=X64-SSE42
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx | FileCheck %s --check-prefixes=X64-AVX,X64-AVX1
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx2 | FileCheck %s --check-prefixes=X64-AVX,X64-AVX2
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X64-AVX,X64-AVX512
-
-;
-; 128-bit Vectors
-;
-
-define i64 @test_reduce_v2i64(<2 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v2i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm2, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movd %xmm3, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v2i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: movdqa {{.*#+}} xmm0 = [0,2147483648,0,2147483648]
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm2
-; X86-SSE42-NEXT: pxor %xmm0, %xmm2
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; X86-SSE42-NEXT: pxor %xmm3, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm2, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X86-SSE42-NEXT: movd %xmm3, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm3, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v2i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vmovddup {{.*#+}} xmm1 = [0,2147483648,0,2147483648]
-; X86-AVX1-NEXT: ## xmm1 = mem[0,0]
-; X86-AVX1-NEXT: vxorps %xmm1, %xmm0, %xmm2
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vxorps %xmm1, %xmm3, %xmm1
-; X86-AVX1-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v2i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpbroadcastq {{.*#+}} xmm1 = [0,2147483648,0,2147483648]
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm2
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm3, %xmm1
-; X86-AVX2-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X86-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v2i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movq %xmm0, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovbq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v2i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pextrq $1, %xmm0, %rax
-; X64-SSE42-NEXT: movq %xmm0, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovbq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v2i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovbq %rcx, %rax
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v2i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovbq %rcx, %rax
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v2i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <2 x i64> %a0, <2 x i64> undef, <2 x i32> <i32 1, i32 undef>
- %2 = icmp ult <2 x i64> %a0, %1
- %3 = select <2 x i1> %2, <2 x i64> %a0, <2 x i64> %1
- %4 = extractelement <2 x i64> %3, i32 0
- ret i64 %4
-}
-
-define i32 @test_reduce_v4i32(<4 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v4i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pxor %xmm1, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm3, %xmm1
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm1
-; X86-SSE2-NEXT: pand %xmm1, %xmm0
-; X86-SSE2-NEXT: pandn %xmm3, %xmm1
-; X86-SSE2-NEXT: por %xmm0, %xmm1
-; X86-SSE2-NEXT: movd %xmm1, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovbl %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v4i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pminud %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pminud %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v4i32:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v4i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2147483648,2147483648,2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: pxor %xmm1, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pxor %xmm3, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm2, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm0
-; X64-SSE2-NEXT: pandn %xmm3, %xmm1
-; X64-SSE2-NEXT: por %xmm0, %xmm1
-; X64-SSE2-NEXT: movd %xmm1, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovbl %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v4i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pminud %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pminud %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v4i32:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: retq
- %1 = shufflevector <4 x i32> %a0, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
- %2 = icmp ult <4 x i32> %a0, %1
- %3 = select <4 x i1> %2, <4 x i32> %a0, <4 x i32> %1
- %4 = shufflevector <4 x i32> %3, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <4 x i32> %3, %4
- %6 = select <4 x i1> %5, <4 x i32> %3, <4 x i32> %4
- %7 = extractelement <4 x i32> %6, i32 0
- ret i32 %7
-}
-
-define i16 @test_reduce_v8i16(<8 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmovbl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmovbl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v8i16:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX-NEXT: retq
- %1 = shufflevector <8 x i16> %a0, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <8 x i16> %a0, %1
- %3 = select <8 x i1> %2, <8 x i16> %a0, <8 x i16> %1
- %4 = shufflevector <8 x i16> %3, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <8 x i16> %3, %4
- %6 = select <8 x i1> %5, <8 x i16> %3, <8 x i16> %4
- %7 = shufflevector <8 x i16> %6, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <8 x i16> %6, %7
- %9 = select <8 x i1> %8, <8 x i16> %6, <8 x i16> %7
- %10 = extractelement <8 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i8 @test_reduce_v16i8(<16 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v16i8:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX-NEXT: retq
- %1 = shufflevector <16 x i8> %a0, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <16 x i8> %a0, %1
- %3 = select <16 x i1> %2, <16 x i8> %a0, <16 x i8> %1
- %4 = shufflevector <16 x i8> %3, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <16 x i8> %3, %4
- %6 = select <16 x i1> %5, <16 x i8> %3, <16 x i8> %4
- %7 = shufflevector <16 x i8> %6, <16 x i8> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <16 x i8> %6, %7
- %9 = select <16 x i1> %8, <16 x i8> %6, <16 x i8> %7
- %10 = shufflevector <16 x i8> %9, <16 x i8> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ult <16 x i8> %9, %10
- %12 = select <16 x i1> %11, <16 x i8> %9, <16 x i8> %10
- %13 = extractelement <16 x i8> %12, i32 0
- ret i8 %13
-}
-
-;
-; 256-bit Vectors
-;
-
-define i64 @test_reduce_v4i64(<4 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v4i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE2-NEXT: pxor %xmm2, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm4, %xmm5
-; X86-SSE2-NEXT: pcmpgtd %xmm3, %xmm5
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm6, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm5[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm4, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm1
-; X86-SSE2-NEXT: pxor %xmm2, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm0, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X86-SSE2-NEXT: pcmpeqd %xmm1, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm1, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm3
-; X86-SSE2-NEXT: pandn %xmm0, %xmm2
-; X86-SSE2-NEXT: por %xmm3, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v4i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE42-NEXT: movdqa {{.*#+}} xmm2 = [0,2147483648,0,2147483648]
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm4
-; X86-SSE42-NEXT: pxor %xmm2, %xmm4
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE42-NEXT: pxor %xmm2, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm4, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm3, %xmm1
-; X86-SSE42-NEXT: movapd %xmm1, %xmm0
-; X86-SSE42-NEXT: xorpd %xmm2, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; X86-SSE42-NEXT: pxor %xmm3, %xmm2
-; X86-SSE42-NEXT: pcmpgtq %xmm0, %xmm2
-; X86-SSE42-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X86-SSE42-NEXT: movd %xmm3, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm3, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v4i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vmovddup {{.*#+}} xmm1 = [0,2147483648,0,2147483648]
-; X86-AVX1-NEXT: ## xmm1 = mem[0,0]
-; X86-AVX1-NEXT: vxorps %xmm1, %xmm0, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vxorps %xmm1, %xmm3, %xmm4
-; X86-AVX1-NEXT: vpcmpgtq %xmm2, %xmm4, %xmm2
-; X86-AVX1-NEXT: vblendvpd %xmm2, %xmm0, %xmm3, %xmm0
-; X86-AVX1-NEXT: vxorpd %xmm1, %xmm0, %xmm2
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vxorpd %xmm1, %xmm3, %xmm1
-; X86-AVX1-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v4i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpbroadcastq {{.*#+}} xmm1 = [0,2147483648,0,2147483648]
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm2
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm3
-; X86-AVX2-NEXT: vpxor %xmm1, %xmm3, %xmm4
-; X86-AVX2-NEXT: vpcmpgtq %xmm2, %xmm4, %xmm2
-; X86-AVX2-NEXT: vblendvpd %xmm2, %xmm0, %xmm3, %xmm0
-; X86-AVX2-NEXT: vxorpd %xmm1, %xmm0, %xmm2
-; X86-AVX2-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vxorpd %xmm1, %xmm3, %xmm1
-; X86-AVX2-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X86-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v4i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [9223372039002259456,9223372039002259456]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X64-SSE2-NEXT: pxor %xmm2, %xmm3
-; X64-SSE2-NEXT: pxor %xmm1, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm5, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm2, %xmm3
-; X64-SSE2-NEXT: pand %xmm3, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm3
-; X64-SSE2-NEXT: por %xmm0, %xmm3
-; X64-SSE2-NEXT: movq %xmm3, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovbq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v4i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE42-NEXT: movdqa {{.*#+}} xmm0 = [9223372036854775808,9223372036854775808]
-; X64-SSE42-NEXT: movdqa %xmm2, %xmm3
-; X64-SSE42-NEXT: pxor %xmm0, %xmm3
-; X64-SSE42-NEXT: pxor %xmm1, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm3, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm1
-; X64-SSE42-NEXT: pextrq $1, %xmm1, %rax
-; X64-SSE42-NEXT: movq %xmm1, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovbq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v4i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vmovddup {{.*#+}} xmm1 = [9223372036854775808,9223372036854775808]
-; X64-AVX1-NEXT: ## xmm1 = mem[0,0]
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpxor %xmm1, %xmm3, %xmm1
-; X64-AVX1-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X64-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovbq %rcx, %rax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v4i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpbroadcastq {{.*#+}} xmm1 = [9223372036854775808,9223372036854775808]
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm2
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm3
-; X64-AVX2-NEXT: vpxor %xmm1, %xmm3, %xmm1
-; X64-AVX2-NEXT: vpcmpgtq %xmm2, %xmm1, %xmm1
-; X64-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovbq %rcx, %rax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v4i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <4 x i64> %a0, <4 x i64> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
- %2 = icmp ult <4 x i64> %a0, %1
- %3 = select <4 x i1> %2, <4 x i64> %a0, <4 x i64> %1
- %4 = shufflevector <4 x i64> %3, <4 x i64> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <4 x i64> %3, %4
- %6 = select <4 x i1> %5, <4 x i64> %3, <4 x i64> %4
- %7 = extractelement <4 x i64> %6, i32 0
- ret i64 %7
-}
-
-define i32 @test_reduce_v8i32(<8 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm4
-; X86-SSE2-NEXT: pxor %xmm2, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm3
-; X86-SSE2-NEXT: pxor %xmm2, %xmm3
-; X86-SSE2-NEXT: pcmpgtd %xmm4, %xmm3
-; X86-SSE2-NEXT: pand %xmm3, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm3
-; X86-SSE2-NEXT: por %xmm0, %xmm3
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm0
-; X86-SSE2-NEXT: pxor %xmm2, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm3[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm2
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm3
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm3, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovbl %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminud %xmm1, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pminud %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pminud %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v8i32:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v8i32:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X64-SSE2-NEXT: pxor %xmm2, %xmm3
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X64-SSE2-NEXT: pxor %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm3, %xmm4
-; X64-SSE2-NEXT: pand %xmm4, %xmm0
-; X64-SSE2-NEXT: pandn %xmm1, %xmm4
-; X64-SSE2-NEXT: por %xmm0, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm4, %xmm0
-; X64-SSE2-NEXT: pxor %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm4[2,3,2,3]
-; X64-SSE2-NEXT: pxor %xmm1, %xmm2
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm2
-; X64-SSE2-NEXT: pand %xmm2, %xmm4
-; X64-SSE2-NEXT: pandn %xmm1, %xmm2
-; X64-SSE2-NEXT: por %xmm4, %xmm2
-; X64-SSE2-NEXT: movd %xmm2, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovbl %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminud %xmm1, %xmm0
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pminud %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pminud %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i32:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i32:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i32:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX512-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i32> %a0, <8 x i32> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <8 x i32> %a0, %1
- %3 = select <8 x i1> %2, <8 x i32> %a0, <8 x i32> %1
- %4 = shufflevector <8 x i32> %3, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <8 x i32> %3, %4
- %6 = select <8 x i1> %5, <8 x i32> %3, <8 x i32> %4
- %7 = shufflevector <8 x i32> %6, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <8 x i32> %6, %7
- %9 = select <8 x i1> %8, <8 x i32> %6, <8 x i32> %7
- %10 = extractelement <8 x i32> %9, i32 0
- ret i32 %10
-}
-
-define i16 @test_reduce_v16i16(<16 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmovbl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminuw %xmm1, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v16i16:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v16i16:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmovbl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminuw %xmm1, %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <16 x i16> %a0, %1
- %3 = select <16 x i1> %2, <16 x i16> %a0, <16 x i16> %1
- %4 = shufflevector <16 x i16> %3, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <16 x i16> %3, %4
- %6 = select <16 x i1> %5, <16 x i16> %3, <16 x i16> %4
- %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <16 x i16> %6, %7
- %9 = select <16 x i1> %8, <16 x i16> %6, <16 x i16> %7
- %10 = shufflevector <16 x i16> %9, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ult <16 x i16> %9, %10
- %12 = select <16 x i1> %11, <16 x i16> %9, <16 x i16> %10
- %13 = extractelement <16 x i16> %12, i32 0
- ret i16 %13
-}
-
-define i8 @test_reduce_v32i8(<32 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminub %xmm1, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v32i8:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v32i8:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminub %xmm1, %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <32 x i8> %a0, %1
- %3 = select <32 x i1> %2, <32 x i8> %a0, <32 x i8> %1
- %4 = shufflevector <32 x i8> %3, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <32 x i8> %3, %4
- %6 = select <32 x i1> %5, <32 x i8> %3, <32 x i8> %4
- %7 = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <32 x i8> %6, %7
- %9 = select <32 x i1> %8, <32 x i8> %6, <32 x i8> %7
- %10 = shufflevector <32 x i8> %9, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ult <32 x i8> %9, %10
- %12 = select <32 x i1> %11, <32 x i8> %9, <32 x i8> %10
- %13 = shufflevector <32 x i8> %12, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp ult <32 x i8> %12, %13
- %15 = select <32 x i1> %14, <32 x i8> %12, <32 x i8> %13
- %16 = extractelement <32 x i8> %15, i32 0
- ret i8 %16
-}
-
-;
-; 512-bit Vectors
-;
-
-define i64 @test_reduce_v8i64(<8 x i64> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v8i64:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm5
-; X86-SSE2-NEXT: pxor %xmm4, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm6
-; X86-SSE2-NEXT: pxor %xmm4, %xmm6
-; X86-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X86-SSE2-NEXT: pcmpgtd %xmm5, %xmm7
-; X86-SSE2-NEXT: pcmpeqd %xmm5, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm6[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm5, %xmm6
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm6, %xmm5
-; X86-SSE2-NEXT: pand %xmm5, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm5
-; X86-SSE2-NEXT: por %xmm0, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm2
-; X86-SSE2-NEXT: pxor %xmm4, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm6
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm6
-; X86-SSE2-NEXT: pcmpeqd %xmm0, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm6[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm7 = xmm2[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm0, %xmm7
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm6[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm7, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm5, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: pand %xmm2, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm2
-; X86-SSE2-NEXT: por %xmm1, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm1
-; X86-SSE2-NEXT: pxor %xmm4, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm3
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm3
-; X86-SSE2-NEXT: pcmpeqd %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm3[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm1, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm5
-; X86-SSE2-NEXT: pandn %xmm2, %xmm0
-; X86-SSE2-NEXT: por %xmm5, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: pxor %xmm4, %xmm2
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm1, %xmm4
-; X86-SSE2-NEXT: movdqa %xmm4, %xmm3
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm3
-; X86-SSE2-NEXT: pcmpeqd %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[0,0,2,2]
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm4[1,1,3,3]
-; X86-SSE2-NEXT: pand %xmm2, %xmm4
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[1,1,3,3]
-; X86-SSE2-NEXT: por %xmm4, %xmm2
-; X86-SSE2-NEXT: pand %xmm2, %xmm0
-; X86-SSE2-NEXT: pandn %xmm1, %xmm2
-; X86-SSE2-NEXT: por %xmm0, %xmm2
-; X86-SSE2-NEXT: movd %xmm2, %eax
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %edx
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v8i64:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm5
-; X86-SSE42-NEXT: movdqa {{.*#+}} xmm4 = [0,2147483648,0,2147483648]
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm6
-; X86-SSE42-NEXT: pxor %xmm4, %xmm6
-; X86-SSE42-NEXT: movdqa %xmm2, %xmm0
-; X86-SSE42-NEXT: pxor %xmm4, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm6, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm5, %xmm2
-; X86-SSE42-NEXT: movapd %xmm2, %xmm5
-; X86-SSE42-NEXT: xorpd %xmm4, %xmm5
-; X86-SSE42-NEXT: movdqa %xmm1, %xmm6
-; X86-SSE42-NEXT: pxor %xmm4, %xmm6
-; X86-SSE42-NEXT: movdqa %xmm3, %xmm0
-; X86-SSE42-NEXT: pxor %xmm4, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm6, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X86-SSE42-NEXT: movapd %xmm3, %xmm0
-; X86-SSE42-NEXT: xorpd %xmm4, %xmm0
-; X86-SSE42-NEXT: pcmpgtq %xmm5, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm3
-; X86-SSE42-NEXT: movapd %xmm3, %xmm0
-; X86-SSE42-NEXT: xorpd %xmm4, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm3[2,3,2,3]
-; X86-SSE42-NEXT: pxor %xmm1, %xmm4
-; X86-SSE42-NEXT: pcmpgtq %xmm0, %xmm4
-; X86-SSE42-NEXT: movdqa %xmm4, %xmm0
-; X86-SSE42-NEXT: blendvpd %xmm0, %xmm3, %xmm1
-; X86-SSE42-NEXT: movd %xmm1, %eax
-; X86-SSE42-NEXT: pextrd $1, %xmm1, %edx
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v8i64:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vmovddup {{.*#+}} xmm2 = [0,2147483648,0,2147483648]
-; X86-AVX1-NEXT: ## xmm2 = mem[0,0]
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm0, %xmm3
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm1, %xmm4
-; X86-AVX1-NEXT: vpcmpgtq %xmm3, %xmm4, %xmm3
-; X86-AVX1-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm3
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm3, %xmm4
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm0, %xmm5
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
-; X86-AVX1-NEXT: vxorps %xmm2, %xmm1, %xmm6
-; X86-AVX1-NEXT: vpcmpgtq %xmm5, %xmm6, %xmm5
-; X86-AVX1-NEXT: vblendvpd %xmm5, %xmm0, %xmm1, %xmm0
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpcmpgtq %xmm4, %xmm1, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm3, %xmm0, %xmm0
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX1-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vxorpd %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpcmpgtq %xmm1, %xmm2, %xmm1
-; X86-AVX1-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v8i64:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [0,2147483648,0,2147483648,0,2147483648,0,2147483648]
-; X86-AVX2-NEXT: vpxor %ymm2, %ymm0, %ymm3
-; X86-AVX2-NEXT: vpxor %ymm2, %ymm1, %ymm4
-; X86-AVX2-NEXT: vpcmpgtq %ymm3, %ymm4, %ymm3
-; X86-AVX2-NEXT: vblendvpd %ymm3, %ymm0, %ymm1, %ymm0
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX2-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm3, %xmm4
-; X86-AVX2-NEXT: vpcmpgtq %xmm1, %xmm4, %xmm1
-; X86-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X86-AVX2-NEXT: vshufps {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vxorpd %xmm2, %xmm3, %xmm2
-; X86-AVX2-NEXT: vpcmpgtq %xmm1, %xmm2, %xmm1
-; X86-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vpextrd $1, %xmm0, %edx
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v8i64:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [9223372039002259456,9223372039002259456]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm5
-; X64-SSE2-NEXT: pxor %xmm4, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X64-SSE2-NEXT: pcmpgtd %xmm5, %xmm7
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm5, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm6[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm8, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm7[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm6, %xmm5
-; X64-SSE2-NEXT: pand %xmm5, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm5
-; X64-SSE2-NEXT: por %xmm0, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm5, %xmm0
-; X64-SSE2-NEXT: pxor %xmm4, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pxor %xmm4, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm3, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm7
-; X64-SSE2-NEXT: pcmpgtd %xmm2, %xmm7
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm8 = xmm7[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm2, %xmm6
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm6[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm8, %xmm2
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm6 = xmm7[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm2, %xmm6
-; X64-SSE2-NEXT: pand %xmm6, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm6
-; X64-SSE2-NEXT: por %xmm1, %xmm6
-; X64-SSE2-NEXT: pxor %xmm6, %xmm4
-; X64-SSE2-NEXT: movdqa %xmm4, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[0,0,2,2]
-; X64-SSE2-NEXT: pcmpeqd %xmm0, %xmm4
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm4[1,1,3,3]
-; X64-SSE2-NEXT: pand %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
-; X64-SSE2-NEXT: por %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm5
-; X64-SSE2-NEXT: pandn %xmm6, %xmm1
-; X64-SSE2-NEXT: por %xmm5, %xmm1
-; X64-SSE2-NEXT: movq %xmm1, %rcx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X64-SSE2-NEXT: movq %xmm0, %rax
-; X64-SSE2-NEXT: cmpq %rax, %rcx
-; X64-SSE2-NEXT: cmovbq %rcx, %rax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v8i64:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm4
-; X64-SSE42-NEXT: movdqa {{.*#+}} xmm5 = [9223372036854775808,9223372036854775808]
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm6
-; X64-SSE42-NEXT: pxor %xmm5, %xmm6
-; X64-SSE42-NEXT: movdqa %xmm2, %xmm0
-; X64-SSE42-NEXT: pxor %xmm5, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm6, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm4, %xmm2
-; X64-SSE42-NEXT: movapd %xmm2, %xmm4
-; X64-SSE42-NEXT: xorpd %xmm5, %xmm4
-; X64-SSE42-NEXT: movdqa %xmm1, %xmm6
-; X64-SSE42-NEXT: pxor %xmm5, %xmm6
-; X64-SSE42-NEXT: movdqa %xmm3, %xmm0
-; X64-SSE42-NEXT: pxor %xmm5, %xmm0
-; X64-SSE42-NEXT: pcmpgtq %xmm6, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm1, %xmm3
-; X64-SSE42-NEXT: xorpd %xmm3, %xmm5
-; X64-SSE42-NEXT: pcmpgtq %xmm4, %xmm5
-; X64-SSE42-NEXT: movdqa %xmm5, %xmm0
-; X64-SSE42-NEXT: blendvpd %xmm0, %xmm2, %xmm3
-; X64-SSE42-NEXT: pextrq $1, %xmm3, %rax
-; X64-SSE42-NEXT: movq %xmm3, %rcx
-; X64-SSE42-NEXT: cmpq %rax, %rcx
-; X64-SSE42-NEXT: cmovbq %rcx, %rax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v8i64:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vmovddup {{.*#+}} xmm2 = [9223372036854775808,9223372036854775808]
-; X64-AVX1-NEXT: ## xmm2 = mem[0,0]
-; X64-AVX1-NEXT: vpxor %xmm2, %xmm0, %xmm3
-; X64-AVX1-NEXT: vpxor %xmm2, %xmm1, %xmm4
-; X64-AVX1-NEXT: vpcmpgtq %xmm3, %xmm4, %xmm3
-; X64-AVX1-NEXT: vblendvpd %xmm3, %xmm0, %xmm1, %xmm3
-; X64-AVX1-NEXT: vxorpd %xmm2, %xmm3, %xmm4
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
-; X64-AVX1-NEXT: vpxor %xmm2, %xmm0, %xmm5
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
-; X64-AVX1-NEXT: vpxor %xmm2, %xmm1, %xmm6
-; X64-AVX1-NEXT: vpcmpgtq %xmm5, %xmm6, %xmm5
-; X64-AVX1-NEXT: vblendvpd %xmm5, %xmm0, %xmm1, %xmm0
-; X64-AVX1-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpcmpgtq %xmm4, %xmm1, %xmm1
-; X64-AVX1-NEXT: vblendvpd %xmm1, %xmm3, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX1-NEXT: vmovq %xmm0, %rcx
-; X64-AVX1-NEXT: cmpq %rax, %rcx
-; X64-AVX1-NEXT: cmovbq %rcx, %rax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v8i64:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [9223372036854775808,9223372036854775808,9223372036854775808,9223372036854775808]
-; X64-AVX2-NEXT: vpxor %ymm2, %ymm0, %ymm3
-; X64-AVX2-NEXT: vpxor %ymm2, %ymm1, %ymm4
-; X64-AVX2-NEXT: vpcmpgtq %ymm3, %ymm4, %ymm3
-; X64-AVX2-NEXT: vblendvpd %ymm3, %ymm0, %ymm1, %ymm0
-; X64-AVX2-NEXT: vxorpd %xmm2, %xmm0, %xmm1
-; X64-AVX2-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX2-NEXT: vxorpd %xmm2, %xmm3, %xmm2
-; X64-AVX2-NEXT: vpcmpgtq %xmm1, %xmm2, %xmm1
-; X64-AVX2-NEXT: vblendvpd %xmm1, %xmm0, %xmm3, %xmm0
-; X64-AVX2-NEXT: vpextrq $1, %xmm0, %rax
-; X64-AVX2-NEXT: vmovq %xmm0, %rcx
-; X64-AVX2-NEXT: cmpq %rax, %rcx
-; X64-AVX2-NEXT: cmovbq %rcx, %rax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v8i64:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpminuq %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminuq %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovq %xmm0, %rax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <8 x i64> %a0, <8 x i64> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <8 x i64> %a0, %1
- %3 = select <8 x i1> %2, <8 x i64> %a0, <8 x i64> %1
- %4 = shufflevector <8 x i64> %3, <8 x i64> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <8 x i64> %3, %4
- %6 = select <8 x i1> %5, <8 x i64> %3, <8 x i64> %4
- %7 = shufflevector <8 x i64> %6, <8 x i64> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <8 x i64> %6, %7
- %9 = select <8 x i1> %8, <8 x i64> %6, <8 x i64> %7
- %10 = extractelement <8 x i64> %9, i32 0
- ret i64 %10
-}
-
-define i32 @test_reduce_v16i32(<16 x i32> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i32:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm6
-; X86-SSE2-NEXT: pxor %xmm4, %xmm6
-; X86-SSE2-NEXT: movdqa %xmm2, %xmm5
-; X86-SSE2-NEXT: pxor %xmm4, %xmm5
-; X86-SSE2-NEXT: pcmpgtd %xmm6, %xmm5
-; X86-SSE2-NEXT: pand %xmm5, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm5
-; X86-SSE2-NEXT: por %xmm0, %xmm5
-; X86-SSE2-NEXT: movdqa %xmm5, %xmm2
-; X86-SSE2-NEXT: pxor %xmm4, %xmm2
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm3, %xmm6
-; X86-SSE2-NEXT: pxor %xmm4, %xmm6
-; X86-SSE2-NEXT: pcmpgtd %xmm0, %xmm6
-; X86-SSE2-NEXT: pand %xmm6, %xmm1
-; X86-SSE2-NEXT: pandn %xmm3, %xmm6
-; X86-SSE2-NEXT: por %xmm1, %xmm6
-; X86-SSE2-NEXT: movdqa %xmm6, %xmm0
-; X86-SSE2-NEXT: pxor %xmm4, %xmm0
-; X86-SSE2-NEXT: pcmpgtd %xmm2, %xmm0
-; X86-SSE2-NEXT: pand %xmm0, %xmm5
-; X86-SSE2-NEXT: pandn %xmm6, %xmm0
-; X86-SSE2-NEXT: por %xmm5, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: pxor %xmm4, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pxor %xmm2, %xmm4
-; X86-SSE2-NEXT: pcmpgtd %xmm1, %xmm4
-; X86-SSE2-NEXT: pand %xmm4, %xmm0
-; X86-SSE2-NEXT: pandn %xmm2, %xmm4
-; X86-SSE2-NEXT: por %xmm0, %xmm4
-; X86-SSE2-NEXT: movd %xmm4, %ecx
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm4[1,1,1,1]
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: cmpl %eax, %ecx
-; X86-SSE2-NEXT: cmovbl %ecx, %eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i32:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminud %xmm3, %xmm1
-; X86-SSE42-NEXT: pminud %xmm2, %xmm0
-; X86-SSE42-NEXT: pminud %xmm1, %xmm0
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE42-NEXT: pminud %xmm0, %xmm1
-; X86-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE42-NEXT: pminud %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v16i32:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpminud %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpminud %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v16i32:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpminud %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i32:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm2, %xmm5
-; X64-SSE2-NEXT: pxor %xmm4, %xmm5
-; X64-SSE2-NEXT: pcmpgtd %xmm6, %xmm5
-; X64-SSE2-NEXT: pand %xmm5, %xmm0
-; X64-SSE2-NEXT: pandn %xmm2, %xmm5
-; X64-SSE2-NEXT: por %xmm0, %xmm5
-; X64-SSE2-NEXT: movdqa %xmm5, %xmm0
-; X64-SSE2-NEXT: pxor %xmm4, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm2
-; X64-SSE2-NEXT: pxor %xmm4, %xmm2
-; X64-SSE2-NEXT: movdqa %xmm3, %xmm6
-; X64-SSE2-NEXT: pxor %xmm4, %xmm6
-; X64-SSE2-NEXT: pcmpgtd %xmm2, %xmm6
-; X64-SSE2-NEXT: pand %xmm6, %xmm1
-; X64-SSE2-NEXT: pandn %xmm3, %xmm6
-; X64-SSE2-NEXT: por %xmm1, %xmm6
-; X64-SSE2-NEXT: movdqa %xmm6, %xmm1
-; X64-SSE2-NEXT: pxor %xmm4, %xmm1
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm1
-; X64-SSE2-NEXT: pand %xmm1, %xmm5
-; X64-SSE2-NEXT: pandn %xmm6, %xmm1
-; X64-SSE2-NEXT: por %xmm5, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: pxor %xmm4, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[2,3,2,3]
-; X64-SSE2-NEXT: pxor %xmm2, %xmm4
-; X64-SSE2-NEXT: pcmpgtd %xmm0, %xmm4
-; X64-SSE2-NEXT: pand %xmm4, %xmm1
-; X64-SSE2-NEXT: pandn %xmm2, %xmm4
-; X64-SSE2-NEXT: por %xmm1, %xmm4
-; X64-SSE2-NEXT: movd %xmm4, %ecx
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm4[1,1,1,1]
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: cmpl %eax, %ecx
-; X64-SSE2-NEXT: cmovbl %ecx, %eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i32:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminud %xmm3, %xmm1
-; X64-SSE42-NEXT: pminud %xmm2, %xmm0
-; X64-SSE42-NEXT: pminud %xmm1, %xmm0
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE42-NEXT: pminud %xmm0, %xmm1
-; X64-SSE42-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE42-NEXT: pminud %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v16i32:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpminud %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpminud %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v16i32:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpminud %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX2-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v16i32:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpminud %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-AVX512-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-AVX512-NEXT: vpminud %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <16 x i32> %a0, <16 x i32> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <16 x i32> %a0, %1
- %3 = select <16 x i1> %2, <16 x i32> %a0, <16 x i32> %1
- %4 = shufflevector <16 x i32> %3, <16 x i32> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <16 x i32> %3, %4
- %6 = select <16 x i1> %5, <16 x i32> %3, <16 x i32> %4
- %7 = shufflevector <16 x i32> %6, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <16 x i32> %6, %7
- %9 = select <16 x i1> %8, <16 x i32> %6, <16 x i32> %7
- %10 = shufflevector <16 x i32> %9, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ult <16 x i32> %9, %10
- %12 = select <16 x i1> %11, <16 x i32> %9, <16 x i32> %10
- %13 = extractelement <16 x i32> %12, i32 0
- ret i32 %13
-}
-
-define i16 @test_reduce_v32i16(<32 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X86-SSE2-NEXT: psubusw %xmm3, %xmm4
-; X86-SSE2-NEXT: psubw %xmm4, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X86-SSE2-NEXT: psubusw %xmm2, %xmm3
-; X86-SSE2-NEXT: psubw %xmm3, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmovbl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminuw %xmm3, %xmm1
-; X86-SSE42-NEXT: pminuw %xmm2, %xmm0
-; X86-SSE42-NEXT: pminuw %xmm1, %xmm0
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v32i16:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpminuw %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpminuw %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v32i16:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpminuw %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm4
-; X64-SSE2-NEXT: psubusw %xmm3, %xmm4
-; X64-SSE2-NEXT: psubw %xmm4, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm3
-; X64-SSE2-NEXT: psubusw %xmm2, %xmm3
-; X64-SSE2-NEXT: psubw %xmm3, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmovbl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminuw %xmm3, %xmm1
-; X64-SSE42-NEXT: pminuw %xmm2, %xmm0
-; X64-SSE42-NEXT: pminuw %xmm1, %xmm0
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v32i16:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpminuw %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpminuw %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v32i16:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpminuw %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v32i16:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpminuw %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminuw %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <32 x i16> %a0, %1
- %3 = select <32 x i1> %2, <32 x i16> %a0, <32 x i16> %1
- %4 = shufflevector <32 x i16> %3, <32 x i16> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <32 x i16> %3, %4
- %6 = select <32 x i1> %5, <32 x i16> %3, <32 x i16> %4
- %7 = shufflevector <32 x i16> %6, <32 x i16> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <32 x i16> %6, %7
- %9 = select <32 x i1> %8, <32 x i16> %6, <32 x i16> %7
- %10 = shufflevector <32 x i16> %9, <32 x i16> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ult <32 x i16> %9, %10
- %12 = select <32 x i1> %11, <32 x i16> %9, <32 x i16> %10
- %13 = shufflevector <32 x i16> %12, <32 x i16> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp ult <32 x i16> %12, %13
- %15 = select <32 x i1> %14, <32 x i16> %12, <32 x i16> %13
- %16 = extractelement <32 x i16> %15, i32 0
- ret i16 %16
-}
-
-define i8 @test_reduce_v64i8(<64 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v64i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pminub %xmm3, %xmm1
-; X86-SSE2-NEXT: pminub %xmm2, %xmm0
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v64i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: pminub %xmm3, %xmm1
-; X86-SSE42-NEXT: pminub %xmm2, %xmm0
-; X86-SSE42-NEXT: pminub %xmm1, %xmm0
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX1-LABEL: test_reduce_v64i8:
-; X86-AVX1: ## %bb.0:
-; X86-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X86-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X86-AVX1-NEXT: vpminub %xmm2, %xmm3, %xmm2
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpminub %xmm2, %xmm0, %xmm0
-; X86-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX1-NEXT: vmovd %xmm0, %eax
-; X86-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX1-NEXT: vzeroupper
-; X86-AVX1-NEXT: retl
-;
-; X86-AVX2-LABEL: test_reduce_v64i8:
-; X86-AVX2: ## %bb.0:
-; X86-AVX2-NEXT: vpminub %ymm1, %ymm0, %ymm0
-; X86-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX2-NEXT: vmovd %xmm0, %eax
-; X86-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX2-NEXT: vzeroupper
-; X86-AVX2-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v64i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pminub %xmm3, %xmm1
-; X64-SSE2-NEXT: pminub %xmm2, %xmm0
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v64i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: pminub %xmm3, %xmm1
-; X64-SSE42-NEXT: pminub %xmm2, %xmm0
-; X64-SSE42-NEXT: pminub %xmm1, %xmm0
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX1-LABEL: test_reduce_v64i8:
-; X64-AVX1: ## %bb.0:
-; X64-AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; X64-AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; X64-AVX1-NEXT: vpminub %xmm2, %xmm3, %xmm2
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpminub %xmm2, %xmm0, %xmm0
-; X64-AVX1-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX1-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX1-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX1-NEXT: vmovd %xmm0, %eax
-; X64-AVX1-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX1-NEXT: vzeroupper
-; X64-AVX1-NEXT: retq
-;
-; X64-AVX2-LABEL: test_reduce_v64i8:
-; X64-AVX2: ## %bb.0:
-; X64-AVX2-NEXT: vpminub %ymm1, %ymm0, %ymm0
-; X64-AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX2-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX2-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX2-NEXT: vmovd %xmm0, %eax
-; X64-AVX2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX2-NEXT: vzeroupper
-; X64-AVX2-NEXT: retq
-;
-; X64-AVX512-LABEL: test_reduce_v64i8:
-; X64-AVX512: ## %bb.0:
-; X64-AVX512-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; X64-AVX512-NEXT: vpminub %ymm1, %ymm0, %ymm0
-; X64-AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX512-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX512-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX512-NEXT: vmovd %xmm0, %eax
-; X64-AVX512-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX512-NEXT: vzeroupper
-; X64-AVX512-NEXT: retq
- %1 = shufflevector <64 x i8> %a0, <64 x i8> undef, <64 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <64 x i8> %a0, %1
- %3 = select <64 x i1> %2, <64 x i8> %a0, <64 x i8> %1
- %4 = shufflevector <64 x i8> %3, <64 x i8> undef, <64 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <64 x i8> %3, %4
- %6 = select <64 x i1> %5, <64 x i8> %3, <64 x i8> %4
- %7 = shufflevector <64 x i8> %6, <64 x i8> undef, <64 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <64 x i8> %6, %7
- %9 = select <64 x i1> %8, <64 x i8> %6, <64 x i8> %7
- %10 = shufflevector <64 x i8> %9, <64 x i8> undef, <64 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ult <64 x i8> %9, %10
- %12 = select <64 x i1> %11, <64 x i8> %9, <64 x i8> %10
- %13 = shufflevector <64 x i8> %12, <64 x i8> undef, <64 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %14 = icmp ult <64 x i8> %12, %13
- %15 = select <64 x i1> %14, <64 x i8> %12, <64 x i8> %13
- %16 = shufflevector <64 x i8> %15, <64 x i8> undef, <64 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %17 = icmp ult <64 x i8> %15, %16
- %18 = select <64 x i1> %17, <64 x i8> %15, <64 x i8> %16
- %19 = extractelement <64 x i8> %18, i32 0
- ret i8 %19
-}
-
-;
-; Partial Vector Reductions
-;
-
-define i16 @test_reduce_v16i16_v8i16(<16 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v16i16_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmovbl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v16i16_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v16i16_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v16i16_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmovbl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v16i16_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v16i16_v8i16:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX-NEXT: vzeroupper
-; X64-AVX-NEXT: retq
- %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <16 x i16> %a0, %1
- %3 = select <16 x i1> %2, <16 x i16> %a0, <16 x i16> %1
- %4 = shufflevector <16 x i16> %3, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <16 x i16> %3, %4
- %6 = select <16 x i1> %5, <16 x i16> %3, <16 x i16> %4
- %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <16 x i16> %6, %7
- %9 = select <16 x i1> %8, <16 x i16> %6, <16 x i16> %7
- %10 = extractelement <16 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i16 @test_reduce_v32i16_v8i16(<32 x i16> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i16_v8i16:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X86-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X86-SSE2-NEXT: psubw %xmm2, %xmm0
-; X86-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X86-SSE2-NEXT: movd %xmm0, %ecx
-; X86-SSE2-NEXT: cmpw %ax, %cx
-; X86-SSE2-NEXT: cmovbl %ecx, %eax
-; X86-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i16_v8i16:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v32i16_v8i16:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i16_v8i16:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
-; X64-SSE2-NEXT: psubusw %xmm1, %xmm2
-; X64-SSE2-NEXT: psubw %xmm2, %xmm0
-; X64-SSE2-NEXT: pextrw $1, %xmm0, %eax
-; X64-SSE2-NEXT: movd %xmm0, %ecx
-; X64-SSE2-NEXT: cmpw %ax, %cx
-; X64-SSE2-NEXT: cmovbl %ecx, %eax
-; X64-SSE2-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i16_v8i16:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: phminposuw %xmm0, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v32i16_v8i16:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: ## kill: def $ax killed $ax killed $eax
-; X64-AVX-NEXT: vzeroupper
-; X64-AVX-NEXT: retq
- %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <32 x i16> %a0, %1
- %3 = select <32 x i1> %2, <32 x i16> %a0, <32 x i16> %1
- %4 = shufflevector <32 x i16> %3, <32 x i16> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <32 x i16> %3, %4
- %6 = select <32 x i1> %5, <32 x i16> %3, <32 x i16> %4
- %7 = shufflevector <32 x i16> %6, <32 x i16> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <32 x i16> %6, %7
- %9 = select <32 x i1> %8, <32 x i16> %6, <32 x i16> %7
- %10 = extractelement <32 x i16> %9, i32 0
- ret i16 %10
-}
-
-define i8 @test_reduce_v32i8_v16i8(<32 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v32i8_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v32i8_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v32i8_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v32i8_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v32i8_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v32i8_v16i8:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX-NEXT: vzeroupper
-; X64-AVX-NEXT: retq
- %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <32 x i8> %a0, %1
- %3 = select <32 x i1> %2, <32 x i8> %a0, <32 x i8> %1
- %4 = shufflevector <32 x i8> %3, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <32 x i8> %3, %4
- %6 = select <32 x i1> %5, <32 x i8> %3, <32 x i8> %4
- %7 = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <32 x i8> %6, %7
- %9 = select <32 x i1> %8, <32 x i8> %6, <32 x i8> %7
- %10 = shufflevector <32 x i8> %9, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ult <32 x i8> %9, %10
- %12 = select <32 x i1> %11, <32 x i8> %9, <32 x i8> %10
- %13 = extractelement <32 x i8> %12, i32 0
- ret i8 %13
-}
-
-define i8 @test_reduce_v64i8_v16i8(<64 x i8> %a0) nounwind {
-; X86-SSE2-LABEL: test_reduce_v64i8_v16i8:
-; X86-SSE2: ## %bb.0:
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE2-NEXT: psrld $16, %xmm1
-; X86-SSE2-NEXT: pminub %xmm0, %xmm1
-; X86-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X86-SSE2-NEXT: psrlw $8, %xmm0
-; X86-SSE2-NEXT: pminub %xmm1, %xmm0
-; X86-SSE2-NEXT: movd %xmm0, %eax
-; X86-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE2-NEXT: retl
-;
-; X86-SSE42-LABEL: test_reduce_v64i8_v16i8:
-; X86-SSE42: ## %bb.0:
-; X86-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X86-SSE42-NEXT: psrlw $8, %xmm1
-; X86-SSE42-NEXT: pminub %xmm0, %xmm1
-; X86-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X86-SSE42-NEXT: movd %xmm0, %eax
-; X86-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X86-SSE42-NEXT: retl
-;
-; X86-AVX-LABEL: test_reduce_v64i8_v16i8:
-; X86-AVX: ## %bb.0:
-; X86-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X86-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X86-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X86-AVX-NEXT: vmovd %xmm0, %eax
-; X86-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X86-AVX-NEXT: vzeroupper
-; X86-AVX-NEXT: retl
-;
-; X64-SSE2-LABEL: test_reduce_v64i8_v16i8:
-; X64-SSE2: ## %bb.0:
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,1,1]
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE2-NEXT: psrld $16, %xmm1
-; X64-SSE2-NEXT: pminub %xmm0, %xmm1
-; X64-SSE2-NEXT: movdqa %xmm1, %xmm0
-; X64-SSE2-NEXT: psrlw $8, %xmm0
-; X64-SSE2-NEXT: pminub %xmm1, %xmm0
-; X64-SSE2-NEXT: movd %xmm0, %eax
-; X64-SSE2-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE2-NEXT: retq
-;
-; X64-SSE42-LABEL: test_reduce_v64i8_v16i8:
-; X64-SSE42: ## %bb.0:
-; X64-SSE42-NEXT: movdqa %xmm0, %xmm1
-; X64-SSE42-NEXT: psrlw $8, %xmm1
-; X64-SSE42-NEXT: pminub %xmm0, %xmm1
-; X64-SSE42-NEXT: phminposuw %xmm1, %xmm0
-; X64-SSE42-NEXT: movd %xmm0, %eax
-; X64-SSE42-NEXT: ## kill: def $al killed $al killed $eax
-; X64-SSE42-NEXT: retq
-;
-; X64-AVX-LABEL: test_reduce_v64i8_v16i8:
-; X64-AVX: ## %bb.0:
-; X64-AVX-NEXT: vpsrlw $8, %xmm0, %xmm1
-; X64-AVX-NEXT: vpminub %xmm1, %xmm0, %xmm0
-; X64-AVX-NEXT: vphminposuw %xmm0, %xmm0
-; X64-AVX-NEXT: vmovd %xmm0, %eax
-; X64-AVX-NEXT: ## kill: def $al killed $al killed $eax
-; X64-AVX-NEXT: vzeroupper
-; X64-AVX-NEXT: retq
- %1 = shufflevector <64 x i8> %a0, <64 x i8> undef, <64 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %2 = icmp ult <64 x i8> %a0, %1
- %3 = select <64 x i1> %2, <64 x i8> %a0, <64 x i8> %1
- %4 = shufflevector <64 x i8> %3, <64 x i8> undef, <64 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %5 = icmp ult <64 x i8> %3, %4
- %6 = select <64 x i1> %5, <64 x i8> %3, <64 x i8> %4
- %7 = shufflevector <64 x i8> %6, <64 x i8> undef, <64 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %8 = icmp ult <64 x i8> %6, %7
- %9 = select <64 x i1> %8, <64 x i8> %6, <64 x i8> %7
- %10 = shufflevector <64 x i8> %9, <64 x i8> undef, <64 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
- %11 = icmp ult <64 x i8> %9, %10
- %12 = select <64 x i1> %11, <64 x i8> %9, <64 x i8> %10
- %13 = extractelement <64 x i8> %12, i32 0
- ret i8 %13
-}
diff --git a/llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-expanded.ll b/llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-expanded.ll
index 928f49aa2dc3d..acddf254c2998 100644
--- a/llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-expanded.ll
+++ b/llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-expanded.ll
@@ -137,12 +137,8 @@ for.end:
define i32 @smin_v4i32(ptr %p) {
; CHECK-LABEL: @smin_v4i32(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[P:%.*]], align 4, !tbaa [[TBAA0]]
-; CHECK-NEXT: [[RDX_SHUF:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 poison, i32 poison>
-; CHECK-NEXT: [[RDX_MINMAX:%.*]] = call <4 x i32> @llvm.smin.v4i32(<4 x i32> [[TMP1]], <4 x i32> [[RDX_SHUF]])
-; CHECK-NEXT: [[RDX_SHUF3:%.*]] = shufflevector <4 x i32> [[RDX_MINMAX]], <4 x i32> poison, <4 x i32> <i32 1, i32 poison, i32 poison, i32 poison>
-; CHECK-NEXT: [[RDX_MINMAX2:%.*]] = call <4 x i32> @llvm.smin.v4i32(<4 x i32> [[RDX_MINMAX]], <4 x i32> [[RDX_SHUF3]])
-; CHECK-NEXT: [[TMP2:%.*]] = extractelement <4 x i32> [[RDX_MINMAX2]], i32 0
+; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[P:%.*]], align 4, !tbaa [[TBAA0]]
+; CHECK-NEXT: [[TMP2:%.*]] = tail call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> [[TMP0]])
; CHECK-NEXT: ret i32 [[TMP2]]
;
entry:
@@ -188,12 +184,8 @@ for.end:
define i32 @umax_v4i32(ptr %p) {
; CHECK-LABEL: @umax_v4i32(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[P:%.*]], align 4, !tbaa [[TBAA0]]
-; CHECK-NEXT: [[RDX_SHUF:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 poison, i32 poison>
-; CHECK-NEXT: [[RDX_MINMAX:%.*]] = call <4 x i32> @llvm.umax.v4i32(<4 x i32> [[TMP1]], <4 x i32> [[RDX_SHUF]])
-; CHECK-NEXT: [[RDX_SHUF3:%.*]] = shufflevector <4 x i32> [[RDX_MINMAX]], <4 x i32> poison, <4 x i32> <i32 1, i32 poison, i32 poison, i32 poison>
-; CHECK-NEXT: [[RDX_MINMAX2:%.*]] = call <4 x i32> @llvm.umax.v4i32(<4 x i32> [[RDX_MINMAX]], <4 x i32> [[RDX_SHUF3]])
-; CHECK-NEXT: [[TMP2:%.*]] = extractelement <4 x i32> [[RDX_MINMAX2]], i32 0
+; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[P:%.*]], align 4, !tbaa [[TBAA0]]
+; CHECK-NEXT: [[TMP2:%.*]] = tail call i32 @llvm.vector.reduce.umax.v4i32(<4 x i32> [[TMP0]])
; CHECK-NEXT: ret i32 [[TMP2]]
;
entry:
More information about the llvm-commits
mailing list