[llvm] [SelectionDAG] Add support for the 3-way comparison intrinsics [US]CMP (PR #91871)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 15:36:42 PDT 2024


https://github.com/Poseydon42 updated https://github.com/llvm/llvm-project/pull/91871

>From 81dfa5432dd76f27fe2a7993f57aa653b530918b Mon Sep 17 00:00:00 2001
From: Poseydon42 <vvmposeydon at gmail.com>
Date: Sat, 11 May 2024 23:33:14 +0100
Subject: [PATCH 1/4] [SelectionDAG] Add support for the 3-way comparison
 intrinsics [US]CMP

---
 llvm/include/llvm/CodeGen/ISDOpcodes.h        |   6 +
 llvm/include/llvm/CodeGen/TargetLowering.h    |   4 +
 .../include/llvm/Target/TargetSelectionDAG.td |   5 +
 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp |   6 +
 .../SelectionDAG/LegalizeIntegerTypes.cpp     |  41 ++++++
 llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h |   5 +
 .../SelectionDAG/SelectionDAGBuilder.cpp      |  16 +++
 .../SelectionDAG/SelectionDAGDumper.cpp       |   2 +
 .../CodeGen/SelectionDAG/TargetLowering.cpp   |  21 +++
 llvm/lib/CodeGen/TargetLoweringBase.cpp       |   3 +
 llvm/test/CodeGen/X86/uscmp.ll                | 129 ++++++++++++++++++
 11 files changed, 238 insertions(+)
 create mode 100644 llvm/test/CodeGen/X86/uscmp.ll

diff --git a/llvm/include/llvm/CodeGen/ISDOpcodes.h b/llvm/include/llvm/CodeGen/ISDOpcodes.h
index 6429947958ee9..7d36f582244b0 100644
--- a/llvm/include/llvm/CodeGen/ISDOpcodes.h
+++ b/llvm/include/llvm/CodeGen/ISDOpcodes.h
@@ -677,6 +677,12 @@ enum NodeType {
   UMIN,
   UMAX,
 
+  /// [US]CMP - 3-way comparison of signed or unsigned integers. Returns -1, 0,
+  /// or 1 depending on whether Op0 <, ==, or > Op1. The operands can have type
+  /// different to the result.
+  SCMP,
+  UCMP,
+
   /// Bitwise operators - logical and, logical or, logical xor.
   AND,
   OR,
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 7ed08cfa8a202..82c450afcbcf6 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -5402,6 +5402,10 @@ class TargetLowering : public TargetLoweringBase {
   /// method accepts integers as its arguments.
   SDValue expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const;
 
+  /// Method for building the DAG expansion of ISD::[US]CMP. This
+  /// method accepts integers as its arguments
+  SDValue expandCMP(SDNode *Node, SelectionDAG &DAG) const;
+
   /// Method for building the DAG expansion of ISD::[US]SHLSAT. This
   /// method accepts integers as its arguments.
   SDValue expandShlSat(SDNode *Node, SelectionDAG &DAG) const;
diff --git a/llvm/include/llvm/Target/TargetSelectionDAG.td b/llvm/include/llvm/Target/TargetSelectionDAG.td
index 1684b424e3b44..6d771521aa739 100644
--- a/llvm/include/llvm/Target/TargetSelectionDAG.td
+++ b/llvm/include/llvm/Target/TargetSelectionDAG.td
@@ -434,6 +434,11 @@ def umin       : SDNode<"ISD::UMIN"      , SDTIntBinOp,
 def umax       : SDNode<"ISD::UMAX"      , SDTIntBinOp,
                                   [SDNPCommutative, SDNPAssociative]>;
 
+def scmp       : SDNode<"ISD::SCMP"      , SDTIntBinOp,
+                                  []>;
+def ucmp       : SDNode<"ISD::UCMP"      , SDTIntBinOp,
+                                  []>;
+
 def saddsat    : SDNode<"ISD::SADDSAT"   , SDTIntBinOp, [SDNPCommutative]>;
 def uaddsat    : SDNode<"ISD::UADDSAT"   , SDTIntBinOp, [SDNPCommutative]>;
 def ssubsat    : SDNode<"ISD::SSUBSAT"   , SDTIntBinOp>;
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index bfc3e08c1632d..f7da195e03bd1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1148,6 +1148,8 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) {
   case ISD::USUBSAT:
   case ISD::SSHLSAT:
   case ISD::USHLSAT:
+  case ISD::SCMP:
+  case ISD::UCMP:
   case ISD::FP_TO_SINT_SAT:
   case ISD::FP_TO_UINT_SAT:
     Action = TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0));
@@ -3864,6 +3866,10 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
   case ISD::USUBSAT:
     Results.push_back(TLI.expandAddSubSat(Node, DAG));
     break;
+  case ISD::SCMP:
+  case ISD::UCMP:
+    Results.push_back(TLI.expandCMP(Node, DAG));
+    break;
   case ISD::SSHLSAT:
   case ISD::USHLSAT:
     Results.push_back(TLI.expandShlSat(Node, DAG));
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 0aa36deda79dc..e82ab9db4c090 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -232,6 +232,11 @@ void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
     Res = PromoteIntRes_ADDSUBSHLSAT<VPMatchContext>(N);
     break;
 
+  case ISD::SCMP:
+  case ISD::UCMP:
+    Res = PromoteIntRes_CMP(N);
+    break;
+
   case ISD::SMULFIX:
   case ISD::SMULFIXSAT:
   case ISD::UMULFIX:
@@ -1246,6 +1251,13 @@ SDValue DAGTypeLegalizer::PromoteIntRes_SADDSUBO(SDNode *N, unsigned ResNo) {
   return Res;
 }
 
+SDValue DAGTypeLegalizer::PromoteIntRes_CMP(SDNode *N) {
+  EVT PromotedResultTy =
+      TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
+  return DAG.getNode(N->getOpcode(), SDLoc(N), PromotedResultTy,
+                     N->getOperand(0), N->getOperand(1));
+}
+
 SDValue DAGTypeLegalizer::PromoteIntRes_Select(SDNode *N) {
   SDValue Mask = N->getOperand(0);
 
@@ -1874,6 +1886,9 @@ bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) {
   case ISD::ROTL:
   case ISD::ROTR: Res = PromoteIntOp_Shift(N); break;
 
+  case ISD::SCMP:
+  case ISD::UCMP: Res = PromoteIntOp_CMP(N); break;
+
   case ISD::FSHL:
   case ISD::FSHR: Res = PromoteIntOp_FunnelShift(N); break;
 
@@ -2184,6 +2199,17 @@ SDValue DAGTypeLegalizer::PromoteIntOp_Shift(SDNode *N) {
                                 ZExtPromotedInteger(N->getOperand(1))), 0);
 }
 
+SDValue DAGTypeLegalizer::PromoteIntOp_CMP(SDNode *N) {
+  SDValue LHS = N->getOpcode() == ISD::UCMP
+                    ? ZExtPromotedInteger(N->getOperand(0))
+                    : SExtPromotedInteger(N->getOperand(0));
+  SDValue RHS = N->getOpcode() == ISD::UCMP
+                    ? ZExtPromotedInteger(N->getOperand(1))
+                    : SExtPromotedInteger(N->getOperand(1));
+
+  return SDValue(DAG.UpdateNodeOperands(N, LHS, RHS), 0);
+}
+
 SDValue DAGTypeLegalizer::PromoteIntOp_FunnelShift(SDNode *N) {
   return SDValue(DAG.UpdateNodeOperands(N, N->getOperand(0), N->getOperand(1),
                                 ZExtPromotedInteger(N->getOperand(2))), 0);
@@ -2741,6 +2767,9 @@ void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) {
   case ISD::UMIN:
   case ISD::SMIN: ExpandIntRes_MINMAX(N, Lo, Hi); break;
 
+  case ISD::SCMP:
+  case ISD::UCMP: ExpandIntRes_CMP(N, Lo, Hi); break;
+
   case ISD::ADD:
   case ISD::SUB: ExpandIntRes_ADDSUB(N, Lo, Hi); break;
 
@@ -3233,6 +3262,11 @@ void DAGTypeLegalizer::ExpandIntRes_MINMAX(SDNode *N,
   SplitInteger(Result, Lo, Hi);
 }
 
+void DAGTypeLegalizer::ExpandIntRes_CMP(SDNode *N, SDValue &Lo, SDValue &Hi) {
+  SDValue ExpandedCMP = TLI.expandCMP(N, DAG);
+  SplitInteger(ExpandedCMP, Lo, Hi);
+}
+
 void DAGTypeLegalizer::ExpandIntRes_ADDSUB(SDNode *N,
                                            SDValue &Lo, SDValue &Hi) {
   SDLoc dl(N);
@@ -5137,6 +5171,9 @@ bool DAGTypeLegalizer::ExpandIntegerOperand(SDNode *N, unsigned OpNo) {
   case ISD::RETURNADDR:
   case ISD::FRAMEADDR:         Res = ExpandIntOp_RETURNADDR(N); break;
 
+  case ISD::SCMP:
+  case ISD::UCMP:              Res = ExpandIntOp_CMP(N); break;
+
   case ISD::ATOMIC_STORE:      Res = ExpandIntOp_ATOMIC_STORE(N); break;
   case ISD::STACKMAP:
     Res = ExpandIntOp_STACKMAP(N, OpNo);
@@ -5398,6 +5435,10 @@ SDValue DAGTypeLegalizer::ExpandIntOp_Shift(SDNode *N) {
   return SDValue(DAG.UpdateNodeOperands(N, N->getOperand(0), Lo), 0);
 }
 
+SDValue DAGTypeLegalizer::ExpandIntOp_CMP(SDNode *N) {
+  return TLI.expandCMP(N, DAG);
+}
+
 SDValue DAGTypeLegalizer::ExpandIntOp_RETURNADDR(SDNode *N) {
   // The argument of RETURNADDR / FRAMEADDR builtin is 32 bit contant.  This
   // surely makes pretty nice problems on 8/16 bit targets. Just truncate this
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index 4b06e19656ce6..035f16720c3f6 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -324,6 +324,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   SDValue PromoteIntRes_Overflow(SDNode *N);
   SDValue PromoteIntRes_FFREXP(SDNode *N);
   SDValue PromoteIntRes_SADDSUBO(SDNode *N, unsigned ResNo);
+  SDValue PromoteIntRes_CMP(SDNode *N);
   SDValue PromoteIntRes_Select(SDNode *N);
   SDValue PromoteIntRes_SELECT_CC(SDNode *N);
   SDValue PromoteIntRes_SETCC(SDNode *N);
@@ -375,6 +376,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   SDValue PromoteIntOp_SELECT_CC(SDNode *N, unsigned OpNo);
   SDValue PromoteIntOp_SETCC(SDNode *N, unsigned OpNo);
   SDValue PromoteIntOp_Shift(SDNode *N);
+  SDValue PromoteIntOp_CMP(SDNode *N);
   SDValue PromoteIntOp_FunnelShift(SDNode *N);
   SDValue PromoteIntOp_SIGN_EXTEND(SDNode *N);
   SDValue PromoteIntOp_VP_SIGN_EXTEND(SDNode *N);
@@ -457,6 +459,8 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
 
   void ExpandIntRes_MINMAX            (SDNode *N, SDValue &Lo, SDValue &Hi);
 
+  void ExpandIntRes_CMP               (SDNode *N, SDValue &Lo, SDValue &Hi);
+
   void ExpandIntRes_SADDSUBO          (SDNode *N, SDValue &Lo, SDValue &Hi);
   void ExpandIntRes_UADDSUBO          (SDNode *N, SDValue &Lo, SDValue &Hi);
   void ExpandIntRes_XMULO             (SDNode *N, SDValue &Lo, SDValue &Hi);
@@ -485,6 +489,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   SDValue ExpandIntOp_SETCC(SDNode *N);
   SDValue ExpandIntOp_SETCCCARRY(SDNode *N);
   SDValue ExpandIntOp_Shift(SDNode *N);
+  SDValue ExpandIntOp_CMP(SDNode *N);
   SDValue ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo);
   SDValue ExpandIntOp_TRUNCATE(SDNode *N);
   SDValue ExpandIntOp_XINT_TO_FP(SDNode *N);
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index cfd82a342433f..16d8a9816b013 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7143,6 +7143,22 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
     setValue(&I, DAG.getNode(ISD::ABS, sdl, Op1.getValueType(), Op1));
     return;
   }
+  case Intrinsic::scmp: {
+    SDValue Op1 = getValue(I.getArgOperand(0));
+    SDValue Op2 = getValue(I.getArgOperand(1));
+    EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
+                                                          I.getType());
+    setValue(&I, DAG.getNode(ISD::SCMP, sdl, DestVT, Op1, Op2));
+    break;
+  }
+  case Intrinsic::ucmp: {
+    SDValue Op1 = getValue(I.getArgOperand(0));
+    SDValue Op2 = getValue(I.getArgOperand(1));
+    EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
+                                                          I.getType());
+    setValue(&I, DAG.getNode(ISD::UCMP, sdl, DestVT, Op1, Op2));
+    break;
+  }
   case Intrinsic::stacksave: {
     SDValue Op = getRoot();
     EVT VT = TLI.getValueType(DAG.getDataLayout(), I.getType());
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
index 4ad4a938ca97f..d5e8256aa4085 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
@@ -289,6 +289,8 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
   case ISD::SMAX:                       return "smax";
   case ISD::UMIN:                       return "umin";
   case ISD::UMAX:                       return "umax";
+  case ISD::SCMP:                       return "scmp";
+  case ISD::UCMP:                       return "ucmp";
 
   case ISD::FLDEXP:                     return "fldexp";
   case ISD::STRICT_FLDEXP:              return "strict_fldexp";
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 336d89fbcf638..3de57001135e9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -10274,6 +10274,27 @@ SDValue TargetLowering::expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const {
   return DAG.getSelect(dl, VT, Overflow, Result, SumDiff);
 }
 
+SDValue TargetLowering::expandCMP(SDNode *Node, SelectionDAG &DAG) const {
+  unsigned Opcode = Node->getOpcode();
+  SDValue LHS = Node->getOperand(0);
+  SDValue RHS = Node->getOperand(1);
+  EVT VT = LHS.getValueType();
+  EVT ResVT = Node->getValueType(0);
+  EVT BoolVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
+  SDLoc dl(Node);
+
+  auto LTPredicate = (Opcode == ISD::UCMP ? ISD::SETULT : ISD::SETLT);
+  auto GTPredicate = (Opcode == ISD::UCMP ? ISD::SETUGT : ISD::SETGT);
+
+  SDValue IsLT = DAG.getSetCC(dl, BoolVT, LHS, RHS, LTPredicate);
+  SDValue IsGT = DAG.getSetCC(dl, BoolVT, LHS, RHS, GTPredicate);
+  SDValue SelectZeroOrOne =
+      DAG.getSelect(dl, ResVT, IsGT, DAG.getConstant(1, dl, ResVT),
+                    DAG.getConstant(0, dl, ResVT));
+  return DAG.getSelect(dl, ResVT, IsLT, DAG.getConstant(-1, dl, ResVT),
+                       SelectZeroOrOne);
+}
+
 SDValue TargetLowering::expandShlSat(SDNode *Node, SelectionDAG &DAG) const {
   unsigned Opcode = Node->getOpcode();
   bool IsSigned = Opcode == ISD::SSHLSAT;
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 6e7b67ded23c8..311ba68b96ec9 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -909,6 +909,9 @@ void TargetLoweringBase::initActions() {
     setOperationAction({ISD::ADDC, ISD::ADDE, ISD::SUBC, ISD::SUBE}, VT,
                        Expand);
 
+    // [US]CMP default to expand
+    setOperationAction({ISD::UCMP, ISD::SCMP}, VT, Expand);
+
     // Halving adds
     setOperationAction(
         {ISD::AVGFLOORS, ISD::AVGFLOORU, ISD::AVGCEILS, ISD::AVGCEILU}, VT,
diff --git a/llvm/test/CodeGen/X86/uscmp.ll b/llvm/test/CodeGen/X86/uscmp.ll
new file mode 100644
index 0000000000000..3d1765b94f72a
--- /dev/null
+++ b/llvm/test/CodeGen/X86/uscmp.ll
@@ -0,0 +1,129 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+
+define i8 @ucmp(i32 %x, i32 %y) {
+; CHECK-LABEL: ucmp:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+  ret i8 %1
+}
+
+define i8 @scmp(i32 %x, i32 %y) {
+; CHECK-LABEL: scmp:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+  ret i8 %1
+}
+
+define i4 @ucmp_narrow_result(i32 %x, i32 %y) {
+; CHECK-LABEL: ucmp_narrow_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i4 @llvm.ucmp(i32 %x, i32 %y)
+  ret i4 %1
+}
+
+define i8 @scmp_narrow_op(i5 %x, i5 %y) {
+; CHECK-LABEL: scmp_narrow_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    andb $31, %sil
+; CHECK-NEXT:    andb $31, %dil
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpb %sil, %dil
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i5 %x, i5 %y)
+  ret i8 %1
+}
+
+define i128 @ucmp_wide_result(i32 %x, i32 %y) {
+; CHECK-LABEL: ucmp_wide_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovaeq %rcx, %rax
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    retq
+  %1 = call i128 @llvm.ucmp(i32 %x, i32 %y)
+  ret i128 %1
+}
+
+define i8 @scmp_wide_op(i128 %x, i128 %y) {
+; CHECK-LABEL: scmp_wide_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    cmpq %rdi, %rdx
+; CHECK-NEXT:    movq %rcx, %rax
+; CHECK-NEXT:    sbbq %rsi, %rax
+; CHECK-NEXT:    setl %al
+; CHECK-NEXT:    movzbl %al, %r8d
+; CHECK-NEXT:    cmpq %rdx, %rdi
+; CHECK-NEXT:    sbbq %rcx, %rsi
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %r8d, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.scmp(i128 %x, i128 %y)
+  ret i8 %1
+}
+
+define i41 @ucmp_uncommon_types(i7 %x, i7 %y) {
+; CHECK-LABEL: ucmp_uncommon_types:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    andb $127, %sil
+; CHECK-NEXT:    andb $127, %dil
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpb %sil, %dil
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovaeq %rcx, %rax
+; CHECK-NEXT:    retq
+  %1 = call i41 @llvm.ucmp(i7 %x, i7 %y)
+  ret i41 %1
+}
+
+define i125 @scmp_uncommon_types(i99 %x, i99 %y) {
+; CHECK-LABEL: scmp_uncommon_types:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    shlq $29, %rsi
+; CHECK-NEXT:    sarq $29, %rsi
+; CHECK-NEXT:    shlq $29, %rcx
+; CHECK-NEXT:    sarq $29, %rcx
+; CHECK-NEXT:    cmpq %rdi, %rdx
+; CHECK-NEXT:    movq %rcx, %rax
+; CHECK-NEXT:    sbbq %rsi, %rax
+; CHECK-NEXT:    setl %al
+; CHECK-NEXT:    movzbl %al, %r8d
+; CHECK-NEXT:    cmpq %rdx, %rdi
+; CHECK-NEXT:    sbbq %rcx, %rsi
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovgeq %r8, %rax
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    retq
+  %1 = call i125 @llvm.scmp(i99 %x, i99 %y)
+  ret i125 %1
+}

>From d2f0b3d1a9bf871de92d1cfc9bacfad10a3de9da Mon Sep 17 00:00:00 2001
From: Poseydon42 <vvmposeydon at gmail.com>
Date: Thu, 16 May 2024 22:22:44 +0100
Subject: [PATCH 2/4] [SelectionDAG] Properly handle legalization of vector
 types for [US]CMP nodes

---
 llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h |    6 +
 .../SelectionDAG/LegalizeVectorOps.cpp        |    2 +
 .../SelectionDAG/LegalizeVectorTypes.cpp      |  169 +++
 .../SelectionDAG/SelectionDAGBuilder.cpp      |    6 +-
 llvm/test/CodeGen/AArch64/scmp.ll             |   95 ++
 llvm/test/CodeGen/AArch64/ucmp.ll             |   95 ++
 llvm/test/CodeGen/X86/scmp.ll                 |  985 +++++++++++++++
 llvm/test/CodeGen/X86/ucmp.ll                 | 1071 +++++++++++++++++
 llvm/test/CodeGen/X86/uscmp.ll                |  129 --
 9 files changed, 2425 insertions(+), 133 deletions(-)
 create mode 100644 llvm/test/CodeGen/AArch64/scmp.ll
 create mode 100644 llvm/test/CodeGen/AArch64/ucmp.ll
 create mode 100644 llvm/test/CodeGen/X86/scmp.ll
 create mode 100644 llvm/test/CodeGen/X86/ucmp.ll
 delete mode 100644 llvm/test/CodeGen/X86/uscmp.ll

diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index 035f16720c3f6..db2cd5e40aefa 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -784,6 +784,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   void ScalarizeVectorResult(SDNode *N, unsigned ResNo);
   SDValue ScalarizeVecRes_MERGE_VALUES(SDNode *N, unsigned ResNo);
   SDValue ScalarizeVecRes_BinOp(SDNode *N);
+  SDValue ScalarizeVecRes_CMP(SDNode *N);
   SDValue ScalarizeVecRes_TernaryOp(SDNode *N);
   SDValue ScalarizeVecRes_UnaryOp(SDNode *N);
   SDValue ScalarizeVecRes_StrictFPOp(SDNode *N);
@@ -827,6 +828,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   SDValue ScalarizeVecOp_STRICT_FP_EXTEND(SDNode *N);
   SDValue ScalarizeVecOp_VECREDUCE(SDNode *N);
   SDValue ScalarizeVecOp_VECREDUCE_SEQ(SDNode *N);
+  SDValue ScalarizeVecOp_CMP(SDNode *N);
 
   //===--------------------------------------------------------------------===//
   // Vector Splitting Support: LegalizeVectorTypes.cpp
@@ -857,6 +859,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   void SplitVectorResult(SDNode *N, unsigned ResNo);
   void SplitVecRes_BinOp(SDNode *N, SDValue &Lo, SDValue &Hi);
   void SplitVecRes_TernaryOp(SDNode *N, SDValue &Lo, SDValue &Hi);
+  void SplitVecRes_CMP(SDNode *N, SDValue &Lo, SDValue &Hi);
   void SplitVecRes_UnaryOp(SDNode *N, SDValue &Lo, SDValue &Hi);
   void SplitVecRes_FFREXP(SDNode *N, unsigned ResNo, SDValue &Lo, SDValue &Hi);
   void SplitVecRes_ExtendOp(SDNode *N, SDValue &Lo, SDValue &Hi);
@@ -920,6 +923,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   SDValue SplitVecOp_VSETCC(SDNode *N);
   SDValue SplitVecOp_FP_ROUND(SDNode *N);
   SDValue SplitVecOp_FPOpDifferentTypes(SDNode *N);
+  SDValue SplitVecOp_CMP(SDNode *N);
   SDValue SplitVecOp_FP_TO_XINT_SAT(SDNode *N);
   SDValue SplitVecOp_VP_CttzElements(SDNode *N);
 
@@ -987,6 +991,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
 
   SDValue WidenVecRes_Ternary(SDNode *N);
   SDValue WidenVecRes_Binary(SDNode *N);
+  SDValue WidenVecRes_CMP(SDNode *N);
   SDValue WidenVecRes_BinaryCanTrap(SDNode *N);
   SDValue WidenVecRes_BinaryWithExtraScalarOp(SDNode *N);
   SDValue WidenVecRes_StrictFP(SDNode *N);
@@ -1006,6 +1011,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   SDValue WidenVecOp_BITCAST(SDNode *N);
   SDValue WidenVecOp_CONCAT_VECTORS(SDNode *N);
   SDValue WidenVecOp_EXTEND(SDNode *N);
+  SDValue WidenVecOp_CMP(SDNode *N);
   SDValue WidenVecOp_EXTRACT_VECTOR_ELT(SDNode *N);
   SDValue WidenVecOp_INSERT_SUBVECTOR(SDNode *N);
   SDValue WidenVecOp_EXTRACT_SUBVECTOR(SDNode *N);
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
index 423df9ae6b2a5..3a1c11da24075 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
@@ -442,6 +442,8 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) {
   case ISD::FP_TO_SINT_SAT:
   case ISD::FP_TO_UINT_SAT:
   case ISD::MGATHER:
+  case ISD::SCMP:
+  case ISD::UCMP:
     Action = TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0));
     break;
   case ISD::SMULFIX:
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index cab4dc5f3c156..2c25e5a0ebf2a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -164,6 +164,12 @@ void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, unsigned ResNo) {
   case ISD::ROTR:
     R = ScalarizeVecRes_BinOp(N);
     break;
+
+  case ISD::SCMP:
+  case ISD::UCMP:
+    R = ScalarizeVecRes_CMP(N);
+    break;
+
   case ISD::FMA:
   case ISD::FSHL:
   case ISD::FSHR:
@@ -213,6 +219,27 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_BinOp(SDNode *N) {
                      LHS.getValueType(), LHS, RHS, N->getFlags());
 }
 
+SDValue DAGTypeLegalizer::ScalarizeVecRes_CMP(SDNode *N) {
+  SDLoc DL(N);
+
+  SDValue LHS = N->getOperand(0);
+  SDValue RHS = N->getOperand(1);
+  if (getTypeAction(LHS.getValueType()) ==
+      TargetLowering::TypeScalarizeVector) {
+    LHS = GetScalarizedVector(LHS);
+    RHS = GetScalarizedVector(RHS);
+  } else {
+    EVT VT = LHS.getValueType().getVectorElementType();
+    LHS = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, LHS,
+                      DAG.getVectorIdxConstant(0, DL));
+    RHS = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, RHS,
+                      DAG.getVectorIdxConstant(0, DL));
+  }
+
+  return DAG.getNode(N->getOpcode(), SDLoc(N),
+                     N->getValueType(0).getVectorElementType(), LHS, RHS);
+}
+
 SDValue DAGTypeLegalizer::ScalarizeVecRes_TernaryOp(SDNode *N) {
   SDValue Op0 = GetScalarizedVector(N->getOperand(0));
   SDValue Op1 = GetScalarizedVector(N->getOperand(1));
@@ -741,6 +768,10 @@ bool DAGTypeLegalizer::ScalarizeVectorOperand(SDNode *N, unsigned OpNo) {
   case ISD::VECREDUCE_SEQ_FMUL:
     Res = ScalarizeVecOp_VECREDUCE_SEQ(N);
     break;
+  case ISD::SCMP:
+  case ISD::UCMP:
+    Res = ScalarizeVecOp_CMP(N);
+    break;
   }
 
   // If the result is null, the sub-method took care of registering results etc.
@@ -961,6 +992,12 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_VECREDUCE_SEQ(SDNode *N) {
                      AccOp, Op, N->getFlags());
 }
 
+SDValue DAGTypeLegalizer::ScalarizeVecOp_CMP(SDNode *N) {
+  SDValue LHS = GetScalarizedVector(N->getOperand(0));
+  SDValue RHS = GetScalarizedVector(N->getOperand(1));
+  return DAG.getNode(N->getOpcode(), SDLoc(N), N->getValueType(0), LHS, RHS);
+}
+
 //===----------------------------------------------------------------------===//
 //  Result Vector Splitting
 //===----------------------------------------------------------------------===//
@@ -1184,6 +1221,10 @@ void DAGTypeLegalizer::SplitVectorResult(SDNode *N, unsigned ResNo) {
     SplitVecRes_TernaryOp(N, Lo, Hi);
     break;
 
+  case ISD::SCMP: case ISD::UCMP:
+    SplitVecRes_CMP(N, Lo, Hi);
+    break;
+
 #define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN)               \
   case ISD::STRICT_##DAGN:
 #include "llvm/IR/ConstrainedOps.def"
@@ -1327,6 +1368,27 @@ void DAGTypeLegalizer::SplitVecRes_TernaryOp(SDNode *N, SDValue &Lo,
                    {Op0Hi, Op1Hi, Op2Hi, MaskHi, EVLHi}, Flags);
 }
 
+void DAGTypeLegalizer::SplitVecRes_CMP(SDNode *N, SDValue &Lo, SDValue &Hi) {
+  LLVMContext &Ctxt = *DAG.getContext();
+  SDLoc dl(N);
+
+  SDValue LHS = N->getOperand(0);
+  SDValue RHS = N->getOperand(1);
+
+  SDValue LHSLo, LHSHi, RHSLo, RHSHi;
+  if (getTypeAction(LHS.getValueType()) == TargetLowering::TypeSplitVector) {
+    GetSplitVector(LHS, LHSLo, LHSHi);
+    GetSplitVector(RHS, RHSLo, RHSHi);
+  } else {
+    std::tie(LHSLo, LHSHi) = DAG.SplitVector(LHS, dl);
+    std::tie(RHSLo, RHSHi) = DAG.SplitVector(RHS, dl);
+  }
+
+  EVT SplitResVT = N->getValueType(0).getHalfNumVectorElementsVT(Ctxt);
+  Lo = DAG.getNode(N->getOpcode(), dl, SplitResVT, LHSLo, RHSLo);
+  Hi = DAG.getNode(N->getOpcode(), dl, SplitResVT, LHSHi, RHSHi);
+}
+
 void DAGTypeLegalizer::SplitVecRes_FIX(SDNode *N, SDValue &Lo, SDValue &Hi) {
   SDValue LHSLo, LHSHi;
   GetSplitVector(N->getOperand(0), LHSLo, LHSHi);
@@ -3054,6 +3116,11 @@ bool DAGTypeLegalizer::SplitVectorOperand(SDNode *N, unsigned OpNo) {
     Res = SplitVecOp_FPOpDifferentTypes(N);
     break;
 
+  case ISD::SCMP:
+  case ISD::UCMP:
+    Res = SplitVecOp_CMP(N);
+    break;
+
   case ISD::ANY_EXTEND_VECTOR_INREG:
   case ISD::SIGN_EXTEND_VECTOR_INREG:
   case ISD::ZERO_EXTEND_VECTOR_INREG:
@@ -4043,6 +4110,25 @@ SDValue DAGTypeLegalizer::SplitVecOp_FPOpDifferentTypes(SDNode *N) {
   return DAG.getNode(ISD::CONCAT_VECTORS, DL, N->getValueType(0), Lo, Hi);
 }
 
+SDValue DAGTypeLegalizer::SplitVecOp_CMP(SDNode *N) {
+  LLVMContext &Ctxt = *DAG.getContext();
+  SDLoc dl(N);
+
+  SDValue LHSLo, LHSHi, RHSLo, RHSHi;
+  GetSplitVector(N->getOperand(0), LHSLo, LHSHi);
+  GetSplitVector(N->getOperand(1), RHSLo, RHSHi);
+
+  EVT ResVT = N->getValueType(0);
+  ElementCount SplitOpEC = LHSLo.getValueType().getVectorElementCount();
+  EVT NewResVT =
+      EVT::getVectorVT(Ctxt, ResVT.getVectorElementType(), SplitOpEC);
+
+  SDValue Lo = DAG.getNode(N->getOpcode(), dl, NewResVT, LHSLo, RHSLo);
+  SDValue Hi = DAG.getNode(N->getOpcode(), dl, NewResVT, LHSHi, RHSHi);
+
+  return DAG.getNode(ISD::CONCAT_VECTORS, dl, ResVT, Lo, Hi);
+}
+
 SDValue DAGTypeLegalizer::SplitVecOp_FP_TO_XINT_SAT(SDNode *N) {
   EVT ResVT = N->getValueType(0);
   SDValue Lo, Hi;
@@ -4220,6 +4306,11 @@ void DAGTypeLegalizer::WidenVectorResult(SDNode *N, unsigned ResNo) {
     Res = WidenVecRes_Binary(N);
     break;
 
+  case ISD::SCMP:
+  case ISD::UCMP:
+    Res = WidenVecRes_CMP(N);
+    break;
+
   case ISD::FPOW:
   case ISD::FREM:
     if (unrollExpandedOp())
@@ -4426,6 +4517,53 @@ SDValue DAGTypeLegalizer::WidenVecRes_Binary(SDNode *N) {
                      {InOp1, InOp2, Mask, N->getOperand(3)}, N->getFlags());
 }
 
+SDValue DAGTypeLegalizer::WidenVecRes_CMP(SDNode *N) {
+  LLVMContext &Ctxt = *DAG.getContext();
+  SDLoc dl(N);
+
+  SDValue LHS = N->getOperand(0);
+  SDValue RHS = N->getOperand(1);
+  EVT OpVT = LHS.getValueType();
+  if (getTypeAction(OpVT) == TargetLowering::TypeWidenVector) {
+    LHS = GetWidenedVector(LHS);
+    RHS = GetWidenedVector(RHS);
+  }
+
+  EVT WidenResVT = TLI.getTypeToTransformTo(Ctxt, N->getValueType(0));
+  ElementCount WidenResEC = WidenResVT.getVectorElementCount();
+  EVT WidenResElementVT = WidenResVT.getVectorElementType();
+
+  // At this point we know that the type of LHS and RHS will not require
+  // widening any further, so we can use the current (updated) type of the
+  // operands as the return type of the CMP node, and then extend/truncate
+  // and resize it appropriately.
+  EVT CmpRetTy = LHS.getValueType();
+  SDValue CMP = DAG.getNode(N->getOpcode(), dl, CmpRetTy, LHS, RHS);
+  if (CmpRetTy.getVectorNumElements() < WidenResVT.getVectorNumElements()) {
+    EVT WideUndefVectorVT =
+        EVT::getVectorVT(Ctxt, CmpRetTy.getVectorElementType(), WidenResEC);
+    SDValue WideUndefValue = DAG.getUNDEF(WideUndefVectorVT);
+    CMP = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, WideUndefVectorVT,
+                      WideUndefValue, CMP, DAG.getVectorIdxConstant(0, dl));
+  } else if (CmpRetTy.getVectorNumElements() >
+             WidenResVT.getVectorNumElements()) {
+    EVT NarrowedVecVT =
+        EVT::getVectorVT(Ctxt, CmpRetTy.getVectorElementType(), WidenResEC);
+    CMP = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, NarrowedVecVT, CMP,
+                      DAG.getVectorIdxConstant(0, dl));
+  }
+
+  ISD::NodeType ExtendCode;
+  if (CMP.getValueType().getVectorElementType().getSizeInBits() >
+      WidenResElementVT.getSizeInBits()) {
+    ExtendCode = ISD::TRUNCATE;
+  } else {
+    ExtendCode =
+        (N->getOpcode() == ISD::SCMP ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND);
+  }
+  return DAG.getNode(ExtendCode, dl, WidenResVT, CMP);
+}
+
 SDValue DAGTypeLegalizer::WidenVecRes_BinaryWithExtraScalarOp(SDNode *N) {
   // Binary op widening, but with an extra operand that shouldn't be widened.
   SDLoc dl(N);
@@ -6129,6 +6267,11 @@ bool DAGTypeLegalizer::WidenVectorOperand(SDNode *N, unsigned OpNo) {
     Res = WidenVecOp_EXTEND(N);
     break;
 
+  case ISD::SCMP:
+  case ISD::UCMP:
+    Res = WidenVecOp_CMP(N);
+    break;
+
   case ISD::FP_EXTEND:
   case ISD::STRICT_FP_EXTEND:
   case ISD::FP_ROUND:
@@ -6273,6 +6416,32 @@ SDValue DAGTypeLegalizer::WidenVecOp_EXTEND(SDNode *N) {
   }
 }
 
+SDValue DAGTypeLegalizer::WidenVecOp_CMP(SDNode *N) {
+  SDLoc dl(N);
+
+  EVT OpVT = N->getOperand(0).getValueType();
+  EVT ResVT = N->getValueType(0);
+  SDValue LHS = GetWidenedVector(N->getOperand(0));
+  SDValue RHS = GetWidenedVector(N->getOperand(1));
+
+  // 1. EXTRACT_SUBVECTOR
+  // 2. SIGN_EXTEND/ZERO_EXTEND
+  // 3. CMP
+  LHS = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, OpVT, LHS,
+                    DAG.getVectorIdxConstant(0, dl));
+  RHS = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, OpVT, RHS,
+                    DAG.getVectorIdxConstant(0, dl));
+
+  // At this point the result type is guaranteed to be valid, so we can use it
+  // as the operand type by extending it appropriately
+  ISD::NodeType ExtendOpcode =
+      N->getOpcode() == ISD::SCMP ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND;
+  LHS = DAG.getNode(ExtendOpcode, dl, ResVT, LHS);
+  RHS = DAG.getNode(ExtendOpcode, dl, ResVT, RHS);
+
+  return DAG.getNode(N->getOpcode(), dl, ResVT, LHS, RHS);
+}
+
 SDValue DAGTypeLegalizer::WidenVecOp_UnrollVectorOp(SDNode *N) {
   // The result (and first input) is legal, but the second input is illegal.
   // We can't do much to fix that, so just unroll and let the extracts off of
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 16d8a9816b013..6bf67545aed4c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7146,16 +7146,14 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
   case Intrinsic::scmp: {
     SDValue Op1 = getValue(I.getArgOperand(0));
     SDValue Op2 = getValue(I.getArgOperand(1));
-    EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
-                                                          I.getType());
+    EVT DestVT = TLI.getValueType(DAG.getDataLayout(), I.getType());
     setValue(&I, DAG.getNode(ISD::SCMP, sdl, DestVT, Op1, Op2));
     break;
   }
   case Intrinsic::ucmp: {
     SDValue Op1 = getValue(I.getArgOperand(0));
     SDValue Op2 = getValue(I.getArgOperand(1));
-    EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
-                                                          I.getType());
+    EVT DestVT = TLI.getValueType(DAG.getDataLayout(), I.getType());
     setValue(&I, DAG.getNode(ISD::UCMP, sdl, DestVT, Op1, Op2));
     break;
   }
diff --git a/llvm/test/CodeGen/AArch64/scmp.ll b/llvm/test/CodeGen/AArch64/scmp.ll
new file mode 100644
index 0000000000000..a7abc5eadaff6
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/scmp.ll
@@ -0,0 +1,95 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs < %s | FileCheck %s
+
+define i8 @scmp.8.8(i8 %x, i8 %y) nounwind {
+; CHECK-LABEL: scmp.8.8:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    sxtb w8, w0
+; CHECK-NEXT:    cmp w8, w1, sxtb
+; CHECK-NEXT:    cset w8, gt
+; CHECK-NEXT:    csinv w0, w8, wzr, ge
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.scmp(i8 %x, i8 %y)
+  ret i8 %1
+}
+
+define i8 @scmp.8.16(i16 %x, i16 %y) nounwind {
+; CHECK-LABEL: scmp.8.16:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    sxth w8, w0
+; CHECK-NEXT:    cmp w8, w1, sxth
+; CHECK-NEXT:    cset w8, gt
+; CHECK-NEXT:    csinv w0, w8, wzr, ge
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.scmp(i16 %x, i16 %y)
+  ret i8 %1
+}
+
+define i8 @scmp.8.32(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: scmp.8.32:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp w0, w1
+; CHECK-NEXT:    cset w8, gt
+; CHECK-NEXT:    csinv w0, w8, wzr, ge
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
+  ret i8 %1
+}
+
+define i8 @scmp.8.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: scmp.8.64:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp x0, x1
+; CHECK-NEXT:    cset w8, gt
+; CHECK-NEXT:    csinv w0, w8, wzr, ge
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.scmp(i64 %x, i64 %y)
+  ret i8 %1
+}
+
+define i8 @scmp.8.128(i128 %x, i128 %y) nounwind {
+; CHECK-LABEL: scmp.8.128:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp x2, x0
+; CHECK-NEXT:    sbcs xzr, x3, x1
+; CHECK-NEXT:    cset w8, lt
+; CHECK-NEXT:    cmp x0, x2
+; CHECK-NEXT:    sbcs xzr, x1, x3
+; CHECK-NEXT:    csinv w0, w8, wzr, ge
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.scmp(i128 %x, i128 %y)
+  ret i8 %1
+}
+
+define i32 @scmp.32.32(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: scmp.32.32:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp w0, w1
+; CHECK-NEXT:    cset w8, gt
+; CHECK-NEXT:    csinv w0, w8, wzr, ge
+; CHECK-NEXT:    ret
+  %1 = call i32 @llvm.scmp(i32 %x, i32 %y)
+  ret i32 %1
+}
+
+define i32 @scmp.32.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: scmp.32.64:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp x0, x1
+; CHECK-NEXT:    cset w8, gt
+; CHECK-NEXT:    csinv w0, w8, wzr, ge
+; CHECK-NEXT:    ret
+  %1 = call i32 @llvm.scmp(i64 %x, i64 %y)
+  ret i32 %1
+}
+
+define i64 @scmp.64.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: scmp.64.64:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp x0, x1
+; CHECK-NEXT:    cset x8, gt
+; CHECK-NEXT:    csinv x0, x8, xzr, ge
+; CHECK-NEXT:    ret
+  %1 = call i64 @llvm.scmp(i64 %x, i64 %y)
+  ret i64 %1
+}
diff --git a/llvm/test/CodeGen/AArch64/ucmp.ll b/llvm/test/CodeGen/AArch64/ucmp.ll
new file mode 100644
index 0000000000000..39a32194147eb
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/ucmp.ll
@@ -0,0 +1,95 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs < %s | FileCheck %s
+
+define i8 @ucmp.8.8(i8 %x, i8 %y) nounwind {
+; CHECK-LABEL: ucmp.8.8:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    and w8, w0, #0xff
+; CHECK-NEXT:    cmp w8, w1, uxtb
+; CHECK-NEXT:    cset w8, hi
+; CHECK-NEXT:    csinv w0, w8, wzr, hs
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.ucmp(i8 %x, i8 %y)
+  ret i8 %1
+}
+
+define i8 @ucmp.8.16(i16 %x, i16 %y) nounwind {
+; CHECK-LABEL: ucmp.8.16:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    and w8, w0, #0xffff
+; CHECK-NEXT:    cmp w8, w1, uxth
+; CHECK-NEXT:    cset w8, hi
+; CHECK-NEXT:    csinv w0, w8, wzr, hs
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.ucmp(i16 %x, i16 %y)
+  ret i8 %1
+}
+
+define i8 @ucmp.8.32(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: ucmp.8.32:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp w0, w1
+; CHECK-NEXT:    cset w8, hi
+; CHECK-NEXT:    csinv w0, w8, wzr, hs
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+  ret i8 %1
+}
+
+define i8 @ucmp.8.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: ucmp.8.64:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp x0, x1
+; CHECK-NEXT:    cset w8, hi
+; CHECK-NEXT:    csinv w0, w8, wzr, hs
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.ucmp(i64 %x, i64 %y)
+  ret i8 %1
+}
+
+define i8 @ucmp.8.128(i128 %x, i128 %y) nounwind {
+; CHECK-LABEL: ucmp.8.128:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp x2, x0
+; CHECK-NEXT:    sbcs xzr, x3, x1
+; CHECK-NEXT:    cset w8, lo
+; CHECK-NEXT:    cmp x0, x2
+; CHECK-NEXT:    sbcs xzr, x1, x3
+; CHECK-NEXT:    csinv w0, w8, wzr, hs
+; CHECK-NEXT:    ret
+  %1 = call i8 @llvm.ucmp(i128 %x, i128 %y)
+  ret i8 %1
+}
+
+define i32 @ucmp.32.32(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: ucmp.32.32:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp w0, w1
+; CHECK-NEXT:    cset w8, hi
+; CHECK-NEXT:    csinv w0, w8, wzr, hs
+; CHECK-NEXT:    ret
+  %1 = call i32 @llvm.ucmp(i32 %x, i32 %y)
+  ret i32 %1
+}
+
+define i32 @ucmp.32.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: ucmp.32.64:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp x0, x1
+; CHECK-NEXT:    cset w8, hi
+; CHECK-NEXT:    csinv w0, w8, wzr, hs
+; CHECK-NEXT:    ret
+  %1 = call i32 @llvm.ucmp(i64 %x, i64 %y)
+  ret i32 %1
+}
+
+define i64 @ucmp.64.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: ucmp.64.64:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    cmp x0, x1
+; CHECK-NEXT:    cset x8, hi
+; CHECK-NEXT:    csinv x0, x8, xzr, hs
+; CHECK-NEXT:    ret
+  %1 = call i64 @llvm.ucmp(i64 %x, i64 %y)
+  ret i64 %1
+}
diff --git a/llvm/test/CodeGen/X86/scmp.ll b/llvm/test/CodeGen/X86/scmp.ll
new file mode 100644
index 0000000000000..82f0859e8a66e
--- /dev/null
+++ b/llvm/test/CodeGen/X86/scmp.ll
@@ -0,0 +1,985 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+
+define i8 @scmp.8.8(i8 %x, i8 %y) nounwind {
+; CHECK-LABEL: scmp.8.8:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpb %sil, %dil
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.scmp(i8 %x, i8 %y)
+  ret i8 %1
+}
+
+define i8 @scmp.8.16(i16 %x, i16 %y) nounwind {
+; CHECK-LABEL: scmp.8.16:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpw %si, %di
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.scmp(i16 %x, i16 %y)
+  ret i8 %1
+}
+
+define i8 @scmp.8.32(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: scmp.8.32:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
+  ret i8 %1
+}
+
+define i8 @scmp.8.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: scmp.8.64:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.scmp(i64 %x, i64 %y)
+  ret i8 %1
+}
+
+define i8 @scmp.8.128(i128 %x, i128 %y) nounwind {
+; CHECK-LABEL: scmp.8.128:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    cmpq %rdi, %rdx
+; CHECK-NEXT:    movq %rcx, %rax
+; CHECK-NEXT:    sbbq %rsi, %rax
+; CHECK-NEXT:    setl %al
+; CHECK-NEXT:    movzbl %al, %r8d
+; CHECK-NEXT:    cmpq %rdx, %rdi
+; CHECK-NEXT:    sbbq %rcx, %rsi
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %r8d, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.scmp(i128 %x, i128 %y)
+  ret i8 %1
+}
+
+define i32 @scmp.32.32(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: scmp.32.32:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    retq
+  %1 = call i32 @llvm.scmp(i32 %x, i32 %y)
+  ret i32 %1
+}
+
+define i32 @scmp.32.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: scmp.32.64:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    retq
+  %1 = call i32 @llvm.scmp(i64 %x, i64 %y)
+  ret i32 %1
+}
+
+define i64 @scmp.64.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: scmp.64.64:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovgeq %rcx, %rax
+; CHECK-NEXT:    retq
+  %1 = call i64 @llvm.scmp(i64 %x, i64 %y)
+  ret i64 %1
+}
+
+define i4 @scmp_narrow_result(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: scmp_narrow_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i4 @llvm.scmp(i32 %x, i32 %y)
+  ret i4 %1
+}
+
+define i8 @scmp_narrow_op(i62 %x, i62 %y) nounwind {
+; CHECK-LABEL: scmp_narrow_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    shlq $2, %rsi
+; CHECK-NEXT:    sarq $2, %rsi
+; CHECK-NEXT:    shlq $2, %rdi
+; CHECK-NEXT:    sarq $2, %rdi
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.scmp(i62 %x, i62 %y)
+  ret i8 %1
+}
+
+define i141 @scmp_wide_result(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: scmp_wide_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovgeq %rcx, %rax
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    retq
+  %1 = call i141 @llvm.scmp(i32 %x, i32 %y)
+  ret i141 %1
+}
+
+define i8 @scmp_wide_op(i109 %x, i109 %y) nounwind {
+; CHECK-LABEL: scmp_wide_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    shlq $19, %rsi
+; CHECK-NEXT:    sarq $19, %rsi
+; CHECK-NEXT:    shlq $19, %rcx
+; CHECK-NEXT:    sarq $19, %rcx
+; CHECK-NEXT:    cmpq %rdi, %rdx
+; CHECK-NEXT:    movq %rcx, %rax
+; CHECK-NEXT:    sbbq %rsi, %rax
+; CHECK-NEXT:    setl %al
+; CHECK-NEXT:    movzbl %al, %r8d
+; CHECK-NEXT:    cmpq %rdx, %rdi
+; CHECK-NEXT:    sbbq %rcx, %rsi
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %r8d, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.scmp(i109 %x, i109 %y)
+  ret i8 %1
+}
+
+define i41 @scmp_uncommon_types(i7 %x, i7 %y) nounwind {
+; CHECK-LABEL: scmp_uncommon_types:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addb %sil, %sil
+; CHECK-NEXT:    sarb %sil
+; CHECK-NEXT:    addb %dil, %dil
+; CHECK-NEXT:    sarb %dil
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpb %sil, %dil
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovgeq %rcx, %rax
+; CHECK-NEXT:    retq
+  %1 = call i41 @llvm.scmp(i7 %x, i7 %y)
+  ret i41 %1
+}
+
+define <4 x i32> @scmp_normal_vectors(<4 x i32> %x, <4 x i32> %y) nounwind {
+; CHECK-LABEL: scmp_normal_vectors:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %eax
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    movd %edx, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
+; CHECK-NEXT:    movdqa %xmm2, %xmm0
+; CHECK-NEXT:    retq
+  %1 = call <4 x i32> @llvm.scmp(<4 x i32> %x, <4 x i32> %y)
+  ret <4 x i32> %1
+}
+
+define <4 x i8> @scmp_narrow_vec_result(<4 x i32> %x, <4 x i32> %y) nounwind {
+; CHECK-LABEL: scmp_narrow_vec_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %eax
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    movd %edx, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
+; CHECK-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2
+; CHECK-NEXT:    pxor %xmm0, %xmm0
+; CHECK-NEXT:    packuswb %xmm0, %xmm2
+; CHECK-NEXT:    packuswb %xmm0, %xmm2
+; CHECK-NEXT:    movdqa %xmm2, %xmm0
+; CHECK-NEXT:    retq
+  %1 = call <4 x i8> @llvm.scmp(<4 x i32> %x, <4 x i32> %y)
+  ret <4 x i8> %1
+}
+
+define <4 x i32> @scmp_narrow_vec_op(<4 x i8> %x, <4 x i8> %y) nounwind {
+; CHECK-LABEL: scmp_narrow_vec_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3]
+; CHECK-NEXT:    psrad $24, %xmm1
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %eax
+; CHECK-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
+; CHECK-NEXT:    psrad $24, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm2[3,3,3,3]
+; CHECK-NEXT:    movd %xmm0, %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    movd %edx, %xmm0
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm2[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    movd %xmm2, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm1
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
+; CHECK-NEXT:    retq
+  %1 = call <4 x i32> @llvm.scmp(<4 x i8> %x, <4 x i8> %y)
+  ret <4 x i32> %1
+}
+
+define <16 x i32> @scmp_wide_vec_result(<16 x i8> %x, <16 x i8> %y) nounwind {
+; CHECK-LABEL: scmp_wide_vec_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    movdqa %xmm1, %xmm3
+; CHECK-NEXT:    movdqa %xmm0, %xmm2
+; CHECK-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1],xmm5[2],xmm1[2],xmm5[3],xmm1[3]
+; CHECK-NEXT:    psrad $24, %xmm5
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm5[3,3,3,3]
+; CHECK-NEXT:    movd %xmm0, %eax
+; CHECK-NEXT:    punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3],xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3]
+; CHECK-NEXT:    psrad $24, %xmm6
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm6[3,3,3,3]
+; CHECK-NEXT:    movd %xmm0, %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    movd %edx, %xmm0
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
+; CHECK-NEXT:    movd %xmm7, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; CHECK-NEXT:    movd %xmm7, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm7
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm0[0],xmm7[1],xmm0[1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    movd %xmm6, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm5
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm5[0],xmm0[1],xmm5[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm7[0]
+; CHECK-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm1[4],xmm5[5],xmm1[5],xmm5[6],xmm1[6],xmm5[7],xmm1[7]
+; CHECK-NEXT:    psrad $24, %xmm5
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm5[3,3,3,3]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4,4,5,5,6,6,7,7]
+; CHECK-NEXT:    psrad $24, %xmm4
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm4[3,3,3,3]
+; CHECK-NEXT:    movd %xmm1, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm1
+; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
+; CHECK-NEXT:    movd %xmm6, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm4[2,3,2,3]
+; CHECK-NEXT:    movd %xmm6, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm6
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm1[0],xmm6[1],xmm1[1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    movd %xmm4, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm1
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
+; CHECK-NEXT:    movd %xmm4, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm4
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm6[0]
+; CHECK-NEXT:    punpckhbw {{.*#+}} xmm3 = xmm3[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm3[0],xmm5[1],xmm3[1],xmm5[2],xmm3[2],xmm5[3],xmm3[3]
+; CHECK-NEXT:    psrad $24, %xmm5
+; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[3,3,3,3]
+; CHECK-NEXT:    movd %xmm4, %ecx
+; CHECK-NEXT:    punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm2[8],xmm4[9],xmm2[9],xmm4[10],xmm2[10],xmm4[11],xmm2[11],xmm4[12],xmm2[12],xmm4[13],xmm2[13],xmm4[14],xmm2[14],xmm4[15],xmm2[15]
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3]
+; CHECK-NEXT:    psrad $24, %xmm6
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm6[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
+; CHECK-NEXT:    movd %xmm7, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; CHECK-NEXT:    movd %xmm7, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm7
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    movd %xmm6, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm5
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm5[0],xmm2[1],xmm5[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm7[0]
+; CHECK-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm3[4],xmm5[5],xmm3[5],xmm5[6],xmm3[6],xmm5[7],xmm3[7]
+; CHECK-NEXT:    psrad $24, %xmm5
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm5[3,3,3,3]
+; CHECK-NEXT:    movd %xmm3, %ecx
+; CHECK-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4,4,5,5,6,6,7,7]
+; CHECK-NEXT:    psrad $24, %xmm4
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[3,3,3,3]
+; CHECK-NEXT:    movd %xmm3, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
+; CHECK-NEXT:    movd %xmm6, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm4[2,3,2,3]
+; CHECK-NEXT:    movd %xmm6, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm6
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    movd %xmm4, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
+; CHECK-NEXT:    movd %xmm4, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm4
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm6[0]
+; CHECK-NEXT:    retq
+  %1 = call <16 x i32> @llvm.scmp(<16 x i8> %x, <16 x i8> %y)
+  ret <16 x i32> %1
+}
+
+define <16 x i8> @scmp_wide_vec_op(<16 x i64> %x, <16 x i64> %y) nounwind {
+; CHECK-LABEL: scmp_wide_vec_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    movq %xmm7, %rax
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovlq %rax, %rcx
+; CHECK-NEXT:    movq %rcx, %xmm9
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm7[2,3,2,3]
+; CHECK-NEXT:    movq %xmm7, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm7
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm9 = xmm9[0],xmm7[0]
+; CHECK-NEXT:    movdqa {{.*#+}} xmm7 = [255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0]
+; CHECK-NEXT:    pand %xmm7, %xmm9
+; CHECK-NEXT:    movq %xmm6, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm8
+; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm6[2,3,2,3]
+; CHECK-NEXT:    movq %xmm6, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm6
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm8 = xmm8[0],xmm6[0]
+; CHECK-NEXT:    pand %xmm7, %xmm8
+; CHECK-NEXT:    packuswb %xmm9, %xmm8
+; CHECK-NEXT:    movq %xmm5, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm6
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[2,3,2,3]
+; CHECK-NEXT:    movq %xmm5, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm5
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm6 = xmm6[0],xmm5[0]
+; CHECK-NEXT:    pand %xmm7, %xmm6
+; CHECK-NEXT:    movq %xmm4, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm5
+; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[2,3,2,3]
+; CHECK-NEXT:    movq %xmm4, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm4
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm5 = xmm5[0],xmm4[0]
+; CHECK-NEXT:    pand %xmm7, %xmm5
+; CHECK-NEXT:    packuswb %xmm6, %xmm5
+; CHECK-NEXT:    packuswb %xmm8, %xmm5
+; CHECK-NEXT:    movq %xmm3, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm4
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[2,3,2,3]
+; CHECK-NEXT:    movq %xmm3, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm3
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm4 = xmm4[0],xmm3[0]
+; CHECK-NEXT:    pand %xmm7, %xmm4
+; CHECK-NEXT:    movq %xmm2, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm3
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[2,3,2,3]
+; CHECK-NEXT:    movq %xmm2, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm2
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm2[0]
+; CHECK-NEXT:    pand %xmm7, %xmm3
+; CHECK-NEXT:    packuswb %xmm4, %xmm3
+; CHECK-NEXT:    movq %xmm1, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movq %xmm1, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm1
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm1[0]
+; CHECK-NEXT:    pand %xmm7, %xmm2
+; CHECK-NEXT:    movq %xmm0, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm1
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
+; CHECK-NEXT:    movq %xmm0, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm0
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
+; CHECK-NEXT:    pand %xmm7, %xmm1
+; CHECK-NEXT:    packuswb %xmm2, %xmm1
+; CHECK-NEXT:    packuswb %xmm3, %xmm1
+; CHECK-NEXT:    packuswb %xmm5, %xmm1
+; CHECK-NEXT:    movdqa %xmm1, %xmm0
+; CHECK-NEXT:    retq
+  %1 = call <16 x i8> @llvm.scmp(<16 x i64> %x, <16 x i64> %y)
+  ret <16 x i8> %1
+}
+
+define <7 x i117> @scmp_uncommon_vectors(<7 x i7> %x, <7 x i7> %y) nounwind {
+; CHECK-LABEL: scmp_uncommon_vectors:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pushq %rbp
+; CHECK-NEXT:    pushq %r15
+; CHECK-NEXT:    pushq %r14
+; CHECK-NEXT:    pushq %r13
+; CHECK-NEXT:    pushq %r12
+; CHECK-NEXT:    pushq %rbx
+; CHECK-NEXT:    movq %rdi, %r14
+; CHECK-NEXT:    movd %r8d, %xmm0
+; CHECK-NEXT:    movd %ecx, %xmm1
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
+; CHECK-NEXT:    movd %edx, %xmm2
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; CHECK-NEXT:    movd %r9d, %xmm1
+; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
+; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
+; CHECK-NEXT:    psllw $9, %xmm0
+; CHECK-NEXT:    psraw $9, %xmm0
+; CHECK-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
+; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
+; CHECK-NEXT:    movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
+; CHECK-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3]
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
+; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; CHECK-NEXT:    movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
+; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
+; CHECK-NEXT:    psllw $9, %xmm1
+; CHECK-NEXT:    psraw $9, %xmm1
+; CHECK-NEXT:    movd %xmm1, %edx
+; CHECK-NEXT:    movd %xmm0, %esi
+; CHECK-NEXT:    xorl %eax, %eax
+; CHECK-NEXT:    cmpw %dx, %si
+; CHECK-NEXT:    setg %al
+; CHECK-NEXT:    movl $65535, %ebp # imm = 0xFFFF
+; CHECK-NEXT:    cmovll %ebp, %eax
+; CHECK-NEXT:    shlq $57, %rax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq %rax, %rcx
+; CHECK-NEXT:    sarq $63, %rcx
+; CHECK-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    pextrw $5, %xmm1, %esi
+; CHECK-NEXT:    pextrw $5, %xmm0, %edi
+; CHECK-NEXT:    xorl %r9d, %r9d
+; CHECK-NEXT:    cmpw %si, %di
+; CHECK-NEXT:    setg %r9b
+; CHECK-NEXT:    cmovll %ebp, %r9d
+; CHECK-NEXT:    shlq $57, %r9
+; CHECK-NEXT:    movq %r9, %rdi
+; CHECK-NEXT:    sarq $57, %rdi
+; CHECK-NEXT:    sarq $63, %r9
+; CHECK-NEXT:    pextrw $1, %xmm1, %esi
+; CHECK-NEXT:    pextrw $1, %xmm0, %r8d
+; CHECK-NEXT:    xorl %ebx, %ebx
+; CHECK-NEXT:    cmpw %si, %r8w
+; CHECK-NEXT:    setg %bl
+; CHECK-NEXT:    cmovll %ebp, %ebx
+; CHECK-NEXT:    shlq $57, %rbx
+; CHECK-NEXT:    movq %rbx, %rsi
+; CHECK-NEXT:    sarq $57, %rsi
+; CHECK-NEXT:    sarq $63, %rbx
+; CHECK-NEXT:    pextrw $2, %xmm1, %r10d
+; CHECK-NEXT:    pextrw $2, %xmm0, %r11d
+; CHECK-NEXT:    xorl %r8d, %r8d
+; CHECK-NEXT:    cmpw %r10w, %r11w
+; CHECK-NEXT:    setg %r8b
+; CHECK-NEXT:    cmovll %ebp, %r8d
+; CHECK-NEXT:    shlq $57, %r8
+; CHECK-NEXT:    movq %r8, %rdx
+; CHECK-NEXT:    sarq $57, %rdx
+; CHECK-NEXT:    sarq $63, %r8
+; CHECK-NEXT:    pextrw $3, %xmm1, %r11d
+; CHECK-NEXT:    pextrw $3, %xmm0, %r15d
+; CHECK-NEXT:    xorl %r10d, %r10d
+; CHECK-NEXT:    cmpw %r11w, %r15w
+; CHECK-NEXT:    setg %r10b
+; CHECK-NEXT:    cmovll %ebp, %r10d
+; CHECK-NEXT:    shlq $57, %r10
+; CHECK-NEXT:    movq %r10, %r11
+; CHECK-NEXT:    sarq $57, %r11
+; CHECK-NEXT:    sarq $63, %r10
+; CHECK-NEXT:    pextrw $4, %xmm1, %r12d
+; CHECK-NEXT:    pextrw $4, %xmm0, %r13d
+; CHECK-NEXT:    xorl %r15d, %r15d
+; CHECK-NEXT:    cmpw %r12w, %r13w
+; CHECK-NEXT:    setg %r15b
+; CHECK-NEXT:    cmovll %ebp, %r15d
+; CHECK-NEXT:    shlq $57, %r15
+; CHECK-NEXT:    movq %r15, %r12
+; CHECK-NEXT:    sarq $57, %r12
+; CHECK-NEXT:    sarq $63, %r15
+; CHECK-NEXT:    pextrw $6, %xmm1, %ecx
+; CHECK-NEXT:    pextrw $6, %xmm0, %eax
+; CHECK-NEXT:    xorl %r13d, %r13d
+; CHECK-NEXT:    cmpw %cx, %ax
+; CHECK-NEXT:    setg %r13b
+; CHECK-NEXT:    cmovll %ebp, %r13d
+; CHECK-NEXT:    shlq $57, %r13
+; CHECK-NEXT:    movq %r13, %rbp
+; CHECK-NEXT:    sarq $57, %rbp
+; CHECK-NEXT:    sarq $63, %r13
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; CHECK-NEXT:    sarq $57, %rax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq %rax, (%r14)
+; CHECK-NEXT:    movq %r13, %rax
+; CHECK-NEXT:    shldq $62, %rbp, %rax
+; CHECK-NEXT:    movq %rax, 88(%r14)
+; CHECK-NEXT:    movq %r15, %rax
+; CHECK-NEXT:    shldq $20, %r12, %rax
+; CHECK-NEXT:    movq %rax, 64(%r14)
+; CHECK-NEXT:    movq %r10, %rax
+; CHECK-NEXT:    shldq $31, %r11, %rax
+; CHECK-NEXT:    movq %rax, 48(%r14)
+; CHECK-NEXT:    movq %r8, %rax
+; CHECK-NEXT:    shldq $42, %rdx, %rax
+; CHECK-NEXT:    movq %rax, 32(%r14)
+; CHECK-NEXT:    movabsq $9007199254738944, %rax # imm = 0x1FFFFFFFFFF800
+; CHECK-NEXT:    andq %rbx, %rax
+; CHECK-NEXT:    shldq $53, %rsi, %rbx
+; CHECK-NEXT:    movq %rbx, 16(%r14)
+; CHECK-NEXT:    movq %r13, %rcx
+; CHECK-NEXT:    shrq $34, %rcx
+; CHECK-NEXT:    movw %cx, 100(%r14)
+; CHECK-NEXT:    movabsq $9007199254740991, %rbx # imm = 0x1FFFFFFFFFFFFF
+; CHECK-NEXT:    andq %rbx, %r9
+; CHECK-NEXT:    shldq $9, %rdi, %r9
+; CHECK-NEXT:    shlq $62, %rbp
+; CHECK-NEXT:    orq %r9, %rbp
+; CHECK-NEXT:    shrq $2, %r13
+; CHECK-NEXT:    movl %r13d, 96(%r14)
+; CHECK-NEXT:    movq %rbp, 80(%r14)
+; CHECK-NEXT:    shlq $42, %rdx
+; CHECK-NEXT:    shrq $11, %rax
+; CHECK-NEXT:    orq %rdx, %rax
+; CHECK-NEXT:    movq %rax, 24(%r14)
+; CHECK-NEXT:    movabsq $2251799813685247, %rax # imm = 0x7FFFFFFFFFFFF
+; CHECK-NEXT:    andq %r13, %rax
+; CHECK-NEXT:    shrq $48, %rax
+; CHECK-NEXT:    movb %al, 102(%r14)
+; CHECK-NEXT:    shlq $9, %rdi
+; CHECK-NEXT:    shrq $44, %r15
+; CHECK-NEXT:    andl $511, %r15d # imm = 0x1FF
+; CHECK-NEXT:    orq %rdi, %r15
+; CHECK-NEXT:    movq %r15, 72(%r14)
+; CHECK-NEXT:    shlq $20, %r12
+; CHECK-NEXT:    shrq $33, %r10
+; CHECK-NEXT:    andl $1048575, %r10d # imm = 0xFFFFF
+; CHECK-NEXT:    orq %r12, %r10
+; CHECK-NEXT:    movq %r10, 56(%r14)
+; CHECK-NEXT:    shlq $31, %r11
+; CHECK-NEXT:    shrq $22, %r8
+; CHECK-NEXT:    andl $2147483647, %r8d # imm = 0x7FFFFFFF
+; CHECK-NEXT:    orq %r11, %r8
+; CHECK-NEXT:    movq %r8, 40(%r14)
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Folded Reload
+; CHECK-NEXT:    # xmm0 = mem[0],zero
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 8-byte Folded Reload
+; CHECK-NEXT:    # xmm1 = mem[0],zero
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movq %xmm0, %rax
+; CHECK-NEXT:    andq %rbx, %rax
+; CHECK-NEXT:    shlq $53, %rsi
+; CHECK-NEXT:    orq %rax, %rsi
+; CHECK-NEXT:    movq %rsi, 8(%r14)
+; CHECK-NEXT:    movq %r14, %rax
+; CHECK-NEXT:    popq %rbx
+; CHECK-NEXT:    popq %r12
+; CHECK-NEXT:    popq %r13
+; CHECK-NEXT:    popq %r14
+; CHECK-NEXT:    popq %r15
+; CHECK-NEXT:    popq %rbp
+; CHECK-NEXT:    retq
+  %1 = call <7 x i117> @llvm.scmp(<7 x i7> %x, <7 x i7> %y)
+  ret <7 x i117> %1
+}
+
+define <1 x i3> @scmp_scalarize(<1 x i33> %x, <1 x i33> %y) nounwind {
+; CHECK-LABEL: scmp_scalarize:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    shlq $31, %rsi
+; CHECK-NEXT:    sarq $31, %rsi
+; CHECK-NEXT:    shlq $31, %rdi
+; CHECK-NEXT:    sarq $31, %rdi
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    setg %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovgel %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call <1 x i3> @llvm.scmp(<1 x i33> %x, <1 x i33> %y)
+  ret <1 x i3> %1
+}
+
+define <2 x i8> @scmp_bool_operands(<2 x i1> %x, <2 x i1> %y) nounwind {
+; CHECK-LABEL: scmp_bool_operands:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    psllq $63, %xmm0
+; CHECK-NEXT:    psrad $31, %xmm0
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
+; CHECK-NEXT:    psllq $63, %xmm1
+; CHECK-NEXT:    psrad $31, %xmm1
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[1,1,3,3]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[3,3,3,3]
+; CHECK-NEXT:    movq %xmm1, %rax
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[3,3,3,3]
+; CHECK-NEXT:    movq %xmm0, %rcx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpq %rax, %rcx
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovlq %rax, %rdx
+; CHECK-NEXT:    movq %rdx, %xmm0
+; CHECK-NEXT:    movq %xmm3, %rcx
+; CHECK-NEXT:    movq %xmm2, %rdx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpq %rcx, %rdx
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovlq %rax, %rsi
+; CHECK-NEXT:    movq %rsi, %xmm1
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
+; CHECK-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
+; CHECK-NEXT:    packuswb %xmm1, %xmm1
+; CHECK-NEXT:    packuswb %xmm1, %xmm1
+; CHECK-NEXT:    packuswb %xmm1, %xmm1
+; CHECK-NEXT:    psllw $7, %xmm1
+; CHECK-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
+; CHECK-NEXT:    pxor %xmm0, %xmm0
+; CHECK-NEXT:    pcmpgtb %xmm1, %xmm0
+; CHECK-NEXT:    retq
+  %1 = call <2 x i8> @llvm.scmp(<2 x i1> %x, <2 x i1> %y)
+  ret <2 x i8> %1
+}
+
+define <2 x i16> @scmp_ret_wider_than_operands(<2 x i8> %x, <2 x i8> %y) nounwind {
+; CHECK-LABEL: scmp_ret_wider_than_operands:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movaps %xmm1, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %al
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    shll $24, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; CHECK-NEXT:    setg %sil
+; CHECK-NEXT:    cmovll %eax, %esi
+; CHECK-NEXT:    movzbl %sil, %ecx
+; CHECK-NEXT:    shll $8, %ecx
+; CHECK-NEXT:    orl %edx, %ecx
+; CHECK-NEXT:    movd %ecx, %xmm0
+; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    shll $8, %edx
+; CHECK-NEXT:    pinsrw $2, %edx, %xmm0
+; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    shll $8, %edx
+; CHECK-NEXT:    pinsrw $3, %edx, %xmm0
+; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    shll $8, %edx
+; CHECK-NEXT:    pinsrw $4, %edx, %xmm0
+; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    shll $8, %edx
+; CHECK-NEXT:    pinsrw $5, %edx, %xmm0
+; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    shll $8, %edx
+; CHECK-NEXT:    pinsrw $6, %edx, %xmm0
+; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; CHECK-NEXT:    setg %dl
+; CHECK-NEXT:    cmovll %eax, %edx
+; CHECK-NEXT:    shll $8, %edx
+; CHECK-NEXT:    pinsrw $7, %edx, %xmm0
+; CHECK-NEXT:    psraw $8, %xmm0
+; CHECK-NEXT:    retq
+  %1 = call <2 x i16> @llvm.scmp(<2 x i8> %x, <2 x i8> %y)
+  ret <2 x i16> %1
+}
+
diff --git a/llvm/test/CodeGen/X86/ucmp.ll b/llvm/test/CodeGen/X86/ucmp.ll
new file mode 100644
index 0000000000000..70a1ca3431a35
--- /dev/null
+++ b/llvm/test/CodeGen/X86/ucmp.ll
@@ -0,0 +1,1071 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+
+define i8 @ucmp.8.8(i8 %x, i8 %y) nounwind {
+; CHECK-LABEL: ucmp.8.8:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpb %sil, %dil
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i8 %x, i8 %y)
+  ret i8 %1
+}
+
+define i8 @ucmp.8.16(i16 %x, i16 %y) nounwind {
+; CHECK-LABEL: ucmp.8.16:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpw %si, %di
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i16 %x, i16 %y)
+  ret i8 %1
+}
+
+define i8 @ucmp.8.32(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: ucmp.8.32:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+  ret i8 %1
+}
+
+define i8 @ucmp.8.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: ucmp.8.64:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i64 %x, i64 %y)
+  ret i8 %1
+}
+
+define i8 @ucmp.8.128(i128 %x, i128 %y) nounwind {
+; CHECK-LABEL: ucmp.8.128:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    cmpq %rdi, %rdx
+; CHECK-NEXT:    movq %rcx, %rax
+; CHECK-NEXT:    sbbq %rsi, %rax
+; CHECK-NEXT:    setb %al
+; CHECK-NEXT:    movzbl %al, %r8d
+; CHECK-NEXT:    cmpq %rdx, %rdi
+; CHECK-NEXT:    sbbq %rcx, %rsi
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %r8d, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i128 %x, i128 %y)
+  ret i8 %1
+}
+
+define i32 @ucmp.32.32(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: ucmp.32.32:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    retq
+  %1 = call i32 @llvm.ucmp(i32 %x, i32 %y)
+  ret i32 %1
+}
+
+define i32 @ucmp.32.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: ucmp.32.64:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    retq
+  %1 = call i32 @llvm.ucmp(i64 %x, i64 %y)
+  ret i32 %1
+}
+
+define i64 @ucmp.64.64(i64 %x, i64 %y) nounwind {
+; CHECK-LABEL: ucmp.64.64:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovaeq %rcx, %rax
+; CHECK-NEXT:    retq
+  %1 = call i64 @llvm.ucmp(i64 %x, i64 %y)
+  ret i64 %1
+}
+
+define i4 @ucmp_narrow_result(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: ucmp_narrow_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i4 @llvm.ucmp(i32 %x, i32 %y)
+  ret i4 %1
+}
+
+define i8 @ucmp_narrow_op(i62 %x, i62 %y) nounwind {
+; CHECK-LABEL: ucmp_narrow_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    movabsq $4611686018427387903, %rax # imm = 0x3FFFFFFFFFFFFFFF
+; CHECK-NEXT:    andq %rax, %rsi
+; CHECK-NEXT:    andq %rax, %rdi
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpq %rsi, %rdi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %ecx, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i62 %x, i62 %y)
+  ret i8 %1
+}
+
+define i141 @ucmp_wide_result(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: ucmp_wide_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpl %esi, %edi
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovaeq %rcx, %rax
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    retq
+  %1 = call i141 @llvm.ucmp(i32 %x, i32 %y)
+  ret i141 %1
+}
+
+define i8 @ucmp_wide_op(i109 %x, i109 %y) nounwind {
+; CHECK-LABEL: ucmp_wide_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    movabsq $35184372088831, %rax # imm = 0x1FFFFFFFFFFF
+; CHECK-NEXT:    andq %rax, %rsi
+; CHECK-NEXT:    andq %rax, %rcx
+; CHECK-NEXT:    cmpq %rdi, %rdx
+; CHECK-NEXT:    movq %rcx, %rax
+; CHECK-NEXT:    sbbq %rsi, %rax
+; CHECK-NEXT:    setb %al
+; CHECK-NEXT:    movzbl %al, %r8d
+; CHECK-NEXT:    cmpq %rdx, %rdi
+; CHECK-NEXT:    sbbq %rcx, %rsi
+; CHECK-NEXT:    movl $255, %eax
+; CHECK-NEXT:    cmovael %r8d, %eax
+; CHECK-NEXT:    # kill: def $al killed $al killed $eax
+; CHECK-NEXT:    retq
+  %1 = call i8 @llvm.ucmp(i109 %x, i109 %y)
+  ret i8 %1
+}
+
+define i41 @ucmp_uncommon_types(i7 %x, i7 %y) nounwind {
+; CHECK-LABEL: ucmp_uncommon_types:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    andb $127, %sil
+; CHECK-NEXT:    andb $127, %dil
+; CHECK-NEXT:    xorl %ecx, %ecx
+; CHECK-NEXT:    cmpb %sil, %dil
+; CHECK-NEXT:    seta %cl
+; CHECK-NEXT:    movq $-1, %rax
+; CHECK-NEXT:    cmovaeq %rcx, %rax
+; CHECK-NEXT:    retq
+  %1 = call i41 @llvm.ucmp(i7 %x, i7 %y)
+  ret i41 %1
+}
+
+define <4 x i32> @ucmp_normal_vectors(<4 x i32> %x, <4 x i32> %y) nounwind {
+; CHECK-LABEL: ucmp_normal_vectors:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %eax
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    seta %dl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovbl %eax, %edx
+; CHECK-NEXT:    movd %edx, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
+; CHECK-NEXT:    movdqa %xmm2, %xmm0
+; CHECK-NEXT:    retq
+  %1 = call <4 x i32> @llvm.ucmp(<4 x i32> %x, <4 x i32> %y)
+  ret <4 x i32> %1
+}
+
+define <4 x i8> @ucmp_narrow_vec_result(<4 x i32> %x, <4 x i32> %y) nounwind {
+; CHECK-LABEL: ucmp_narrow_vec_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %eax
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    seta %dl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovbl %eax, %edx
+; CHECK-NEXT:    movd %edx, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
+; CHECK-NEXT:    movd %xmm3, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
+; CHECK-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2
+; CHECK-NEXT:    pxor %xmm0, %xmm0
+; CHECK-NEXT:    packuswb %xmm0, %xmm2
+; CHECK-NEXT:    packuswb %xmm0, %xmm2
+; CHECK-NEXT:    movdqa %xmm2, %xmm0
+; CHECK-NEXT:    retq
+  %1 = call <4 x i8> @llvm.ucmp(<4 x i32> %x, <4 x i32> %y)
+  ret <4 x i8> %1
+}
+
+define <4 x i32> @ucmp_narrow_vec_op(<4 x i8> %x, <4 x i8> %y) nounwind {
+; CHECK-LABEL: ucmp_narrow_vec_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pxor %xmm2, %xmm2
+; CHECK-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
+; CHECK-NEXT:    pextrw $0, %xmm1, %ecx
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[3,3,3,3]
+; CHECK-NEXT:    movd %xmm3, %eax
+; CHECK-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
+; CHECK-NEXT:    pextrw $0, %xmm0, %edx
+; CHECK-NEXT:    movdqa %xmm0, %xmm3
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm3[3,3,3,3]
+; CHECK-NEXT:    movd %xmm0, %esi
+; CHECK-NEXT:    xorl %edi, %edi
+; CHECK-NEXT:    cmpl %eax, %esi
+; CHECK-NEXT:    seta %dil
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovbl %eax, %edi
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movd %xmm0, %esi
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
+; CHECK-NEXT:    movd %xmm0, %r8d
+; CHECK-NEXT:    xorl %r9d, %r9d
+; CHECK-NEXT:    cmpl %esi, %r8d
+; CHECK-NEXT:    movd %edi, %xmm0
+; CHECK-NEXT:    seta %r9b
+; CHECK-NEXT:    cmovbl %eax, %r9d
+; CHECK-NEXT:    movd %r9d, %xmm2
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm3[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm1
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm2[0]
+; CHECK-NEXT:    retq
+  %1 = call <4 x i32> @llvm.ucmp(<4 x i8> %x, <4 x i8> %y)
+  ret <4 x i32> %1
+}
+
+define <16 x i32> @ucmp_wide_vec_result(<16 x i8> %x, <16 x i8> %y) nounwind {
+; CHECK-LABEL: ucmp_wide_vec_result:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pushq %rbp
+; CHECK-NEXT:    pushq %r15
+; CHECK-NEXT:    pushq %r14
+; CHECK-NEXT:    pushq %r13
+; CHECK-NEXT:    pushq %r12
+; CHECK-NEXT:    pushq %rbx
+; CHECK-NEXT:    pxor %xmm2, %xmm2
+; CHECK-NEXT:    movdqa %xmm1, %xmm4
+; CHECK-NEXT:    punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3],xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
+; CHECK-NEXT:    pextrw $0, %xmm4, %edi
+; CHECK-NEXT:    movdqa %xmm4, %xmm3
+; CHECK-NEXT:    pextrw $4, %xmm4, %r11d
+; CHECK-NEXT:    movdqa %xmm4, %xmm5
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm2[0],xmm5[1],xmm2[1],xmm5[2],xmm2[2],xmm5[3],xmm2[3]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[3,3,3,3]
+; CHECK-NEXT:    movd %xmm4, %eax
+; CHECK-NEXT:    movdqa %xmm0, %xmm6
+; CHECK-NEXT:    punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3],xmm6[4],xmm2[4],xmm6[5],xmm2[5],xmm6[6],xmm2[6],xmm6[7],xmm2[7]
+; CHECK-NEXT:    pextrw $0, %xmm6, %r8d
+; CHECK-NEXT:    movdqa %xmm6, %xmm4
+; CHECK-NEXT:    pextrw $4, %xmm6, %ebx
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
+; CHECK-NEXT:    movd %xmm7, %ecx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    movl $-1, %edx
+; CHECK-NEXT:    cmovbl %edx, %esi
+; CHECK-NEXT:    movl %esi, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
+; CHECK-NEXT:    movd %xmm7, %esi
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; CHECK-NEXT:    movd %xmm7, %r9d
+; CHECK-NEXT:    xorl %eax, %eax
+; CHECK-NEXT:    cmpl %esi, %r9d
+; CHECK-NEXT:    seta %al
+; CHECK-NEXT:    cmovbl %edx, %eax
+; CHECK-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %edi, %r8d
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %edx, %esi
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %r8d
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %r9d
+; CHECK-NEXT:    xorl %edi, %edi
+; CHECK-NEXT:    cmpl %r8d, %r9d
+; CHECK-NEXT:    seta %dil
+; CHECK-NEXT:    cmovbl %edx, %edi
+; CHECK-NEXT:    punpckhwd {{.*#+}} xmm3 = xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[3,3,3,3]
+; CHECK-NEXT:    movd %xmm5, %r9d
+; CHECK-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[3,3,3,3]
+; CHECK-NEXT:    movd %xmm5, %r10d
+; CHECK-NEXT:    xorl %r8d, %r8d
+; CHECK-NEXT:    cmpl %r9d, %r10d
+; CHECK-NEXT:    seta %r8b
+; CHECK-NEXT:    cmovbl %edx, %r8d
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[2,3,2,3]
+; CHECK-NEXT:    movd %xmm5, %r10d
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[2,3,2,3]
+; CHECK-NEXT:    movd %xmm5, %ebp
+; CHECK-NEXT:    xorl %r9d, %r9d
+; CHECK-NEXT:    cmpl %r10d, %ebp
+; CHECK-NEXT:    seta %r9b
+; CHECK-NEXT:    cmovbl %edx, %r9d
+; CHECK-NEXT:    xorl %r10d, %r10d
+; CHECK-NEXT:    cmpl %r11d, %ebx
+; CHECK-NEXT:    seta %r10b
+; CHECK-NEXT:    cmovbl %edx, %r10d
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
+; CHECK-NEXT:    movd %xmm3, %ebx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[1,1,1,1]
+; CHECK-NEXT:    movd %xmm3, %ebp
+; CHECK-NEXT:    xorl %r11d, %r11d
+; CHECK-NEXT:    cmpl %ebx, %ebp
+; CHECK-NEXT:    seta %r11b
+; CHECK-NEXT:    cmovbl %edx, %r11d
+; CHECK-NEXT:    punpckhbw {{.*#+}} xmm1 = xmm1[8],xmm2[8],xmm1[9],xmm2[9],xmm1[10],xmm2[10],xmm1[11],xmm2[11],xmm1[12],xmm2[12],xmm1[13],xmm2[13],xmm1[14],xmm2[14],xmm1[15],xmm2[15]
+; CHECK-NEXT:    pextrw $0, %xmm1, %r15d
+; CHECK-NEXT:    movdqa %xmm1, %xmm4
+; CHECK-NEXT:    movdqa %xmm1, %xmm3
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[3,3,3,3]
+; CHECK-NEXT:    movd %xmm5, %ebp
+; CHECK-NEXT:    punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm2[8],xmm0[9],xmm2[9],xmm0[10],xmm2[10],xmm0[11],xmm2[11],xmm0[12],xmm2[12],xmm0[13],xmm2[13],xmm0[14],xmm2[14],xmm0[15],xmm2[15]
+; CHECK-NEXT:    pextrw $0, %xmm0, %r12d
+; CHECK-NEXT:    movdqa %xmm0, %xmm5
+; CHECK-NEXT:    movdqa %xmm0, %xmm6
+; CHECK-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
+; CHECK-NEXT:    movd %xmm7, %r14d
+; CHECK-NEXT:    xorl %ebx, %ebx
+; CHECK-NEXT:    cmpl %ebp, %r14d
+; CHECK-NEXT:    seta %bl
+; CHECK-NEXT:    cmovbl %edx, %ebx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm3[2,3,2,3]
+; CHECK-NEXT:    movd %xmm7, %r14d
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; CHECK-NEXT:    movd %xmm7, %r13d
+; CHECK-NEXT:    xorl %ebp, %ebp
+; CHECK-NEXT:    cmpl %r14d, %r13d
+; CHECK-NEXT:    seta %bpl
+; CHECK-NEXT:    cmovbl %edx, %ebp
+; CHECK-NEXT:    xorl %r14d, %r14d
+; CHECK-NEXT:    cmpl %r15d, %r12d
+; CHECK-NEXT:    seta %r14b
+; CHECK-NEXT:    cmovbl %edx, %r14d
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
+; CHECK-NEXT:    movd %xmm3, %r12d
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm6[1,1,1,1]
+; CHECK-NEXT:    movd %xmm3, %r13d
+; CHECK-NEXT:    xorl %r15d, %r15d
+; CHECK-NEXT:    cmpl %r12d, %r13d
+; CHECK-NEXT:    seta %r15b
+; CHECK-NEXT:    cmovbl %edx, %r15d
+; CHECK-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[3,3,3,3]
+; CHECK-NEXT:    movd %xmm3, %r13d
+; CHECK-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm2[4],xmm5[5],xmm2[5],xmm5[6],xmm2[6],xmm5[7],xmm2[7]
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %eax
+; CHECK-NEXT:    xorl %r12d, %r12d
+; CHECK-NEXT:    cmpl %r13d, %eax
+; CHECK-NEXT:    seta %r12b
+; CHECK-NEXT:    cmovbl %edx, %r12d
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm4[2,3,2,3]
+; CHECK-NEXT:    movd %xmm2, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[2,3,2,3]
+; CHECK-NEXT:    movd %xmm2, %eax
+; CHECK-NEXT:    xorl %r13d, %r13d
+; CHECK-NEXT:    cmpl %ecx, %eax
+; CHECK-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm2 # 4-byte Folded Reload
+; CHECK-NEXT:    # xmm2 = mem[0],zero,zero,zero
+; CHECK-NEXT:    pextrw $4, %xmm1, %eax
+; CHECK-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm3 # 4-byte Folded Reload
+; CHECK-NEXT:    # xmm3 = mem[0],zero,zero,zero
+; CHECK-NEXT:    pextrw $4, %xmm0, %ecx
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    movd %edi, %xmm6
+; CHECK-NEXT:    movd %r8d, %xmm7
+; CHECK-NEXT:    movd %r9d, %xmm8
+; CHECK-NEXT:    movd %r10d, %xmm1
+; CHECK-NEXT:    movd %r11d, %xmm9
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; CHECK-NEXT:    movd %ebx, %xmm10
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1]
+; CHECK-NEXT:    movd %ebp, %xmm6
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
+; CHECK-NEXT:    movd %r14d, %xmm2
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm8 = xmm8[0],xmm7[0],xmm8[1],xmm7[1]
+; CHECK-NEXT:    movd %r15d, %xmm3
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm9[0],xmm1[1],xmm9[1]
+; CHECK-NEXT:    movd %r12d, %xmm7
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm8[0]
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm10[0],xmm6[1],xmm10[1]
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm6[0]
+; CHECK-NEXT:    seta %r13b
+; CHECK-NEXT:    cmovbl %edx, %r13d
+; CHECK-NEXT:    movd %r13d, %xmm6
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1]
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %edx, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
+; CHECK-NEXT:    movd %xmm4, %eax
+; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[1,1,1,1]
+; CHECK-NEXT:    movd %xmm4, %ecx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %edx, %esi
+; CHECK-NEXT:    movd %esi, %xmm4
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm6[0]
+; CHECK-NEXT:    popq %rbx
+; CHECK-NEXT:    popq %r12
+; CHECK-NEXT:    popq %r13
+; CHECK-NEXT:    popq %r14
+; CHECK-NEXT:    popq %r15
+; CHECK-NEXT:    popq %rbp
+; CHECK-NEXT:    retq
+  %1 = call <16 x i32> @llvm.ucmp(<16 x i8> %x, <16 x i8> %y)
+  ret <16 x i32> %1
+}
+
+define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
+; CHECK-LABEL: ucmp_wide_vec_op:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pshufd {{.*#+}} xmm8 = xmm7[3,3,3,3]
+; CHECK-NEXT:    movd %xmm8, %eax
+; CHECK-NEXT:    pshufd {{.*#+}} xmm8 = xmm3[3,3,3,3]
+; CHECK-NEXT:    movd %xmm8, %ecx
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    cmpl %eax, %ecx
+; CHECK-NEXT:    seta %dl
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovbl %eax, %edx
+; CHECK-NEXT:    movd %edx, %xmm8
+; CHECK-NEXT:    pshufd {{.*#+}} xmm9 = xmm7[2,3,2,3]
+; CHECK-NEXT:    movd %xmm9, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm9 = xmm3[2,3,2,3]
+; CHECK-NEXT:    movd %xmm9, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm9
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1]
+; CHECK-NEXT:    movd %xmm7, %ecx
+; CHECK-NEXT:    movd %xmm3, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm8
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm7[1,1,1,1]
+; CHECK-NEXT:    movd %xmm7, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
+; CHECK-NEXT:    movd %xmm3, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm3
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm8 = xmm8[0],xmm3[0],xmm8[1],xmm3[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm8 = xmm8[0],xmm9[0]
+; CHECK-NEXT:    movdqa {{.*#+}} xmm3 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
+; CHECK-NEXT:    pand %xmm3, %xmm8
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
+; CHECK-NEXT:    movd %xmm7, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm2[3,3,3,3]
+; CHECK-NEXT:    movd %xmm7, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm7
+; CHECK-NEXT:    pshufd {{.*#+}} xmm9 = xmm6[2,3,2,3]
+; CHECK-NEXT:    movd %xmm9, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm9 = xmm2[2,3,2,3]
+; CHECK-NEXT:    movd %xmm9, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm9
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm9 = xmm9[0],xmm7[0],xmm9[1],xmm7[1]
+; CHECK-NEXT:    movd %xmm6, %ecx
+; CHECK-NEXT:    movd %xmm2, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm7
+; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm6[1,1,1,1]
+; CHECK-NEXT:    movd %xmm6, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,1,1,1]
+; CHECK-NEXT:    movd %xmm2, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm7 = xmm7[0],xmm9[0]
+; CHECK-NEXT:    pand %xmm3, %xmm7
+; CHECK-NEXT:    packuswb %xmm8, %xmm7
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; CHECK-NEXT:    movd %xmm2, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
+; CHECK-NEXT:    movd %xmm6, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm1[2,3,2,3]
+; CHECK-NEXT:    movd %xmm6, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm6
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    movd %xmm1, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; CHECK-NEXT:    movd %xmm1, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm1
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm6[0]
+; CHECK-NEXT:    pand %xmm3, %xmm2
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm4[3,3,3,3]
+; CHECK-NEXT:    movd %xmm1, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[3,3,3,3]
+; CHECK-NEXT:    movd %xmm1, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm1
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[2,3,2,3]
+; CHECK-NEXT:    movd %xmm5, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm0[2,3,2,3]
+; CHECK-NEXT:    movd %xmm5, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm5
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1]
+; CHECK-NEXT:    movd %xmm4, %ecx
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm1
+; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
+; CHECK-NEXT:    movd %xmm4, %ecx
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; CHECK-NEXT:    movd %xmm0, %edx
+; CHECK-NEXT:    xorl %esi, %esi
+; CHECK-NEXT:    cmpl %ecx, %edx
+; CHECK-NEXT:    seta %sil
+; CHECK-NEXT:    cmovbl %eax, %esi
+; CHECK-NEXT:    movd %esi, %xmm0
+; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
+; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm5[0]
+; CHECK-NEXT:    pand %xmm3, %xmm1
+; CHECK-NEXT:    packuswb %xmm2, %xmm1
+; CHECK-NEXT:    packuswb %xmm7, %xmm1
+; CHECK-NEXT:    movdqa %xmm1, %xmm0
+; CHECK-NEXT:    retq
+  %1 = call <16 x i8> @llvm.ucmp(<16 x i32> %x, <16 x i32> %y)
+  ret <16 x i8> %1
+}
+
+define <17 x i2> @ucmp_uncommon_vectors(<17 x i71> %x, <17 x i71> %y) nounwind {
+; CHECK-LABEL: ucmp_uncommon_vectors:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    pushq %rbp
+; CHECK-NEXT:    pushq %r15
+; CHECK-NEXT:    pushq %r14
+; CHECK-NEXT:    pushq %r13
+; CHECK-NEXT:    pushq %r12
+; CHECK-NEXT:    pushq %rbx
+; CHECK-NEXT:    subq $168, %rsp
+; CHECK-NEXT:    movq %r9, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq %rdx, %r11
+; CHECK-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    andl $127, %r8d
+; CHECK-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, (%rsp) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r15
+; CHECK-NEXT:    andl $127, %r15d
+; CHECK-NEXT:    movq %r15, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, %rbp
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rbx
+; CHECK-NEXT:    andl $127, %ebx
+; CHECK-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, %r12
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r8
+; CHECK-NEXT:    andl $127, %r8d
+; CHECK-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; CHECK-NEXT:    andl $127, %edx
+; CHECK-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq %rax, %r13
+; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    andl $127, %r11d
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    andl $127, %eax
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    andl $127, %ecx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r14
+; CHECK-NEXT:    andl $127, %r14d
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r9
+; CHECK-NEXT:    cmpq %rdi, %r9
+; CHECK-NEXT:    movq %r14, %r10
+; CHECK-NEXT:    sbbq %rcx, %r10
+; CHECK-NEXT:    setb %r10b
+; CHECK-NEXT:    cmpq %r9, %rdi
+; CHECK-NEXT:    sbbq %r14, %rcx
+; CHECK-NEXT:    movzbl %r10b, %edi
+; CHECK-NEXT:    movq $-1, %rcx
+; CHECK-NEXT:    cmovbq %rcx, %rdi
+; CHECK-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r9
+; CHECK-NEXT:    cmpq %rsi, %r9
+; CHECK-NEXT:    movq %rax, %rdi
+; CHECK-NEXT:    sbbq %r11, %rdi
+; CHECK-NEXT:    setb %dil
+; CHECK-NEXT:    cmpq %r9, %rsi
+; CHECK-NEXT:    sbbq %rax, %r11
+; CHECK-NEXT:    movzbl %dil, %r14d
+; CHECK-NEXT:    cmovbq %rcx, %r14
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq %r13, %rcx
+; CHECK-NEXT:    sbbq %rdx, %rcx
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    sbbq %r12, %r8
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    sbbq %rbp, %rbx
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Folded Reload
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq (%rsp), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Reload
+; CHECK-NEXT:    sbbq %r15, %rcx
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r12 # 8-byte Reload
+; CHECK-NEXT:    movq %r12, %rcx
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r10 # 8-byte Reload
+; CHECK-NEXT:    sbbq %r10, %rcx
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
+; CHECK-NEXT:    movq %rbx, %rcx
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r9 # 8-byte Reload
+; CHECK-NEXT:    sbbq %r9, %rcx
+; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdi # 8-byte Reload
+; CHECK-NEXT:    cmpq %rdi, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r8 # 8-byte Reload
+; CHECK-NEXT:    movq %r8, %rbp
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
+; CHECK-NEXT:    sbbq %rsi, %rbp
+; CHECK-NEXT:    setb %bpl
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r11
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    cmpq %rcx, %r11
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; CHECK-NEXT:    movq %rdx, %r13
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; CHECK-NEXT:    sbbq %rax, %r13
+; CHECK-NEXT:    setb %r13b
+; CHECK-NEXT:    andl $3, %r14d
+; CHECK-NEXT:    cmpq %r11, %rcx
+; CHECK-NEXT:    sbbq %rdx, %rax
+; CHECK-NEXT:    movzbl %r13b, %eax
+; CHECK-NEXT:    movl $-1, %r13d
+; CHECK-NEXT:    cmovbl %r13d, %eax
+; CHECK-NEXT:    andl $3, %eax
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdi
+; CHECK-NEXT:    sbbq %r8, %rsi
+; CHECK-NEXT:    leaq (%r14,%rax,4), %rax
+; CHECK-NEXT:    movzbl %bpl, %ecx
+; CHECK-NEXT:    cmovbl %r13d, %ecx
+; CHECK-NEXT:    andl $3, %ecx
+; CHECK-NEXT:    shll $4, %ecx
+; CHECK-NEXT:    orq %rax, %rcx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    sbbq %rbx, %r9
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %eax
+; CHECK-NEXT:    andl $3, %eax
+; CHECK-NEXT:    shll $6, %eax
+; CHECK-NEXT:    orq %rcx, %rax
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    cmpq %rcx, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    sbbq %r12, %r10
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %ecx
+; CHECK-NEXT:    andl $3, %ecx
+; CHECK-NEXT:    shll $8, %ecx
+; CHECK-NEXT:    orq %rax, %rcx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %eax
+; CHECK-NEXT:    andl $3, %eax
+; CHECK-NEXT:    shll $10, %eax
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; CHECK-NEXT:    cmpq %rdx, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %edx
+; CHECK-NEXT:    andl $3, %edx
+; CHECK-NEXT:    shll $12, %edx
+; CHECK-NEXT:    orq %rax, %rdx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %esi # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %esi
+; CHECK-NEXT:    andl $3, %esi
+; CHECK-NEXT:    shll $14, %esi
+; CHECK-NEXT:    orq %rdx, %rsi
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %eax
+; CHECK-NEXT:    andl $3, %eax
+; CHECK-NEXT:    shll $16, %eax
+; CHECK-NEXT:    orq %rsi, %rax
+; CHECK-NEXT:    orq %rcx, %rax
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %ecx
+; CHECK-NEXT:    andl $3, %ecx
+; CHECK-NEXT:    shll $18, %ecx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdx
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %edx
+; CHECK-NEXT:    andl $3, %edx
+; CHECK-NEXT:    shll $20, %edx
+; CHECK-NEXT:    orq %rcx, %rdx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq (%rsp), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %ecx
+; CHECK-NEXT:    andl $3, %ecx
+; CHECK-NEXT:    shll $22, %ecx
+; CHECK-NEXT:    orq %rdx, %rcx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdx
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; CHECK-NEXT:    sbbq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Folded Spill
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %edx
+; CHECK-NEXT:    andl $3, %edx
+; CHECK-NEXT:    shll $24, %edx
+; CHECK-NEXT:    orq %rcx, %rdx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %ecx
+; CHECK-NEXT:    andl $3, %ecx
+; CHECK-NEXT:    shlq $26, %rcx
+; CHECK-NEXT:    orq %rdx, %rcx
+; CHECK-NEXT:    orq %rax, %rcx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %eax
+; CHECK-NEXT:    andl $3, %eax
+; CHECK-NEXT:    shlq $28, %rax
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; CHECK-NEXT:    andl $3, %edx
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rsi
+; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rsi
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
+; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Folded Reload
+; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
+; CHECK-NEXT:    movb %dl, 4(%rsi)
+; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
+; CHECK-NEXT:    cmovbl %r13d, %edx
+; CHECK-NEXT:    andl $3, %edx
+; CHECK-NEXT:    shlq $30, %rdx
+; CHECK-NEXT:    orq %rax, %rdx
+; CHECK-NEXT:    orq %rcx, %rdx
+; CHECK-NEXT:    movq %rsi, %rax
+; CHECK-NEXT:    movl %edx, (%rsi)
+; CHECK-NEXT:    addq $168, %rsp
+; CHECK-NEXT:    popq %rbx
+; CHECK-NEXT:    popq %r12
+; CHECK-NEXT:    popq %r13
+; CHECK-NEXT:    popq %r14
+; CHECK-NEXT:    popq %r15
+; CHECK-NEXT:    popq %rbp
+; CHECK-NEXT:    retq
+  %1 = call <17 x i2> @llvm.ucmp(<17 x i71> %x, <17 x i71> %y)
+  ret <17 x i2> %1
+}
diff --git a/llvm/test/CodeGen/X86/uscmp.ll b/llvm/test/CodeGen/X86/uscmp.ll
deleted file mode 100644
index 3d1765b94f72a..0000000000000
--- a/llvm/test/CodeGen/X86/uscmp.ll
+++ /dev/null
@@ -1,129 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
-
-define i8 @ucmp(i32 %x, i32 %y) {
-; CHECK-LABEL: ucmp:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
-  %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
-  ret i8 %1
-}
-
-define i8 @scmp(i32 %x, i32 %y) {
-; CHECK-LABEL: scmp:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
-  %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
-  ret i8 %1
-}
-
-define i4 @ucmp_narrow_result(i32 %x, i32 %y) {
-; CHECK-LABEL: ucmp_narrow_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
-  %1 = call i4 @llvm.ucmp(i32 %x, i32 %y)
-  ret i4 %1
-}
-
-define i8 @scmp_narrow_op(i5 %x, i5 %y) {
-; CHECK-LABEL: scmp_narrow_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    andb $31, %sil
-; CHECK-NEXT:    andb $31, %dil
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpb %sil, %dil
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
-  %1 = call i8 @llvm.ucmp(i5 %x, i5 %y)
-  ret i8 %1
-}
-
-define i128 @ucmp_wide_result(i32 %x, i32 %y) {
-; CHECK-LABEL: ucmp_wide_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovaeq %rcx, %rax
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    retq
-  %1 = call i128 @llvm.ucmp(i32 %x, i32 %y)
-  ret i128 %1
-}
-
-define i8 @scmp_wide_op(i128 %x, i128 %y) {
-; CHECK-LABEL: scmp_wide_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    cmpq %rdi, %rdx
-; CHECK-NEXT:    movq %rcx, %rax
-; CHECK-NEXT:    sbbq %rsi, %rax
-; CHECK-NEXT:    setl %al
-; CHECK-NEXT:    movzbl %al, %r8d
-; CHECK-NEXT:    cmpq %rdx, %rdi
-; CHECK-NEXT:    sbbq %rcx, %rsi
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %r8d, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
-  %1 = call i8 @llvm.scmp(i128 %x, i128 %y)
-  ret i8 %1
-}
-
-define i41 @ucmp_uncommon_types(i7 %x, i7 %y) {
-; CHECK-LABEL: ucmp_uncommon_types:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    andb $127, %sil
-; CHECK-NEXT:    andb $127, %dil
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpb %sil, %dil
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovaeq %rcx, %rax
-; CHECK-NEXT:    retq
-  %1 = call i41 @llvm.ucmp(i7 %x, i7 %y)
-  ret i41 %1
-}
-
-define i125 @scmp_uncommon_types(i99 %x, i99 %y) {
-; CHECK-LABEL: scmp_uncommon_types:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    shlq $29, %rsi
-; CHECK-NEXT:    sarq $29, %rsi
-; CHECK-NEXT:    shlq $29, %rcx
-; CHECK-NEXT:    sarq $29, %rcx
-; CHECK-NEXT:    cmpq %rdi, %rdx
-; CHECK-NEXT:    movq %rcx, %rax
-; CHECK-NEXT:    sbbq %rsi, %rax
-; CHECK-NEXT:    setl %al
-; CHECK-NEXT:    movzbl %al, %r8d
-; CHECK-NEXT:    cmpq %rdx, %rdi
-; CHECK-NEXT:    sbbq %rcx, %rsi
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovgeq %r8, %rax
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    retq
-  %1 = call i125 @llvm.scmp(i99 %x, i99 %y)
-  ret i125 %1
-}

>From 4d9ed7866949db5817c2555abb7555d348e0c4e0 Mon Sep 17 00:00:00 2001
From: Poseydon42 <vvmposeydon at gmail.com>
Date: Tue, 11 Jun 2024 22:52:43 +0100
Subject: [PATCH 3/4] Added tests for both x86 and x86_64

---
 llvm/test/CodeGen/X86/scmp.ll | 3013 ++++++++++++++++++++---------
 llvm/test/CodeGen/X86/ucmp.ll | 3325 +++++++++++++++++++++++----------
 2 files changed, 4490 insertions(+), 1848 deletions(-)

diff --git a/llvm/test/CodeGen/X86/scmp.ll b/llvm/test/CodeGen/X86/scmp.ll
index 82f0859e8a66e..d5d5b8daa8395 100644
--- a/llvm/test/CodeGen/X86/scmp.ll
+++ b/llvm/test/CodeGen/X86/scmp.ll
@@ -1,984 +1,2251 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
+; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86
 
 define i8 @scmp.8.8(i8 %x, i8 %y) nounwind {
-; CHECK-LABEL: scmp.8.8:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpb %sil, %dil
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp.8.8:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpb %sil, %dil
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp.8.8:
+; X86:       # %bb.0:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB0_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB0_2:
+; X86-NEXT:    retl
   %1 = call i8 @llvm.scmp(i8 %x, i8 %y)
   ret i8 %1
 }
 
 define i8 @scmp.8.16(i16 %x, i16 %y) nounwind {
-; CHECK-LABEL: scmp.8.16:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpw %si, %di
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp.8.16:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpw %si, %di
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp.8.16:
+; X86:       # %bb.0:
+; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpw {{[0-9]+}}(%esp), %ax
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB1_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB1_2:
+; X86-NEXT:    retl
   %1 = call i8 @llvm.scmp(i16 %x, i16 %y)
   ret i8 %1
 }
 
 define i8 @scmp.8.32(i32 %x, i32 %y) nounwind {
-; CHECK-LABEL: scmp.8.32:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp.8.32:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpl %esi, %edi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp.8.32:
+; X86:       # %bb.0:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB2_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB2_2:
+; X86-NEXT:    retl
   %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
   ret i8 %1
 }
 
 define i8 @scmp.8.64(i64 %x, i64 %y) nounwind {
-; CHECK-LABEL: scmp.8.64:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp.8.64:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp.8.64:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %esi
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    sbbl %edx, %ecx
+; X86-NEXT:    setl %cl
+; X86-NEXT:    cmpl %esi, %eax
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB3_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB3_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call i8 @llvm.scmp(i64 %x, i64 %y)
   ret i8 %1
 }
 
 define i8 @scmp.8.128(i128 %x, i128 %y) nounwind {
-; CHECK-LABEL: scmp.8.128:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    cmpq %rdi, %rdx
-; CHECK-NEXT:    movq %rcx, %rax
-; CHECK-NEXT:    sbbq %rsi, %rax
-; CHECK-NEXT:    setl %al
-; CHECK-NEXT:    movzbl %al, %r8d
-; CHECK-NEXT:    cmpq %rdx, %rdi
-; CHECK-NEXT:    sbbq %rcx, %rsi
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %r8d, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp.8.128:
+; X64:       # %bb.0:
+; X64-NEXT:    cmpq %rdi, %rdx
+; X64-NEXT:    movq %rcx, %rax
+; X64-NEXT:    sbbq %rsi, %rax
+; X64-NEXT:    setl %al
+; X64-NEXT:    movzbl %al, %r8d
+; X64-NEXT:    cmpq %rdx, %rdi
+; X64-NEXT:    sbbq %rcx, %rsi
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %r8d, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp.8.128:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %ebp, %ebx
+; X86-NEXT:    sbbl %edx, %ebx
+; X86-NEXT:    movl %ecx, %ebx
+; X86-NEXT:    sbbl %eax, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl %esi, %ecx
+; X86-NEXT:    sbbl %ebx, %ecx
+; X86-NEXT:    setl %cl
+; X86-NEXT:    cmpl %edi, {{[0-9]+}}(%esp)
+; X86-NEXT:    sbbl %ebp, %edx
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %esi, %ebx
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB4_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB4_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl
   %1 = call i8 @llvm.scmp(i128 %x, i128 %y)
   ret i8 %1
 }
 
 define i32 @scmp.32.32(i32 %x, i32 %y) nounwind {
-; CHECK-LABEL: scmp.32.32:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp.32.32:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpl %esi, %edi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp.32.32:
+; X86:       # %bb.0:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ecx, %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    setg %dl
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    jl .LBB5_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %dl, %cl
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB5_2:
+; X86-NEXT:    retl
   %1 = call i32 @llvm.scmp(i32 %x, i32 %y)
   ret i32 %1
 }
 
 define i32 @scmp.32.64(i64 %x, i64 %y) nounwind {
-; CHECK-LABEL: scmp.32.64:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp.32.64:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp.32.64:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %esi
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    sbbl %edx, %ecx
+; X86-NEXT:    setl %cl
+; X86-NEXT:    cmpl %esi, %eax
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    jl .LBB6_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzbl %cl, %eax
+; X86-NEXT:  .LBB6_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call i32 @llvm.scmp(i64 %x, i64 %y)
   ret i32 %1
 }
 
 define i64 @scmp.64.64(i64 %x, i64 %y) nounwind {
-; CHECK-LABEL: scmp.64.64:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovgeq %rcx, %rax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp.64.64:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movq $-1, %rax
+; X64-NEXT:    cmovgeq %rcx, %rax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp.64.64:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %esi
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    sbbl %edx, %ecx
+; X86-NEXT:    setl %cl
+; X86-NEXT:    cmpl %esi, %eax
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    jl .LBB7_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzbl %cl, %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:  .LBB7_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call i64 @llvm.scmp(i64 %x, i64 %y)
   ret i64 %1
 }
 
 define i4 @scmp_narrow_result(i32 %x, i32 %y) nounwind {
-; CHECK-LABEL: scmp_narrow_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_narrow_result:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpl %esi, %edi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_narrow_result:
+; X86:       # %bb.0:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB8_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB8_2:
+; X86-NEXT:    retl
   %1 = call i4 @llvm.scmp(i32 %x, i32 %y)
   ret i4 %1
 }
 
 define i8 @scmp_narrow_op(i62 %x, i62 %y) nounwind {
-; CHECK-LABEL: scmp_narrow_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    shlq $2, %rsi
-; CHECK-NEXT:    sarq $2, %rsi
-; CHECK-NEXT:    shlq $2, %rdi
-; CHECK-NEXT:    sarq $2, %rdi
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_narrow_op:
+; X64:       # %bb.0:
+; X64-NEXT:    shlq $2, %rsi
+; X64-NEXT:    sarq $2, %rsi
+; X64-NEXT:    shlq $2, %rdi
+; X64-NEXT:    sarq $2, %rdi
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_narrow_op:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    shll $2, %eax
+; X86-NEXT:    sarl $2, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    shll $2, %edi
+; X86-NEXT:    sarl $2, %edi
+; X86-NEXT:    cmpl %ecx, %esi
+; X86-NEXT:    movl %edi, %edx
+; X86-NEXT:    sbbl %eax, %edx
+; X86-NEXT:    setl %dl
+; X86-NEXT:    cmpl %esi, %ecx
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB9_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %edx, %eax
+; X86-NEXT:  .LBB9_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call i8 @llvm.scmp(i62 %x, i62 %y)
   ret i8 %1
 }
 
 define i141 @scmp_wide_result(i32 %x, i32 %y) nounwind {
-; CHECK-LABEL: scmp_wide_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovgeq %rcx, %rax
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_wide_result:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpl %esi, %edi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movq $-1, %rax
+; X64-NEXT:    cmovgeq %rcx, %rax
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_wide_result:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    xorl %ecx, %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    setg %bl
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jl .LBB10_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    xorl %esi, %esi
+; X86-NEXT:    movb %bl, %cl
+; X86-NEXT:    movl %ecx, %edx
+; X86-NEXT:  .LBB10_2:
+; X86-NEXT:    movl %esi, 4(%eax)
+; X86-NEXT:    movl %edx, (%eax)
+; X86-NEXT:    movl $0, 12(%eax)
+; X86-NEXT:    movl $0, 8(%eax)
+; X86-NEXT:    movw $0, 16(%eax)
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    retl $4
   %1 = call i141 @llvm.scmp(i32 %x, i32 %y)
   ret i141 %1
 }
 
 define i8 @scmp_wide_op(i109 %x, i109 %y) nounwind {
-; CHECK-LABEL: scmp_wide_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    shlq $19, %rsi
-; CHECK-NEXT:    sarq $19, %rsi
-; CHECK-NEXT:    shlq $19, %rcx
-; CHECK-NEXT:    sarq $19, %rcx
-; CHECK-NEXT:    cmpq %rdi, %rdx
-; CHECK-NEXT:    movq %rcx, %rax
-; CHECK-NEXT:    sbbq %rsi, %rax
-; CHECK-NEXT:    setl %al
-; CHECK-NEXT:    movzbl %al, %r8d
-; CHECK-NEXT:    cmpq %rdx, %rdi
-; CHECK-NEXT:    sbbq %rcx, %rsi
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %r8d, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_wide_op:
+; X64:       # %bb.0:
+; X64-NEXT:    shlq $19, %rsi
+; X64-NEXT:    sarq $19, %rsi
+; X64-NEXT:    shlq $19, %rcx
+; X64-NEXT:    sarq $19, %rcx
+; X64-NEXT:    cmpq %rdi, %rdx
+; X64-NEXT:    movq %rcx, %rax
+; X64-NEXT:    sbbq %rsi, %rax
+; X64-NEXT:    setl %al
+; X64-NEXT:    movzbl %al, %r8d
+; X64-NEXT:    cmpq %rdx, %rdi
+; X64-NEXT:    sbbq %rcx, %rsi
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %r8d, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_wide_op:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    pushl %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    shll $19, %eax
+; X86-NEXT:    sarl $19, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    shll $19, %ecx
+; X86-NEXT:    sarl $19, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %edx, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %edi, %esi
+; X86-NEXT:    sbbl %ebx, %esi
+; X86-NEXT:    movl %ecx, %esi
+; X86-NEXT:    sbbl %eax, %esi
+; X86-NEXT:    setl {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %ebp, {{[0-9]+}}(%esp)
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl %edi, %ebx
+; X86-NEXT:    sbbl %ecx, %eax
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB11_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:  .LBB11_2:
+; X86-NEXT:    addl $4, %esp
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl
   %1 = call i8 @llvm.scmp(i109 %x, i109 %y)
   ret i8 %1
 }
 
 define i41 @scmp_uncommon_types(i7 %x, i7 %y) nounwind {
-; CHECK-LABEL: scmp_uncommon_types:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    addb %sil, %sil
-; CHECK-NEXT:    sarb %sil
-; CHECK-NEXT:    addb %dil, %dil
-; CHECK-NEXT:    sarb %dil
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpb %sil, %dil
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovgeq %rcx, %rax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_uncommon_types:
+; X64:       # %bb.0:
+; X64-NEXT:    addb %sil, %sil
+; X64-NEXT:    sarb %sil
+; X64-NEXT:    addb %dil, %dil
+; X64-NEXT:    sarb %dil
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpb %sil, %dil
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movq $-1, %rax
+; X64-NEXT:    cmovgeq %rcx, %rax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_uncommon_types:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    addb %al, %al
+; X86-NEXT:    sarb %al
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    addb %dl, %dl
+; X86-NEXT:    sarb %dl
+; X86-NEXT:    xorl %ecx, %ecx
+; X86-NEXT:    cmpb %al, %dl
+; X86-NEXT:    setg %bl
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    jl .LBB12_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    movb %bl, %cl
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB12_2:
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    retl
   %1 = call i41 @llvm.scmp(i7 %x, i7 %y)
   ret i41 %1
 }
 
 define <4 x i32> @scmp_normal_vectors(<4 x i32> %x, <4 x i32> %y) nounwind {
-; CHECK-LABEL: scmp_normal_vectors:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %eax
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    movd %edx, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
-; CHECK-NEXT:    movdqa %xmm2, %xmm0
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_normal_vectors:
+; X64:       # %bb.0:
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %eax
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
+; X64-NEXT:    movdqa %xmm2, %xmm0
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_normal_vectors:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    jl .LBB13_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %ebp
+; X86-NEXT:  .LBB13_2:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jl .LBB13_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %esi
+; X86-NEXT:  .LBB13_4:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jl .LBB13_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edi
+; X86-NEXT:  .LBB13_6:
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    setg %cl
+; X86-NEXT:    jl .LBB13_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:  .LBB13_8:
+; X86-NEXT:    movl %edx, 12(%eax)
+; X86-NEXT:    movl %edi, 8(%eax)
+; X86-NEXT:    movl %esi, 4(%eax)
+; X86-NEXT:    movl %ebp, (%eax)
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <4 x i32> @llvm.scmp(<4 x i32> %x, <4 x i32> %y)
   ret <4 x i32> %1
 }
 
 define <4 x i8> @scmp_narrow_vec_result(<4 x i32> %x, <4 x i32> %y) nounwind {
-; CHECK-LABEL: scmp_narrow_vec_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %eax
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    movd %edx, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
-; CHECK-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2
-; CHECK-NEXT:    pxor %xmm0, %xmm0
-; CHECK-NEXT:    packuswb %xmm0, %xmm2
-; CHECK-NEXT:    packuswb %xmm0, %xmm2
-; CHECK-NEXT:    movdqa %xmm2, %xmm0
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_narrow_vec_result:
+; X64:       # %bb.0:
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %eax
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
+; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2
+; X64-NEXT:    pxor %xmm0, %xmm0
+; X64-NEXT:    packuswb %xmm0, %xmm2
+; X64-NEXT:    packuswb %xmm0, %xmm2
+; X64-NEXT:    movdqa %xmm2, %xmm0
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_narrow_vec_result:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    setg %ch
+; X86-NEXT:    movb $-1, %dl
+; X86-NEXT:    movb $-1, %cl
+; X86-NEXT:    jl .LBB14_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %ch, %cl
+; X86-NEXT:  .LBB14_2:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    setg %al
+; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    jl .LBB14_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %al, %ch
+; X86-NEXT:  .LBB14_4:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    setg %bl
+; X86-NEXT:    movb $-1, %dh
+; X86-NEXT:    jl .LBB14_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %bl, %dh
+; X86-NEXT:  .LBB14_6:
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    setg %bl
+; X86-NEXT:    jl .LBB14_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %bl, %dl
+; X86-NEXT:  .LBB14_8:
+; X86-NEXT:    movb %dl, 3(%eax)
+; X86-NEXT:    movb %dh, 2(%eax)
+; X86-NEXT:    movb %ch, 1(%eax)
+; X86-NEXT:    movb %cl, (%eax)
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    retl $4
   %1 = call <4 x i8> @llvm.scmp(<4 x i32> %x, <4 x i32> %y)
   ret <4 x i8> %1
 }
 
 define <4 x i32> @scmp_narrow_vec_op(<4 x i8> %x, <4 x i8> %y) nounwind {
-; CHECK-LABEL: scmp_narrow_vec_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3]
-; CHECK-NEXT:    psrad $24, %xmm1
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %eax
-; CHECK-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
-; CHECK-NEXT:    psrad $24, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm2[3,3,3,3]
-; CHECK-NEXT:    movd %xmm0, %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    movd %edx, %xmm0
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm2[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    movd %xmm2, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm1
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_narrow_vec_op:
+; X64:       # %bb.0:
+; X64-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3]
+; X64-NEXT:    psrad $24, %xmm1
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %eax
+; X64-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
+; X64-NEXT:    psrad $24, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm2[3,3,3,3]
+; X64-NEXT:    movd %xmm0, %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm0
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm2[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    movd %xmm2, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm2[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm1
+; X64-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_narrow_vec_op:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    jl .LBB15_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %ebp
+; X86-NEXT:  .LBB15_2:
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    xorl %eax, %eax
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %bl
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jl .LBB15_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %bl, %al
+; X86-NEXT:    movl %eax, %esi
+; X86-NEXT:  .LBB15_4:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jl .LBB15_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edi
+; X86-NEXT:  .LBB15_6:
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    jl .LBB15_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:  .LBB15_8:
+; X86-NEXT:    movl %edx, 12(%eax)
+; X86-NEXT:    movl %edi, 8(%eax)
+; X86-NEXT:    movl %esi, 4(%eax)
+; X86-NEXT:    movl %ebp, (%eax)
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <4 x i32> @llvm.scmp(<4 x i8> %x, <4 x i8> %y)
   ret <4 x i32> %1
 }
 
 define <16 x i32> @scmp_wide_vec_result(<16 x i8> %x, <16 x i8> %y) nounwind {
-; CHECK-LABEL: scmp_wide_vec_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    movdqa %xmm1, %xmm3
-; CHECK-NEXT:    movdqa %xmm0, %xmm2
-; CHECK-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1],xmm5[2],xmm1[2],xmm5[3],xmm1[3]
-; CHECK-NEXT:    psrad $24, %xmm5
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm5[3,3,3,3]
-; CHECK-NEXT:    movd %xmm0, %eax
-; CHECK-NEXT:    punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3],xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3]
-; CHECK-NEXT:    psrad $24, %xmm6
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm6[3,3,3,3]
-; CHECK-NEXT:    movd %xmm0, %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    movd %edx, %xmm0
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
-; CHECK-NEXT:    movd %xmm7, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
-; CHECK-NEXT:    movd %xmm7, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm7
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm0[0],xmm7[1],xmm0[1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    movd %xmm6, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm5
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm5[0],xmm0[1],xmm5[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm7[0]
-; CHECK-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm1[4],xmm5[5],xmm1[5],xmm5[6],xmm1[6],xmm5[7],xmm1[7]
-; CHECK-NEXT:    psrad $24, %xmm5
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm5[3,3,3,3]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4,4,5,5,6,6,7,7]
-; CHECK-NEXT:    psrad $24, %xmm4
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm4[3,3,3,3]
-; CHECK-NEXT:    movd %xmm1, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm1
-; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
-; CHECK-NEXT:    movd %xmm6, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm4[2,3,2,3]
-; CHECK-NEXT:    movd %xmm6, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm6
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm1[0],xmm6[1],xmm1[1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    movd %xmm4, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm1
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
-; CHECK-NEXT:    movd %xmm4, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm4
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm6[0]
-; CHECK-NEXT:    punpckhbw {{.*#+}} xmm3 = xmm3[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm3[0],xmm5[1],xmm3[1],xmm5[2],xmm3[2],xmm5[3],xmm3[3]
-; CHECK-NEXT:    psrad $24, %xmm5
-; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[3,3,3,3]
-; CHECK-NEXT:    movd %xmm4, %ecx
-; CHECK-NEXT:    punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm2[8],xmm4[9],xmm2[9],xmm4[10],xmm2[10],xmm4[11],xmm2[11],xmm4[12],xmm2[12],xmm4[13],xmm2[13],xmm4[14],xmm2[14],xmm4[15],xmm2[15]
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3]
-; CHECK-NEXT:    psrad $24, %xmm6
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm6[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
-; CHECK-NEXT:    movd %xmm7, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
-; CHECK-NEXT:    movd %xmm7, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm7
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    movd %xmm6, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm5
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm5[0],xmm2[1],xmm5[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm7[0]
-; CHECK-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm3[4],xmm5[5],xmm3[5],xmm5[6],xmm3[6],xmm5[7],xmm3[7]
-; CHECK-NEXT:    psrad $24, %xmm5
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm5[3,3,3,3]
-; CHECK-NEXT:    movd %xmm3, %ecx
-; CHECK-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4,4,5,5,6,6,7,7]
-; CHECK-NEXT:    psrad $24, %xmm4
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[3,3,3,3]
-; CHECK-NEXT:    movd %xmm3, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
-; CHECK-NEXT:    movd %xmm6, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm4[2,3,2,3]
-; CHECK-NEXT:    movd %xmm6, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm6
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    movd %xmm4, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
-; CHECK-NEXT:    movd %xmm4, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm4
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm6[0]
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_wide_vec_result:
+; X64:       # %bb.0:
+; X64-NEXT:    movdqa %xmm1, %xmm3
+; X64-NEXT:    movdqa %xmm0, %xmm2
+; X64-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1],xmm5[2],xmm1[2],xmm5[3],xmm1[3]
+; X64-NEXT:    psrad $24, %xmm5
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm5[3,3,3,3]
+; X64-NEXT:    movd %xmm0, %eax
+; X64-NEXT:    punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3],xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3]
+; X64-NEXT:    psrad $24, %xmm6
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm6[3,3,3,3]
+; X64-NEXT:    movd %xmm0, %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm0
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm7
+; X64-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm0[0],xmm7[1],xmm0[1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    movd %xmm6, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm5
+; X64-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm5[0],xmm0[1],xmm5[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm7[0]
+; X64-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm1[4],xmm5[5],xmm1[5],xmm5[6],xmm1[6],xmm5[7],xmm1[7]
+; X64-NEXT:    psrad $24, %xmm5
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm5[3,3,3,3]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4,4,5,5,6,6,7,7]
+; X64-NEXT:    psrad $24, %xmm4
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm4[3,3,3,3]
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm1
+; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
+; X64-NEXT:    movd %xmm6, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm4[2,3,2,3]
+; X64-NEXT:    movd %xmm6, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm6
+; X64-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm1[0],xmm6[1],xmm1[1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    movd %xmm4, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm1
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
+; X64-NEXT:    movd %xmm4, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm4
+; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm6[0]
+; X64-NEXT:    punpckhbw {{.*#+}} xmm3 = xmm3[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm3[0],xmm5[1],xmm3[1],xmm5[2],xmm3[2],xmm5[3],xmm3[3]
+; X64-NEXT:    psrad $24, %xmm5
+; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[3,3,3,3]
+; X64-NEXT:    movd %xmm4, %ecx
+; X64-NEXT:    punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm2[8],xmm4[9],xmm2[9],xmm4[10],xmm2[10],xmm4[11],xmm2[11],xmm4[12],xmm2[12],xmm4[13],xmm2[13],xmm4[14],xmm2[14],xmm4[15],xmm2[15]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3]
+; X64-NEXT:    psrad $24, %xmm6
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm6[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm7
+; X64-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    movd %xmm6, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm5
+; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm5[0],xmm2[1],xmm5[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm7[0]
+; X64-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm3[4],xmm5[5],xmm3[5],xmm5[6],xmm3[6],xmm5[7],xmm3[7]
+; X64-NEXT:    psrad $24, %xmm5
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm5[3,3,3,3]
+; X64-NEXT:    movd %xmm3, %ecx
+; X64-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4,4,5,5,6,6,7,7]
+; X64-NEXT:    psrad $24, %xmm4
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[3,3,3,3]
+; X64-NEXT:    movd %xmm3, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
+; X64-NEXT:    movd %xmm6, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm4[2,3,2,3]
+; X64-NEXT:    movd %xmm6, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm6
+; X64-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    movd %xmm4, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
+; X64-NEXT:    movd %xmm4, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movd %esi, %xmm4
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm6[0]
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_wide_vec_result:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    subl $48, %esp
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    xorl %ecx, %ecx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %dl
+; X86-NEXT:    setg %dl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jl .LBB16_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %dl, %cl
+; X86-NEXT:    movl %ecx, %esi
+; X86-NEXT:  .LBB16_2:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jl .LBB16_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, %edi
+; X86-NEXT:  .LBB16_4:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    jl .LBB16_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, %ebx
+; X86-NEXT:  .LBB16_6:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    jl .LBB16_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, %ebp
+; X86-NEXT:  .LBB16_8:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jl .LBB16_10
+; X86-NEXT:  # %bb.9:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_10:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jl .LBB16_12
+; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_12:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jl .LBB16_14
+; X86-NEXT:  # %bb.13:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_14:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jl .LBB16_16
+; X86-NEXT:  # %bb.15:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_16:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jl .LBB16_18
+; X86-NEXT:  # %bb.17:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_18:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, (%esp) # 4-byte Folded Spill
+; X86-NEXT:    jl .LBB16_20
+; X86-NEXT:  # %bb.19:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, (%esp) # 4-byte Spill
+; X86-NEXT:  .LBB16_20:
+; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    jl .LBB16_22
+; X86-NEXT:  # %bb.21:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, %ebx
+; X86-NEXT:  .LBB16_22:
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    jl .LBB16_24
+; X86-NEXT:  # %bb.23:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %ebp
+; X86-NEXT:  .LBB16_24:
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %dl
+; X86-NEXT:    setg %ah
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    jl .LBB16_26
+; X86-NEXT:  # %bb.25:
+; X86-NEXT:    movb %ah, %bl
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:  .LBB16_26:
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %al
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jl .LBB16_28
+; X86-NEXT:  # %bb.27:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %esi
+; X86-NEXT:  .LBB16_28:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jl .LBB16_30
+; X86-NEXT:  # %bb.29:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edi
+; X86-NEXT:  .LBB16_30:
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    setg %cl
+; X86-NEXT:    jl .LBB16_32
+; X86-NEXT:  # %bb.31:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_32:
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 60(%eax)
+; X86-NEXT:    movl %edi, 56(%eax)
+; X86-NEXT:    movl %esi, 52(%eax)
+; X86-NEXT:    movl %edx, 48(%eax)
+; X86-NEXT:    movl %ebp, 44(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 40(%eax)
+; X86-NEXT:    movl (%esp), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 36(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 32(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 28(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 24(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 20(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 16(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 12(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 8(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 4(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, (%eax)
+; X86-NEXT:    addl $48, %esp
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <16 x i32> @llvm.scmp(<16 x i8> %x, <16 x i8> %y)
   ret <16 x i32> %1
 }
 
 define <16 x i8> @scmp_wide_vec_op(<16 x i64> %x, <16 x i64> %y) nounwind {
-; CHECK-LABEL: scmp_wide_vec_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    movq %xmm7, %rax
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovlq %rax, %rcx
-; CHECK-NEXT:    movq %rcx, %xmm9
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm7[2,3,2,3]
-; CHECK-NEXT:    movq %xmm7, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm7
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm9 = xmm9[0],xmm7[0]
-; CHECK-NEXT:    movdqa {{.*#+}} xmm7 = [255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0]
-; CHECK-NEXT:    pand %xmm7, %xmm9
-; CHECK-NEXT:    movq %xmm6, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm8
-; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm6[2,3,2,3]
-; CHECK-NEXT:    movq %xmm6, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm6
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm8 = xmm8[0],xmm6[0]
-; CHECK-NEXT:    pand %xmm7, %xmm8
-; CHECK-NEXT:    packuswb %xmm9, %xmm8
-; CHECK-NEXT:    movq %xmm5, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm6
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[2,3,2,3]
-; CHECK-NEXT:    movq %xmm5, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm5
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm6 = xmm6[0],xmm5[0]
-; CHECK-NEXT:    pand %xmm7, %xmm6
-; CHECK-NEXT:    movq %xmm4, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm5
-; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[2,3,2,3]
-; CHECK-NEXT:    movq %xmm4, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm4
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm5 = xmm5[0],xmm4[0]
-; CHECK-NEXT:    pand %xmm7, %xmm5
-; CHECK-NEXT:    packuswb %xmm6, %xmm5
-; CHECK-NEXT:    packuswb %xmm8, %xmm5
-; CHECK-NEXT:    movq %xmm3, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm4
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[2,3,2,3]
-; CHECK-NEXT:    movq %xmm3, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm3
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm4 = xmm4[0],xmm3[0]
-; CHECK-NEXT:    pand %xmm7, %xmm4
-; CHECK-NEXT:    movq %xmm2, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm3
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[2,3,2,3]
-; CHECK-NEXT:    movq %xmm2, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm2
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm2[0]
-; CHECK-NEXT:    pand %xmm7, %xmm3
-; CHECK-NEXT:    packuswb %xmm4, %xmm3
-; CHECK-NEXT:    movq %xmm1, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movq %xmm1, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm1
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm1[0]
-; CHECK-NEXT:    pand %xmm7, %xmm2
-; CHECK-NEXT:    movq %xmm0, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm1
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
-; CHECK-NEXT:    movq %xmm0, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm0
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
-; CHECK-NEXT:    pand %xmm7, %xmm1
-; CHECK-NEXT:    packuswb %xmm2, %xmm1
-; CHECK-NEXT:    packuswb %xmm3, %xmm1
-; CHECK-NEXT:    packuswb %xmm5, %xmm1
-; CHECK-NEXT:    movdqa %xmm1, %xmm0
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_wide_vec_op:
+; X64:       # %bb.0:
+; X64-NEXT:    movq %xmm7, %rax
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movq $-1, %rax
+; X64-NEXT:    cmovlq %rax, %rcx
+; X64-NEXT:    movq %rcx, %xmm9
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm7[2,3,2,3]
+; X64-NEXT:    movq %xmm7, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm7
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm9 = xmm9[0],xmm7[0]
+; X64-NEXT:    movdqa {{.*#+}} xmm7 = [255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0]
+; X64-NEXT:    pand %xmm7, %xmm9
+; X64-NEXT:    movq %xmm6, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm8
+; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm6[2,3,2,3]
+; X64-NEXT:    movq %xmm6, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm6
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm8 = xmm8[0],xmm6[0]
+; X64-NEXT:    pand %xmm7, %xmm8
+; X64-NEXT:    packuswb %xmm9, %xmm8
+; X64-NEXT:    movq %xmm5, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm6
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[2,3,2,3]
+; X64-NEXT:    movq %xmm5, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm5
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm6 = xmm6[0],xmm5[0]
+; X64-NEXT:    pand %xmm7, %xmm6
+; X64-NEXT:    movq %xmm4, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm5
+; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[2,3,2,3]
+; X64-NEXT:    movq %xmm4, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm4
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm5 = xmm5[0],xmm4[0]
+; X64-NEXT:    pand %xmm7, %xmm5
+; X64-NEXT:    packuswb %xmm6, %xmm5
+; X64-NEXT:    packuswb %xmm8, %xmm5
+; X64-NEXT:    movq %xmm3, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm4
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[2,3,2,3]
+; X64-NEXT:    movq %xmm3, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm3
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm4 = xmm4[0],xmm3[0]
+; X64-NEXT:    pand %xmm7, %xmm4
+; X64-NEXT:    movq %xmm2, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm3
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[2,3,2,3]
+; X64-NEXT:    movq %xmm2, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm2
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm2[0]
+; X64-NEXT:    pand %xmm7, %xmm3
+; X64-NEXT:    packuswb %xmm4, %xmm3
+; X64-NEXT:    movq %xmm1, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[2,3,2,3]
+; X64-NEXT:    movq %xmm1, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm1
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm1[0]
+; X64-NEXT:    pand %xmm7, %xmm2
+; X64-NEXT:    movq %xmm0, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm1
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
+; X64-NEXT:    movq %xmm0, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm0
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
+; X64-NEXT:    pand %xmm7, %xmm1
+; X64-NEXT:    packuswb %xmm2, %xmm1
+; X64-NEXT:    packuswb %xmm3, %xmm1
+; X64-NEXT:    packuswb %xmm5, %xmm1
+; X64-NEXT:    movdqa %xmm1, %xmm0
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_wide_vec_op:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    subl $16, %esp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %edx
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %edx, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl %edi, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movb $-1, %bh
+; X86-NEXT:    jl .LBB17_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %bl, %bh
+; X86-NEXT:  .LBB17_2:
+; X86-NEXT:    cmpl %ecx, %edx
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %eax, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %edx, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    sbbl %esi, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_4:
+; X86-NEXT:    cmpl %edx, %eax
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %eax, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_6:
+; X86-NEXT:    cmpl %edx, %ecx
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %eax, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %ecx, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    sbbl %esi, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_8:
+; X86-NEXT:    cmpl %edx, %eax
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %eax, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_10
+; X86-NEXT:  # %bb.9:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_10:
+; X86-NEXT:    cmpl %edx, %ecx
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %eax, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %ecx, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    sbbl %esi, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_12
+; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_12:
+; X86-NEXT:    cmpl %edx, %eax
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %eax, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_14
+; X86-NEXT:  # %bb.13:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_14:
+; X86-NEXT:    cmpl %edx, %ecx
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %eax, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %ecx, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    sbbl %esi, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_16
+; X86-NEXT:  # %bb.15:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_16:
+; X86-NEXT:    cmpl %edx, %eax
+; X86-NEXT:    movl %edi, %esi
+; X86-NEXT:    sbbl %ecx, %esi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %eax, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %edi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_18
+; X86-NEXT:  # %bb.17:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_18:
+; X86-NEXT:    cmpl %esi, %ecx
+; X86-NEXT:    movl %edx, %edi
+; X86-NEXT:    sbbl %eax, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %ecx, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    sbbl %edx, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_20
+; X86-NEXT:  # %bb.19:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_20:
+; X86-NEXT:    cmpl %esi, %eax
+; X86-NEXT:    movl %edx, %edi
+; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %eax, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %edx, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jl .LBB17_22
+; X86-NEXT:  # %bb.21:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_22:
+; X86-NEXT:    cmpl %esi, %edx
+; X86-NEXT:    movl %ecx, %edi
+; X86-NEXT:    sbbl %eax, %edi
+; X86-NEXT:    setl %bl
+; X86-NEXT:    cmpl %edx, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ecx, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movb $-1, %cl
+; X86-NEXT:    jl .LBB17_24
+; X86-NEXT:  # %bb.23:
+; X86-NEXT:    movl %ebx, %ecx
+; X86-NEXT:  .LBB17_24:
+; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movb %bh, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    cmpl %edi, %eax
+; X86-NEXT:    movl %edx, %ecx
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    setl %ch
+; X86-NEXT:    cmpl %eax, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %edx, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movb $-1, %cl
+; X86-NEXT:    jl .LBB17_26
+; X86-NEXT:  # %bb.25:
+; X86-NEXT:    movb %ch, %cl
+; X86-NEXT:  .LBB17_26:
+; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    cmpl %edi, %esi
+; X86-NEXT:    movl %ebp, %ecx
+; X86-NEXT:    sbbl %eax, %ecx
+; X86-NEXT:    setl %dh
+; X86-NEXT:    cmpl %esi, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ebp, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB17_28
+; X86-NEXT:  # %bb.27:
+; X86-NEXT:    movb %dh, %al
+; X86-NEXT:  .LBB17_28:
+; X86-NEXT:    movb %al, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl %edi, %ebx
+; X86-NEXT:    movl %ebp, %edx
+; X86-NEXT:    sbbl %esi, %ebp
+; X86-NEXT:    setl %cl
+; X86-NEXT:    cmpl %ebx, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    sbbl %edx, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movb $-1, %dh
+; X86-NEXT:    jl .LBB17_30
+; X86-NEXT:  # %bb.29:
+; X86-NEXT:    movb %cl, %dh
+; X86-NEXT:  .LBB17_30:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %ebx, %ecx
+; X86-NEXT:    movl %ebp, %esi
+; X86-NEXT:    sbbl %edi, %esi
+; X86-NEXT:    setl %dl
+; X86-NEXT:    cmpl %ecx, %ebx
+; X86-NEXT:    sbbl %ebp, %edi
+; X86-NEXT:    movb $-1, %bl
+; X86-NEXT:    jl .LBB17_32
+; X86-NEXT:  # %bb.31:
+; X86-NEXT:    movl %edx, %ebx
+; X86-NEXT:  .LBB17_32:
+; X86-NEXT:    movb %bl, 15(%eax)
+; X86-NEXT:    movb %dh, 14(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 13(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 12(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 11(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 10(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 9(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 8(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 7(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 6(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 5(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 4(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 3(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 2(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 1(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, (%eax)
+; X86-NEXT:    addl $16, %esp
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <16 x i8> @llvm.scmp(<16 x i64> %x, <16 x i64> %y)
   ret <16 x i8> %1
 }
 
 define <7 x i117> @scmp_uncommon_vectors(<7 x i7> %x, <7 x i7> %y) nounwind {
-; CHECK-LABEL: scmp_uncommon_vectors:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pushq %rbp
-; CHECK-NEXT:    pushq %r15
-; CHECK-NEXT:    pushq %r14
-; CHECK-NEXT:    pushq %r13
-; CHECK-NEXT:    pushq %r12
-; CHECK-NEXT:    pushq %rbx
-; CHECK-NEXT:    movq %rdi, %r14
-; CHECK-NEXT:    movd %r8d, %xmm0
-; CHECK-NEXT:    movd %ecx, %xmm1
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
-; CHECK-NEXT:    movd %edx, %xmm2
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
-; CHECK-NEXT:    movd %r9d, %xmm1
-; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
-; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
-; CHECK-NEXT:    psllw $9, %xmm0
-; CHECK-NEXT:    psraw $9, %xmm0
-; CHECK-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
-; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
-; CHECK-NEXT:    movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
-; CHECK-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3]
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
-; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; CHECK-NEXT:    movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
-; CHECK-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
-; CHECK-NEXT:    psllw $9, %xmm1
-; CHECK-NEXT:    psraw $9, %xmm1
-; CHECK-NEXT:    movd %xmm1, %edx
-; CHECK-NEXT:    movd %xmm0, %esi
-; CHECK-NEXT:    xorl %eax, %eax
-; CHECK-NEXT:    cmpw %dx, %si
-; CHECK-NEXT:    setg %al
-; CHECK-NEXT:    movl $65535, %ebp # imm = 0xFFFF
-; CHECK-NEXT:    cmovll %ebp, %eax
-; CHECK-NEXT:    shlq $57, %rax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq %rax, %rcx
-; CHECK-NEXT:    sarq $63, %rcx
-; CHECK-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    pextrw $5, %xmm1, %esi
-; CHECK-NEXT:    pextrw $5, %xmm0, %edi
-; CHECK-NEXT:    xorl %r9d, %r9d
-; CHECK-NEXT:    cmpw %si, %di
-; CHECK-NEXT:    setg %r9b
-; CHECK-NEXT:    cmovll %ebp, %r9d
-; CHECK-NEXT:    shlq $57, %r9
-; CHECK-NEXT:    movq %r9, %rdi
-; CHECK-NEXT:    sarq $57, %rdi
-; CHECK-NEXT:    sarq $63, %r9
-; CHECK-NEXT:    pextrw $1, %xmm1, %esi
-; CHECK-NEXT:    pextrw $1, %xmm0, %r8d
-; CHECK-NEXT:    xorl %ebx, %ebx
-; CHECK-NEXT:    cmpw %si, %r8w
-; CHECK-NEXT:    setg %bl
-; CHECK-NEXT:    cmovll %ebp, %ebx
-; CHECK-NEXT:    shlq $57, %rbx
-; CHECK-NEXT:    movq %rbx, %rsi
-; CHECK-NEXT:    sarq $57, %rsi
-; CHECK-NEXT:    sarq $63, %rbx
-; CHECK-NEXT:    pextrw $2, %xmm1, %r10d
-; CHECK-NEXT:    pextrw $2, %xmm0, %r11d
-; CHECK-NEXT:    xorl %r8d, %r8d
-; CHECK-NEXT:    cmpw %r10w, %r11w
-; CHECK-NEXT:    setg %r8b
-; CHECK-NEXT:    cmovll %ebp, %r8d
-; CHECK-NEXT:    shlq $57, %r8
-; CHECK-NEXT:    movq %r8, %rdx
-; CHECK-NEXT:    sarq $57, %rdx
-; CHECK-NEXT:    sarq $63, %r8
-; CHECK-NEXT:    pextrw $3, %xmm1, %r11d
-; CHECK-NEXT:    pextrw $3, %xmm0, %r15d
-; CHECK-NEXT:    xorl %r10d, %r10d
-; CHECK-NEXT:    cmpw %r11w, %r15w
-; CHECK-NEXT:    setg %r10b
-; CHECK-NEXT:    cmovll %ebp, %r10d
-; CHECK-NEXT:    shlq $57, %r10
-; CHECK-NEXT:    movq %r10, %r11
-; CHECK-NEXT:    sarq $57, %r11
-; CHECK-NEXT:    sarq $63, %r10
-; CHECK-NEXT:    pextrw $4, %xmm1, %r12d
-; CHECK-NEXT:    pextrw $4, %xmm0, %r13d
-; CHECK-NEXT:    xorl %r15d, %r15d
-; CHECK-NEXT:    cmpw %r12w, %r13w
-; CHECK-NEXT:    setg %r15b
-; CHECK-NEXT:    cmovll %ebp, %r15d
-; CHECK-NEXT:    shlq $57, %r15
-; CHECK-NEXT:    movq %r15, %r12
-; CHECK-NEXT:    sarq $57, %r12
-; CHECK-NEXT:    sarq $63, %r15
-; CHECK-NEXT:    pextrw $6, %xmm1, %ecx
-; CHECK-NEXT:    pextrw $6, %xmm0, %eax
-; CHECK-NEXT:    xorl %r13d, %r13d
-; CHECK-NEXT:    cmpw %cx, %ax
-; CHECK-NEXT:    setg %r13b
-; CHECK-NEXT:    cmovll %ebp, %r13d
-; CHECK-NEXT:    shlq $57, %r13
-; CHECK-NEXT:    movq %r13, %rbp
-; CHECK-NEXT:    sarq $57, %rbp
-; CHECK-NEXT:    sarq $63, %r13
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; CHECK-NEXT:    sarq $57, %rax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq %rax, (%r14)
-; CHECK-NEXT:    movq %r13, %rax
-; CHECK-NEXT:    shldq $62, %rbp, %rax
-; CHECK-NEXT:    movq %rax, 88(%r14)
-; CHECK-NEXT:    movq %r15, %rax
-; CHECK-NEXT:    shldq $20, %r12, %rax
-; CHECK-NEXT:    movq %rax, 64(%r14)
-; CHECK-NEXT:    movq %r10, %rax
-; CHECK-NEXT:    shldq $31, %r11, %rax
-; CHECK-NEXT:    movq %rax, 48(%r14)
-; CHECK-NEXT:    movq %r8, %rax
-; CHECK-NEXT:    shldq $42, %rdx, %rax
-; CHECK-NEXT:    movq %rax, 32(%r14)
-; CHECK-NEXT:    movabsq $9007199254738944, %rax # imm = 0x1FFFFFFFFFF800
-; CHECK-NEXT:    andq %rbx, %rax
-; CHECK-NEXT:    shldq $53, %rsi, %rbx
-; CHECK-NEXT:    movq %rbx, 16(%r14)
-; CHECK-NEXT:    movq %r13, %rcx
-; CHECK-NEXT:    shrq $34, %rcx
-; CHECK-NEXT:    movw %cx, 100(%r14)
-; CHECK-NEXT:    movabsq $9007199254740991, %rbx # imm = 0x1FFFFFFFFFFFFF
-; CHECK-NEXT:    andq %rbx, %r9
-; CHECK-NEXT:    shldq $9, %rdi, %r9
-; CHECK-NEXT:    shlq $62, %rbp
-; CHECK-NEXT:    orq %r9, %rbp
-; CHECK-NEXT:    shrq $2, %r13
-; CHECK-NEXT:    movl %r13d, 96(%r14)
-; CHECK-NEXT:    movq %rbp, 80(%r14)
-; CHECK-NEXT:    shlq $42, %rdx
-; CHECK-NEXT:    shrq $11, %rax
-; CHECK-NEXT:    orq %rdx, %rax
-; CHECK-NEXT:    movq %rax, 24(%r14)
-; CHECK-NEXT:    movabsq $2251799813685247, %rax # imm = 0x7FFFFFFFFFFFF
-; CHECK-NEXT:    andq %r13, %rax
-; CHECK-NEXT:    shrq $48, %rax
-; CHECK-NEXT:    movb %al, 102(%r14)
-; CHECK-NEXT:    shlq $9, %rdi
-; CHECK-NEXT:    shrq $44, %r15
-; CHECK-NEXT:    andl $511, %r15d # imm = 0x1FF
-; CHECK-NEXT:    orq %rdi, %r15
-; CHECK-NEXT:    movq %r15, 72(%r14)
-; CHECK-NEXT:    shlq $20, %r12
-; CHECK-NEXT:    shrq $33, %r10
-; CHECK-NEXT:    andl $1048575, %r10d # imm = 0xFFFFF
-; CHECK-NEXT:    orq %r12, %r10
-; CHECK-NEXT:    movq %r10, 56(%r14)
-; CHECK-NEXT:    shlq $31, %r11
-; CHECK-NEXT:    shrq $22, %r8
-; CHECK-NEXT:    andl $2147483647, %r8d # imm = 0x7FFFFFFF
-; CHECK-NEXT:    orq %r11, %r8
-; CHECK-NEXT:    movq %r8, 40(%r14)
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Folded Reload
-; CHECK-NEXT:    # xmm0 = mem[0],zero
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 8-byte Folded Reload
-; CHECK-NEXT:    # xmm1 = mem[0],zero
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movq %xmm0, %rax
-; CHECK-NEXT:    andq %rbx, %rax
-; CHECK-NEXT:    shlq $53, %rsi
-; CHECK-NEXT:    orq %rax, %rsi
-; CHECK-NEXT:    movq %rsi, 8(%r14)
-; CHECK-NEXT:    movq %r14, %rax
-; CHECK-NEXT:    popq %rbx
-; CHECK-NEXT:    popq %r12
-; CHECK-NEXT:    popq %r13
-; CHECK-NEXT:    popq %r14
-; CHECK-NEXT:    popq %r15
-; CHECK-NEXT:    popq %rbp
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_uncommon_vectors:
+; X64:       # %bb.0:
+; X64-NEXT:    pushq %rbp
+; X64-NEXT:    pushq %r15
+; X64-NEXT:    pushq %r14
+; X64-NEXT:    pushq %r13
+; X64-NEXT:    pushq %r12
+; X64-NEXT:    pushq %rbx
+; X64-NEXT:    movq %rdi, %r14
+; X64-NEXT:    movd %r8d, %xmm0
+; X64-NEXT:    movd %ecx, %xmm1
+; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
+; X64-NEXT:    movd %edx, %xmm2
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
+; X64-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; X64-NEXT:    movd %r9d, %xmm1
+; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
+; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
+; X64-NEXT:    psllw $9, %xmm0
+; X64-NEXT:    psraw $9, %xmm0
+; X64-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; X64-NEXT:    punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
+; X64-NEXT:    movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
+; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3]
+; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
+; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
+; X64-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
+; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
+; X64-NEXT:    psllw $9, %xmm1
+; X64-NEXT:    psraw $9, %xmm1
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    movd %xmm0, %esi
+; X64-NEXT:    xorl %eax, %eax
+; X64-NEXT:    cmpw %dx, %si
+; X64-NEXT:    setg %al
+; X64-NEXT:    movl $65535, %ebp # imm = 0xFFFF
+; X64-NEXT:    cmovll %ebp, %eax
+; X64-NEXT:    shlq $57, %rax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq %rax, %rcx
+; X64-NEXT:    sarq $63, %rcx
+; X64-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    pextrw $5, %xmm1, %esi
+; X64-NEXT:    pextrw $5, %xmm0, %edi
+; X64-NEXT:    xorl %r9d, %r9d
+; X64-NEXT:    cmpw %si, %di
+; X64-NEXT:    setg %r9b
+; X64-NEXT:    cmovll %ebp, %r9d
+; X64-NEXT:    shlq $57, %r9
+; X64-NEXT:    movq %r9, %rdi
+; X64-NEXT:    sarq $57, %rdi
+; X64-NEXT:    sarq $63, %r9
+; X64-NEXT:    pextrw $1, %xmm1, %esi
+; X64-NEXT:    pextrw $1, %xmm0, %r8d
+; X64-NEXT:    xorl %ebx, %ebx
+; X64-NEXT:    cmpw %si, %r8w
+; X64-NEXT:    setg %bl
+; X64-NEXT:    cmovll %ebp, %ebx
+; X64-NEXT:    shlq $57, %rbx
+; X64-NEXT:    movq %rbx, %rsi
+; X64-NEXT:    sarq $57, %rsi
+; X64-NEXT:    sarq $63, %rbx
+; X64-NEXT:    pextrw $2, %xmm1, %r10d
+; X64-NEXT:    pextrw $2, %xmm0, %r11d
+; X64-NEXT:    xorl %r8d, %r8d
+; X64-NEXT:    cmpw %r10w, %r11w
+; X64-NEXT:    setg %r8b
+; X64-NEXT:    cmovll %ebp, %r8d
+; X64-NEXT:    shlq $57, %r8
+; X64-NEXT:    movq %r8, %rdx
+; X64-NEXT:    sarq $57, %rdx
+; X64-NEXT:    sarq $63, %r8
+; X64-NEXT:    pextrw $3, %xmm1, %r11d
+; X64-NEXT:    pextrw $3, %xmm0, %r15d
+; X64-NEXT:    xorl %r10d, %r10d
+; X64-NEXT:    cmpw %r11w, %r15w
+; X64-NEXT:    setg %r10b
+; X64-NEXT:    cmovll %ebp, %r10d
+; X64-NEXT:    shlq $57, %r10
+; X64-NEXT:    movq %r10, %r11
+; X64-NEXT:    sarq $57, %r11
+; X64-NEXT:    sarq $63, %r10
+; X64-NEXT:    pextrw $4, %xmm1, %r12d
+; X64-NEXT:    pextrw $4, %xmm0, %r13d
+; X64-NEXT:    xorl %r15d, %r15d
+; X64-NEXT:    cmpw %r12w, %r13w
+; X64-NEXT:    setg %r15b
+; X64-NEXT:    cmovll %ebp, %r15d
+; X64-NEXT:    shlq $57, %r15
+; X64-NEXT:    movq %r15, %r12
+; X64-NEXT:    sarq $57, %r12
+; X64-NEXT:    sarq $63, %r15
+; X64-NEXT:    pextrw $6, %xmm1, %ecx
+; X64-NEXT:    pextrw $6, %xmm0, %eax
+; X64-NEXT:    xorl %r13d, %r13d
+; X64-NEXT:    cmpw %cx, %ax
+; X64-NEXT:    setg %r13b
+; X64-NEXT:    cmovll %ebp, %r13d
+; X64-NEXT:    shlq $57, %r13
+; X64-NEXT:    movq %r13, %rbp
+; X64-NEXT:    sarq $57, %rbp
+; X64-NEXT:    sarq $63, %r13
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sarq $57, %rax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq %rax, (%r14)
+; X64-NEXT:    movq %r13, %rax
+; X64-NEXT:    shldq $62, %rbp, %rax
+; X64-NEXT:    movq %rax, 88(%r14)
+; X64-NEXT:    movq %r15, %rax
+; X64-NEXT:    shldq $20, %r12, %rax
+; X64-NEXT:    movq %rax, 64(%r14)
+; X64-NEXT:    movq %r10, %rax
+; X64-NEXT:    shldq $31, %r11, %rax
+; X64-NEXT:    movq %rax, 48(%r14)
+; X64-NEXT:    movq %r8, %rax
+; X64-NEXT:    shldq $42, %rdx, %rax
+; X64-NEXT:    movq %rax, 32(%r14)
+; X64-NEXT:    movabsq $9007199254738944, %rax # imm = 0x1FFFFFFFFFF800
+; X64-NEXT:    andq %rbx, %rax
+; X64-NEXT:    shldq $53, %rsi, %rbx
+; X64-NEXT:    movq %rbx, 16(%r14)
+; X64-NEXT:    movq %r13, %rcx
+; X64-NEXT:    shrq $34, %rcx
+; X64-NEXT:    movw %cx, 100(%r14)
+; X64-NEXT:    movabsq $9007199254740991, %rbx # imm = 0x1FFFFFFFFFFFFF
+; X64-NEXT:    andq %rbx, %r9
+; X64-NEXT:    shldq $9, %rdi, %r9
+; X64-NEXT:    shlq $62, %rbp
+; X64-NEXT:    orq %r9, %rbp
+; X64-NEXT:    shrq $2, %r13
+; X64-NEXT:    movl %r13d, 96(%r14)
+; X64-NEXT:    movq %rbp, 80(%r14)
+; X64-NEXT:    shlq $42, %rdx
+; X64-NEXT:    shrq $11, %rax
+; X64-NEXT:    orq %rdx, %rax
+; X64-NEXT:    movq %rax, 24(%r14)
+; X64-NEXT:    movabsq $2251799813685247, %rax # imm = 0x7FFFFFFFFFFFF
+; X64-NEXT:    andq %r13, %rax
+; X64-NEXT:    shrq $48, %rax
+; X64-NEXT:    movb %al, 102(%r14)
+; X64-NEXT:    shlq $9, %rdi
+; X64-NEXT:    shrq $44, %r15
+; X64-NEXT:    andl $511, %r15d # imm = 0x1FF
+; X64-NEXT:    orq %rdi, %r15
+; X64-NEXT:    movq %r15, 72(%r14)
+; X64-NEXT:    shlq $20, %r12
+; X64-NEXT:    shrq $33, %r10
+; X64-NEXT:    andl $1048575, %r10d # imm = 0xFFFFF
+; X64-NEXT:    orq %r12, %r10
+; X64-NEXT:    movq %r10, 56(%r14)
+; X64-NEXT:    shlq $31, %r11
+; X64-NEXT:    shrq $22, %r8
+; X64-NEXT:    andl $2147483647, %r8d # imm = 0x7FFFFFFF
+; X64-NEXT:    orq %r11, %r8
+; X64-NEXT:    movq %r8, 40(%r14)
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Folded Reload
+; X64-NEXT:    # xmm0 = mem[0],zero
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 8-byte Folded Reload
+; X64-NEXT:    # xmm1 = mem[0],zero
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
+; X64-NEXT:    movq %xmm0, %rax
+; X64-NEXT:    andq %rbx, %rax
+; X64-NEXT:    shlq $53, %rsi
+; X64-NEXT:    orq %rax, %rsi
+; X64-NEXT:    movq %rsi, 8(%r14)
+; X64-NEXT:    movq %r14, %rax
+; X64-NEXT:    popq %rbx
+; X64-NEXT:    popq %r12
+; X64-NEXT:    popq %r13
+; X64-NEXT:    popq %r14
+; X64-NEXT:    popq %r15
+; X64-NEXT:    popq %rbp
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_uncommon_vectors:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    subl $44, %esp
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ah
+; X86-NEXT:    addb %ah, %ah
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %bh
+; X86-NEXT:    addb %bh, %bh
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    addb %al, %al
+; X86-NEXT:    sarb %al
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    addb %cl, %cl
+; X86-NEXT:    sarb %cl
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %dh
+; X86-NEXT:    addb %dh, %dh
+; X86-NEXT:    sarb %dh
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %bl
+; X86-NEXT:    addb %bl, %bl
+; X86-NEXT:    sarb %bl
+; X86-NEXT:    cmpb %dh, %bl
+; X86-NEXT:    setg %dh
+; X86-NEXT:    movb $-1, %bl
+; X86-NEXT:    jl .LBB18_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %dh, %bl
+; X86-NEXT:  .LBB18_2:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %dh
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %bl
+; X86-NEXT:    addb %dl, %dl
+; X86-NEXT:    addb %ch, %ch
+; X86-NEXT:    sarb %ah
+; X86-NEXT:    sarb %bh
+; X86-NEXT:    cmpb %al, %cl
+; X86-NEXT:    setg %al
+; X86-NEXT:    movb $-1, %cl
+; X86-NEXT:    jl .LBB18_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %al, %cl
+; X86-NEXT:  .LBB18_4:
+; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    addb %dh, %dh
+; X86-NEXT:    addb %bl, %bl
+; X86-NEXT:    sarb %dl
+; X86-NEXT:    sarb %ch
+; X86-NEXT:    cmpb %ah, %bh
+; X86-NEXT:    setg %ah
+; X86-NEXT:    movb $-1, %bh
+; X86-NEXT:    jl .LBB18_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %ah, %bh
+; X86-NEXT:  .LBB18_6:
+; X86-NEXT:    movb %bh, (%esp) # 1-byte Spill
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %bh
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ah
+; X86-NEXT:    addb %al, %al
+; X86-NEXT:    addb %cl, %cl
+; X86-NEXT:    sarb %dh
+; X86-NEXT:    sarb %bl
+; X86-NEXT:    cmpb %dl, %ch
+; X86-NEXT:    setg %dl
+; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    jl .LBB18_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %dl, %ch
+; X86-NEXT:  .LBB18_8:
+; X86-NEXT:    addb %bh, %bh
+; X86-NEXT:    addb %ah, %ah
+; X86-NEXT:    sarb %al
+; X86-NEXT:    sarb %cl
+; X86-NEXT:    cmpb %dh, %bl
+; X86-NEXT:    setg %dl
+; X86-NEXT:    movb $-1, %bl
+; X86-NEXT:    jl .LBB18_10
+; X86-NEXT:  # %bb.9:
+; X86-NEXT:    movb %dl, %bl
+; X86-NEXT:  .LBB18_10:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sarb %bh
+; X86-NEXT:    sarb %ah
+; X86-NEXT:    cmpb %al, %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB18_12
+; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movb %cl, %al
+; X86-NEXT:  .LBB18_12:
+; X86-NEXT:    cmpb %bh, %ah
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movb $-1, %dl
+; X86-NEXT:    jl .LBB18_14
+; X86-NEXT:  # %bb.13:
+; X86-NEXT:    movl %ecx, %edx
+; X86-NEXT:  .LBB18_14:
+; X86-NEXT:    movzbl %dl, %edx
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    shll $25, %edx
+; X86-NEXT:    movl %edx, %edi
+; X86-NEXT:    sarl $31, %edi
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %edi, 96(%esi)
+; X86-NEXT:    movl %edi, 92(%esi)
+; X86-NEXT:    movzbl %al, %eax
+; X86-NEXT:    shll $25, %eax
+; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    sarl $31, %eax
+; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %eax, 80(%esi)
+; X86-NEXT:    movzbl %bl, %eax
+; X86-NEXT:    shll $25, %eax
+; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %eax, %edi
+; X86-NEXT:    sarl $31, %edi
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %edi, 68(%esi)
+; X86-NEXT:    movl %edi, 64(%esi)
+; X86-NEXT:    movzbl %ch, %ebp
+; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    shll $25, %ebp
+; X86-NEXT:    movl %ebp, %ebx
+; X86-NEXT:    sarl $31, %ebx
+; X86-NEXT:    movl %ebx, 52(%esi)
+; X86-NEXT:    movl %ebx, 48(%esi)
+; X86-NEXT:    movzbl (%esp), %eax # 1-byte Folded Reload
+; X86-NEXT:    shll $25, %eax
+; X86-NEXT:    movl %eax, (%esp) # 4-byte Spill
+; X86-NEXT:    movl %eax, %ecx
+; X86-NEXT:    sarl $31, %ecx
+; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %ecx, 36(%esi)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
+; X86-NEXT:    shll $25, %edi
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    sarl $31, %edi
+; X86-NEXT:    movl %edi, 24(%esi)
+; X86-NEXT:    movl %edi, 20(%esi)
+; X86-NEXT:    movl %esi, %eax
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
+; X86-NEXT:    shll $25, %esi
+; X86-NEXT:    movl %esi, %ecx
+; X86-NEXT:    sarl $31, %ecx
+; X86-NEXT:    movl %ecx, 8(%eax)
+; X86-NEXT:    movl %ecx, 4(%eax)
+; X86-NEXT:    sarl $25, %esi
+; X86-NEXT:    movl %esi, (%eax)
+; X86-NEXT:    sarl $25, %edx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    shrdl $2, %esi, %edx
+; X86-NEXT:    movl %edx, 88(%eax)
+; X86-NEXT:    sarl $25, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    movl %esi, %edx
+; X86-NEXT:    andl $2097151, %edx # imm = 0x1FFFFF
+; X86-NEXT:    shldl $9, %esi, %edx
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    shldl $9, %edx, %esi
+; X86-NEXT:    movl %esi, 76(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    sarl $25, %edx
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    shldl $20, %edx, %esi
+; X86-NEXT:    movl %esi, 60(%eax)
+; X86-NEXT:    sarl $25, %ebp
+; X86-NEXT:    shrdl $1, %ebx, %ebp
+; X86-NEXT:    movl %ebp, 44(%eax)
+; X86-NEXT:    movl (%esp), %edx # 4-byte Reload
+; X86-NEXT:    sarl $25, %edx
+; X86-NEXT:    movl %edx, (%esp) # 4-byte Spill
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    movl %esi, %ebp
+; X86-NEXT:    andl $2097151, %ebp # imm = 0x1FFFFF
+; X86-NEXT:    shldl $10, %esi, %ebp
+; X86-NEXT:    shldl $10, %edx, %esi
+; X86-NEXT:    movl %eax, %edx
+; X86-NEXT:    movl %esi, 32(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
+; X86-NEXT:    sarl $25, %eax
+; X86-NEXT:    movl %edi, %esi
+; X86-NEXT:    shldl $21, %eax, %esi
+; X86-NEXT:    movl %esi, 16(%edx)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    shrl $2, %esi
+; X86-NEXT:    movw %si, 100(%edx)
+; X86-NEXT:    shll $21, %eax
+; X86-NEXT:    andl $2097151, %ecx # imm = 0x1FFFFF
+; X86-NEXT:    orl %eax, %ecx
+; X86-NEXT:    movl %ecx, 12(%edx)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shll $30, %ecx
+; X86-NEXT:    addl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Folded Reload
+; X86-NEXT:    movl %ecx, 84(%edx)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shll $9, %ecx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
+; X86-NEXT:    shrl $12, %eax
+; X86-NEXT:    andl $511, %eax # imm = 0x1FF
+; X86-NEXT:    orl %ecx, %eax
+; X86-NEXT:    movl %eax, 72(%edx)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shll $20, %ecx
+; X86-NEXT:    shrl %ebx
+; X86-NEXT:    andl $1048575, %ebx # imm = 0xFFFFF
+; X86-NEXT:    orl %ecx, %ebx
+; X86-NEXT:    movl %ebx, 56(%edx)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shll $31, %ecx
+; X86-NEXT:    orl %ebp, %ecx
+; X86-NEXT:    movl %ecx, 40(%edx)
+; X86-NEXT:    movl %edx, %ecx
+; X86-NEXT:    movl (%esp), %edx # 4-byte Reload
+; X86-NEXT:    shll $10, %edx
+; X86-NEXT:    shrl $11, %edi
+; X86-NEXT:    andl $1023, %edi # imm = 0x3FF
+; X86-NEXT:    orl %edx, %edi
+; X86-NEXT:    movl %edi, 28(%ecx)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
+; X86-NEXT:    shrl $18, %eax
+; X86-NEXT:    andl $7, %eax
+; X86-NEXT:    movb %al, 102(%ecx)
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:    addl $44, %esp
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <7 x i117> @llvm.scmp(<7 x i7> %x, <7 x i7> %y)
   ret <7 x i117> %1
 }
 
 define <1 x i3> @scmp_scalarize(<1 x i33> %x, <1 x i33> %y) nounwind {
-; CHECK-LABEL: scmp_scalarize:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    shlq $31, %rsi
-; CHECK-NEXT:    sarq $31, %rsi
-; CHECK-NEXT:    shlq $31, %rdi
-; CHECK-NEXT:    sarq $31, %rdi
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    setg %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovgel %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_scalarize:
+; X64:       # %bb.0:
+; X64-NEXT:    shlq $31, %rsi
+; X64-NEXT:    sarq $31, %rsi
+; X64-NEXT:    shlq $31, %rdi
+; X64-NEXT:    sarq $31, %rdi
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    setg %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovgel %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_scalarize:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    andl $1, %eax
+; X86-NEXT:    negl %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    andl $1, %edi
+; X86-NEXT:    negl %edi
+; X86-NEXT:    cmpl %ecx, %esi
+; X86-NEXT:    movl %edi, %edx
+; X86-NEXT:    sbbl %eax, %edx
+; X86-NEXT:    setl %dl
+; X86-NEXT:    cmpl %esi, %ecx
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB19_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %edx, %eax
+; X86-NEXT:  .LBB19_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call <1 x i3> @llvm.scmp(<1 x i33> %x, <1 x i33> %y)
   ret <1 x i3> %1
 }
 
 define <2 x i8> @scmp_bool_operands(<2 x i1> %x, <2 x i1> %y) nounwind {
-; CHECK-LABEL: scmp_bool_operands:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    psllq $63, %xmm0
-; CHECK-NEXT:    psrad $31, %xmm0
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
-; CHECK-NEXT:    psllq $63, %xmm1
-; CHECK-NEXT:    psrad $31, %xmm1
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[1,1,3,3]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[3,3,3,3]
-; CHECK-NEXT:    movq %xmm1, %rax
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[3,3,3,3]
-; CHECK-NEXT:    movq %xmm0, %rcx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpq %rax, %rcx
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovlq %rax, %rdx
-; CHECK-NEXT:    movq %rdx, %xmm0
-; CHECK-NEXT:    movq %xmm3, %rcx
-; CHECK-NEXT:    movq %xmm2, %rdx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpq %rcx, %rdx
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovlq %rax, %rsi
-; CHECK-NEXT:    movq %rsi, %xmm1
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
-; CHECK-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
-; CHECK-NEXT:    packuswb %xmm1, %xmm1
-; CHECK-NEXT:    packuswb %xmm1, %xmm1
-; CHECK-NEXT:    packuswb %xmm1, %xmm1
-; CHECK-NEXT:    psllw $7, %xmm1
-; CHECK-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
-; CHECK-NEXT:    pxor %xmm0, %xmm0
-; CHECK-NEXT:    pcmpgtb %xmm1, %xmm0
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_bool_operands:
+; X64:       # %bb.0:
+; X64-NEXT:    psllq $63, %xmm0
+; X64-NEXT:    psrad $31, %xmm0
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
+; X64-NEXT:    psllq $63, %xmm1
+; X64-NEXT:    psrad $31, %xmm1
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[1,1,3,3]
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[3,3,3,3]
+; X64-NEXT:    movq %xmm1, %rax
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[3,3,3,3]
+; X64-NEXT:    movq %xmm0, %rcx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpq %rax, %rcx
+; X64-NEXT:    setg %dl
+; X64-NEXT:    movq $-1, %rax
+; X64-NEXT:    cmovlq %rax, %rdx
+; X64-NEXT:    movq %rdx, %xmm0
+; X64-NEXT:    movq %xmm3, %rcx
+; X64-NEXT:    movq %xmm2, %rdx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpq %rcx, %rdx
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovlq %rax, %rsi
+; X64-NEXT:    movq %rsi, %xmm1
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
+; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
+; X64-NEXT:    packuswb %xmm1, %xmm1
+; X64-NEXT:    packuswb %xmm1, %xmm1
+; X64-NEXT:    packuswb %xmm1, %xmm1
+; X64-NEXT:    psllw $7, %xmm1
+; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
+; X64-NEXT:    pxor %xmm0, %xmm0
+; X64-NEXT:    pcmpgtb %xmm1, %xmm0
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_bool_operands:
+; X86:       # %bb.0:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    andb $1, %cl
+; X86-NEXT:    negb %cl
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ah
+; X86-NEXT:    andb $1, %ah
+; X86-NEXT:    negb %ah
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    andb $1, %al
+; X86-NEXT:    negb %al
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    andb $1, %dl
+; X86-NEXT:    negb %dl
+; X86-NEXT:    cmpb %al, %dl
+; X86-NEXT:    setg %ch
+; X86-NEXT:    movb $-1, %dl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jl .LBB20_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %ch, %al
+; X86-NEXT:  .LBB20_2:
+; X86-NEXT:    cmpb %cl, %ah
+; X86-NEXT:    setg %cl
+; X86-NEXT:    jl .LBB20_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movl %ecx, %edx
+; X86-NEXT:  .LBB20_4:
+; X86-NEXT:    retl
   %1 = call <2 x i8> @llvm.scmp(<2 x i1> %x, <2 x i1> %y)
   ret <2 x i8> %1
 }
 
 define <2 x i16> @scmp_ret_wider_than_operands(<2 x i8> %x, <2 x i8> %y) nounwind {
-; CHECK-LABEL: scmp_ret_wider_than_operands:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movaps %xmm1, -{{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %al
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    shll $24, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; CHECK-NEXT:    setg %sil
-; CHECK-NEXT:    cmovll %eax, %esi
-; CHECK-NEXT:    movzbl %sil, %ecx
-; CHECK-NEXT:    shll $8, %ecx
-; CHECK-NEXT:    orl %edx, %ecx
-; CHECK-NEXT:    movd %ecx, %xmm0
-; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    shll $8, %edx
-; CHECK-NEXT:    pinsrw $2, %edx, %xmm0
-; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    shll $8, %edx
-; CHECK-NEXT:    pinsrw $3, %edx, %xmm0
-; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    shll $8, %edx
-; CHECK-NEXT:    pinsrw $4, %edx, %xmm0
-; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    shll $8, %edx
-; CHECK-NEXT:    pinsrw $5, %edx, %xmm0
-; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    shll $8, %edx
-; CHECK-NEXT:    pinsrw $6, %edx, %xmm0
-; CHECK-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; CHECK-NEXT:    setg %dl
-; CHECK-NEXT:    cmovll %eax, %edx
-; CHECK-NEXT:    shll $8, %edx
-; CHECK-NEXT:    pinsrw $7, %edx, %xmm0
-; CHECK-NEXT:    psraw $8, %xmm0
-; CHECK-NEXT:    retq
+; X64-LABEL: scmp_ret_wider_than_operands:
+; X64:       # %bb.0:
+; X64-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
+; X64-NEXT:    movaps %xmm1, -{{[0-9]+}}(%rsp)
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %al
+; X64-NEXT:    setg %dl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    shll $24, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovll %eax, %esi
+; X64-NEXT:    movzbl %sil, %ecx
+; X64-NEXT:    shll $8, %ecx
+; X64-NEXT:    orl %edx, %ecx
+; X64-NEXT:    movd %ecx, %xmm0
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    shll $8, %edx
+; X64-NEXT:    pinsrw $2, %edx, %xmm0
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    shll $8, %edx
+; X64-NEXT:    pinsrw $3, %edx, %xmm0
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    shll $8, %edx
+; X64-NEXT:    pinsrw $4, %edx, %xmm0
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    shll $8, %edx
+; X64-NEXT:    pinsrw $5, %edx, %xmm0
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    shll $8, %edx
+; X64-NEXT:    pinsrw $6, %edx, %xmm0
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    shll $8, %edx
+; X64-NEXT:    pinsrw $7, %edx, %xmm0
+; X64-NEXT:    psraw $8, %xmm0
+; X64-NEXT:    retq
+;
+; X86-LABEL: scmp_ret_wider_than_operands:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    setg %ch
+; X86-NEXT:    movl $65535, %edx # imm = 0xFFFF
+; X86-NEXT:    movl $65535, %eax # imm = 0xFFFF
+; X86-NEXT:    jl .LBB21_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %ch, %bl
+; X86-NEXT:    movl %ebx, %eax
+; X86-NEXT:  .LBB21_2:
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    setg %cl
+; X86-NEXT:    jl .LBB21_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:  .LBB21_4:
+; X86-NEXT:    # kill: def $ax killed $ax killed $eax
+; X86-NEXT:    # kill: def $dx killed $dx killed $edx
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    retl
   %1 = call <2 x i16> @llvm.scmp(<2 x i8> %x, <2 x i8> %y)
   ret <2 x i16> %1
 }
diff --git a/llvm/test/CodeGen/X86/ucmp.ll b/llvm/test/CodeGen/X86/ucmp.ll
index 70a1ca3431a35..724dcc5aa2a60 100644
--- a/llvm/test/CodeGen/X86/ucmp.ll
+++ b/llvm/test/CodeGen/X86/ucmp.ll
@@ -1,1071 +1,2446 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
+; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86
 
 define i8 @ucmp.8.8(i8 %x, i8 %y) nounwind {
-; CHECK-LABEL: ucmp.8.8:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpb %sil, %dil
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp.8.8:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpb %sil, %dil
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovael %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp.8.8:
+; X86:       # %bb.0:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jb .LBB0_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB0_2:
+; X86-NEXT:    retl
   %1 = call i8 @llvm.ucmp(i8 %x, i8 %y)
   ret i8 %1
 }
 
 define i8 @ucmp.8.16(i16 %x, i16 %y) nounwind {
-; CHECK-LABEL: ucmp.8.16:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpw %si, %di
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp.8.16:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpw %si, %di
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovael %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp.8.16:
+; X86:       # %bb.0:
+; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpw {{[0-9]+}}(%esp), %ax
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jb .LBB1_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB1_2:
+; X86-NEXT:    retl
   %1 = call i8 @llvm.ucmp(i16 %x, i16 %y)
   ret i8 %1
 }
 
 define i8 @ucmp.8.32(i32 %x, i32 %y) nounwind {
-; CHECK-LABEL: ucmp.8.32:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp.8.32:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpl %esi, %edi
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovael %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp.8.32:
+; X86:       # %bb.0:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jb .LBB2_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB2_2:
+; X86-NEXT:    retl
   %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
   ret i8 %1
 }
 
 define i8 @ucmp.8.64(i64 %x, i64 %y) nounwind {
-; CHECK-LABEL: ucmp.8.64:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp.8.64:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovael %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp.8.64:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %esi
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    sbbl %edx, %ecx
+; X86-NEXT:    setb %cl
+; X86-NEXT:    cmpl %esi, %eax
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jb .LBB3_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB3_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call i8 @llvm.ucmp(i64 %x, i64 %y)
   ret i8 %1
 }
 
 define i8 @ucmp.8.128(i128 %x, i128 %y) nounwind {
-; CHECK-LABEL: ucmp.8.128:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    cmpq %rdi, %rdx
-; CHECK-NEXT:    movq %rcx, %rax
-; CHECK-NEXT:    sbbq %rsi, %rax
-; CHECK-NEXT:    setb %al
-; CHECK-NEXT:    movzbl %al, %r8d
-; CHECK-NEXT:    cmpq %rdx, %rdi
-; CHECK-NEXT:    sbbq %rcx, %rsi
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %r8d, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp.8.128:
+; X64:       # %bb.0:
+; X64-NEXT:    cmpq %rdi, %rdx
+; X64-NEXT:    movq %rcx, %rax
+; X64-NEXT:    sbbq %rsi, %rax
+; X64-NEXT:    setb %al
+; X64-NEXT:    movzbl %al, %r8d
+; X64-NEXT:    cmpq %rdx, %rdi
+; X64-NEXT:    sbbq %rcx, %rsi
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovael %r8d, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp.8.128:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %ebp, %ebx
+; X86-NEXT:    sbbl %edx, %ebx
+; X86-NEXT:    movl %ecx, %ebx
+; X86-NEXT:    sbbl %eax, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl %esi, %ecx
+; X86-NEXT:    sbbl %ebx, %ecx
+; X86-NEXT:    setb %cl
+; X86-NEXT:    cmpl %edi, {{[0-9]+}}(%esp)
+; X86-NEXT:    sbbl %ebp, %edx
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %esi, %ebx
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jb .LBB4_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB4_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl
   %1 = call i8 @llvm.ucmp(i128 %x, i128 %y)
   ret i8 %1
 }
 
 define i32 @ucmp.32.32(i32 %x, i32 %y) nounwind {
-; CHECK-LABEL: ucmp.32.32:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp.32.32:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpl %esi, %edi
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovael %ecx, %eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp.32.32:
+; X86:       # %bb.0:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ecx, %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %dl
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    jb .LBB5_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %dl, %cl
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB5_2:
+; X86-NEXT:    retl
   %1 = call i32 @llvm.ucmp(i32 %x, i32 %y)
   ret i32 %1
 }
 
 define i32 @ucmp.32.64(i64 %x, i64 %y) nounwind {
-; CHECK-LABEL: ucmp.32.64:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp.32.64:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovael %ecx, %eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp.32.64:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %esi
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    sbbl %edx, %ecx
+; X86-NEXT:    setb %cl
+; X86-NEXT:    cmpl %esi, %eax
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    jb .LBB6_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzbl %cl, %eax
+; X86-NEXT:  .LBB6_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call i32 @llvm.ucmp(i64 %x, i64 %y)
   ret i32 %1
 }
 
 define i64 @ucmp.64.64(i64 %x, i64 %y) nounwind {
-; CHECK-LABEL: ucmp.64.64:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovaeq %rcx, %rax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp.64.64:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movq $-1, %rax
+; X64-NEXT:    cmovaeq %rcx, %rax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp.64.64:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %esi
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    sbbl %edx, %ecx
+; X86-NEXT:    setb %cl
+; X86-NEXT:    cmpl %esi, %eax
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    jb .LBB7_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzbl %cl, %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:  .LBB7_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call i64 @llvm.ucmp(i64 %x, i64 %y)
   ret i64 %1
 }
 
 define i4 @ucmp_narrow_result(i32 %x, i32 %y) nounwind {
-; CHECK-LABEL: ucmp_narrow_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_narrow_result:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpl %esi, %edi
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovael %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_narrow_result:
+; X86:       # %bb.0:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jb .LBB8_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB8_2:
+; X86-NEXT:    retl
   %1 = call i4 @llvm.ucmp(i32 %x, i32 %y)
   ret i4 %1
 }
 
 define i8 @ucmp_narrow_op(i62 %x, i62 %y) nounwind {
-; CHECK-LABEL: ucmp_narrow_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    movabsq $4611686018427387903, %rax # imm = 0x3FFFFFFFFFFFFFFF
-; CHECK-NEXT:    andq %rax, %rsi
-; CHECK-NEXT:    andq %rax, %rdi
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpq %rsi, %rdi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %ecx, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_narrow_op:
+; X64:       # %bb.0:
+; X64-NEXT:    movabsq $4611686018427387903, %rax # imm = 0x3FFFFFFFFFFFFFFF
+; X64-NEXT:    andq %rax, %rsi
+; X64-NEXT:    andq %rax, %rdi
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpq %rsi, %rdi
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovael %ecx, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_narrow_op:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl $1073741823, %eax # imm = 0x3FFFFFFF
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    andl %eax, %edx
+; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %esi, %edi
+; X86-NEXT:    movl %eax, %ecx
+; X86-NEXT:    sbbl %edx, %ecx
+; X86-NEXT:    setb %cl
+; X86-NEXT:    cmpl %edi, %esi
+; X86-NEXT:    sbbl %eax, %edx
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jb .LBB9_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB9_2:
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    retl
   %1 = call i8 @llvm.ucmp(i62 %x, i62 %y)
   ret i8 %1
 }
 
 define i141 @ucmp_wide_result(i32 %x, i32 %y) nounwind {
-; CHECK-LABEL: ucmp_wide_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpl %esi, %edi
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovaeq %rcx, %rax
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_wide_result:
+; X64:       # %bb.0:
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpl %esi, %edi
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movq $-1, %rax
+; X64-NEXT:    cmovaeq %rcx, %rax
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_wide_result:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    xorl %ecx, %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    seta %bl
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jb .LBB10_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %bl, %dl
+; X86-NEXT:    movl %edx, %esi
+; X86-NEXT:  .LBB10_2:
+; X86-NEXT:    sbbl %ecx, %ecx
+; X86-NEXT:    movl %ecx, 4(%eax)
+; X86-NEXT:    movl %esi, (%eax)
+; X86-NEXT:    movl $0, 12(%eax)
+; X86-NEXT:    movl $0, 8(%eax)
+; X86-NEXT:    movw $0, 16(%eax)
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    retl $4
   %1 = call i141 @llvm.ucmp(i32 %x, i32 %y)
   ret i141 %1
 }
 
 define i8 @ucmp_wide_op(i109 %x, i109 %y) nounwind {
-; CHECK-LABEL: ucmp_wide_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    movabsq $35184372088831, %rax # imm = 0x1FFFFFFFFFFF
-; CHECK-NEXT:    andq %rax, %rsi
-; CHECK-NEXT:    andq %rax, %rcx
-; CHECK-NEXT:    cmpq %rdi, %rdx
-; CHECK-NEXT:    movq %rcx, %rax
-; CHECK-NEXT:    sbbq %rsi, %rax
-; CHECK-NEXT:    setb %al
-; CHECK-NEXT:    movzbl %al, %r8d
-; CHECK-NEXT:    cmpq %rdx, %rdi
-; CHECK-NEXT:    sbbq %rcx, %rsi
-; CHECK-NEXT:    movl $255, %eax
-; CHECK-NEXT:    cmovael %r8d, %eax
-; CHECK-NEXT:    # kill: def $al killed $al killed $eax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_wide_op:
+; X64:       # %bb.0:
+; X64-NEXT:    movabsq $35184372088831, %rax # imm = 0x1FFFFFFFFFFF
+; X64-NEXT:    andq %rax, %rsi
+; X64-NEXT:    andq %rax, %rcx
+; X64-NEXT:    cmpq %rdi, %rdx
+; X64-NEXT:    movq %rcx, %rax
+; X64-NEXT:    sbbq %rsi, %rax
+; X64-NEXT:    setb %al
+; X64-NEXT:    movzbl %al, %r8d
+; X64-NEXT:    cmpq %rdx, %rdi
+; X64-NEXT:    sbbq %rcx, %rsi
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovael %r8d, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_wide_op:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    pushl %eax
+; X86-NEXT:    movl $8191, %eax # imm = 0x1FFF
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    andl %eax, %ecx
+; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %edx, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %edi, %esi
+; X86-NEXT:    sbbl %ebx, %esi
+; X86-NEXT:    movl %eax, %esi
+; X86-NEXT:    sbbl %ecx, %esi
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %ebp, {{[0-9]+}}(%esp)
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl %edi, %ebx
+; X86-NEXT:    sbbl %eax, %ecx
+; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    jb .LBB11_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:  .LBB11_2:
+; X86-NEXT:    addl $4, %esp
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl
   %1 = call i8 @llvm.ucmp(i109 %x, i109 %y)
   ret i8 %1
 }
 
 define i41 @ucmp_uncommon_types(i7 %x, i7 %y) nounwind {
-; CHECK-LABEL: ucmp_uncommon_types:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    andb $127, %sil
-; CHECK-NEXT:    andb $127, %dil
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    cmpb %sil, %dil
-; CHECK-NEXT:    seta %cl
-; CHECK-NEXT:    movq $-1, %rax
-; CHECK-NEXT:    cmovaeq %rcx, %rax
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_uncommon_types:
+; X64:       # %bb.0:
+; X64-NEXT:    andb $127, %sil
+; X64-NEXT:    andb $127, %dil
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpb %sil, %dil
+; X64-NEXT:    seta %cl
+; X64-NEXT:    movq $-1, %rax
+; X64-NEXT:    cmovaeq %rcx, %rax
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_uncommon_types:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    andb $127, %al
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ah
+; X86-NEXT:    andb $127, %ah
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    xorl %ecx, %ecx
+; X86-NEXT:    cmpb %al, %ah
+; X86-NEXT:    seta %bl
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    jb .LBB12_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %bl, %cl
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:  .LBB12_2:
+; X86-NEXT:    sbbl %edx, %edx
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    retl
   %1 = call i41 @llvm.ucmp(i7 %x, i7 %y)
   ret i41 %1
 }
 
 define <4 x i32> @ucmp_normal_vectors(<4 x i32> %x, <4 x i32> %y) nounwind {
-; CHECK-LABEL: ucmp_normal_vectors:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %eax
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    seta %dl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovbl %eax, %edx
-; CHECK-NEXT:    movd %edx, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
-; CHECK-NEXT:    movdqa %xmm2, %xmm0
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_normal_vectors:
+; X64:       # %bb.0:
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %eax
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    seta %dl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovbl %eax, %edx
+; X64-NEXT:    movd %edx, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
+; X64-NEXT:    movdqa %xmm2, %xmm0
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_normal_vectors:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    jb .LBB13_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %ebp
+; X86-NEXT:  .LBB13_2:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jb .LBB13_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %esi
+; X86-NEXT:  .LBB13_4:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jb .LBB13_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edi
+; X86-NEXT:  .LBB13_6:
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    seta %cl
+; X86-NEXT:    jb .LBB13_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:  .LBB13_8:
+; X86-NEXT:    movl %edx, 12(%eax)
+; X86-NEXT:    movl %edi, 8(%eax)
+; X86-NEXT:    movl %esi, 4(%eax)
+; X86-NEXT:    movl %ebp, (%eax)
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <4 x i32> @llvm.ucmp(<4 x i32> %x, <4 x i32> %y)
   ret <4 x i32> %1
 }
 
 define <4 x i8> @ucmp_narrow_vec_result(<4 x i32> %x, <4 x i32> %y) nounwind {
-; CHECK-LABEL: ucmp_narrow_vec_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %eax
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    seta %dl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovbl %eax, %edx
-; CHECK-NEXT:    movd %edx, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; CHECK-NEXT:    movd %xmm3, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
-; CHECK-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2
-; CHECK-NEXT:    pxor %xmm0, %xmm0
-; CHECK-NEXT:    packuswb %xmm0, %xmm2
-; CHECK-NEXT:    packuswb %xmm0, %xmm2
-; CHECK-NEXT:    movdqa %xmm2, %xmm0
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_narrow_vec_result:
+; X64:       # %bb.0:
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %eax
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    seta %dl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovbl %eax, %edx
+; X64-NEXT:    movd %edx, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
+; X64-NEXT:    movd %xmm3, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
+; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2
+; X64-NEXT:    pxor %xmm0, %xmm0
+; X64-NEXT:    packuswb %xmm0, %xmm2
+; X64-NEXT:    packuswb %xmm0, %xmm2
+; X64-NEXT:    movdqa %xmm2, %xmm0
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_narrow_vec_result:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    seta %ch
+; X86-NEXT:    movb $-1, %dl
+; X86-NEXT:    movb $-1, %cl
+; X86-NEXT:    jb .LBB14_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %ch, %cl
+; X86-NEXT:  .LBB14_2:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    jb .LBB14_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %al, %ch
+; X86-NEXT:  .LBB14_4:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    seta %bl
+; X86-NEXT:    movb $-1, %dh
+; X86-NEXT:    jb .LBB14_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %bl, %dh
+; X86-NEXT:  .LBB14_6:
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    seta %bl
+; X86-NEXT:    jb .LBB14_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %bl, %dl
+; X86-NEXT:  .LBB14_8:
+; X86-NEXT:    movb %dl, 3(%eax)
+; X86-NEXT:    movb %dh, 2(%eax)
+; X86-NEXT:    movb %ch, 1(%eax)
+; X86-NEXT:    movb %cl, (%eax)
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    retl $4
   %1 = call <4 x i8> @llvm.ucmp(<4 x i32> %x, <4 x i32> %y)
   ret <4 x i8> %1
 }
 
 define <4 x i32> @ucmp_narrow_vec_op(<4 x i8> %x, <4 x i8> %y) nounwind {
-; CHECK-LABEL: ucmp_narrow_vec_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pxor %xmm2, %xmm2
-; CHECK-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
-; CHECK-NEXT:    pextrw $0, %xmm1, %ecx
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[3,3,3,3]
-; CHECK-NEXT:    movd %xmm3, %eax
-; CHECK-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
-; CHECK-NEXT:    pextrw $0, %xmm0, %edx
-; CHECK-NEXT:    movdqa %xmm0, %xmm3
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm3[3,3,3,3]
-; CHECK-NEXT:    movd %xmm0, %esi
-; CHECK-NEXT:    xorl %edi, %edi
-; CHECK-NEXT:    cmpl %eax, %esi
-; CHECK-NEXT:    seta %dil
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovbl %eax, %edi
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movd %xmm0, %esi
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
-; CHECK-NEXT:    movd %xmm0, %r8d
-; CHECK-NEXT:    xorl %r9d, %r9d
-; CHECK-NEXT:    cmpl %esi, %r8d
-; CHECK-NEXT:    movd %edi, %xmm0
-; CHECK-NEXT:    seta %r9b
-; CHECK-NEXT:    cmovbl %eax, %r9d
-; CHECK-NEXT:    movd %r9d, %xmm2
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm3[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm1
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm2[0]
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_narrow_vec_op:
+; X64:       # %bb.0:
+; X64-NEXT:    pxor %xmm2, %xmm2
+; X64-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
+; X64-NEXT:    pextrw $0, %xmm1, %ecx
+; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm3, %eax
+; X64-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
+; X64-NEXT:    pextrw $0, %xmm0, %edx
+; X64-NEXT:    movdqa %xmm0, %xmm3
+; X64-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm3[3,3,3,3]
+; X64-NEXT:    movd %xmm0, %esi
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpl %eax, %esi
+; X64-NEXT:    seta %dil
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovbl %eax, %edi
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm0, %esi
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm3[2,3,2,3]
+; X64-NEXT:    movd %xmm0, %r8d
+; X64-NEXT:    xorl %r9d, %r9d
+; X64-NEXT:    cmpl %esi, %r8d
+; X64-NEXT:    movd %edi, %xmm0
+; X64-NEXT:    seta %r9b
+; X64-NEXT:    cmovbl %eax, %r9d
+; X64-NEXT:    movd %r9d, %xmm2
+; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm3[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm1
+; X64-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm2[0]
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_narrow_vec_op:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    jb .LBB15_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %ebp
+; X86-NEXT:  .LBB15_2:
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    xorl %eax, %eax
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    seta %bl
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jb .LBB15_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %bl, %al
+; X86-NEXT:    movl %eax, %esi
+; X86-NEXT:  .LBB15_4:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jb .LBB15_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edi
+; X86-NEXT:  .LBB15_6:
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    seta %cl
+; X86-NEXT:    jb .LBB15_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:  .LBB15_8:
+; X86-NEXT:    movl %edx, 12(%eax)
+; X86-NEXT:    movl %edi, 8(%eax)
+; X86-NEXT:    movl %esi, 4(%eax)
+; X86-NEXT:    movl %ebp, (%eax)
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <4 x i32> @llvm.ucmp(<4 x i8> %x, <4 x i8> %y)
   ret <4 x i32> %1
 }
 
 define <16 x i32> @ucmp_wide_vec_result(<16 x i8> %x, <16 x i8> %y) nounwind {
-; CHECK-LABEL: ucmp_wide_vec_result:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pushq %rbp
-; CHECK-NEXT:    pushq %r15
-; CHECK-NEXT:    pushq %r14
-; CHECK-NEXT:    pushq %r13
-; CHECK-NEXT:    pushq %r12
-; CHECK-NEXT:    pushq %rbx
-; CHECK-NEXT:    pxor %xmm2, %xmm2
-; CHECK-NEXT:    movdqa %xmm1, %xmm4
-; CHECK-NEXT:    punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3],xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
-; CHECK-NEXT:    pextrw $0, %xmm4, %edi
-; CHECK-NEXT:    movdqa %xmm4, %xmm3
-; CHECK-NEXT:    pextrw $4, %xmm4, %r11d
-; CHECK-NEXT:    movdqa %xmm4, %xmm5
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm2[0],xmm5[1],xmm2[1],xmm5[2],xmm2[2],xmm5[3],xmm2[3]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[3,3,3,3]
-; CHECK-NEXT:    movd %xmm4, %eax
-; CHECK-NEXT:    movdqa %xmm0, %xmm6
-; CHECK-NEXT:    punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3],xmm6[4],xmm2[4],xmm6[5],xmm2[5],xmm6[6],xmm2[6],xmm6[7],xmm2[7]
-; CHECK-NEXT:    pextrw $0, %xmm6, %r8d
-; CHECK-NEXT:    movdqa %xmm6, %xmm4
-; CHECK-NEXT:    pextrw $4, %xmm6, %ebx
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
-; CHECK-NEXT:    movd %xmm7, %ecx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    movl $-1, %edx
-; CHECK-NEXT:    cmovbl %edx, %esi
-; CHECK-NEXT:    movl %esi, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
-; CHECK-NEXT:    movd %xmm7, %esi
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
-; CHECK-NEXT:    movd %xmm7, %r9d
-; CHECK-NEXT:    xorl %eax, %eax
-; CHECK-NEXT:    cmpl %esi, %r9d
-; CHECK-NEXT:    seta %al
-; CHECK-NEXT:    cmovbl %edx, %eax
-; CHECK-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %edi, %r8d
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %edx, %esi
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %r8d
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %r9d
-; CHECK-NEXT:    xorl %edi, %edi
-; CHECK-NEXT:    cmpl %r8d, %r9d
-; CHECK-NEXT:    seta %dil
-; CHECK-NEXT:    cmovbl %edx, %edi
-; CHECK-NEXT:    punpckhwd {{.*#+}} xmm3 = xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[3,3,3,3]
-; CHECK-NEXT:    movd %xmm5, %r9d
-; CHECK-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[3,3,3,3]
-; CHECK-NEXT:    movd %xmm5, %r10d
-; CHECK-NEXT:    xorl %r8d, %r8d
-; CHECK-NEXT:    cmpl %r9d, %r10d
-; CHECK-NEXT:    seta %r8b
-; CHECK-NEXT:    cmovbl %edx, %r8d
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[2,3,2,3]
-; CHECK-NEXT:    movd %xmm5, %r10d
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[2,3,2,3]
-; CHECK-NEXT:    movd %xmm5, %ebp
-; CHECK-NEXT:    xorl %r9d, %r9d
-; CHECK-NEXT:    cmpl %r10d, %ebp
-; CHECK-NEXT:    seta %r9b
-; CHECK-NEXT:    cmovbl %edx, %r9d
-; CHECK-NEXT:    xorl %r10d, %r10d
-; CHECK-NEXT:    cmpl %r11d, %ebx
-; CHECK-NEXT:    seta %r10b
-; CHECK-NEXT:    cmovbl %edx, %r10d
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
-; CHECK-NEXT:    movd %xmm3, %ebx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[1,1,1,1]
-; CHECK-NEXT:    movd %xmm3, %ebp
-; CHECK-NEXT:    xorl %r11d, %r11d
-; CHECK-NEXT:    cmpl %ebx, %ebp
-; CHECK-NEXT:    seta %r11b
-; CHECK-NEXT:    cmovbl %edx, %r11d
-; CHECK-NEXT:    punpckhbw {{.*#+}} xmm1 = xmm1[8],xmm2[8],xmm1[9],xmm2[9],xmm1[10],xmm2[10],xmm1[11],xmm2[11],xmm1[12],xmm2[12],xmm1[13],xmm2[13],xmm1[14],xmm2[14],xmm1[15],xmm2[15]
-; CHECK-NEXT:    pextrw $0, %xmm1, %r15d
-; CHECK-NEXT:    movdqa %xmm1, %xmm4
-; CHECK-NEXT:    movdqa %xmm1, %xmm3
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[3,3,3,3]
-; CHECK-NEXT:    movd %xmm5, %ebp
-; CHECK-NEXT:    punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm2[8],xmm0[9],xmm2[9],xmm0[10],xmm2[10],xmm0[11],xmm2[11],xmm0[12],xmm2[12],xmm0[13],xmm2[13],xmm0[14],xmm2[14],xmm0[15],xmm2[15]
-; CHECK-NEXT:    pextrw $0, %xmm0, %r12d
-; CHECK-NEXT:    movdqa %xmm0, %xmm5
-; CHECK-NEXT:    movdqa %xmm0, %xmm6
-; CHECK-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
-; CHECK-NEXT:    movd %xmm7, %r14d
-; CHECK-NEXT:    xorl %ebx, %ebx
-; CHECK-NEXT:    cmpl %ebp, %r14d
-; CHECK-NEXT:    seta %bl
-; CHECK-NEXT:    cmovbl %edx, %ebx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm3[2,3,2,3]
-; CHECK-NEXT:    movd %xmm7, %r14d
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
-; CHECK-NEXT:    movd %xmm7, %r13d
-; CHECK-NEXT:    xorl %ebp, %ebp
-; CHECK-NEXT:    cmpl %r14d, %r13d
-; CHECK-NEXT:    seta %bpl
-; CHECK-NEXT:    cmovbl %edx, %ebp
-; CHECK-NEXT:    xorl %r14d, %r14d
-; CHECK-NEXT:    cmpl %r15d, %r12d
-; CHECK-NEXT:    seta %r14b
-; CHECK-NEXT:    cmovbl %edx, %r14d
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
-; CHECK-NEXT:    movd %xmm3, %r12d
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm6[1,1,1,1]
-; CHECK-NEXT:    movd %xmm3, %r13d
-; CHECK-NEXT:    xorl %r15d, %r15d
-; CHECK-NEXT:    cmpl %r12d, %r13d
-; CHECK-NEXT:    seta %r15b
-; CHECK-NEXT:    cmovbl %edx, %r15d
-; CHECK-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[3,3,3,3]
-; CHECK-NEXT:    movd %xmm3, %r13d
-; CHECK-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm2[4],xmm5[5],xmm2[5],xmm5[6],xmm2[6],xmm5[7],xmm2[7]
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %eax
-; CHECK-NEXT:    xorl %r12d, %r12d
-; CHECK-NEXT:    cmpl %r13d, %eax
-; CHECK-NEXT:    seta %r12b
-; CHECK-NEXT:    cmovbl %edx, %r12d
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm4[2,3,2,3]
-; CHECK-NEXT:    movd %xmm2, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[2,3,2,3]
-; CHECK-NEXT:    movd %xmm2, %eax
-; CHECK-NEXT:    xorl %r13d, %r13d
-; CHECK-NEXT:    cmpl %ecx, %eax
-; CHECK-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm2 # 4-byte Folded Reload
-; CHECK-NEXT:    # xmm2 = mem[0],zero,zero,zero
-; CHECK-NEXT:    pextrw $4, %xmm1, %eax
-; CHECK-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm3 # 4-byte Folded Reload
-; CHECK-NEXT:    # xmm3 = mem[0],zero,zero,zero
-; CHECK-NEXT:    pextrw $4, %xmm0, %ecx
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    movd %edi, %xmm6
-; CHECK-NEXT:    movd %r8d, %xmm7
-; CHECK-NEXT:    movd %r9d, %xmm8
-; CHECK-NEXT:    movd %r10d, %xmm1
-; CHECK-NEXT:    movd %r11d, %xmm9
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; CHECK-NEXT:    movd %ebx, %xmm10
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1]
-; CHECK-NEXT:    movd %ebp, %xmm6
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
-; CHECK-NEXT:    movd %r14d, %xmm2
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm8 = xmm8[0],xmm7[0],xmm8[1],xmm7[1]
-; CHECK-NEXT:    movd %r15d, %xmm3
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm9[0],xmm1[1],xmm9[1]
-; CHECK-NEXT:    movd %r12d, %xmm7
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm8[0]
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm10[0],xmm6[1],xmm10[1]
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm6[0]
-; CHECK-NEXT:    seta %r13b
-; CHECK-NEXT:    cmovbl %edx, %r13d
-; CHECK-NEXT:    movd %r13d, %xmm6
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1]
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %edx, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
-; CHECK-NEXT:    movd %xmm4, %eax
-; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[1,1,1,1]
-; CHECK-NEXT:    movd %xmm4, %ecx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %edx, %esi
-; CHECK-NEXT:    movd %esi, %xmm4
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm6[0]
-; CHECK-NEXT:    popq %rbx
-; CHECK-NEXT:    popq %r12
-; CHECK-NEXT:    popq %r13
-; CHECK-NEXT:    popq %r14
-; CHECK-NEXT:    popq %r15
-; CHECK-NEXT:    popq %rbp
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_wide_vec_result:
+; X64:       # %bb.0:
+; X64-NEXT:    pushq %rbp
+; X64-NEXT:    pushq %r15
+; X64-NEXT:    pushq %r14
+; X64-NEXT:    pushq %r13
+; X64-NEXT:    pushq %r12
+; X64-NEXT:    pushq %rbx
+; X64-NEXT:    pxor %xmm2, %xmm2
+; X64-NEXT:    movdqa %xmm1, %xmm4
+; X64-NEXT:    punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3],xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
+; X64-NEXT:    pextrw $0, %xmm4, %edi
+; X64-NEXT:    movdqa %xmm4, %xmm3
+; X64-NEXT:    pextrw $4, %xmm4, %r11d
+; X64-NEXT:    movdqa %xmm4, %xmm5
+; X64-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm2[0],xmm5[1],xmm2[1],xmm5[2],xmm2[2],xmm5[3],xmm2[3]
+; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[3,3,3,3]
+; X64-NEXT:    movd %xmm4, %eax
+; X64-NEXT:    movdqa %xmm0, %xmm6
+; X64-NEXT:    punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3],xmm6[4],xmm2[4],xmm6[5],xmm2[5],xmm6[6],xmm2[6],xmm6[7],xmm2[7]
+; X64-NEXT:    pextrw $0, %xmm6, %r8d
+; X64-NEXT:    movdqa %xmm6, %xmm4
+; X64-NEXT:    pextrw $4, %xmm6, %ebx
+; X64-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3]
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
+; X64-NEXT:    movd %xmm7, %ecx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    movl $-1, %edx
+; X64-NEXT:    cmovbl %edx, %esi
+; X64-NEXT:    movl %esi, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm5[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %esi
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %r9d
+; X64-NEXT:    xorl %eax, %eax
+; X64-NEXT:    cmpl %esi, %r9d
+; X64-NEXT:    seta %al
+; X64-NEXT:    cmovbl %edx, %eax
+; X64-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %edi, %r8d
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %edx, %esi
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %r8d
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm6[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %r9d
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpl %r8d, %r9d
+; X64-NEXT:    seta %dil
+; X64-NEXT:    cmovbl %edx, %edi
+; X64-NEXT:    punpckhwd {{.*#+}} xmm3 = xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[3,3,3,3]
+; X64-NEXT:    movd %xmm5, %r9d
+; X64-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[3,3,3,3]
+; X64-NEXT:    movd %xmm5, %r10d
+; X64-NEXT:    xorl %r8d, %r8d
+; X64-NEXT:    cmpl %r9d, %r10d
+; X64-NEXT:    seta %r8b
+; X64-NEXT:    cmovbl %edx, %r8d
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[2,3,2,3]
+; X64-NEXT:    movd %xmm5, %r10d
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[2,3,2,3]
+; X64-NEXT:    movd %xmm5, %ebp
+; X64-NEXT:    xorl %r9d, %r9d
+; X64-NEXT:    cmpl %r10d, %ebp
+; X64-NEXT:    seta %r9b
+; X64-NEXT:    cmovbl %edx, %r9d
+; X64-NEXT:    xorl %r10d, %r10d
+; X64-NEXT:    cmpl %r11d, %ebx
+; X64-NEXT:    seta %r10b
+; X64-NEXT:    cmovbl %edx, %r10d
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
+; X64-NEXT:    movd %xmm3, %ebx
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[1,1,1,1]
+; X64-NEXT:    movd %xmm3, %ebp
+; X64-NEXT:    xorl %r11d, %r11d
+; X64-NEXT:    cmpl %ebx, %ebp
+; X64-NEXT:    seta %r11b
+; X64-NEXT:    cmovbl %edx, %r11d
+; X64-NEXT:    punpckhbw {{.*#+}} xmm1 = xmm1[8],xmm2[8],xmm1[9],xmm2[9],xmm1[10],xmm2[10],xmm1[11],xmm2[11],xmm1[12],xmm2[12],xmm1[13],xmm2[13],xmm1[14],xmm2[14],xmm1[15],xmm2[15]
+; X64-NEXT:    pextrw $0, %xmm1, %r15d
+; X64-NEXT:    movdqa %xmm1, %xmm4
+; X64-NEXT:    movdqa %xmm1, %xmm3
+; X64-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm3[3,3,3,3]
+; X64-NEXT:    movd %xmm5, %ebp
+; X64-NEXT:    punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm2[8],xmm0[9],xmm2[9],xmm0[10],xmm2[10],xmm0[11],xmm2[11],xmm0[12],xmm2[12],xmm0[13],xmm2[13],xmm0[14],xmm2[14],xmm0[15],xmm2[15]
+; X64-NEXT:    pextrw $0, %xmm0, %r12d
+; X64-NEXT:    movdqa %xmm0, %xmm5
+; X64-NEXT:    movdqa %xmm0, %xmm6
+; X64-NEXT:    punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3]
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
+; X64-NEXT:    movd %xmm7, %r14d
+; X64-NEXT:    xorl %ebx, %ebx
+; X64-NEXT:    cmpl %ebp, %r14d
+; X64-NEXT:    seta %bl
+; X64-NEXT:    cmovbl %edx, %ebx
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm3[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %r14d
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %r13d
+; X64-NEXT:    xorl %ebp, %ebp
+; X64-NEXT:    cmpl %r14d, %r13d
+; X64-NEXT:    seta %bpl
+; X64-NEXT:    cmovbl %edx, %ebp
+; X64-NEXT:    xorl %r14d, %r14d
+; X64-NEXT:    cmpl %r15d, %r12d
+; X64-NEXT:    seta %r14b
+; X64-NEXT:    cmovbl %edx, %r14d
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
+; X64-NEXT:    movd %xmm3, %r12d
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm6[1,1,1,1]
+; X64-NEXT:    movd %xmm3, %r13d
+; X64-NEXT:    xorl %r15d, %r15d
+; X64-NEXT:    cmpl %r12d, %r13d
+; X64-NEXT:    seta %r15b
+; X64-NEXT:    cmovbl %edx, %r15d
+; X64-NEXT:    punpckhwd {{.*#+}} xmm4 = xmm4[4],xmm2[4],xmm4[5],xmm2[5],xmm4[6],xmm2[6],xmm4[7],xmm2[7]
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm4[3,3,3,3]
+; X64-NEXT:    movd %xmm3, %r13d
+; X64-NEXT:    punpckhwd {{.*#+}} xmm5 = xmm5[4],xmm2[4],xmm5[5],xmm2[5],xmm5[6],xmm2[6],xmm5[7],xmm2[7]
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %eax
+; X64-NEXT:    xorl %r12d, %r12d
+; X64-NEXT:    cmpl %r13d, %eax
+; X64-NEXT:    seta %r12b
+; X64-NEXT:    cmovbl %edx, %r12d
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm4[2,3,2,3]
+; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[2,3,2,3]
+; X64-NEXT:    movd %xmm2, %eax
+; X64-NEXT:    xorl %r13d, %r13d
+; X64-NEXT:    cmpl %ecx, %eax
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm2 # 4-byte Folded Reload
+; X64-NEXT:    # xmm2 = mem[0],zero,zero,zero
+; X64-NEXT:    pextrw $4, %xmm1, %eax
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm3 # 4-byte Folded Reload
+; X64-NEXT:    # xmm3 = mem[0],zero,zero,zero
+; X64-NEXT:    pextrw $4, %xmm0, %ecx
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    movd %edi, %xmm6
+; X64-NEXT:    movd %r8d, %xmm7
+; X64-NEXT:    movd %r9d, %xmm8
+; X64-NEXT:    movd %r10d, %xmm1
+; X64-NEXT:    movd %r11d, %xmm9
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
+; X64-NEXT:    movd %ebx, %xmm10
+; X64-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1]
+; X64-NEXT:    movd %ebp, %xmm6
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm3[0]
+; X64-NEXT:    movd %r14d, %xmm2
+; X64-NEXT:    punpckldq {{.*#+}} xmm8 = xmm8[0],xmm7[0],xmm8[1],xmm7[1]
+; X64-NEXT:    movd %r15d, %xmm3
+; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm9[0],xmm1[1],xmm9[1]
+; X64-NEXT:    movd %r12d, %xmm7
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm8[0]
+; X64-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm10[0],xmm6[1],xmm10[1]
+; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm6[0]
+; X64-NEXT:    seta %r13b
+; X64-NEXT:    cmovbl %edx, %r13d
+; X64-NEXT:    movd %r13d, %xmm6
+; X64-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1]
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %edx, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
+; X64-NEXT:    movd %xmm4, %eax
+; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm5[1,1,1,1]
+; X64-NEXT:    movd %xmm4, %ecx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %edx, %esi
+; X64-NEXT:    movd %esi, %xmm4
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm6[0]
+; X64-NEXT:    popq %rbx
+; X64-NEXT:    popq %r12
+; X64-NEXT:    popq %r13
+; X64-NEXT:    popq %r14
+; X64-NEXT:    popq %r15
+; X64-NEXT:    popq %rbp
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_wide_vec_result:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    subl $48, %esp
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    xorl %ecx, %ecx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %dl
+; X86-NEXT:    seta %dl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jb .LBB16_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %dl, %cl
+; X86-NEXT:    movl %ecx, %esi
+; X86-NEXT:  .LBB16_2:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jb .LBB16_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, %edi
+; X86-NEXT:  .LBB16_4:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    jb .LBB16_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, %ebx
+; X86-NEXT:  .LBB16_6:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    jb .LBB16_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, %ebp
+; X86-NEXT:  .LBB16_8:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jb .LBB16_10
+; X86-NEXT:  # %bb.9:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_10:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jb .LBB16_12
+; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_12:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jb .LBB16_14
+; X86-NEXT:  # %bb.13:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_14:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jb .LBB16_16
+; X86-NEXT:  # %bb.15:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_16:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    jb .LBB16_18
+; X86-NEXT:  # %bb.17:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_18:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, (%esp) # 4-byte Folded Spill
+; X86-NEXT:    jb .LBB16_20
+; X86-NEXT:  # %bb.19:
+; X86-NEXT:    movb %al, %dl
+; X86-NEXT:    movl %edx, (%esp) # 4-byte Spill
+; X86-NEXT:  .LBB16_20:
+; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %edx, %edx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    jb .LBB16_22
+; X86-NEXT:  # %bb.21:
+; X86-NEXT:    movb %cl, %dl
+; X86-NEXT:    movl %edx, %ebx
+; X86-NEXT:  .LBB16_22:
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    jb .LBB16_24
+; X86-NEXT:  # %bb.23:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %ebp
+; X86-NEXT:  .LBB16_24:
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %dl
+; X86-NEXT:    seta %ah
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    jb .LBB16_26
+; X86-NEXT:  # %bb.25:
+; X86-NEXT:    movb %ah, %bl
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:  .LBB16_26:
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    seta %al
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jb .LBB16_28
+; X86-NEXT:  # %bb.27:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %esi
+; X86-NEXT:  .LBB16_28:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jb .LBB16_30
+; X86-NEXT:  # %bb.29:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, %edi
+; X86-NEXT:  .LBB16_30:
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    seta %cl
+; X86-NEXT:    jb .LBB16_32
+; X86-NEXT:  # %bb.31:
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:  .LBB16_32:
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 60(%eax)
+; X86-NEXT:    movl %edi, 56(%eax)
+; X86-NEXT:    movl %esi, 52(%eax)
+; X86-NEXT:    movl %edx, 48(%eax)
+; X86-NEXT:    movl %ebp, 44(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 40(%eax)
+; X86-NEXT:    movl (%esp), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 36(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 32(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 28(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 24(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 20(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 16(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 12(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 8(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, 4(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, (%eax)
+; X86-NEXT:    addl $48, %esp
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <16 x i32> @llvm.ucmp(<16 x i8> %x, <16 x i8> %y)
   ret <16 x i32> %1
 }
 
 define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
-; CHECK-LABEL: ucmp_wide_vec_op:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pshufd {{.*#+}} xmm8 = xmm7[3,3,3,3]
-; CHECK-NEXT:    movd %xmm8, %eax
-; CHECK-NEXT:    pshufd {{.*#+}} xmm8 = xmm3[3,3,3,3]
-; CHECK-NEXT:    movd %xmm8, %ecx
-; CHECK-NEXT:    xorl %edx, %edx
-; CHECK-NEXT:    cmpl %eax, %ecx
-; CHECK-NEXT:    seta %dl
-; CHECK-NEXT:    movl $-1, %eax
-; CHECK-NEXT:    cmovbl %eax, %edx
-; CHECK-NEXT:    movd %edx, %xmm8
-; CHECK-NEXT:    pshufd {{.*#+}} xmm9 = xmm7[2,3,2,3]
-; CHECK-NEXT:    movd %xmm9, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm9 = xmm3[2,3,2,3]
-; CHECK-NEXT:    movd %xmm9, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm9
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1]
-; CHECK-NEXT:    movd %xmm7, %ecx
-; CHECK-NEXT:    movd %xmm3, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm8
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm7[1,1,1,1]
-; CHECK-NEXT:    movd %xmm7, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
-; CHECK-NEXT:    movd %xmm3, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm3
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm8 = xmm8[0],xmm3[0],xmm8[1],xmm3[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm8 = xmm8[0],xmm9[0]
-; CHECK-NEXT:    movdqa {{.*#+}} xmm3 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
-; CHECK-NEXT:    pand %xmm3, %xmm8
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
-; CHECK-NEXT:    movd %xmm7, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm7 = xmm2[3,3,3,3]
-; CHECK-NEXT:    movd %xmm7, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm7
-; CHECK-NEXT:    pshufd {{.*#+}} xmm9 = xmm6[2,3,2,3]
-; CHECK-NEXT:    movd %xmm9, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm9 = xmm2[2,3,2,3]
-; CHECK-NEXT:    movd %xmm9, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm9
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm9 = xmm9[0],xmm7[0],xmm9[1],xmm7[1]
-; CHECK-NEXT:    movd %xmm6, %ecx
-; CHECK-NEXT:    movd %xmm2, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm7
-; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm6[1,1,1,1]
-; CHECK-NEXT:    movd %xmm6, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,1,1,1]
-; CHECK-NEXT:    movd %xmm2, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm7 = xmm7[0],xmm9[0]
-; CHECK-NEXT:    pand %xmm3, %xmm7
-; CHECK-NEXT:    packuswb %xmm8, %xmm7
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
-; CHECK-NEXT:    movd %xmm2, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
-; CHECK-NEXT:    movd %xmm6, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm6 = xmm1[2,3,2,3]
-; CHECK-NEXT:    movd %xmm6, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm6
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    movd %xmm1, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; CHECK-NEXT:    movd %xmm1, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm1
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm6[0]
-; CHECK-NEXT:    pand %xmm3, %xmm2
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm4[3,3,3,3]
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[3,3,3,3]
-; CHECK-NEXT:    movd %xmm1, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm1
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[2,3,2,3]
-; CHECK-NEXT:    movd %xmm5, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm5 = xmm0[2,3,2,3]
-; CHECK-NEXT:    movd %xmm5, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm5
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1]
-; CHECK-NEXT:    movd %xmm4, %ecx
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm1
-; CHECK-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
-; CHECK-NEXT:    movd %xmm4, %ecx
-; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; CHECK-NEXT:    movd %xmm0, %edx
-; CHECK-NEXT:    xorl %esi, %esi
-; CHECK-NEXT:    cmpl %ecx, %edx
-; CHECK-NEXT:    seta %sil
-; CHECK-NEXT:    cmovbl %eax, %esi
-; CHECK-NEXT:    movd %esi, %xmm0
-; CHECK-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
-; CHECK-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm5[0]
-; CHECK-NEXT:    pand %xmm3, %xmm1
-; CHECK-NEXT:    packuswb %xmm2, %xmm1
-; CHECK-NEXT:    packuswb %xmm7, %xmm1
-; CHECK-NEXT:    movdqa %xmm1, %xmm0
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_wide_vec_op:
+; X64:       # %bb.0:
+; X64-NEXT:    pshufd {{.*#+}} xmm8 = xmm7[3,3,3,3]
+; X64-NEXT:    movd %xmm8, %eax
+; X64-NEXT:    pshufd {{.*#+}} xmm8 = xmm3[3,3,3,3]
+; X64-NEXT:    movd %xmm8, %ecx
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpl %eax, %ecx
+; X64-NEXT:    seta %dl
+; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    cmovbl %eax, %edx
+; X64-NEXT:    movd %edx, %xmm8
+; X64-NEXT:    pshufd {{.*#+}} xmm9 = xmm7[2,3,2,3]
+; X64-NEXT:    movd %xmm9, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm9 = xmm3[2,3,2,3]
+; X64-NEXT:    movd %xmm9, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm9
+; X64-NEXT:    punpckldq {{.*#+}} xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1]
+; X64-NEXT:    movd %xmm7, %ecx
+; X64-NEXT:    movd %xmm3, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm8
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm7[1,1,1,1]
+; X64-NEXT:    movd %xmm7, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,1,1,1]
+; X64-NEXT:    movd %xmm3, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    punpckldq {{.*#+}} xmm8 = xmm8[0],xmm3[0],xmm8[1],xmm3[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm8 = xmm8[0],xmm9[0]
+; X64-NEXT:    movdqa {{.*#+}} xmm3 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
+; X64-NEXT:    pand %xmm3, %xmm8
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
+; X64-NEXT:    movd %xmm7, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm2[3,3,3,3]
+; X64-NEXT:    movd %xmm7, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm7
+; X64-NEXT:    pshufd {{.*#+}} xmm9 = xmm6[2,3,2,3]
+; X64-NEXT:    movd %xmm9, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm9 = xmm2[2,3,2,3]
+; X64-NEXT:    movd %xmm9, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm9
+; X64-NEXT:    punpckldq {{.*#+}} xmm9 = xmm9[0],xmm7[0],xmm9[1],xmm7[1]
+; X64-NEXT:    movd %xmm6, %ecx
+; X64-NEXT:    movd %xmm2, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm7
+; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm6[1,1,1,1]
+; X64-NEXT:    movd %xmm6, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,1,1,1]
+; X64-NEXT:    movd %xmm2, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm7 = xmm7[0],xmm9[0]
+; X64-NEXT:    pand %xmm3, %xmm7
+; X64-NEXT:    packuswb %xmm8, %xmm7
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm2, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[2,3,2,3]
+; X64-NEXT:    movd %xmm6, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm6, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm6
+; X64-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[1,1,1,1]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm1
+; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm6[0]
+; X64-NEXT:    pand %xmm3, %xmm2
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm4[3,3,3,3]
+; X64-NEXT:    movd %xmm1, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[3,3,3,3]
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm1
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm4[2,3,2,3]
+; X64-NEXT:    movd %xmm5, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm0[2,3,2,3]
+; X64-NEXT:    movd %xmm5, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm5
+; X64-NEXT:    punpckldq {{.*#+}} xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1]
+; X64-NEXT:    movd %xmm4, %ecx
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm1
+; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,1,1,1]
+; X64-NEXT:    movd %xmm4, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpl %ecx, %edx
+; X64-NEXT:    seta %sil
+; X64-NEXT:    cmovbl %eax, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm5[0]
+; X64-NEXT:    pand %xmm3, %xmm1
+; X64-NEXT:    packuswb %xmm2, %xmm1
+; X64-NEXT:    packuswb %xmm7, %xmm1
+; X64-NEXT:    movdqa %xmm1, %xmm0
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_wide_vec_op:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    subl $12, %esp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    movb $-1, %dl
+; X86-NEXT:    jb .LBB17_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl %ecx, %edx
+; X86-NEXT:  .LBB17_2:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movb $-1, %ah
+; X86-NEXT:    jb .LBB17_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movb %al, %ah
+; X86-NEXT:  .LBB17_4:
+; X86-NEXT:    movb %ah, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    jb .LBB17_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movb %cl, %ch
+; X86-NEXT:  .LBB17_6:
+; X86-NEXT:    movb %ch, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movb $-1, %ah
+; X86-NEXT:    jb .LBB17_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movb %al, %ah
+; X86-NEXT:  .LBB17_8:
+; X86-NEXT:    movb %ah, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    jb .LBB17_10
+; X86-NEXT:  # %bb.9:
+; X86-NEXT:    movb %cl, %ch
+; X86-NEXT:  .LBB17_10:
+; X86-NEXT:    movb %ch, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movb $-1, %ah
+; X86-NEXT:    jb .LBB17_12
+; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movb %al, %ah
+; X86-NEXT:  .LBB17_12:
+; X86-NEXT:    movb %ah, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    jb .LBB17_14
+; X86-NEXT:  # %bb.13:
+; X86-NEXT:    movb %cl, %ch
+; X86-NEXT:  .LBB17_14:
+; X86-NEXT:    movb %ch, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movb $-1, %ah
+; X86-NEXT:    jb .LBB17_16
+; X86-NEXT:  # %bb.15:
+; X86-NEXT:    movb %al, %ah
+; X86-NEXT:  .LBB17_16:
+; X86-NEXT:    movb %ah, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    jb .LBB17_18
+; X86-NEXT:  # %bb.17:
+; X86-NEXT:    movb %cl, %ch
+; X86-NEXT:  .LBB17_18:
+; X86-NEXT:    movb %ch, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movb $-1, %ah
+; X86-NEXT:    jb .LBB17_20
+; X86-NEXT:  # %bb.19:
+; X86-NEXT:    movb %al, %ah
+; X86-NEXT:  .LBB17_20:
+; X86-NEXT:    movb %ah, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movb %dl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    seta %cl
+; X86-NEXT:    movb $-1, %bh
+; X86-NEXT:    jb .LBB17_22
+; X86-NEXT:  # %bb.21:
+; X86-NEXT:    movb %cl, %bh
+; X86-NEXT:  .LBB17_22:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movb $-1, %cl
+; X86-NEXT:    jb .LBB17_24
+; X86-NEXT:  # %bb.23:
+; X86-NEXT:    movl %eax, %ecx
+; X86-NEXT:  .LBB17_24:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    seta %ch
+; X86-NEXT:    movb $-1, %dl
+; X86-NEXT:    jb .LBB17_26
+; X86-NEXT:  # %bb.25:
+; X86-NEXT:    movb %ch, %dl
+; X86-NEXT:  .LBB17_26:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    seta %al
+; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    jb .LBB17_28
+; X86-NEXT:  # %bb.27:
+; X86-NEXT:    movb %al, %ch
+; X86-NEXT:  .LBB17_28:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    seta %bl
+; X86-NEXT:    movb $-1, %dh
+; X86-NEXT:    jb .LBB17_30
+; X86-NEXT:  # %bb.29:
+; X86-NEXT:    movb %bl, %dh
+; X86-NEXT:  .LBB17_30:
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    seta %bl
+; X86-NEXT:    jb .LBB17_32
+; X86-NEXT:  # %bb.31:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB17_32:
+; X86-NEXT:    movb {{[-0-9]+}}(%e{{[sb]}}p), %bl # 1-byte Reload
+; X86-NEXT:    movb %bl, 15(%eax)
+; X86-NEXT:    movb %dh, 14(%eax)
+; X86-NEXT:    movb %ch, 13(%eax)
+; X86-NEXT:    movb %dl, 12(%eax)
+; X86-NEXT:    movb %cl, 11(%eax)
+; X86-NEXT:    movb %bh, 10(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 9(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 8(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 7(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 6(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 5(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 4(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 3(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 2(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, 1(%eax)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, (%eax)
+; X86-NEXT:    addl $12, %esp
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    retl $4
   %1 = call <16 x i8> @llvm.ucmp(<16 x i32> %x, <16 x i32> %y)
   ret <16 x i8> %1
 }
 
 define <17 x i2> @ucmp_uncommon_vectors(<17 x i71> %x, <17 x i71> %y) nounwind {
-; CHECK-LABEL: ucmp_uncommon_vectors:
-; CHECK:       # %bb.0:
-; CHECK-NEXT:    pushq %rbp
-; CHECK-NEXT:    pushq %r15
-; CHECK-NEXT:    pushq %r14
-; CHECK-NEXT:    pushq %r13
-; CHECK-NEXT:    pushq %r12
-; CHECK-NEXT:    pushq %rbx
-; CHECK-NEXT:    subq $168, %rsp
-; CHECK-NEXT:    movq %r9, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq %rdx, %r11
-; CHECK-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    andl $127, %r8d
-; CHECK-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, (%rsp) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r15
-; CHECK-NEXT:    andl $127, %r15d
-; CHECK-NEXT:    movq %r15, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, %rbp
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rbx
-; CHECK-NEXT:    andl $127, %ebx
-; CHECK-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, %r12
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r8
-; CHECK-NEXT:    andl $127, %r8d
-; CHECK-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
-; CHECK-NEXT:    andl $127, %edx
-; CHECK-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq %rax, %r13
-; CHECK-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    andl $127, %r11d
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    andl $127, %eax
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    andl $127, %ecx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r14
-; CHECK-NEXT:    andl $127, %r14d
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r9
-; CHECK-NEXT:    cmpq %rdi, %r9
-; CHECK-NEXT:    movq %r14, %r10
-; CHECK-NEXT:    sbbq %rcx, %r10
-; CHECK-NEXT:    setb %r10b
-; CHECK-NEXT:    cmpq %r9, %rdi
-; CHECK-NEXT:    sbbq %r14, %rcx
-; CHECK-NEXT:    movzbl %r10b, %edi
-; CHECK-NEXT:    movq $-1, %rcx
-; CHECK-NEXT:    cmovbq %rcx, %rdi
-; CHECK-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r9
-; CHECK-NEXT:    cmpq %rsi, %r9
-; CHECK-NEXT:    movq %rax, %rdi
-; CHECK-NEXT:    sbbq %r11, %rdi
-; CHECK-NEXT:    setb %dil
-; CHECK-NEXT:    cmpq %r9, %rsi
-; CHECK-NEXT:    sbbq %rax, %r11
-; CHECK-NEXT:    movzbl %dil, %r14d
-; CHECK-NEXT:    cmovbq %rcx, %r14
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movq %r13, %rcx
-; CHECK-NEXT:    sbbq %rdx, %rcx
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    sbbq %r12, %r8
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    sbbq %rbp, %rbx
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Folded Reload
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movq (%rsp), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Reload
-; CHECK-NEXT:    sbbq %r15, %rcx
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r12 # 8-byte Reload
-; CHECK-NEXT:    movq %r12, %rcx
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r10 # 8-byte Reload
-; CHECK-NEXT:    sbbq %r10, %rcx
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
-; CHECK-NEXT:    movq %rbx, %rcx
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r9 # 8-byte Reload
-; CHECK-NEXT:    sbbq %r9, %rcx
-; CHECK-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdi # 8-byte Reload
-; CHECK-NEXT:    cmpq %rdi, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r8 # 8-byte Reload
-; CHECK-NEXT:    movq %r8, %rbp
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
-; CHECK-NEXT:    sbbq %rsi, %rbp
-; CHECK-NEXT:    setb %bpl
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %r11
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    cmpq %rcx, %r11
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; CHECK-NEXT:    movq %rdx, %r13
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; CHECK-NEXT:    sbbq %rax, %r13
-; CHECK-NEXT:    setb %r13b
-; CHECK-NEXT:    andl $3, %r14d
-; CHECK-NEXT:    cmpq %r11, %rcx
-; CHECK-NEXT:    sbbq %rdx, %rax
-; CHECK-NEXT:    movzbl %r13b, %eax
-; CHECK-NEXT:    movl $-1, %r13d
-; CHECK-NEXT:    cmovbl %r13d, %eax
-; CHECK-NEXT:    andl $3, %eax
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdi
-; CHECK-NEXT:    sbbq %r8, %rsi
-; CHECK-NEXT:    leaq (%r14,%rax,4), %rax
-; CHECK-NEXT:    movzbl %bpl, %ecx
-; CHECK-NEXT:    cmovbl %r13d, %ecx
-; CHECK-NEXT:    andl $3, %ecx
-; CHECK-NEXT:    shll $4, %ecx
-; CHECK-NEXT:    orq %rax, %rcx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    sbbq %rbx, %r9
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %eax
-; CHECK-NEXT:    andl $3, %eax
-; CHECK-NEXT:    shll $6, %eax
-; CHECK-NEXT:    orq %rcx, %rax
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    cmpq %rcx, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    sbbq %r12, %r10
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %ecx
-; CHECK-NEXT:    andl $3, %ecx
-; CHECK-NEXT:    shll $8, %ecx
-; CHECK-NEXT:    orq %rax, %rcx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %eax
-; CHECK-NEXT:    andl $3, %eax
-; CHECK-NEXT:    shll $10, %eax
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
-; CHECK-NEXT:    cmpq %rdx, {{[0-9]+}}(%rsp)
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %edx
-; CHECK-NEXT:    andl $3, %edx
-; CHECK-NEXT:    shll $12, %edx
-; CHECK-NEXT:    orq %rax, %rdx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %esi # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %esi
-; CHECK-NEXT:    andl $3, %esi
-; CHECK-NEXT:    shll $14, %esi
-; CHECK-NEXT:    orq %rdx, %rsi
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %eax
-; CHECK-NEXT:    andl $3, %eax
-; CHECK-NEXT:    shll $16, %eax
-; CHECK-NEXT:    orq %rsi, %rax
-; CHECK-NEXT:    orq %rcx, %rax
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %ecx
-; CHECK-NEXT:    andl $3, %ecx
-; CHECK-NEXT:    shll $18, %ecx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdx
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %edx
-; CHECK-NEXT:    andl $3, %edx
-; CHECK-NEXT:    shll $20, %edx
-; CHECK-NEXT:    orq %rcx, %rdx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq (%rsp), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %ecx
-; CHECK-NEXT:    andl $3, %ecx
-; CHECK-NEXT:    shll $22, %ecx
-; CHECK-NEXT:    orq %rdx, %rcx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdx
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; CHECK-NEXT:    sbbq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Folded Spill
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %edx
-; CHECK-NEXT:    andl $3, %edx
-; CHECK-NEXT:    shll $24, %edx
-; CHECK-NEXT:    orq %rcx, %rdx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %ecx
-; CHECK-NEXT:    andl $3, %ecx
-; CHECK-NEXT:    shlq $26, %rcx
-; CHECK-NEXT:    orq %rdx, %rcx
-; CHECK-NEXT:    orq %rax, %rcx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %eax
-; CHECK-NEXT:    andl $3, %eax
-; CHECK-NEXT:    shlq $28, %rax
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; CHECK-NEXT:    andl $3, %edx
-; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rsi
-; CHECK-NEXT:    cmpq {{[0-9]+}}(%rsp), %rsi
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
-; CHECK-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Folded Reload
-; CHECK-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
-; CHECK-NEXT:    movb %dl, 4(%rsi)
-; CHECK-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
-; CHECK-NEXT:    cmovbl %r13d, %edx
-; CHECK-NEXT:    andl $3, %edx
-; CHECK-NEXT:    shlq $30, %rdx
-; CHECK-NEXT:    orq %rax, %rdx
-; CHECK-NEXT:    orq %rcx, %rdx
-; CHECK-NEXT:    movq %rsi, %rax
-; CHECK-NEXT:    movl %edx, (%rsi)
-; CHECK-NEXT:    addq $168, %rsp
-; CHECK-NEXT:    popq %rbx
-; CHECK-NEXT:    popq %r12
-; CHECK-NEXT:    popq %r13
-; CHECK-NEXT:    popq %r14
-; CHECK-NEXT:    popq %r15
-; CHECK-NEXT:    popq %rbp
-; CHECK-NEXT:    retq
+; X64-LABEL: ucmp_uncommon_vectors:
+; X64:       # %bb.0:
+; X64-NEXT:    pushq %rbp
+; X64-NEXT:    pushq %r15
+; X64-NEXT:    pushq %r14
+; X64-NEXT:    pushq %r13
+; X64-NEXT:    pushq %r12
+; X64-NEXT:    pushq %rbx
+; X64-NEXT:    subq $168, %rsp
+; X64-NEXT:    movq %r9, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq %rdx, %r11
+; X64-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    andl $127, %r8d
+; X64-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, (%rsp) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r15
+; X64-NEXT:    andl $127, %r15d
+; X64-NEXT:    movq %r15, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, %rbp
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rbx
+; X64-NEXT:    andl $127, %ebx
+; X64-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, %r12
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r8
+; X64-NEXT:    andl $127, %r8d
+; X64-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    andl $127, %edx
+; X64-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq %rax, %r13
+; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    andl $127, %r11d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    andl $127, %eax
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    andl $127, %ecx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r14
+; X64-NEXT:    andl $127, %r14d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r9
+; X64-NEXT:    cmpq %rdi, %r9
+; X64-NEXT:    movq %r14, %r10
+; X64-NEXT:    sbbq %rcx, %r10
+; X64-NEXT:    setb %r10b
+; X64-NEXT:    cmpq %r9, %rdi
+; X64-NEXT:    sbbq %r14, %rcx
+; X64-NEXT:    movzbl %r10b, %edi
+; X64-NEXT:    movq $-1, %rcx
+; X64-NEXT:    cmovbq %rcx, %rdi
+; X64-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r9
+; X64-NEXT:    cmpq %rsi, %r9
+; X64-NEXT:    movq %rax, %rdi
+; X64-NEXT:    sbbq %r11, %rdi
+; X64-NEXT:    setb %dil
+; X64-NEXT:    cmpq %r9, %rsi
+; X64-NEXT:    sbbq %rax, %r11
+; X64-NEXT:    movzbl %dil, %r14d
+; X64-NEXT:    cmovbq %rcx, %r14
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq %r13, %rcx
+; X64-NEXT:    sbbq %rdx, %rcx
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    sbbq %r12, %r8
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    sbbq %rbp, %rbx
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Folded Reload
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq (%rsp), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Reload
+; X64-NEXT:    sbbq %r15, %rcx
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r12 # 8-byte Reload
+; X64-NEXT:    movq %r12, %rcx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r10 # 8-byte Reload
+; X64-NEXT:    sbbq %r10, %rcx
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
+; X64-NEXT:    movq %rbx, %rcx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r9 # 8-byte Reload
+; X64-NEXT:    sbbq %r9, %rcx
+; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdi # 8-byte Reload
+; X64-NEXT:    cmpq %rdi, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r8 # 8-byte Reload
+; X64-NEXT:    movq %r8, %rbp
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
+; X64-NEXT:    sbbq %rsi, %rbp
+; X64-NEXT:    setb %bpl
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r11
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    cmpq %rcx, %r11
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; X64-NEXT:    movq %rdx, %r13
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %r13
+; X64-NEXT:    setb %r13b
+; X64-NEXT:    andl $3, %r14d
+; X64-NEXT:    cmpq %r11, %rcx
+; X64-NEXT:    sbbq %rdx, %rax
+; X64-NEXT:    movzbl %r13b, %eax
+; X64-NEXT:    movl $-1, %r13d
+; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    andl $3, %eax
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdi
+; X64-NEXT:    sbbq %r8, %rsi
+; X64-NEXT:    leaq (%r14,%rax,4), %rax
+; X64-NEXT:    movzbl %bpl, %ecx
+; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    andl $3, %ecx
+; X64-NEXT:    shll $4, %ecx
+; X64-NEXT:    orq %rax, %rcx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    sbbq %rbx, %r9
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    andl $3, %eax
+; X64-NEXT:    shll $6, %eax
+; X64-NEXT:    orq %rcx, %rax
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq %rcx, {{[0-9]+}}(%rsp)
+; X64-NEXT:    sbbq %r12, %r10
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    andl $3, %ecx
+; X64-NEXT:    shll $8, %ecx
+; X64-NEXT:    orq %rax, %rcx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    andl $3, %eax
+; X64-NEXT:    shll $10, %eax
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    cmpq %rdx, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %edx
+; X64-NEXT:    andl $3, %edx
+; X64-NEXT:    shll $12, %edx
+; X64-NEXT:    orq %rax, %rdx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %esi # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %esi
+; X64-NEXT:    andl $3, %esi
+; X64-NEXT:    shll $14, %esi
+; X64-NEXT:    orq %rdx, %rsi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    andl $3, %eax
+; X64-NEXT:    shll $16, %eax
+; X64-NEXT:    orq %rsi, %rax
+; X64-NEXT:    orq %rcx, %rax
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    andl $3, %ecx
+; X64-NEXT:    shll $18, %ecx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %edx
+; X64-NEXT:    andl $3, %edx
+; X64-NEXT:    shll $20, %edx
+; X64-NEXT:    orq %rcx, %rdx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq (%rsp), %rcx # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    andl $3, %ecx
+; X64-NEXT:    shll $22, %ecx
+; X64-NEXT:    orq %rdx, %rcx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; X64-NEXT:    sbbq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Folded Spill
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %edx
+; X64-NEXT:    andl $3, %edx
+; X64-NEXT:    shll $24, %edx
+; X64-NEXT:    orq %rcx, %rdx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    andl $3, %ecx
+; X64-NEXT:    shlq $26, %rcx
+; X64-NEXT:    orq %rdx, %rcx
+; X64-NEXT:    orq %rax, %rcx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    andl $3, %eax
+; X64-NEXT:    shlq $28, %rax
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; X64-NEXT:    andl $3, %edx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rsi
+; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rsi
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
+; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Folded Reload
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
+; X64-NEXT:    movb %dl, 4(%rsi)
+; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
+; X64-NEXT:    cmovbl %r13d, %edx
+; X64-NEXT:    andl $3, %edx
+; X64-NEXT:    shlq $30, %rdx
+; X64-NEXT:    orq %rax, %rdx
+; X64-NEXT:    orq %rcx, %rdx
+; X64-NEXT:    movq %rsi, %rax
+; X64-NEXT:    movl %edx, (%rsi)
+; X64-NEXT:    addq $168, %rsp
+; X64-NEXT:    popq %rbx
+; X64-NEXT:    popq %r12
+; X64-NEXT:    popq %r13
+; X64-NEXT:    popq %r14
+; X64-NEXT:    popq %r15
+; X64-NEXT:    popq %rbp
+; X64-NEXT:    retq
+;
+; X86-LABEL: ucmp_uncommon_vectors:
+; X86:       # %bb.0:
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    pushl %ebx
+; X86-NEXT:    pushl %edi
+; X86-NEXT:    pushl %esi
+; X86-NEXT:    subl $68, %esp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    andl $127, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    andl $127, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    andl $127, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:    sbbl %ebp, %edx
+; X86-NEXT:    movl %edi, %edx
+; X86-NEXT:    sbbl %eax, %edx
+; X86-NEXT:    movl $0, %edx
+; X86-NEXT:    sbbl %edx, %edx
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl %ebx, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    jb .LBB18_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_2:
+; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    andl $127, %edi
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl %edi, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl %ebx, %eax
+; X86-NEXT:    sbbl %ebp, %eax
+; X86-NEXT:    movl %esi, %eax
+; X86-NEXT:    sbbl %ecx, %eax
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    sbbl %ebx, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl $0, %esi
+; X86-NEXT:    sbbl %esi, %esi
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jb .LBB18_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_4:
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    andl $127, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %edi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl %ebx, %esi
+; X86-NEXT:    sbbl %ebp, %esi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
+; X86-NEXT:    movl %edi, %esi
+; X86-NEXT:    sbbl %edx, %esi
+; X86-NEXT:    movl $0, %esi
+; X86-NEXT:    sbbl %esi, %esi
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ebx, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
+; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    jb .LBB18_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_6:
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %ecx
+; X86-NEXT:    andl $127, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl %edi, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl %ebp, %ebx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
+; X86-NEXT:    movl %edi, %ebx
+; X86-NEXT:    sbbl %eax, %ebx
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    movl $0, %edi
+; X86-NEXT:    sbbl %edi, %edi
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jb .LBB18_8
+; X86-NEXT:  # %bb.7:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_8:
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    andl $127, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    sbbl %ebp, %edi
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    movl $0, %edi
+; X86-NEXT:    sbbl %edi, %edi
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl $0, %esi
+; X86-NEXT:    sbbl %esi, %esi
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jb .LBB18_10
+; X86-NEXT:  # %bb.9:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_10:
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    andl $127, %edi
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %edi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %edi, %esi
+; X86-NEXT:    sbbl %ebp, %esi
+; X86-NEXT:    movl %ebx, %esi
+; X86-NEXT:    sbbl %edx, %esi
+; X86-NEXT:    movl $0, %esi
+; X86-NEXT:    sbbl %esi, %esi
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %edi, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %ebx, %edx
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
+; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    jb .LBB18_12
+; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_12:
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %ecx
+; X86-NEXT:    andl $127, %esi
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl %esi, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl %esi, %ebx
+; X86-NEXT:    sbbl %ebp, %ebx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
+; X86-NEXT:    movl %edi, %ebx
+; X86-NEXT:    sbbl %eax, %ebx
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl %esi, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    movl $0, %edi
+; X86-NEXT:    sbbl %edi, %edi
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jb .LBB18_14
+; X86-NEXT:  # %bb.13:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_14:
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    andl $127, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %eax, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    sbbl %ebp, %edi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    movl %esi, %edi
+; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    movl $0, %edi
+; X86-NEXT:    sbbl %edi, %edi
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl $0, %esi
+; X86-NEXT:    sbbl %esi, %esi
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    jb .LBB18_16
+; X86-NEXT:  # %bb.15:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_16:
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    andl $127, %edi
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %edi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %edi, %esi
+; X86-NEXT:    sbbl %ebp, %esi
+; X86-NEXT:    movl %ebx, %esi
+; X86-NEXT:    sbbl %edx, %esi
+; X86-NEXT:    movl $0, %esi
+; X86-NEXT:    sbbl %esi, %esi
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %edi, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %ebx, %edx
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
+; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    jb .LBB18_18
+; X86-NEXT:  # %bb.17:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_18:
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %ecx
+; X86-NEXT:    andl $127, %esi
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl %esi, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl %esi, %ebx
+; X86-NEXT:    sbbl %ebp, %ebx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
+; X86-NEXT:    movl %edi, %ebx
+; X86-NEXT:    sbbl %eax, %ebx
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl %esi, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    jb .LBB18_20
+; X86-NEXT:  # %bb.19:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_20:
+; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %ebx
+; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %edx, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl %edx, %eax
+; X86-NEXT:    sbbl %ebp, %eax
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    movl %esi, %eax
+; X86-NEXT:    sbbl %ecx, %eax
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %edi, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    sbbl %edx, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl $0, %ecx
+; X86-NEXT:    sbbl %ecx, %ecx
+; X86-NEXT:    movl $-1, %ecx
+; X86-NEXT:    jb .LBB18_22
+; X86-NEXT:  # %bb.21:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_22:
+; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %edi
+; X86-NEXT:    andl $127, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    cmpl %ebp, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    sbbl %eax, %ecx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    movl %edx, %ecx
+; X86-NEXT:    sbbl %ebx, %ecx
+; X86-NEXT:    movl $0, %ecx
+; X86-NEXT:    sbbl %ecx, %ecx
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    sbbl %edx, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    jb .LBB18_24
+; X86-NEXT:  # %bb.23:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_24:
+; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %esi
+; X86-NEXT:    andl $127, %ebp
+; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    cmpl %ebx, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %ecx, %eax
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Reload
+; X86-NEXT:    movl %ebp, %eax
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    setb %al
+; X86-NEXT:    cmpl %edx, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl %ebp, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl $0, %ecx
+; X86-NEXT:    sbbl %ecx, %ecx
+; X86-NEXT:    movl $-1, %ecx
+; X86-NEXT:    jb .LBB18_26
+; X86-NEXT:  # %bb.25:
+; X86-NEXT:    movzbl %al, %ecx
+; X86-NEXT:  .LBB18_26:
+; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    andl $127, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    cmpl %ebp, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %ebx, %eax
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:    sbbl %esi, %eax
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %edi, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %ecx, %esi
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
+; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    jb .LBB18_28
+; X86-NEXT:  # %bb.27:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_28:
+; X86-NEXT:    andl $127, %edi
+; X86-NEXT:    andl $127, %ebp
+; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    cmpl %ebp, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %eax, %ebp
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, %ebp
+; X86-NEXT:    sbbl %edx, %ebp
+; X86-NEXT:    movl $0, %ebp
+; X86-NEXT:    sbbl %ebp, %ebp
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %esi, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %ecx, %edx
+; X86-NEXT:    movl $0, %edx
+; X86-NEXT:    sbbl %edx, %edx
+; X86-NEXT:    movl $-1, %ecx
+; X86-NEXT:    jb .LBB18_30
+; X86-NEXT:  # %bb.29:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_30:
+; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    andl $127, %esi
+; X86-NEXT:    andl $127, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %edx, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl %eax, %edx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, %edx
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movl $0, %edx
+; X86-NEXT:    sbbl %edx, %edx
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    movl $0, %ecx
+; X86-NEXT:    sbbl %ecx, %ecx
+; X86-NEXT:    movl $-1, %ecx
+; X86-NEXT:    jb .LBB18_32
+; X86-NEXT:  # %bb.31:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_32:
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %edi, %edx
+; X86-NEXT:    sbbl %eax, %edx
+; X86-NEXT:    movl %ebp, %edx
+; X86-NEXT:    sbbl %esi, %edx
+; X86-NEXT:    movl $0, %edx
+; X86-NEXT:    sbbl %edx, %edx
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    sbbl %ebp, %esi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    jb .LBB18_34
+; X86-NEXT:  # %bb.33:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_34:
+; X86-NEXT:    andl $3, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movb %dl, 4(%eax)
+; X86-NEXT:    andl $3, %ecx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    andl $3, %edx
+; X86-NEXT:    leal (%edx,%ecx,4), %ecx
+; X86-NEXT:    andl $3, %ebx
+; X86-NEXT:    shll $4, %ebx
+; X86-NEXT:    orl %ecx, %ebx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    andl $3, %ecx
+; X86-NEXT:    shll $6, %ecx
+; X86-NEXT:    orl %ebx, %ecx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    andl $3, %edx
+; X86-NEXT:    shll $8, %edx
+; X86-NEXT:    orl %ecx, %edx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    andl $3, %esi
+; X86-NEXT:    shll $10, %esi
+; X86-NEXT:    orl %edx, %esi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    andl $3, %ecx
+; X86-NEXT:    shll $12, %ecx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    andl $3, %edx
+; X86-NEXT:    shll $14, %edx
+; X86-NEXT:    orl %ecx, %edx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    andl $3, %ecx
+; X86-NEXT:    shll $16, %ecx
+; X86-NEXT:    orl %edx, %ecx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
+; X86-NEXT:    andl $3, %edi
+; X86-NEXT:    shll $18, %edi
+; X86-NEXT:    orl %ecx, %edi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    andl $3, %edx
+; X86-NEXT:    shll $20, %edx
+; X86-NEXT:    orl %edi, %edx
+; X86-NEXT:    orl %esi, %edx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    andl $3, %esi
+; X86-NEXT:    shll $22, %esi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    andl $3, %ecx
+; X86-NEXT:    shll $24, %ecx
+; X86-NEXT:    orl %esi, %ecx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    andl $3, %esi
+; X86-NEXT:    shll $26, %esi
+; X86-NEXT:    orl %ecx, %esi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    andl $3, %ecx
+; X86-NEXT:    shll $28, %ecx
+; X86-NEXT:    orl %esi, %ecx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    shll $30, %esi
+; X86-NEXT:    orl %ecx, %esi
+; X86-NEXT:    orl %edx, %esi
+; X86-NEXT:    movl %esi, (%eax)
+; X86-NEXT:    addl $68, %esp
+; X86-NEXT:    popl %esi
+; X86-NEXT:    popl %edi
+; X86-NEXT:    popl %ebx
+; X86-NEXT:    popl %ebp
+; X86-NEXT:    retl $4
   %1 = call <17 x i2> @llvm.ucmp(<17 x i71> %x, <17 x i71> %y)
   ret <17 x i2> %1
 }

>From 8ed9aaf3c608482570bfe57b3cbaa4a496323ffd Mon Sep 17 00:00:00 2001
From: Poseydon42 <vvmposeydon at gmail.com>
Date: Sun, 16 Jun 2024 21:58:17 +0100
Subject: [PATCH 4/4] Changed WidenVecRes_CMP to unroll the operation to avoid
 crashing with AVX-512

---
 .../SelectionDAG/LegalizeVectorTypes.cpp      |   35 +-
 llvm/test/CodeGen/X86/scmp.ll                 |  918 +++++------
 llvm/test/CodeGen/X86/ucmp.ll                 | 1340 +++++++++--------
 3 files changed, 1081 insertions(+), 1212 deletions(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index 2c25e5a0ebf2a..d52004553e5bc 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -4527,41 +4527,16 @@ SDValue DAGTypeLegalizer::WidenVecRes_CMP(SDNode *N) {
   if (getTypeAction(OpVT) == TargetLowering::TypeWidenVector) {
     LHS = GetWidenedVector(LHS);
     RHS = GetWidenedVector(RHS);
+    OpVT = LHS.getValueType();
   }
 
   EVT WidenResVT = TLI.getTypeToTransformTo(Ctxt, N->getValueType(0));
   ElementCount WidenResEC = WidenResVT.getVectorElementCount();
-  EVT WidenResElementVT = WidenResVT.getVectorElementType();
-
-  // At this point we know that the type of LHS and RHS will not require
-  // widening any further, so we can use the current (updated) type of the
-  // operands as the return type of the CMP node, and then extend/truncate
-  // and resize it appropriately.
-  EVT CmpRetTy = LHS.getValueType();
-  SDValue CMP = DAG.getNode(N->getOpcode(), dl, CmpRetTy, LHS, RHS);
-  if (CmpRetTy.getVectorNumElements() < WidenResVT.getVectorNumElements()) {
-    EVT WideUndefVectorVT =
-        EVT::getVectorVT(Ctxt, CmpRetTy.getVectorElementType(), WidenResEC);
-    SDValue WideUndefValue = DAG.getUNDEF(WideUndefVectorVT);
-    CMP = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, WideUndefVectorVT,
-                      WideUndefValue, CMP, DAG.getVectorIdxConstant(0, dl));
-  } else if (CmpRetTy.getVectorNumElements() >
-             WidenResVT.getVectorNumElements()) {
-    EVT NarrowedVecVT =
-        EVT::getVectorVT(Ctxt, CmpRetTy.getVectorElementType(), WidenResEC);
-    CMP = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, NarrowedVecVT, CMP,
-                      DAG.getVectorIdxConstant(0, dl));
-  }
-
-  ISD::NodeType ExtendCode;
-  if (CMP.getValueType().getVectorElementType().getSizeInBits() >
-      WidenResElementVT.getSizeInBits()) {
-    ExtendCode = ISD::TRUNCATE;
-  } else {
-    ExtendCode =
-        (N->getOpcode() == ISD::SCMP ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND);
+  if (WidenResEC == OpVT.getVectorElementCount()) {
+    return DAG.getNode(N->getOpcode(), dl, WidenResVT, LHS, RHS);
   }
-  return DAG.getNode(ExtendCode, dl, WidenResVT, CMP);
+
+  return DAG.UnrollVectorOp(N, WidenResVT.getVectorNumElements());
 }
 
 SDValue DAGTypeLegalizer::WidenVecRes_BinaryWithExtraScalarOp(SDNode *N) {
diff --git a/llvm/test/CodeGen/X86/scmp.ll b/llvm/test/CodeGen/X86/scmp.ll
index d5d5b8daa8395..55dc0d6059e05 100644
--- a/llvm/test/CodeGen/X86/scmp.ll
+++ b/llvm/test/CodeGen/X86/scmp.ll
@@ -594,49 +594,47 @@ define <4 x i32> @scmp_normal_vectors(<4 x i32> %x, <4 x i32> %y) nounwind {
 define <4 x i8> @scmp_narrow_vec_result(<4 x i32> %x, <4 x i32> %y) nounwind {
 ; X64-LABEL: scmp_narrow_vec_result:
 ; X64:       # %bb.0:
-; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
-; X64-NEXT:    movd %xmm2, %eax
-; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
-; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    movd %xmm1, %eax
+; X64-NEXT:    movd %xmm0, %ecx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpl %eax, %ecx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    movl $255, %eax
 ; X64-NEXT:    cmovll %eax, %edx
-; X64-NEXT:    movd %edx, %xmm2
-; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; X64-NEXT:    movd %xmm3, %ecx
-; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X64-NEXT:    movd %xmm3, %edx
-; X64-NEXT:    xorl %esi, %esi
-; X64-NEXT:    cmpl %ecx, %edx
-; X64-NEXT:    setg %sil
-; X64-NEXT:    cmovll %eax, %esi
-; X64-NEXT:    movd %esi, %xmm3
-; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; X64-NEXT:    movd %xmm1, %ecx
-; X64-NEXT:    movd %xmm0, %edx
-; X64-NEXT:    xorl %esi, %esi
-; X64-NEXT:    cmpl %ecx, %edx
-; X64-NEXT:    setg %sil
-; X64-NEXT:    cmovll %eax, %esi
-; X64-NEXT:    movd %esi, %xmm2
-; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; X64-NEXT:    movd %xmm1, %ecx
-; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; X64-NEXT:    movd %xmm0, %edx
-; X64-NEXT:    xorl %esi, %esi
-; X64-NEXT:    cmpl %ecx, %edx
-; X64-NEXT:    setg %sil
-; X64-NEXT:    cmovll %eax, %esi
-; X64-NEXT:    movd %esi, %xmm0
-; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
-; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2
-; X64-NEXT:    pxor %xmm0, %xmm0
-; X64-NEXT:    packuswb %xmm0, %xmm2
-; X64-NEXT:    packuswb %xmm0, %xmm2
-; X64-NEXT:    movdqa %xmm2, %xmm0
+; X64-NEXT:    movzbl %dl, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm2, %edx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,1,1]
+; X64-NEXT:    movd %xmm2, %esi
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpl %edx, %esi
+; X64-NEXT:    setg %dil
+; X64-NEXT:    cmovll %eax, %edi
+; X64-NEXT:    movzbl %dil, %edx
+; X64-NEXT:    shll $8, %edx
+; X64-NEXT:    orl %ecx, %edx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
+; X64-NEXT:    movd %xmm2, %esi
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpl %ecx, %esi
+; X64-NEXT:    setg %dil
+; X64-NEXT:    cmovll %eax, %edi
+; X64-NEXT:    movzbl %dil, %ecx
+; X64-NEXT:    shll $16, %ecx
+; X64-NEXT:    orl %edx, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[3,3,3,3]
+; X64-NEXT:    movd %xmm0, %esi
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpl %edx, %esi
+; X64-NEXT:    setg %dil
+; X64-NEXT:    cmovll %eax, %edi
+; X64-NEXT:    shll $24, %edi
+; X64-NEXT:    orl %ecx, %edi
+; X64-NEXT:    movd %edi, %xmm0
 ; X64-NEXT:    retq
 ;
 ; X86-LABEL: scmp_narrow_vec_result:
@@ -1192,131 +1190,122 @@ define <16 x i8> @scmp_wide_vec_op(<16 x i64> %x, <16 x i64> %y) nounwind {
 ; X64-NEXT:    xorl %ecx, %ecx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    setg %cl
-; X64-NEXT:    movq $-1, %rax
-; X64-NEXT:    cmovlq %rax, %rcx
-; X64-NEXT:    movq %rcx, %xmm9
+; X64-NEXT:    movl $255, %eax
+; X64-NEXT:    cmovll %eax, %ecx
+; X64-NEXT:    movd %ecx, %xmm8
 ; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm7[2,3,2,3]
 ; X64-NEXT:    movq %xmm7, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm7
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm9 = xmm9[0],xmm7[0]
-; X64-NEXT:    movdqa {{.*#+}} xmm7 = [255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0]
-; X64-NEXT:    pand %xmm7, %xmm9
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm7
+; X64-NEXT:    punpcklbw {{.*#+}} xmm8 = xmm8[0],xmm7[0],xmm8[1],xmm7[1],xmm8[2],xmm7[2],xmm8[3],xmm7[3],xmm8[4],xmm7[4],xmm8[5],xmm7[5],xmm8[6],xmm7[6],xmm8[7],xmm7[7]
 ; X64-NEXT:    movq %xmm6, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm8
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm7
 ; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm6[2,3,2,3]
 ; X64-NEXT:    movq %xmm6, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm6
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm8 = xmm8[0],xmm6[0]
-; X64-NEXT:    pand %xmm7, %xmm8
-; X64-NEXT:    packuswb %xmm9, %xmm8
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm6
+; X64-NEXT:    punpcklbw {{.*#+}} xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1],xmm7[2],xmm6[2],xmm7[3],xmm6[3],xmm7[4],xmm6[4],xmm7[5],xmm6[5],xmm7[6],xmm6[6],xmm7[7],xmm6[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm7 = xmm7[0],xmm8[0],xmm7[1],xmm8[1],xmm7[2],xmm8[2],xmm7[3],xmm8[3]
 ; X64-NEXT:    movq %xmm5, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm6
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm6
 ; X64-NEXT:    pshufd {{.*#+}} xmm5 = xmm5[2,3,2,3]
 ; X64-NEXT:    movq %xmm5, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm5
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm6 = xmm6[0],xmm5[0]
-; X64-NEXT:    pand %xmm7, %xmm6
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm5
+; X64-NEXT:    punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm5[0],xmm6[1],xmm5[1],xmm6[2],xmm5[2],xmm6[3],xmm5[3],xmm6[4],xmm5[4],xmm6[5],xmm5[5],xmm6[6],xmm5[6],xmm6[7],xmm5[7]
 ; X64-NEXT:    movq %xmm4, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm5
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm5
 ; X64-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[2,3,2,3]
 ; X64-NEXT:    movq %xmm4, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm4
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm5 = xmm5[0],xmm4[0]
-; X64-NEXT:    pand %xmm7, %xmm5
-; X64-NEXT:    packuswb %xmm6, %xmm5
-; X64-NEXT:    packuswb %xmm8, %xmm5
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm4
+; X64-NEXT:    punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1],xmm5[2],xmm4[2],xmm5[3],xmm4[3],xmm5[4],xmm4[4],xmm5[5],xmm4[5],xmm5[6],xmm4[6],xmm5[7],xmm4[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm6[0],xmm5[1],xmm6[1],xmm5[2],xmm6[2],xmm5[3],xmm6[3]
+; X64-NEXT:    punpckldq {{.*#+}} xmm5 = xmm5[0],xmm7[0],xmm5[1],xmm7[1]
 ; X64-NEXT:    movq %xmm3, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm4
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm4
 ; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[2,3,2,3]
 ; X64-NEXT:    movq %xmm3, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm3
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm4 = xmm4[0],xmm3[0]
-; X64-NEXT:    pand %xmm7, %xmm4
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm3
+; X64-NEXT:    punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1],xmm4[2],xmm3[2],xmm4[3],xmm3[3],xmm4[4],xmm3[4],xmm4[5],xmm3[5],xmm4[6],xmm3[6],xmm4[7],xmm3[7]
 ; X64-NEXT:    movq %xmm2, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm3
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm3
 ; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[2,3,2,3]
 ; X64-NEXT:    movq %xmm2, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm2
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm3 = xmm3[0],xmm2[0]
-; X64-NEXT:    pand %xmm7, %xmm3
-; X64-NEXT:    packuswb %xmm4, %xmm3
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm2
+; X64-NEXT:    punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3],xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1],xmm3[2],xmm4[2],xmm3[3],xmm4[3]
 ; X64-NEXT:    movq %xmm1, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm2
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm2
 ; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[2,3,2,3]
 ; X64-NEXT:    movq %xmm1, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm1
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm1[0]
-; X64-NEXT:    pand %xmm7, %xmm2
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm1
+; X64-NEXT:    punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7]
 ; X64-NEXT:    movq %xmm0, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm1
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm1
 ; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
 ; X64-NEXT:    movq %xmm0, %rcx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
 ; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm0
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
-; X64-NEXT:    pand %xmm7, %xmm1
-; X64-NEXT:    packuswb %xmm2, %xmm1
-; X64-NEXT:    packuswb %xmm3, %xmm1
-; X64-NEXT:    packuswb %xmm5, %xmm1
+; X64-NEXT:    cmovll %eax, %edx
+; X64-NEXT:    movd %edx, %xmm0
+; X64-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
+; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm5[0]
 ; X64-NEXT:    movdqa %xmm1, %xmm0
 ; X64-NEXT:    retq
 ;
@@ -1618,181 +1607,111 @@ define <7 x i117> @scmp_uncommon_vectors(<7 x i7> %x, <7 x i7> %y) nounwind {
 ; X64-NEXT:    pushq %rbp
 ; X64-NEXT:    pushq %r15
 ; X64-NEXT:    pushq %r14
-; X64-NEXT:    pushq %r13
 ; X64-NEXT:    pushq %r12
 ; X64-NEXT:    pushq %rbx
-; X64-NEXT:    movq %rdi, %r14
-; X64-NEXT:    movd %r8d, %xmm0
-; X64-NEXT:    movd %ecx, %xmm1
-; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
-; X64-NEXT:    movd %edx, %xmm2
-; X64-NEXT:    movd %esi, %xmm0
-; X64-NEXT:    punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
-; X64-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
-; X64-NEXT:    movd %r9d, %xmm1
-; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
-; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
-; X64-NEXT:    psllw $9, %xmm0
-; X64-NEXT:    psraw $9, %xmm0
-; X64-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
-; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; X64-NEXT:    punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
-; X64-NEXT:    movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
-; X64-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
-; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3]
-; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
-; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; X64-NEXT:    movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
-; X64-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
-; X64-NEXT:    movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
-; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
-; X64-NEXT:    psllw $9, %xmm1
-; X64-NEXT:    psraw $9, %xmm1
-; X64-NEXT:    movd %xmm1, %edx
-; X64-NEXT:    movd %xmm0, %esi
-; X64-NEXT:    xorl %eax, %eax
-; X64-NEXT:    cmpw %dx, %si
-; X64-NEXT:    setg %al
-; X64-NEXT:    movl $65535, %ebp # imm = 0xFFFF
-; X64-NEXT:    cmovll %ebp, %eax
-; X64-NEXT:    shlq $57, %rax
-; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq %rax, %rcx
-; X64-NEXT:    sarq $63, %rcx
-; X64-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    pextrw $5, %xmm1, %esi
-; X64-NEXT:    pextrw $5, %xmm0, %edi
-; X64-NEXT:    xorl %r9d, %r9d
-; X64-NEXT:    cmpw %si, %di
-; X64-NEXT:    setg %r9b
-; X64-NEXT:    cmovll %ebp, %r9d
-; X64-NEXT:    shlq $57, %r9
-; X64-NEXT:    movq %r9, %rdi
-; X64-NEXT:    sarq $57, %rdi
-; X64-NEXT:    sarq $63, %r9
-; X64-NEXT:    pextrw $1, %xmm1, %esi
-; X64-NEXT:    pextrw $1, %xmm0, %r8d
-; X64-NEXT:    xorl %ebx, %ebx
-; X64-NEXT:    cmpw %si, %r8w
-; X64-NEXT:    setg %bl
-; X64-NEXT:    cmovll %ebp, %ebx
-; X64-NEXT:    shlq $57, %rbx
-; X64-NEXT:    movq %rbx, %rsi
-; X64-NEXT:    sarq $57, %rsi
-; X64-NEXT:    sarq $63, %rbx
-; X64-NEXT:    pextrw $2, %xmm1, %r10d
-; X64-NEXT:    pextrw $2, %xmm0, %r11d
+; X64-NEXT:    movq %rdi, %rax
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r10d
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %ebx
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %ebp
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r14d
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r15d
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r12d
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r11d
+; X64-NEXT:    addb %r11b, %r11b
+; X64-NEXT:    sarb %r11b
+; X64-NEXT:    addb %dl, %dl
+; X64-NEXT:    sarb %dl
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpb %r11b, %dl
+; X64-NEXT:    setg %dil
+; X64-NEXT:    movq $-1, %r11
+; X64-NEXT:    cmovlq %r11, %rdi
+; X64-NEXT:    addb %r12b, %r12b
+; X64-NEXT:    sarb %r12b
+; X64-NEXT:    addb %cl, %cl
+; X64-NEXT:    sarb %cl
+; X64-NEXT:    xorl %edx, %edx
+; X64-NEXT:    cmpb %r12b, %cl
+; X64-NEXT:    setg %dl
+; X64-NEXT:    cmovlq %r11, %rdx
+; X64-NEXT:    addb %r15b, %r15b
+; X64-NEXT:    sarb %r15b
+; X64-NEXT:    addb %r8b, %r8b
+; X64-NEXT:    sarb %r8b
+; X64-NEXT:    xorl %ecx, %ecx
+; X64-NEXT:    cmpb %r15b, %r8b
+; X64-NEXT:    setg %cl
+; X64-NEXT:    cmovlq %r11, %rcx
+; X64-NEXT:    addb %r14b, %r14b
+; X64-NEXT:    sarb %r14b
+; X64-NEXT:    addb %r9b, %r9b
+; X64-NEXT:    sarb %r9b
 ; X64-NEXT:    xorl %r8d, %r8d
-; X64-NEXT:    cmpw %r10w, %r11w
+; X64-NEXT:    cmpb %r14b, %r9b
 ; X64-NEXT:    setg %r8b
-; X64-NEXT:    cmovll %ebp, %r8d
-; X64-NEXT:    shlq $57, %r8
-; X64-NEXT:    movq %r8, %rdx
-; X64-NEXT:    sarq $57, %rdx
-; X64-NEXT:    sarq $63, %r8
-; X64-NEXT:    pextrw $3, %xmm1, %r11d
-; X64-NEXT:    pextrw $3, %xmm0, %r15d
-; X64-NEXT:    xorl %r10d, %r10d
-; X64-NEXT:    cmpw %r11w, %r15w
-; X64-NEXT:    setg %r10b
-; X64-NEXT:    cmovll %ebp, %r10d
-; X64-NEXT:    shlq $57, %r10
-; X64-NEXT:    movq %r10, %r11
-; X64-NEXT:    sarq $57, %r11
-; X64-NEXT:    sarq $63, %r10
-; X64-NEXT:    pextrw $4, %xmm1, %r12d
-; X64-NEXT:    pextrw $4, %xmm0, %r13d
-; X64-NEXT:    xorl %r15d, %r15d
-; X64-NEXT:    cmpw %r12w, %r13w
-; X64-NEXT:    setg %r15b
-; X64-NEXT:    cmovll %ebp, %r15d
-; X64-NEXT:    shlq $57, %r15
-; X64-NEXT:    movq %r15, %r12
-; X64-NEXT:    sarq $57, %r12
-; X64-NEXT:    sarq $63, %r15
-; X64-NEXT:    pextrw $6, %xmm1, %ecx
-; X64-NEXT:    pextrw $6, %xmm0, %eax
-; X64-NEXT:    xorl %r13d, %r13d
-; X64-NEXT:    cmpw %cx, %ax
-; X64-NEXT:    setg %r13b
-; X64-NEXT:    cmovll %ebp, %r13d
-; X64-NEXT:    shlq $57, %r13
-; X64-NEXT:    movq %r13, %rbp
-; X64-NEXT:    sarq $57, %rbp
-; X64-NEXT:    sarq $63, %r13
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; X64-NEXT:    sarq $57, %rax
-; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq %rax, (%r14)
-; X64-NEXT:    movq %r13, %rax
-; X64-NEXT:    shldq $62, %rbp, %rax
-; X64-NEXT:    movq %rax, 88(%r14)
-; X64-NEXT:    movq %r15, %rax
-; X64-NEXT:    shldq $20, %r12, %rax
-; X64-NEXT:    movq %rax, 64(%r14)
-; X64-NEXT:    movq %r10, %rax
-; X64-NEXT:    shldq $31, %r11, %rax
-; X64-NEXT:    movq %rax, 48(%r14)
-; X64-NEXT:    movq %r8, %rax
-; X64-NEXT:    shldq $42, %rdx, %rax
-; X64-NEXT:    movq %rax, 32(%r14)
-; X64-NEXT:    movabsq $9007199254738944, %rax # imm = 0x1FFFFFFFFFF800
-; X64-NEXT:    andq %rbx, %rax
-; X64-NEXT:    shldq $53, %rsi, %rbx
-; X64-NEXT:    movq %rbx, 16(%r14)
-; X64-NEXT:    movq %r13, %rcx
-; X64-NEXT:    shrq $34, %rcx
-; X64-NEXT:    movw %cx, 100(%r14)
-; X64-NEXT:    movabsq $9007199254740991, %rbx # imm = 0x1FFFFFFFFFFFFF
-; X64-NEXT:    andq %rbx, %r9
-; X64-NEXT:    shldq $9, %rdi, %r9
-; X64-NEXT:    shlq $62, %rbp
-; X64-NEXT:    orq %r9, %rbp
-; X64-NEXT:    shrq $2, %r13
-; X64-NEXT:    movl %r13d, 96(%r14)
-; X64-NEXT:    movq %rbp, 80(%r14)
+; X64-NEXT:    cmovlq %r11, %r8
+; X64-NEXT:    addb %bpl, %bpl
+; X64-NEXT:    sarb %bpl
+; X64-NEXT:    addb %sil, %sil
+; X64-NEXT:    sarb %sil
+; X64-NEXT:    xorl %r9d, %r9d
+; X64-NEXT:    cmpb %bpl, %sil
+; X64-NEXT:    setg %r9b
+; X64-NEXT:    cmovlq %r11, %r9
+; X64-NEXT:    addb %bl, %bl
+; X64-NEXT:    sarb %bl
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %ebp
+; X64-NEXT:    addb %bpl, %bpl
+; X64-NEXT:    sarb %bpl
+; X64-NEXT:    xorl %esi, %esi
+; X64-NEXT:    cmpb %bl, %bpl
+; X64-NEXT:    setg %sil
+; X64-NEXT:    cmovlq %r11, %rsi
+; X64-NEXT:    addb %r10b, %r10b
+; X64-NEXT:    sarb %r10b
+; X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %ebx
+; X64-NEXT:    addb %bl, %bl
+; X64-NEXT:    sarb %bl
+; X64-NEXT:    xorl %r14d, %r14d
+; X64-NEXT:    cmpb %r10b, %bl
+; X64-NEXT:    setg %r14b
+; X64-NEXT:    cmovlq %r11, %r14
+; X64-NEXT:    movq %r14, %r10
+; X64-NEXT:    shrq $2, %r10
+; X64-NEXT:    movq %r10, 88(%rax)
+; X64-NEXT:    movq %rsi, %r10
+; X64-NEXT:    shlq $9, %r10
+; X64-NEXT:    movq %r10, 72(%rax)
+; X64-NEXT:    movq %r9, (%rax)
+; X64-NEXT:    shlq $62, %r14
+; X64-NEXT:    shrq $55, %rsi
+; X64-NEXT:    orq %r14, %rsi
+; X64-NEXT:    movq %rsi, 80(%rax)
+; X64-NEXT:    movq %r8, %rsi
+; X64-NEXT:    shrq $44, %rsi
+; X64-NEXT:    movq %rsi, 64(%rax)
+; X64-NEXT:    shlq $20, %r8
+; X64-NEXT:    movq %r8, 56(%rax)
+; X64-NEXT:    movq %rcx, %rsi
+; X64-NEXT:    shrq $33, %rsi
+; X64-NEXT:    movq %rsi, 48(%rax)
+; X64-NEXT:    shlq $31, %rcx
+; X64-NEXT:    movq %rcx, 40(%rax)
+; X64-NEXT:    movq %rdx, %rcx
+; X64-NEXT:    shrq $22, %rcx
+; X64-NEXT:    movq %rcx, 32(%rax)
 ; X64-NEXT:    shlq $42, %rdx
-; X64-NEXT:    shrq $11, %rax
-; X64-NEXT:    orq %rdx, %rax
-; X64-NEXT:    movq %rax, 24(%r14)
-; X64-NEXT:    movabsq $2251799813685247, %rax # imm = 0x7FFFFFFFFFFFF
-; X64-NEXT:    andq %r13, %rax
-; X64-NEXT:    shrq $48, %rax
-; X64-NEXT:    movb %al, 102(%r14)
-; X64-NEXT:    shlq $9, %rdi
-; X64-NEXT:    shrq $44, %r15
-; X64-NEXT:    andl $511, %r15d # imm = 0x1FF
-; X64-NEXT:    orq %rdi, %r15
-; X64-NEXT:    movq %r15, 72(%r14)
-; X64-NEXT:    shlq $20, %r12
-; X64-NEXT:    shrq $33, %r10
-; X64-NEXT:    andl $1048575, %r10d # imm = 0xFFFFF
-; X64-NEXT:    orq %r12, %r10
-; X64-NEXT:    movq %r10, 56(%r14)
-; X64-NEXT:    shlq $31, %r11
-; X64-NEXT:    shrq $22, %r8
-; X64-NEXT:    andl $2147483647, %r8d # imm = 0x7FFFFFFF
-; X64-NEXT:    orq %r11, %r8
-; X64-NEXT:    movq %r8, 40(%r14)
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Folded Reload
-; X64-NEXT:    # xmm0 = mem[0],zero
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 8-byte Folded Reload
-; X64-NEXT:    # xmm1 = mem[0],zero
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
-; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[2,3,2,3]
-; X64-NEXT:    movq %xmm0, %rax
-; X64-NEXT:    andq %rbx, %rax
-; X64-NEXT:    shlq $53, %rsi
-; X64-NEXT:    orq %rax, %rsi
-; X64-NEXT:    movq %rsi, 8(%r14)
-; X64-NEXT:    movq %r14, %rax
+; X64-NEXT:    movq %rdx, 24(%rax)
+; X64-NEXT:    movq %rdi, %rcx
+; X64-NEXT:    shrq $11, %rcx
+; X64-NEXT:    movq %rcx, 16(%rax)
+; X64-NEXT:    shlq $53, %rdi
+; X64-NEXT:    movq %rdi, 8(%rax)
+; X64-NEXT:    movb $0, 102(%rax)
+; X64-NEXT:    movw $0, 100(%rax)
+; X64-NEXT:    movl $0, 96(%rax)
 ; X64-NEXT:    popq %rbx
 ; X64-NEXT:    popq %r12
-; X64-NEXT:    popq %r13
 ; X64-NEXT:    popq %r14
 ; X64-NEXT:    popq %r15
 ; X64-NEXT:    popq %rbp
@@ -1805,229 +1724,201 @@ define <7 x i117> @scmp_uncommon_vectors(<7 x i7> %x, <7 x i7> %y) nounwind {
 ; X86-NEXT:    pushl %edi
 ; X86-NEXT:    pushl %esi
 ; X86-NEXT:    subl $44, %esp
-; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %ch
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %ah
-; X86-NEXT:    addb %ah, %ah
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %bh
-; X86-NEXT:    addb %bh, %bh
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %al
-; X86-NEXT:    addb %al, %al
-; X86-NEXT:    sarb %al
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movb %al, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movb %al, (%esp) # 1-byte Spill
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
 ; X86-NEXT:    addb %cl, %cl
-; X86-NEXT:    sarb %cl
 ; X86-NEXT:    movb {{[0-9]+}}(%esp), %dh
 ; X86-NEXT:    addb %dh, %dh
-; X86-NEXT:    sarb %dh
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %bl
-; X86-NEXT:    addb %bl, %bl
-; X86-NEXT:    sarb %bl
-; X86-NEXT:    cmpb %dh, %bl
-; X86-NEXT:    setg %dh
-; X86-NEXT:    movb $-1, %bl
-; X86-NEXT:    jl .LBB18_2
-; X86-NEXT:  # %bb.1:
-; X86-NEXT:    movb %dh, %bl
-; X86-NEXT:  .LBB18_2:
-; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %dh
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %bl
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %dl
 ; X86-NEXT:    addb %dl, %dl
+; X86-NEXT:    sarb %dl
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ch
 ; X86-NEXT:    addb %ch, %ch
+; X86-NEXT:    sarb %ch
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    addb %al, %al
+; X86-NEXT:    sarb %al
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ah
+; X86-NEXT:    addb %ah, %ah
 ; X86-NEXT:    sarb %ah
-; X86-NEXT:    sarb %bh
-; X86-NEXT:    cmpb %al, %cl
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb %al, %ah
 ; X86-NEXT:    setg %al
-; X86-NEXT:    movb $-1, %cl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    jl .LBB18_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movb %al, %bl
+; X86-NEXT:    movl %ebx, %esi
+; X86-NEXT:    xorl %edi, %edi
+; X86-NEXT:  .LBB18_2:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %bh
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:    addb %al, %al
+; X86-NEXT:    movb %al, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movzbl (%esp), %eax # 1-byte Folded Reload
+; X86-NEXT:    addb %al, %al
+; X86-NEXT:    movb %al, (%esp) # 1-byte Spill
+; X86-NEXT:    sarb %cl
+; X86-NEXT:    sarb %dh
+; X86-NEXT:    xorl %eax, %eax
+; X86-NEXT:    cmpb %dl, %ch
+; X86-NEXT:    setg %dl
+; X86-NEXT:    movl $-1, %ebp
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
 ; X86-NEXT:    jl .LBB18_4
 ; X86-NEXT:  # %bb.3:
-; X86-NEXT:    movb %al, %cl
+; X86-NEXT:    movb %dl, %al
+; X86-NEXT:    movl %eax, %ebp
+; X86-NEXT:    movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
 ; X86-NEXT:  .LBB18_4:
-; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %al
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %cl
-; X86-NEXT:    addb %dh, %dh
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %ch
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %dl
 ; X86-NEXT:    addb %bl, %bl
-; X86-NEXT:    sarb %dl
-; X86-NEXT:    sarb %ch
-; X86-NEXT:    cmpb %ah, %bh
-; X86-NEXT:    setg %ah
-; X86-NEXT:    movb $-1, %bh
+; X86-NEXT:    addb %bh, %bh
+; X86-NEXT:    sarb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    sarb (%esp) # 1-byte Folded Spill
+; X86-NEXT:    xorl %eax, %eax
+; X86-NEXT:    cmpb %cl, %dh
+; X86-NEXT:    setg %cl
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
 ; X86-NEXT:    jl .LBB18_6
 ; X86-NEXT:  # %bb.5:
-; X86-NEXT:    movb %ah, %bh
+; X86-NEXT:    movb %cl, %al
+; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
 ; X86-NEXT:  .LBB18_6:
-; X86-NEXT:    movb %bh, (%esp) # 1-byte Spill
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %bh
-; X86-NEXT:    movb {{[0-9]+}}(%esp), %ah
-; X86-NEXT:    addb %al, %al
-; X86-NEXT:    addb %cl, %cl
-; X86-NEXT:    sarb %dh
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %cl
+; X86-NEXT:    movb {{[0-9]+}}(%esp), %dh
+; X86-NEXT:    addb %ch, %ch
+; X86-NEXT:    addb %dl, %dl
 ; X86-NEXT:    sarb %bl
-; X86-NEXT:    cmpb %dl, %ch
-; X86-NEXT:    setg %dl
-; X86-NEXT:    movb $-1, %ch
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    sarb %bh
+; X86-NEXT:    xorl %eax, %eax
+; X86-NEXT:    movb (%esp), %bl # 1-byte Reload
+; X86-NEXT:    cmpb {{[-0-9]+}}(%e{{[sb]}}p), %bl # 1-byte Folded Reload
+; X86-NEXT:    setg %bl
+; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    movl $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
 ; X86-NEXT:    jl .LBB18_8
 ; X86-NEXT:  # %bb.7:
-; X86-NEXT:    movb %dl, %ch
+; X86-NEXT:    movb %bl, %al
+; X86-NEXT:    movl %eax, %esi
+; X86-NEXT:    movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
 ; X86-NEXT:  .LBB18_8:
-; X86-NEXT:    addb %bh, %bh
-; X86-NEXT:    addb %ah, %ah
-; X86-NEXT:    sarb %al
-; X86-NEXT:    sarb %cl
-; X86-NEXT:    cmpb %dh, %bl
-; X86-NEXT:    setg %dl
-; X86-NEXT:    movb $-1, %bl
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    addb %cl, %cl
+; X86-NEXT:    addb %dh, %dh
+; X86-NEXT:    sarb %ch
+; X86-NEXT:    sarb %dl
+; X86-NEXT:    xorl %eax, %eax
+; X86-NEXT:    cmpb {{[-0-9]+}}(%e{{[sb]}}p), %bh # 1-byte Folded Reload
+; X86-NEXT:    setg %bl
+; X86-NEXT:    movl $-1, %edi
+; X86-NEXT:    movl $-1, %ebp
 ; X86-NEXT:    jl .LBB18_10
 ; X86-NEXT:  # %bb.9:
-; X86-NEXT:    movb %dl, %bl
+; X86-NEXT:    movb %bl, %al
+; X86-NEXT:    movl %eax, %edi
+; X86-NEXT:    xorl %ebp, %ebp
 ; X86-NEXT:  .LBB18_10:
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
-; X86-NEXT:    sarb %bh
-; X86-NEXT:    sarb %ah
-; X86-NEXT:    cmpb %al, %cl
-; X86-NEXT:    setg %cl
-; X86-NEXT:    movb $-1, %al
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sarb %cl
+; X86-NEXT:    sarb %dh
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb %ch, %dl
+; X86-NEXT:    setg %dl
+; X86-NEXT:    movl $-1, (%esp) # 4-byte Folded Spill
+; X86-NEXT:    movl $-1, %esi
 ; X86-NEXT:    jl .LBB18_12
 ; X86-NEXT:  # %bb.11:
-; X86-NEXT:    movb %cl, %al
+; X86-NEXT:    movb %dl, %bl
+; X86-NEXT:    movl %ebx, (%esp) # 4-byte Spill
+; X86-NEXT:    xorl %esi, %esi
 ; X86-NEXT:  .LBB18_12:
-; X86-NEXT:    cmpb %bh, %ah
+; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    xorl %ebx, %ebx
+; X86-NEXT:    cmpb %cl, %dh
 ; X86-NEXT:    setg %cl
-; X86-NEXT:    movb $-1, %dl
+; X86-NEXT:    movl $-1, %edx
 ; X86-NEXT:    jl .LBB18_14
 ; X86-NEXT:  # %bb.13:
-; X86-NEXT:    movl %ecx, %edx
+; X86-NEXT:    movb %cl, %bl
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    xorl %edx, %edx
 ; X86-NEXT:  .LBB18_14:
-; X86-NEXT:    movzbl %dl, %edx
-; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    shll $25, %edx
-; X86-NEXT:    movl %edx, %edi
-; X86-NEXT:    sarl $31, %edi
-; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl %edi, 96(%esi)
-; X86-NEXT:    movl %edi, 92(%esi)
-; X86-NEXT:    movzbl %al, %eax
-; X86-NEXT:    shll $25, %eax
-; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    sarl $31, %eax
-; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl %eax, 80(%esi)
-; X86-NEXT:    movzbl %bl, %eax
-; X86-NEXT:    shll $25, %eax
-; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl %eax, %edi
-; X86-NEXT:    sarl $31, %edi
-; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl %edi, 68(%esi)
-; X86-NEXT:    movl %edi, 64(%esi)
-; X86-NEXT:    movzbl %ch, %ebp
-; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    shll $25, %ebp
-; X86-NEXT:    movl %ebp, %ebx
-; X86-NEXT:    sarl $31, %ebx
-; X86-NEXT:    movl %ebx, 52(%esi)
-; X86-NEXT:    movl %ebx, 48(%esi)
-; X86-NEXT:    movzbl (%esp), %eax # 1-byte Folded Reload
-; X86-NEXT:    shll $25, %eax
-; X86-NEXT:    movl %eax, (%esp) # 4-byte Spill
-; X86-NEXT:    movl %eax, %ecx
-; X86-NEXT:    sarl $31, %ecx
-; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl %ecx, 36(%esi)
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
-; X86-NEXT:    shll $25, %edi
-; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    sarl $31, %edi
-; X86-NEXT:    movl %edi, 24(%esi)
-; X86-NEXT:    movl %edi, 20(%esi)
-; X86-NEXT:    movl %esi, %eax
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
-; X86-NEXT:    shll $25, %esi
+; X86-NEXT:    movl %edx, 4(%eax)
 ; X86-NEXT:    movl %esi, %ecx
-; X86-NEXT:    sarl $31, %ecx
-; X86-NEXT:    movl %ecx, 8(%eax)
-; X86-NEXT:    movl %ecx, 4(%eax)
-; X86-NEXT:    sarl $25, %esi
-; X86-NEXT:    movl %esi, (%eax)
-; X86-NEXT:    sarl $25, %edx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
-; X86-NEXT:    shrdl $2, %esi, %edx
-; X86-NEXT:    movl %edx, 88(%eax)
-; X86-NEXT:    sarl $25, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
-; X86-NEXT:    movl %esi, %edx
-; X86-NEXT:    andl $2097151, %edx # imm = 0x1FFFFF
-; X86-NEXT:    shldl $9, %esi, %edx
-; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
-; X86-NEXT:    shldl $9, %edx, %esi
-; X86-NEXT:    movl %esi, 76(%eax)
+; X86-NEXT:    shrl $2, %ecx
+; X86-NEXT:    movl %ecx, 92(%eax)
+; X86-NEXT:    movl %ebp, %ecx
+; X86-NEXT:    shrl $23, %ecx
+; X86-NEXT:    movl %ecx, 80(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    shrl $12, %ecx
+; X86-NEXT:    movl %ecx, 64(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
+; X86-NEXT:    movl %ebx, %ecx
+; X86-NEXT:    shrl %ecx
+; X86-NEXT:    movl %ecx, 48(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shrl $22, %ecx
+; X86-NEXT:    movl %ecx, 36(%eax)
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
-; X86-NEXT:    sarl $25, %edx
-; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
-; X86-NEXT:    shldl $20, %edx, %esi
-; X86-NEXT:    movl %esi, 60(%eax)
-; X86-NEXT:    sarl $25, %ebp
-; X86-NEXT:    shrdl $1, %ebx, %ebp
-; X86-NEXT:    movl %ebp, 44(%eax)
-; X86-NEXT:    movl (%esp), %edx # 4-byte Reload
-; X86-NEXT:    sarl $25, %edx
-; X86-NEXT:    movl %edx, (%esp) # 4-byte Spill
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
-; X86-NEXT:    movl %esi, %ebp
-; X86-NEXT:    andl $2097151, %ebp # imm = 0x1FFFFF
-; X86-NEXT:    shldl $10, %esi, %ebp
-; X86-NEXT:    shldl $10, %edx, %esi
-; X86-NEXT:    movl %eax, %edx
-; X86-NEXT:    movl %esi, 32(%eax)
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
-; X86-NEXT:    sarl $25, %eax
-; X86-NEXT:    movl %edi, %esi
-; X86-NEXT:    shldl $21, %eax, %esi
-; X86-NEXT:    movl %esi, 16(%edx)
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
-; X86-NEXT:    shrl $2, %esi
-; X86-NEXT:    movw %si, 100(%edx)
-; X86-NEXT:    shll $21, %eax
-; X86-NEXT:    andl $2097151, %ecx # imm = 0x1FFFFF
-; X86-NEXT:    orl %eax, %ecx
-; X86-NEXT:    movl %ecx, 12(%edx)
+; X86-NEXT:    movl %edx, %ecx
+; X86-NEXT:    shrl $11, %ecx
+; X86-NEXT:    movl %ecx, 20(%eax)
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl %ecx, (%eax)
+; X86-NEXT:    movl (%esp), %ecx # 4-byte Reload
+; X86-NEXT:    shldl $30, %ecx, %esi
+; X86-NEXT:    movl %esi, 88(%eax)
 ; X86-NEXT:    shll $30, %ecx
-; X86-NEXT:    addl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Folded Reload
-; X86-NEXT:    movl %ecx, 84(%edx)
+; X86-NEXT:    movl %ecx, 84(%eax)
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shldl $9, %ecx, %ebp
+; X86-NEXT:    movl %ebp, 76(%eax)
 ; X86-NEXT:    shll $9, %ecx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
-; X86-NEXT:    shrl $12, %eax
-; X86-NEXT:    andl $511, %eax # imm = 0x1FF
-; X86-NEXT:    orl %ecx, %eax
-; X86-NEXT:    movl %eax, 72(%edx)
+; X86-NEXT:    movl %ecx, 72(%eax)
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shldl $20, %ecx, %edi
+; X86-NEXT:    movl %edi, 60(%eax)
 ; X86-NEXT:    shll $20, %ecx
-; X86-NEXT:    shrl %ebx
-; X86-NEXT:    andl $1048575, %ebx # imm = 0xFFFFF
-; X86-NEXT:    orl %ecx, %ebx
-; X86-NEXT:    movl %ebx, 56(%edx)
+; X86-NEXT:    movl %ecx, 56(%eax)
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shldl $31, %ecx, %ebx
+; X86-NEXT:    movl %ebx, 44(%eax)
 ; X86-NEXT:    shll $31, %ecx
-; X86-NEXT:    orl %ebp, %ecx
-; X86-NEXT:    movl %ecx, 40(%edx)
-; X86-NEXT:    movl %edx, %ecx
-; X86-NEXT:    movl (%esp), %edx # 4-byte Reload
-; X86-NEXT:    shll $10, %edx
-; X86-NEXT:    shrl $11, %edi
-; X86-NEXT:    andl $1023, %edi # imm = 0x3FF
-; X86-NEXT:    orl %edx, %edi
-; X86-NEXT:    movl %edi, 28(%ecx)
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
-; X86-NEXT:    shrl $18, %eax
-; X86-NEXT:    andl $7, %eax
-; X86-NEXT:    movb %al, 102(%ecx)
-; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:    movl %ecx, 40(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    shldl $10, %ecx, %esi
+; X86-NEXT:    movl %esi, 32(%eax)
+; X86-NEXT:    shll $10, %ecx
+; X86-NEXT:    movl %ecx, 28(%eax)
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shldl $21, %ecx, %edx
+; X86-NEXT:    movl %edx, 16(%eax)
+; X86-NEXT:    shll $21, %ecx
+; X86-NEXT:    movl %ecx, 12(%eax)
+; X86-NEXT:    movb $0, 102(%eax)
+; X86-NEXT:    movw $0, 100(%eax)
+; X86-NEXT:    movl $0, 96(%eax)
+; X86-NEXT:    movl $0, 68(%eax)
+; X86-NEXT:    movl $0, 52(%eax)
+; X86-NEXT:    movl $0, 24(%eax)
+; X86-NEXT:    movl $0, 8(%eax)
 ; X86-NEXT:    addl $44, %esp
 ; X86-NEXT:    popl %esi
 ; X86-NEXT:    popl %edi
@@ -2086,38 +1977,33 @@ define <1 x i3> @scmp_scalarize(<1 x i33> %x, <1 x i33> %y) nounwind {
 define <2 x i8> @scmp_bool_operands(<2 x i1> %x, <2 x i1> %y) nounwind {
 ; X64-LABEL: scmp_bool_operands:
 ; X64:       # %bb.0:
-; X64-NEXT:    psllq $63, %xmm0
-; X64-NEXT:    psrad $31, %xmm0
-; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
-; X64-NEXT:    psllq $63, %xmm1
-; X64-NEXT:    psrad $31, %xmm1
-; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[1,1,3,3]
-; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[3,3,3,3]
-; X64-NEXT:    movq %xmm1, %rax
-; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[3,3,3,3]
-; X64-NEXT:    movq %xmm0, %rcx
-; X64-NEXT:    xorl %edx, %edx
-; X64-NEXT:    cmpq %rax, %rcx
-; X64-NEXT:    setg %dl
-; X64-NEXT:    movq $-1, %rax
-; X64-NEXT:    cmovlq %rax, %rdx
-; X64-NEXT:    movq %rdx, %xmm0
-; X64-NEXT:    movq %xmm3, %rcx
-; X64-NEXT:    movq %xmm2, %rdx
+; X64-NEXT:    movaps %xmm1, -{{[0-9]+}}(%rsp)
+; X64-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    andb $1, %cl
+; X64-NEXT:    negb %cl
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %edx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %esi
+; X64-NEXT:    andb $1, %sil
+; X64-NEXT:    negb %sil
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpb %cl, %sil
+; X64-NEXT:    setg %dil
+; X64-NEXT:    movl $255, %ecx
+; X64-NEXT:    cmovll %ecx, %edi
+; X64-NEXT:    shll $8, %edi
+; X64-NEXT:    andb $1, %al
+; X64-NEXT:    negb %al
+; X64-NEXT:    andb $1, %dl
+; X64-NEXT:    negb %dl
 ; X64-NEXT:    xorl %esi, %esi
-; X64-NEXT:    cmpq %rcx, %rdx
+; X64-NEXT:    cmpb %al, %dl
 ; X64-NEXT:    setg %sil
-; X64-NEXT:    cmovlq %rax, %rsi
-; X64-NEXT:    movq %rsi, %xmm1
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm0[0]
-; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
-; X64-NEXT:    packuswb %xmm1, %xmm1
-; X64-NEXT:    packuswb %xmm1, %xmm1
-; X64-NEXT:    packuswb %xmm1, %xmm1
-; X64-NEXT:    psllw $7, %xmm1
-; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
-; X64-NEXT:    pxor %xmm0, %xmm0
-; X64-NEXT:    pcmpgtb %xmm1, %xmm0
+; X64-NEXT:    cmovll %ecx, %esi
+; X64-NEXT:    movzbl %sil, %eax
+; X64-NEXT:    orl %edi, %eax
+; X64-NEXT:    movd %eax, %xmm0
 ; X64-NEXT:    retq
 ;
 ; X86-LABEL: scmp_bool_operands:
@@ -2156,67 +2042,23 @@ define <2 x i8> @scmp_bool_operands(<2 x i1> %x, <2 x i1> %y) nounwind {
 define <2 x i16> @scmp_ret_wider_than_operands(<2 x i8> %x, <2 x i8> %y) nounwind {
 ; X64-LABEL: scmp_ret_wider_than_operands:
 ; X64:       # %bb.0:
-; X64-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
-; X64-NEXT:    movaps %xmm1, -{{[0-9]+}}(%rsp)
-; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
-; X64-NEXT:    xorl %edx, %edx
-; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT:    setg %dl
-; X64-NEXT:    movl $255, %eax
-; X64-NEXT:    cmovll %eax, %edx
-; X64-NEXT:    shll $24, %edx
+; X64-NEXT:    movd %xmm1, %eax
+; X64-NEXT:    movl %eax, %ecx
+; X64-NEXT:    shrl $8, %ecx
+; X64-NEXT:    movd %xmm0, %edx
+; X64-NEXT:    movl %edx, %esi
+; X64-NEXT:    shrl $8, %esi
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpb %cl, %sil
+; X64-NEXT:    setg %dil
+; X64-NEXT:    movl $65535, %ecx # imm = 0xFFFF
+; X64-NEXT:    cmovll %ecx, %edi
 ; X64-NEXT:    xorl %esi, %esi
-; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
+; X64-NEXT:    cmpb %al, %dl
 ; X64-NEXT:    setg %sil
-; X64-NEXT:    cmovll %eax, %esi
-; X64-NEXT:    movzbl %sil, %ecx
-; X64-NEXT:    shll $8, %ecx
-; X64-NEXT:    orl %edx, %ecx
-; X64-NEXT:    movd %ecx, %xmm0
-; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; X64-NEXT:    xorl %edx, %edx
-; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovll %eax, %edx
-; X64-NEXT:    shll $8, %edx
-; X64-NEXT:    pinsrw $2, %edx, %xmm0
-; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; X64-NEXT:    xorl %edx, %edx
-; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovll %eax, %edx
-; X64-NEXT:    shll $8, %edx
-; X64-NEXT:    pinsrw $3, %edx, %xmm0
-; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; X64-NEXT:    xorl %edx, %edx
-; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovll %eax, %edx
-; X64-NEXT:    shll $8, %edx
-; X64-NEXT:    pinsrw $4, %edx, %xmm0
-; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; X64-NEXT:    xorl %edx, %edx
-; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovll %eax, %edx
-; X64-NEXT:    shll $8, %edx
-; X64-NEXT:    pinsrw $5, %edx, %xmm0
-; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; X64-NEXT:    xorl %edx, %edx
-; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovll %eax, %edx
-; X64-NEXT:    shll $8, %edx
-; X64-NEXT:    pinsrw $6, %edx, %xmm0
-; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
-; X64-NEXT:    xorl %edx, %edx
-; X64-NEXT:    cmpb -{{[0-9]+}}(%rsp), %cl
-; X64-NEXT:    setg %dl
-; X64-NEXT:    cmovll %eax, %edx
-; X64-NEXT:    shll $8, %edx
-; X64-NEXT:    pinsrw $7, %edx, %xmm0
-; X64-NEXT:    psraw $8, %xmm0
+; X64-NEXT:    cmovll %ecx, %esi
+; X64-NEXT:    movd %esi, %xmm0
+; X64-NEXT:    pinsrw $1, %edi, %xmm0
 ; X64-NEXT:    retq
 ;
 ; X86-LABEL: scmp_ret_wider_than_operands:
diff --git a/llvm/test/CodeGen/X86/ucmp.ll b/llvm/test/CodeGen/X86/ucmp.ll
index 724dcc5aa2a60..344404749d7ef 100644
--- a/llvm/test/CodeGen/X86/ucmp.ll
+++ b/llvm/test/CodeGen/X86/ucmp.ll
@@ -584,49 +584,47 @@ define <4 x i32> @ucmp_normal_vectors(<4 x i32> %x, <4 x i32> %y) nounwind {
 define <4 x i8> @ucmp_narrow_vec_result(<4 x i32> %x, <4 x i32> %y) nounwind {
 ; X64-LABEL: ucmp_narrow_vec_result:
 ; X64:       # %bb.0:
-; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
-; X64-NEXT:    movd %xmm2, %eax
-; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[3,3,3,3]
-; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    movd %xmm1, %eax
+; X64-NEXT:    movd %xmm0, %ecx
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpl %eax, %ecx
 ; X64-NEXT:    seta %dl
-; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    movl $255, %eax
 ; X64-NEXT:    cmovbl %eax, %edx
-; X64-NEXT:    movd %edx, %xmm2
-; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3]
-; X64-NEXT:    movd %xmm3, %ecx
-; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
-; X64-NEXT:    movd %xmm3, %edx
-; X64-NEXT:    xorl %esi, %esi
-; X64-NEXT:    cmpl %ecx, %edx
-; X64-NEXT:    seta %sil
-; X64-NEXT:    cmovbl %eax, %esi
-; X64-NEXT:    movd %esi, %xmm3
-; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; X64-NEXT:    movd %xmm1, %ecx
-; X64-NEXT:    movd %xmm0, %edx
-; X64-NEXT:    xorl %esi, %esi
-; X64-NEXT:    cmpl %ecx, %edx
-; X64-NEXT:    seta %sil
-; X64-NEXT:    cmovbl %eax, %esi
-; X64-NEXT:    movd %esi, %xmm2
-; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1]
-; X64-NEXT:    movd %xmm1, %ecx
-; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
-; X64-NEXT:    movd %xmm0, %edx
-; X64-NEXT:    xorl %esi, %esi
-; X64-NEXT:    cmpl %ecx, %edx
-; X64-NEXT:    seta %sil
-; X64-NEXT:    cmovbl %eax, %esi
-; X64-NEXT:    movd %esi, %xmm0
-; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
-; X64-NEXT:    pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2
-; X64-NEXT:    pxor %xmm0, %xmm0
-; X64-NEXT:    packuswb %xmm0, %xmm2
-; X64-NEXT:    packuswb %xmm0, %xmm2
-; X64-NEXT:    movdqa %xmm2, %xmm0
+; X64-NEXT:    movzbl %dl, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[1,1,1,1]
+; X64-NEXT:    movd %xmm2, %edx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,1,1]
+; X64-NEXT:    movd %xmm2, %esi
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpl %edx, %esi
+; X64-NEXT:    seta %dil
+; X64-NEXT:    cmovbl %eax, %edi
+; X64-NEXT:    movzbl %dil, %edx
+; X64-NEXT:    shll $8, %edx
+; X64-NEXT:    orl %ecx, %edx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[2,3,2,3]
+; X64-NEXT:    movd %xmm2, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
+; X64-NEXT:    movd %xmm2, %esi
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpl %ecx, %esi
+; X64-NEXT:    seta %dil
+; X64-NEXT:    cmovbl %eax, %edi
+; X64-NEXT:    movzbl %dil, %ecx
+; X64-NEXT:    shll $16, %ecx
+; X64-NEXT:    orl %edx, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[3,3,3,3]
+; X64-NEXT:    movd %xmm1, %edx
+; X64-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[3,3,3,3]
+; X64-NEXT:    movd %xmm0, %esi
+; X64-NEXT:    xorl %edi, %edi
+; X64-NEXT:    cmpl %edx, %esi
+; X64-NEXT:    seta %dil
+; X64-NEXT:    cmovbl %eax, %edi
+; X64-NEXT:    shll $24, %edi
+; X64-NEXT:    orl %ecx, %edi
+; X64-NEXT:    movd %edi, %xmm0
 ; X64-NEXT:    retq
 ;
 ; X86-LABEL: ucmp_narrow_vec_result:
@@ -1201,7 +1199,7 @@ define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
 ; X64-NEXT:    xorl %edx, %edx
 ; X64-NEXT:    cmpl %eax, %ecx
 ; X64-NEXT:    seta %dl
-; X64-NEXT:    movl $-1, %eax
+; X64-NEXT:    movl $255, %eax
 ; X64-NEXT:    cmovbl %eax, %edx
 ; X64-NEXT:    movd %edx, %xmm8
 ; X64-NEXT:    pshufd {{.*#+}} xmm9 = xmm7[2,3,2,3]
@@ -1213,7 +1211,7 @@ define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
 ; X64-NEXT:    movd %esi, %xmm9
-; X64-NEXT:    punpckldq {{.*#+}} xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1],xmm9[2],xmm8[2],xmm9[3],xmm8[3],xmm9[4],xmm8[4],xmm9[5],xmm8[5],xmm9[6],xmm8[6],xmm9[7],xmm8[7]
 ; X64-NEXT:    movd %xmm7, %ecx
 ; X64-NEXT:    movd %xmm3, %edx
 ; X64-NEXT:    xorl %esi, %esi
@@ -1230,36 +1228,34 @@ define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
 ; X64-NEXT:    movd %esi, %xmm3
-; X64-NEXT:    punpckldq {{.*#+}} xmm8 = xmm8[0],xmm3[0],xmm8[1],xmm3[1]
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm8 = xmm8[0],xmm9[0]
-; X64-NEXT:    movdqa {{.*#+}} xmm3 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
-; X64-NEXT:    pand %xmm3, %xmm8
-; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[3,3,3,3]
-; X64-NEXT:    movd %xmm7, %ecx
-; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm2[3,3,3,3]
-; X64-NEXT:    movd %xmm7, %edx
+; X64-NEXT:    punpcklbw {{.*#+}} xmm8 = xmm8[0],xmm3[0],xmm8[1],xmm3[1],xmm8[2],xmm3[2],xmm8[3],xmm3[3],xmm8[4],xmm3[4],xmm8[5],xmm3[5],xmm8[6],xmm3[6],xmm8[7],xmm3[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm8 = xmm8[0],xmm9[0],xmm8[1],xmm9[1],xmm8[2],xmm9[2],xmm8[3],xmm9[3]
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm6[3,3,3,3]
+; X64-NEXT:    movd %xmm3, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm3 = xmm2[3,3,3,3]
+; X64-NEXT:    movd %xmm3, %edx
 ; X64-NEXT:    xorl %esi, %esi
 ; X64-NEXT:    cmpl %ecx, %edx
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
-; X64-NEXT:    movd %esi, %xmm7
-; X64-NEXT:    pshufd {{.*#+}} xmm9 = xmm6[2,3,2,3]
-; X64-NEXT:    movd %xmm9, %ecx
-; X64-NEXT:    pshufd {{.*#+}} xmm9 = xmm2[2,3,2,3]
-; X64-NEXT:    movd %xmm9, %edx
+; X64-NEXT:    movd %esi, %xmm3
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm6[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %ecx
+; X64-NEXT:    pshufd {{.*#+}} xmm7 = xmm2[2,3,2,3]
+; X64-NEXT:    movd %xmm7, %edx
 ; X64-NEXT:    xorl %esi, %esi
 ; X64-NEXT:    cmpl %ecx, %edx
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
-; X64-NEXT:    movd %esi, %xmm9
-; X64-NEXT:    punpckldq {{.*#+}} xmm9 = xmm9[0],xmm7[0],xmm9[1],xmm7[1]
+; X64-NEXT:    movd %esi, %xmm7
+; X64-NEXT:    punpcklbw {{.*#+}} xmm7 = xmm7[0],xmm3[0],xmm7[1],xmm3[1],xmm7[2],xmm3[2],xmm7[3],xmm3[3],xmm7[4],xmm3[4],xmm7[5],xmm3[5],xmm7[6],xmm3[6],xmm7[7],xmm3[7]
 ; X64-NEXT:    movd %xmm6, %ecx
 ; X64-NEXT:    movd %xmm2, %edx
 ; X64-NEXT:    xorl %esi, %esi
 ; X64-NEXT:    cmpl %ecx, %edx
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
-; X64-NEXT:    movd %esi, %xmm7
+; X64-NEXT:    movd %esi, %xmm3
 ; X64-NEXT:    pshufd {{.*#+}} xmm6 = xmm6[1,1,1,1]
 ; X64-NEXT:    movd %xmm6, %ecx
 ; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,1,1,1]
@@ -1269,10 +1265,9 @@ define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
 ; X64-NEXT:    movd %esi, %xmm2
-; X64-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm7 = xmm7[0],xmm9[0]
-; X64-NEXT:    pand %xmm3, %xmm7
-; X64-NEXT:    packuswb %xmm8, %xmm7
+; X64-NEXT:    punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3],xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm7[0],xmm3[1],xmm7[1],xmm3[2],xmm7[2],xmm3[3],xmm7[3]
+; X64-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm8[0],xmm3[1],xmm8[1]
 ; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm5[3,3,3,3]
 ; X64-NEXT:    movd %xmm2, %ecx
 ; X64-NEXT:    pshufd {{.*#+}} xmm2 = xmm1[3,3,3,3]
@@ -1291,7 +1286,7 @@ define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
 ; X64-NEXT:    movd %esi, %xmm6
-; X64-NEXT:    punpckldq {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3],xmm6[4],xmm2[4],xmm6[5],xmm2[5],xmm6[6],xmm2[6],xmm6[7],xmm2[7]
 ; X64-NEXT:    movd %xmm5, %ecx
 ; X64-NEXT:    movd %xmm1, %edx
 ; X64-NEXT:    xorl %esi, %esi
@@ -1308,9 +1303,8 @@ define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
 ; X64-NEXT:    movd %esi, %xmm1
-; X64-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm6[0]
-; X64-NEXT:    pand %xmm3, %xmm2
+; X64-NEXT:    punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1],xmm2[2],xmm6[2],xmm2[3],xmm6[3]
 ; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm4[3,3,3,3]
 ; X64-NEXT:    movd %xmm1, %ecx
 ; X64-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[3,3,3,3]
@@ -1329,7 +1323,7 @@ define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
 ; X64-NEXT:    movd %esi, %xmm5
-; X64-NEXT:    punpckldq {{.*#+}} xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1],xmm5[2],xmm1[2],xmm5[3],xmm1[3],xmm5[4],xmm1[4],xmm5[5],xmm1[5],xmm5[6],xmm1[6],xmm5[7],xmm1[7]
 ; X64-NEXT:    movd %xmm4, %ecx
 ; X64-NEXT:    movd %xmm0, %edx
 ; X64-NEXT:    xorl %esi, %esi
@@ -1346,11 +1340,10 @@ define <16 x i8> @ucmp_wide_vec_op(<16 x i32> %x, <16 x i32> %y) nounwind {
 ; X64-NEXT:    seta %sil
 ; X64-NEXT:    cmovbl %eax, %esi
 ; X64-NEXT:    movd %esi, %xmm0
-; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
-; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm5[0]
-; X64-NEXT:    pand %xmm3, %xmm1
-; X64-NEXT:    packuswb %xmm2, %xmm1
-; X64-NEXT:    packuswb %xmm7, %xmm1
+; X64-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm5[0],xmm1[1],xmm5[1],xmm1[2],xmm5[2],xmm1[3],xmm5[3]
+; X64-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
 ; X64-NEXT:    movdqa %xmm1, %xmm0
 ; X64-NEXT:    retq
 ;
@@ -1544,28 +1537,24 @@ define <17 x i2> @ucmp_uncommon_vectors(<17 x i71> %x, <17 x i71> %y) nounwind {
 ; X64-NEXT:    pushq %r13
 ; X64-NEXT:    pushq %r12
 ; X64-NEXT:    pushq %rbx
-; X64-NEXT:    subq $168, %rsp
+; X64-NEXT:    subq $120, %rsp
 ; X64-NEXT:    movq %r9, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq %rdx, %r11
+; X64-NEXT:    movq %rsi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    andl $127, %r8d
-; X64-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    andl $127, %eax
-; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    andl $127, %eax
-; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    andl $127, %edx
+; X64-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    andl $127, %r8d
+; X64-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
@@ -1583,7 +1572,7 @@ define <17 x i2> @ucmp_uncommon_vectors(<17 x i71> %x, <17 x i71> %y) nounwind {
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
-; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq %rax, (%rsp) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
@@ -1611,282 +1600,342 @@ define <17 x i2> @ucmp_uncommon_vectors(<17 x i71> %x, <17 x i71> %y) nounwind {
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    andl $127, %eax
-; X64-NEXT:    movq %rax, (%rsp) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r13
+; X64-NEXT:    andl $127, %r13d
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r15
 ; X64-NEXT:    andl $127, %r15d
-; X64-NEXT:    movq %r15, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
 ; X64-NEXT:    andl $127, %eax
-; X64-NEXT:    movq %rax, %rbp
 ; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rbx
 ; X64-NEXT:    andl $127, %ebx
-; X64-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    andl $127, %eax
-; X64-NEXT:    movq %rax, %r12
-; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r12
+; X64-NEXT:    andl $127, %r12d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rbp
+; X64-NEXT:    andl $127, %ebp
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r11
+; X64-NEXT:    andl $127, %r11d
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r8
 ; X64-NEXT:    andl $127, %r8d
-; X64-NEXT:    movq %r8, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r10
+; X64-NEXT:    andl $127, %r10d
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
 ; X64-NEXT:    andl $127, %edx
-; X64-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    andl $127, %eax
-; X64-NEXT:    movq %rax, %r13
-; X64-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    andl $127, %r11d
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    andl $127, %eax
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; X64-NEXT:    andl $127, %ecx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rsi
+; X64-NEXT:    andl $127, %esi
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r14
 ; X64-NEXT:    andl $127, %r14d
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    andl $127, %ecx
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r9
-; X64-NEXT:    cmpq %rdi, %r9
-; X64-NEXT:    movq %r14, %r10
-; X64-NEXT:    sbbq %rcx, %r10
-; X64-NEXT:    setb %r10b
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
 ; X64-NEXT:    cmpq %r9, %rdi
-; X64-NEXT:    sbbq %r14, %rcx
-; X64-NEXT:    movzbl %r10b, %edi
-; X64-NEXT:    movq $-1, %rcx
-; X64-NEXT:    cmovbq %rcx, %rdi
-; X64-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r9
-; X64-NEXT:    cmpq %rsi, %r9
-; X64-NEXT:    movq %rax, %rdi
-; X64-NEXT:    sbbq %r11, %rdi
-; X64-NEXT:    setb %dil
-; X64-NEXT:    cmpq %r9, %rsi
-; X64-NEXT:    sbbq %rax, %r11
-; X64-NEXT:    movzbl %dil, %r14d
-; X64-NEXT:    cmovbq %rcx, %r14
+; X64-NEXT:    movq %rcx, %rax
+; X64-NEXT:    sbbq %r14, %rax
+; X64-NEXT:    setb %al
+; X64-NEXT:    cmpq %rdi, %r9
+; X64-NEXT:    sbbq %rcx, %r14
+; X64-NEXT:    movzbl %al, %eax
+; X64-NEXT:    movl $255, %r14d
+; X64-NEXT:    cmovbl %r14d, %eax
+; X64-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; X64-NEXT:    movq %r13, %rcx
-; X64-NEXT:    sbbq %rdx, %rcx
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq %rax, %rcx
+; X64-NEXT:    movq %rsi, %rdi
+; X64-NEXT:    sbbq %rdx, %rdi
+; X64-NEXT:    setb %dil
+; X64-NEXT:    cmpq %rcx, %rax
+; X64-NEXT:    sbbq %rsi, %rdx
+; X64-NEXT:    movzbl %dil, %eax
+; X64-NEXT:    cmovbl %r14d, %eax
+; X64-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; X64-NEXT:    sbbq %r12, %r8
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq %rax, %rcx
+; X64-NEXT:    movq %r10, %rdx
+; X64-NEXT:    sbbq %r8, %rdx
+; X64-NEXT:    setb %dl
+; X64-NEXT:    cmpq %rcx, %rax
+; X64-NEXT:    sbbq %r10, %r8
+; X64-NEXT:    movzbl %dl, %eax
+; X64-NEXT:    cmovbl %r14d, %eax
+; X64-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; X64-NEXT:    sbbq %rbp, %rbx
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq %rax, %rcx
+; X64-NEXT:    movq %r11, %rdx
+; X64-NEXT:    sbbq %rbp, %rdx
+; X64-NEXT:    setb %dl
+; X64-NEXT:    cmpq %rcx, %rax
+; X64-NEXT:    sbbq %r11, %rbp
+; X64-NEXT:    movzbl %dl, %eax
+; X64-NEXT:    cmovbl %r14d, %eax
+; X64-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Folded Reload
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq %rax, %rcx
+; X64-NEXT:    movq %r12, %rdx
+; X64-NEXT:    sbbq %rbx, %rdx
+; X64-NEXT:    setb %dl
+; X64-NEXT:    cmpq %rcx, %rax
+; X64-NEXT:    sbbq %r12, %rbx
+; X64-NEXT:    movzbl %dl, %eax
+; X64-NEXT:    cmovbl %r14d, %eax
+; X64-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; X64-NEXT:    movq (%rsp), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq %rax, %rcx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
+; X64-NEXT:    movq %rsi, %rdx
+; X64-NEXT:    sbbq %r15, %rdx
+; X64-NEXT:    setb %dl
+; X64-NEXT:    cmpq %rcx, %rax
+; X64-NEXT:    sbbq %rsi, %r15
+; X64-NEXT:    movzbl %dl, %eax
+; X64-NEXT:    cmovbl %r14d, %eax
+; X64-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
 ; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    cmpq %rax, %rcx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
+; X64-NEXT:    movq %rsi, %rdx
+; X64-NEXT:    sbbq %r13, %rdx
+; X64-NEXT:    setb %dl
+; X64-NEXT:    cmpq %rcx, %rax
+; X64-NEXT:    sbbq %rsi, %r13
+; X64-NEXT:    movzbl %dl, %eax
+; X64-NEXT:    cmovbl %r14d, %eax
+; X64-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    cmpq %rcx, %rdx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdi # 8-byte Reload
+; X64-NEXT:    movq %rdi, %rsi
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %rsi
+; X64-NEXT:    setb %sil
+; X64-NEXT:    cmpq %rdx, %rcx
+; X64-NEXT:    sbbq %rdi, %rax
+; X64-NEXT:    movzbl %sil, %ebp
+; X64-NEXT:    cmovbl %r14d, %ebp
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rsi
+; X64-NEXT:    cmpq %rdx, %rsi
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq %rcx, %rdi
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %rdi
+; X64-NEXT:    setb %dil
+; X64-NEXT:    cmpq %rsi, %rdx
+; X64-NEXT:    sbbq %rcx, %rax
+; X64-NEXT:    movzbl %dil, %ebx
+; X64-NEXT:    cmovbl %r14d, %ebx
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rsi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
+; X64-NEXT:    cmpq %rsi, %rdi
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq %rcx, %r8
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %r8
+; X64-NEXT:    setb %r8b
+; X64-NEXT:    cmpq %rdi, %rsi
+; X64-NEXT:    sbbq %rcx, %rax
+; X64-NEXT:    movzbl %r8b, %r10d
+; X64-NEXT:    cmovbl %r14d, %r10d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r8
+; X64-NEXT:    cmpq %rdi, %r8
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
+; X64-NEXT:    movq %rcx, %r9
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %r9
+; X64-NEXT:    setb %r9b
+; X64-NEXT:    cmpq %r8, %rdi
+; X64-NEXT:    sbbq %rcx, %rax
+; X64-NEXT:    movzbl %r9b, %r8d
+; X64-NEXT:    cmovbl %r14d, %r8d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r9
+; X64-NEXT:    cmpq %rdi, %r9
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq %rcx, %r11
+; X64-NEXT:    movq (%rsp), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %r11
+; X64-NEXT:    setb %r11b
+; X64-NEXT:    cmpq %r9, %rdi
+; X64-NEXT:    sbbq %rcx, %rax
+; X64-NEXT:    movzbl %r11b, %r9d
+; X64-NEXT:    cmovbl %r14d, %r9d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r11
+; X64-NEXT:    cmpq %rdi, %r11
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
+; X64-NEXT:    movq %rcx, %r15
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %r15
+; X64-NEXT:    setb %r15b
+; X64-NEXT:    cmpq %r11, %rdi
+; X64-NEXT:    sbbq %rcx, %rax
+; X64-NEXT:    movzbl %r15b, %r11d
+; X64-NEXT:    cmovbl %r14d, %r11d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdi
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    cmpq %rax, %rdi
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; X64-NEXT:    movq %rdx, %r15
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Reload
-; X64-NEXT:    sbbq %r15, %rcx
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r12 # 8-byte Reload
-; X64-NEXT:    movq %r12, %rcx
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r10 # 8-byte Reload
-; X64-NEXT:    sbbq %r10, %rcx
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
-; X64-NEXT:    movq %rbx, %rcx
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r9 # 8-byte Reload
-; X64-NEXT:    sbbq %r9, %rcx
-; X64-NEXT:    setb {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Folded Spill
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdi # 8-byte Reload
-; X64-NEXT:    cmpq %rdi, {{[0-9]+}}(%rsp)
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %r8 # 8-byte Reload
-; X64-NEXT:    movq %r8, %rbp
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
-; X64-NEXT:    sbbq %rsi, %rbp
-; X64-NEXT:    setb %bpl
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r11
+; X64-NEXT:    sbbq %rcx, %r15
+; X64-NEXT:    setb %r15b
+; X64-NEXT:    cmpq %rdi, %rax
+; X64-NEXT:    sbbq %rdx, %rcx
+; X64-NEXT:    movzbl %r15b, %edi
+; X64-NEXT:    cmovbl %r14d, %edi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r15
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    cmpq %rcx, %r15
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
+; X64-NEXT:    movq %rdx, %r12
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %r12
+; X64-NEXT:    setb %r12b
+; X64-NEXT:    cmpq %r15, %rcx
+; X64-NEXT:    sbbq %rdx, %rax
+; X64-NEXT:    movzbl %r12b, %r15d
+; X64-NEXT:    cmovbl %r14d, %r15d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %r12
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    cmpq %rcx, %r11
+; X64-NEXT:    cmpq %rcx, %r12
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
 ; X64-NEXT:    movq %rdx, %r13
 ; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
 ; X64-NEXT:    sbbq %rax, %r13
 ; X64-NEXT:    setb %r13b
-; X64-NEXT:    andl $3, %r14d
-; X64-NEXT:    cmpq %r11, %rcx
+; X64-NEXT:    cmpq %r12, %rcx
 ; X64-NEXT:    sbbq %rdx, %rax
+; X64-NEXT:    movzbl %r13b, %r12d
+; X64-NEXT:    cmovbl %r14d, %r12d
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rsi
+; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; X64-NEXT:    cmpq %rsi, %rdx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
+; X64-NEXT:    movq %rcx, %r13
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
+; X64-NEXT:    sbbq %rax, %r13
+; X64-NEXT:    setb %r13b
+; X64-NEXT:    cmpq %rdx, %rsi
+; X64-NEXT:    sbbq %rcx, %rax
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Folded Reload
+; X64-NEXT:    # xmm0 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 4-byte Folded Reload
+; X64-NEXT:    # xmm1 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm2 # 4-byte Folded Reload
+; X64-NEXT:    # xmm2 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm3 # 4-byte Folded Reload
+; X64-NEXT:    # xmm3 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm4 # 4-byte Folded Reload
+; X64-NEXT:    # xmm4 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm5 # 4-byte Folded Reload
+; X64-NEXT:    # xmm5 = mem[0],zero,zero,zero
+; X64-NEXT:    movd {{[-0-9]+}}(%r{{[sb]}}p), %xmm6 # 4-byte Folded Reload
+; X64-NEXT:    # xmm6 = mem[0],zero,zero,zero
+; X64-NEXT:    movd %ebp, %xmm7
+; X64-NEXT:    movd %ebx, %xmm8
+; X64-NEXT:    movd %r10d, %xmm9
+; X64-NEXT:    movd %r8d, %xmm10
+; X64-NEXT:    movd %r9d, %xmm11
+; X64-NEXT:    movd %r11d, %xmm12
+; X64-NEXT:    movd %edi, %xmm13
+; X64-NEXT:    movd %r15d, %xmm14
+; X64-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3],xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1],xmm3[2],xmm1[2],xmm3[3],xmm1[3]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1],xmm5[2],xmm4[2],xmm5[3],xmm4[3],xmm5[4],xmm4[4],xmm5[5],xmm4[5],xmm5[6],xmm4[6],xmm5[7],xmm4[7]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1],xmm7[2],xmm6[2],xmm7[3],xmm6[3],xmm7[4],xmm6[4],xmm7[5],xmm6[5],xmm7[6],xmm6[6],xmm7[7],xmm6[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm7 = xmm7[0],xmm5[0],xmm7[1],xmm5[1],xmm7[2],xmm5[2],xmm7[3],xmm5[3]
+; X64-NEXT:    punpckldq {{.*#+}} xmm7 = xmm7[0],xmm3[0],xmm7[1],xmm3[1]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1],xmm9[2],xmm8[2],xmm9[3],xmm8[3],xmm9[4],xmm8[4],xmm9[5],xmm8[5],xmm9[6],xmm8[6],xmm9[7],xmm8[7]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm11 = xmm11[0],xmm10[0],xmm11[1],xmm10[1],xmm11[2],xmm10[2],xmm11[3],xmm10[3],xmm11[4],xmm10[4],xmm11[5],xmm10[5],xmm11[6],xmm10[6],xmm11[7],xmm10[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm11 = xmm11[0],xmm9[0],xmm11[1],xmm9[1],xmm11[2],xmm9[2],xmm11[3],xmm9[3]
+; X64-NEXT:    punpcklbw {{.*#+}} xmm13 = xmm13[0],xmm12[0],xmm13[1],xmm12[1],xmm13[2],xmm12[2],xmm13[3],xmm12[3],xmm13[4],xmm12[4],xmm13[5],xmm12[5],xmm13[6],xmm12[6],xmm13[7],xmm12[7]
+; X64-NEXT:    movd %r12d, %xmm0
+; X64-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm14[0],xmm0[1],xmm14[1],xmm0[2],xmm14[2],xmm0[3],xmm14[3],xmm0[4],xmm14[4],xmm0[5],xmm14[5],xmm0[6],xmm14[6],xmm0[7],xmm14[7]
+; X64-NEXT:    punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm13[0],xmm0[1],xmm13[1],xmm0[2],xmm13[2],xmm0[3],xmm13[3]
+; X64-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm11[0],xmm0[1],xmm11[1]
+; X64-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm7[0]
 ; X64-NEXT:    movzbl %r13b, %eax
-; X64-NEXT:    movl $-1, %r13d
-; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    cmovbl %r14d, %eax
 ; X64-NEXT:    andl $3, %eax
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdi
-; X64-NEXT:    sbbq %r8, %rsi
-; X64-NEXT:    leaq (%r14,%rax,4), %rax
-; X64-NEXT:    movzbl %bpl, %ecx
-; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdi # 8-byte Reload
+; X64-NEXT:    movb %al, 4(%rdi)
+; X64-NEXT:    movdqa %xmm0, -{{[0-9]+}}(%rsp)
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
+; X64-NEXT:    andl $3, %eax
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
+; X64-NEXT:    andl $3, %ecx
+; X64-NEXT:    leaq (%rcx,%rax,4), %rax
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
 ; X64-NEXT:    andl $3, %ecx
 ; X64-NEXT:    shll $4, %ecx
 ; X64-NEXT:    orq %rax, %rcx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; X64-NEXT:    sbbq %rbx, %r9
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
 ; X64-NEXT:    andl $3, %eax
 ; X64-NEXT:    shll $6, %eax
 ; X64-NEXT:    orq %rcx, %rax
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; X64-NEXT:    cmpq %rcx, {{[0-9]+}}(%rsp)
-; X64-NEXT:    sbbq %r12, %r10
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
 ; X64-NEXT:    andl $3, %ecx
 ; X64-NEXT:    shll $8, %ecx
 ; X64-NEXT:    orq %rax, %rcx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq %rax, {{[0-9]+}}(%rsp)
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %r15 # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
 ; X64-NEXT:    andl $3, %eax
 ; X64-NEXT:    shll $10, %eax
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
-; X64-NEXT:    cmpq %rdx, {{[0-9]+}}(%rsp)
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %edx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %edx
 ; X64-NEXT:    andl $3, %edx
 ; X64-NEXT:    shll $12, %edx
 ; X64-NEXT:    orq %rax, %rdx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %esi # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %esi
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %esi
 ; X64-NEXT:    andl $3, %esi
 ; X64-NEXT:    shll $14, %esi
 ; X64-NEXT:    orq %rdx, %rsi
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
 ; X64-NEXT:    andl $3, %eax
 ; X64-NEXT:    shll $16, %eax
 ; X64-NEXT:    orq %rsi, %rax
 ; X64-NEXT:    orq %rcx, %rax
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
 ; X64-NEXT:    andl $3, %ecx
 ; X64-NEXT:    shll $18, %ecx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdx
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %edx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %edx
 ; X64-NEXT:    andl $3, %edx
 ; X64-NEXT:    shll $20, %edx
 ; X64-NEXT:    orq %rcx, %rdx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq (%rsp), %rcx # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
 ; X64-NEXT:    andl $3, %ecx
 ; X64-NEXT:    shll $22, %ecx
 ; X64-NEXT:    orq %rdx, %rcx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rdx
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; X64-NEXT:    sbbq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Folded Spill
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %edx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %edx
 ; X64-NEXT:    andl $3, %edx
 ; X64-NEXT:    shll $24, %edx
 ; X64-NEXT:    orq %rcx, %rdx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rcx
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %ecx # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %ecx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %ecx
 ; X64-NEXT:    andl $3, %ecx
 ; X64-NEXT:    shlq $26, %rcx
 ; X64-NEXT:    orq %rdx, %rcx
 ; X64-NEXT:    orq %rax, %rcx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rax
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %eax
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %eax
 ; X64-NEXT:    andl $3, %eax
 ; X64-NEXT:    shlq $28, %rax
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
-; X64-NEXT:    andl $3, %edx
-; X64-NEXT:    movq {{[0-9]+}}(%rsp), %rsi
-; X64-NEXT:    cmpq {{[0-9]+}}(%rsp), %rsi
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
-; X64-NEXT:    sbbq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Folded Reload
-; X64-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
-; X64-NEXT:    movb %dl, 4(%rsi)
-; X64-NEXT:    movzbl {{[-0-9]+}}(%r{{[sb]}}p), %edx # 1-byte Folded Reload
-; X64-NEXT:    cmovbl %r13d, %edx
+; X64-NEXT:    movzbl -{{[0-9]+}}(%rsp), %edx
 ; X64-NEXT:    andl $3, %edx
 ; X64-NEXT:    shlq $30, %rdx
 ; X64-NEXT:    orq %rax, %rdx
 ; X64-NEXT:    orq %rcx, %rdx
-; X64-NEXT:    movq %rsi, %rax
-; X64-NEXT:    movl %edx, (%rsi)
-; X64-NEXT:    addq $168, %rsp
+; X64-NEXT:    movq %rdi, %rax
+; X64-NEXT:    movl %edx, (%rdi)
+; X64-NEXT:    addq $120, %rsp
 ; X64-NEXT:    popq %rbx
 ; X64-NEXT:    popq %r12
 ; X64-NEXT:    popq %r13
@@ -1901,541 +1950,544 @@ define <17 x i2> @ucmp_uncommon_vectors(<17 x i71> %x, <17 x i71> %y) nounwind {
 ; X86-NEXT:    pushl %ebx
 ; X86-NEXT:    pushl %edi
 ; X86-NEXT:    pushl %esi
-; X86-NEXT:    subl $68, %esp
+; X86-NEXT:    subl $44, %esp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
 ; X86-NEXT:    andl $127, %ecx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
-; X86-NEXT:    andl $127, %esi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    andl $127, %eax
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
 ; X86-NEXT:    andl $127, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    andl $127, %esi
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
 ; X86-NEXT:    movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
 ; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    movl %ebx, %edx
-; X86-NEXT:    sbbl %ebp, %edx
-; X86-NEXT:    movl %edi, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl %ebp, %edx
+; X86-NEXT:    sbbl %ebx, %edx
+; X86-NEXT:    movl %esi, %edx
 ; X86-NEXT:    sbbl %eax, %edx
 ; X86-NEXT:    movl $0, %edx
 ; X86-NEXT:    sbbl %edx, %edx
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
 ; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    sbbl %ebx, %ebp
+; X86-NEXT:    sbbl %ebp, %ebx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    sbbl %edi, %eax
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    sbbl %esi, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
 ; X86-NEXT:    movl $0, %eax
 ; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    movb $-1, %bl
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    movl $-1, %eax
 ; X86-NEXT:    jb .LBB18_2
 ; X86-NEXT:  # %bb.1:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
 ; X86-NEXT:  .LBB18_2:
-; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
 ; X86-NEXT:    andl $127, %edx
-; X86-NEXT:    andl $127, %edi
-; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    andl $127, %esi
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    cmpl %edi, %eax
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    movl %ebx, %eax
-; X86-NEXT:    sbbl %ebp, %eax
-; X86-NEXT:    movl %esi, %eax
-; X86-NEXT:    sbbl %ecx, %eax
-; X86-NEXT:    movl $0, %eax
-; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    cmpl %eax, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl %ebp, %ebx
+; X86-NEXT:    movl %edi, %ebx
+; X86-NEXT:    sbbl %ecx, %ebx
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    sbbl %ebx, %ebp
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %esi, %ecx
-; X86-NEXT:    movl $0, %esi
-; X86-NEXT:    sbbl %esi, %esi
-; X86-NEXT:    movl $-1, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %edi, %ecx
+; X86-NEXT:    movl $0, %edi
+; X86-NEXT:    sbbl %edi, %edi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
 ; X86-NEXT:    jb .LBB18_4
 ; X86-NEXT:  # %bb.3:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
 ; X86-NEXT:  .LBB18_4:
-; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
 ; X86-NEXT:    andl $127, %eax
-; X86-NEXT:    andl $127, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    cmpl %edi, %ecx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    movl %ebx, %esi
-; X86-NEXT:    sbbl %ebp, %esi
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
-; X86-NEXT:    movl %edi, %esi
-; X86-NEXT:    sbbl %edx, %esi
-; X86-NEXT:    movl $0, %esi
-; X86-NEXT:    sbbl %esi, %esi
-; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
-; X86-NEXT:    sbbl %ebx, %ebp
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %edi, %edx
-; X86-NEXT:    movl $0, %ebx
-; X86-NEXT:    sbbl %ebx, %ebx
-; X86-NEXT:    movl $-1, %ebx
-; X86-NEXT:    jb .LBB18_6
-; X86-NEXT:  # %bb.5:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
-; X86-NEXT:  .LBB18_6:
+; X86-NEXT:    andl $127, %ebx
 ; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %ecx
-; X86-NEXT:    andl $127, %esi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    cmpl %edi, %edx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    sbbl %ebp, %ebx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
-; X86-NEXT:    movl %edi, %ebx
-; X86-NEXT:    sbbl %eax, %ebx
-; X86-NEXT:    movl $0, %ebx
-; X86-NEXT:    sbbl %ebx, %ebx
-; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %ebx, %ecx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %edi, %eax
-; X86-NEXT:    movl $0, %edi
-; X86-NEXT:    sbbl %edi, %edi
-; X86-NEXT:    movl $-1, %edi
-; X86-NEXT:    jb .LBB18_8
-; X86-NEXT:  # %bb.7:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
-; X86-NEXT:  .LBB18_8:
-; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %edx
-; X86-NEXT:    andl $127, %ebx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    cmpl %eax, %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl %ebx, %edi
 ; X86-NEXT:    sbbl %ebp, %edi
 ; X86-NEXT:    movl %esi, %edi
-; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    sbbl %edx, %edi
 ; X86-NEXT:    movl $0, %edi
 ; X86-NEXT:    sbbl %edi, %edi
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %ebx, %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    sbbl %esi, %edx
 ; X86-NEXT:    movl $0, %esi
 ; X86-NEXT:    sbbl %esi, %esi
-; X86-NEXT:    movl $-1, %esi
-; X86-NEXT:    jb .LBB18_10
-; X86-NEXT:  # %bb.9:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
-; X86-NEXT:  .LBB18_10:
-; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jb .LBB18_6
+; X86-NEXT:  # %bb.5:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 1-byte Folded Reload
+; X86-NEXT:    movb %dl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB18_6:
+; X86-NEXT:    andl $127, %ecx
 ; X86-NEXT:    andl $127, %edi
 ; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    cmpl %edi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl %edi, %edx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
 ; X86-NEXT:    movl %edi, %esi
 ; X86-NEXT:    sbbl %ebp, %esi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
 ; X86-NEXT:    movl %ebx, %esi
-; X86-NEXT:    sbbl %edx, %esi
+; X86-NEXT:    sbbl %eax, %esi
 ; X86-NEXT:    movl $0, %esi
 ; X86-NEXT:    sbbl %esi, %esi
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
 ; X86-NEXT:    sbbl %edi, %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %ebx, %edx
+; X86-NEXT:    sbbl %ebx, %eax
 ; X86-NEXT:    movl $0, %ebx
 ; X86-NEXT:    sbbl %ebx, %ebx
-; X86-NEXT:    movl $-1, %ebx
-; X86-NEXT:    jb .LBB18_12
-; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movb $-1, %bl
+; X86-NEXT:    jb .LBB18_8
+; X86-NEXT:  # %bb.7:
 ; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
-; X86-NEXT:  .LBB18_12:
-; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %ecx
+; X86-NEXT:  .LBB18_8:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    andl $127, %edx
 ; X86-NEXT:    andl $127, %esi
 ; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    cmpl %esi, %edx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
-; X86-NEXT:    movl %esi, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl %esi, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
 ; X86-NEXT:    sbbl %ebp, %ebx
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
 ; X86-NEXT:    movl %edi, %ebx
-; X86-NEXT:    sbbl %eax, %ebx
+; X86-NEXT:    sbbl %ecx, %ebx
 ; X86-NEXT:    movl $0, %ebx
 ; X86-NEXT:    sbbl %ebx, %ebx
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    sbbl %esi, %ebp
+; X86-NEXT:    cmpl %eax, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    sbbl %edi, %ecx
 ; X86-NEXT:    movl $0, %edi
 ; X86-NEXT:    sbbl %edi, %edi
-; X86-NEXT:    movl $-1, %edi
-; X86-NEXT:    jb .LBB18_14
-; X86-NEXT:  # %bb.13:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
-; X86-NEXT:  .LBB18_14:
-; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %edx
-; X86-NEXT:    andl $127, %ebx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    cmpl %eax, %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    sbbl %ebp, %edi
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jb .LBB18_10
+; X86-NEXT:  # %bb.9:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB18_10:
+; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    andl $127, %esi
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %esi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
 ; X86-NEXT:    movl %esi, %edi
-; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    sbbl %ebp, %edi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
+; X86-NEXT:    movl %ebx, %edi
+; X86-NEXT:    sbbl %edx, %edi
 ; X86-NEXT:    movl $0, %edi
 ; X86-NEXT:    sbbl %edi, %edi
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl %esi, %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    sbbl %ebx, %edx
 ; X86-NEXT:    movl $0, %esi
 ; X86-NEXT:    sbbl %esi, %esi
-; X86-NEXT:    movl $-1, %esi
-; X86-NEXT:    jb .LBB18_16
-; X86-NEXT:  # %bb.15:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
-; X86-NEXT:  .LBB18_16:
-; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    jb .LBB18_12
+; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 1-byte Folded Reload
+; X86-NEXT:    movb %dl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:  .LBB18_12:
+; X86-NEXT:    andl $127, %ecx
 ; X86-NEXT:    andl $127, %edi
 ; X86-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    cmpl %edi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    cmpl %edi, %edx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
 ; X86-NEXT:    movl %edi, %esi
 ; X86-NEXT:    sbbl %ebp, %esi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
 ; X86-NEXT:    movl %ebx, %esi
-; X86-NEXT:    sbbl %edx, %esi
+; X86-NEXT:    sbbl %eax, %esi
 ; X86-NEXT:    movl $0, %esi
 ; X86-NEXT:    sbbl %esi, %esi
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
 ; X86-NEXT:    sbbl %edi, %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %ebx, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ebx, %eax
 ; X86-NEXT:    movl $0, %ebx
 ; X86-NEXT:    sbbl %ebx, %ebx
-; X86-NEXT:    movl $-1, %ebx
-; X86-NEXT:    jb .LBB18_18
-; X86-NEXT:  # %bb.17:
+; X86-NEXT:    movb $-1, %bl
+; X86-NEXT:    jb .LBB18_14
+; X86-NEXT:  # %bb.13:
 ; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
-; X86-NEXT:  .LBB18_18:
-; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %ecx
-; X86-NEXT:    andl $127, %esi
-; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    cmpl %esi, %edx
+; X86-NEXT:  .LBB18_14:
+; X86-NEXT:    movb %bl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    andl $127, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
+; X86-NEXT:    cmpl %ebp, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl %esi, %ebx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
+; X86-NEXT:    movl %edi, %ebx
+; X86-NEXT:    sbbl %ecx, %ebx
+; X86-NEXT:    movl $0, %ebx
+; X86-NEXT:    sbbl %ebx, %ebx
+; X86-NEXT:    setb %bl
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %esi
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
-; X86-NEXT:    movl %esi, %ebx
-; X86-NEXT:    sbbl %ebp, %ebx
+; X86-NEXT:    sbbl %edi, %ecx
+; X86-NEXT:    movl $0, %edi
+; X86-NEXT:    sbbl %edi, %edi
+; X86-NEXT:    movb $-1, %bh
+; X86-NEXT:    jb .LBB18_16
+; X86-NEXT:  # %bb.15:
+; X86-NEXT:    movb %bl, %bh
+; X86-NEXT:  .LBB18_16:
+; X86-NEXT:    movb %bh, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    andl $127, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    cmpl %ebx, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl %esi, %ebx
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
 ; X86-NEXT:    movl %edi, %ebx
-; X86-NEXT:    sbbl %eax, %ebx
+; X86-NEXT:    sbbl %edx, %ebx
 ; X86-NEXT:    movl $0, %ebx
 ; X86-NEXT:    sbbl %ebx, %ebx
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    sbbl %esi, %ebp
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %edi, %eax
-; X86-NEXT:    movl $0, %eax
-; X86-NEXT:    sbbl %eax, %eax
-; X86-NEXT:    movl $-1, %eax
-; X86-NEXT:    jb .LBB18_20
-; X86-NEXT:  # %bb.19:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
-; X86-NEXT:  .LBB18_20:
-; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    movl $0, %edx
+; X86-NEXT:    sbbl %edx, %edx
+; X86-NEXT:    movb $-1, %dl
+; X86-NEXT:    jb .LBB18_18
+; X86-NEXT:  # %bb.17:
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 1-byte Folded Reload
+; X86-NEXT:  .LBB18_18:
+; X86-NEXT:    movb %dl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    andl $127, %ecx
 ; X86-NEXT:    andl $127, %ebx
-; X86-NEXT:    andl $127, %edx
-; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    cmpl %edx, %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    movl %edx, %eax
-; X86-NEXT:    sbbl %ebp, %eax
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
-; X86-NEXT:    movl %esi, %eax
-; X86-NEXT:    sbbl %ecx, %eax
-; X86-NEXT:    movl $0, %eax
-; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    cmpl %ebx, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:    sbbl %esi, %edx
+; X86-NEXT:    movl %ebp, %edx
+; X86-NEXT:    sbbl %eax, %edx
+; X86-NEXT:    movl $0, %edx
+; X86-NEXT:    sbbl %edx, %edx
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
 ; X86-NEXT:    cmpl %edi, {{[0-9]+}}(%esp)
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    sbbl %ebx, %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ebp, %eax
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    sbbl %edx, %ebp
+; X86-NEXT:    movl $0, %ebp
+; X86-NEXT:    sbbl %ebp, %ebp
+; X86-NEXT:    movb $-1, %dh
+; X86-NEXT:    jb .LBB18_20
+; X86-NEXT:  # %bb.19:
+; X86-NEXT:    movb {{[-0-9]+}}(%e{{[sb]}}p), %dh # 1-byte Reload
+; X86-NEXT:  .LBB18_20:
+; X86-NEXT:    movb %dh, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    andl $127, %edi
+; X86-NEXT:    andl $127, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    cmpl %ebp, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl %esi, %edx
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
+; X86-NEXT:    movl %ebx, %edx
+; X86-NEXT:    sbbl %ecx, %edx
+; X86-NEXT:    movl $0, %edx
+; X86-NEXT:    sbbl %edx, %edx
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %eax, %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    sbbl %esi, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ebx, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
 ; X86-NEXT:    movl $0, %ecx
 ; X86-NEXT:    sbbl %ecx, %ecx
-; X86-NEXT:    movl $-1, %ecx
+; X86-NEXT:    movb $-1, %cl
 ; X86-NEXT:    jb .LBB18_22
 ; X86-NEXT:  # %bb.21:
 ; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
 ; X86-NEXT:  .LBB18_22:
-; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %edi
-; X86-NEXT:    andl $127, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
-; X86-NEXT:    cmpl %ebp, {{[0-9]+}}(%esp)
+; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    andl $127, %eax
+; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    cmpl %ebp, %ebx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    sbbl %eax, %ecx
+; X86-NEXT:    sbbl %esi, %ecx
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
 ; X86-NEXT:    movl %edx, %ecx
-; X86-NEXT:    sbbl %ebx, %ecx
+; X86-NEXT:    sbbl %edi, %ecx
 ; X86-NEXT:    movl $0, %ecx
 ; X86-NEXT:    sbbl %ecx, %ecx
 ; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    cmpl %ebx, %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %esi
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    sbbl %edx, %ebx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    movl $0, %eax
-; X86-NEXT:    sbbl %eax, %eax
-; X86-NEXT:    movl $-1, %eax
+; X86-NEXT:    sbbl %edx, %edi
+; X86-NEXT:    movl $0, %esi
+; X86-NEXT:    sbbl %esi, %esi
+; X86-NEXT:    movb $-1, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
 ; X86-NEXT:    jb .LBB18_24
 ; X86-NEXT:  # %bb.23:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 1-byte Folded Reload
+; X86-NEXT:    movb %dl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
 ; X86-NEXT:  .LBB18_24:
-; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %esi
 ; X86-NEXT:    andl $127, %ebp
-; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    cmpl %ebx, %edx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    sbbl %ecx, %eax
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Reload
-; X86-NEXT:    movl %ebp, %eax
-; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    andl $127, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %esi, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ecx, %esi
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    movl %edx, %esi
+; X86-NEXT:    sbbl %eax, %esi
+; X86-NEXT:    movl $0, %esi
+; X86-NEXT:    sbbl %esi, %esi
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    cmpl %edi, {{[0-9]+}}(%esp)
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %edx, %eax
 ; X86-NEXT:    movl $0, %eax
 ; X86-NEXT:    sbbl %eax, %eax
-; X86-NEXT:    setb %al
-; X86-NEXT:    cmpl %edx, %ebx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    sbbl %ebp, %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    movl $0, %ecx
-; X86-NEXT:    sbbl %ecx, %ecx
-; X86-NEXT:    movl $-1, %ecx
+; X86-NEXT:    movb $-1, %al
 ; X86-NEXT:    jb .LBB18_26
 ; X86-NEXT:  # %bb.25:
-; X86-NEXT:    movzbl %al, %ecx
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
 ; X86-NEXT:  .LBB18_26:
-; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    movb %al, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    andl $127, %edi
 ; X86-NEXT:    andl $127, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    cmpl %ebp, %edi
+; X86-NEXT:    cmpl %ecx, {{[0-9]+}}(%esp)
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    sbbl %ebx, %eax
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
-; X86-NEXT:    movl %ecx, %eax
 ; X86-NEXT:    sbbl %esi, %eax
+; X86-NEXT:    movl %ebx, %eax
+; X86-NEXT:    sbbl %ebp, %eax
 ; X86-NEXT:    movl $0, %eax
 ; X86-NEXT:    sbbl %eax, %eax
-; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl %edi, %ebp
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %ebx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    sbbl %ecx, %esi
-; X86-NEXT:    movl $0, %ebx
-; X86-NEXT:    sbbl %ebx, %ebx
-; X86-NEXT:    movl $-1, %ebx
+; X86-NEXT:    setb %al
+; X86-NEXT:    cmpl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ebx, %ebp
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    movl $0, %ebp
+; X86-NEXT:    sbbl %ebp, %ebp
+; X86-NEXT:    movb $-1, %ah
 ; X86-NEXT:    jb .LBB18_28
 ; X86-NEXT:  # %bb.27:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
+; X86-NEXT:    movb %al, %ah
 ; X86-NEXT:  .LBB18_28:
-; X86-NEXT:    andl $127, %edi
-; X86-NEXT:    andl $127, %ebp
-; X86-NEXT:    movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
-; X86-NEXT:    cmpl %ebp, %esi
+; X86-NEXT:    movb %ah, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    andl $127, %edx
+; X86-NEXT:    andl $127, %ecx
+; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl %eax, %ebp
+; X86-NEXT:    cmpl %ebp, %ebx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %esi, %eax
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
-; X86-NEXT:    movl %ecx, %ebp
-; X86-NEXT:    sbbl %edx, %ebp
-; X86-NEXT:    movl $0, %ebp
-; X86-NEXT:    sbbl %ebp, %ebp
-; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    cmpl %esi, {{[0-9]+}}(%esp)
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:    sbbl %edi, %eax
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    setb %al
+; X86-NEXT:    cmpl %ebx, %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebp
-; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    sbbl %ecx, %edx
-; X86-NEXT:    movl $0, %edx
-; X86-NEXT:    sbbl %edx, %edx
-; X86-NEXT:    movl $-1, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ecx, %edi
+; X86-NEXT:    movl $0, %edi
+; X86-NEXT:    sbbl %edi, %edi
+; X86-NEXT:    movb $-1, %cl
 ; X86-NEXT:    jb .LBB18_30
 ; X86-NEXT:  # %bb.29:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movl %eax, %ecx
 ; X86-NEXT:  .LBB18_30:
-; X86-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
-; X86-NEXT:    andl $127, %esi
+; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
 ; X86-NEXT:    andl $127, %ebp
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    andl $127, %ebx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    cmpl %edx, %ecx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    sbbl %eax, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    cmpl %ecx, %edi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    sbbl %esi, %eax
 ; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
-; X86-NEXT:    movl %ecx, %edx
-; X86-NEXT:    sbbl %edi, %edx
-; X86-NEXT:    movl $0, %edx
-; X86-NEXT:    sbbl %edx, %edx
-; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
-; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl %ecx, %eax
+; X86-NEXT:    sbbl %edx, %eax
+; X86-NEXT:    movl $0, %eax
+; X86-NEXT:    sbbl %eax, %eax
+; X86-NEXT:    setb %al
+; X86-NEXT:    cmpl %edi, {{[0-9]+}}(%esp)
+; X86-NEXT:    sbbl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
+; X86-NEXT:    sbbl %ecx, %edx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    sbbl %ecx, %edi
 ; X86-NEXT:    movl $0, %ecx
 ; X86-NEXT:    sbbl %ecx, %ecx
-; X86-NEXT:    movl $-1, %ecx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
+; X86-NEXT:    movb $-1, %cl
 ; X86-NEXT:    jb .LBB18_32
 ; X86-NEXT:  # %bb.31:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movl %eax, %ecx
 ; X86-NEXT:  .LBB18_32:
-; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
+; X86-NEXT:    movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
+; X86-NEXT:    movl %edi, %ecx
+; X86-NEXT:    cmpl %esi, %edi
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
-; X86-NEXT:    movl %edi, %edx
-; X86-NEXT:    sbbl %eax, %edx
-; X86-NEXT:    movl %ebp, %edx
-; X86-NEXT:    sbbl %esi, %edx
-; X86-NEXT:    movl $0, %edx
-; X86-NEXT:    sbbl %edx, %edx
-; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT:    cmpl %edx, {{[0-9]+}}(%esp)
-; X86-NEXT:    sbbl %edi, %eax
-; X86-NEXT:    sbbl %ebp, %esi
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
+; X86-NEXT:    movl %edi, %eax
+; X86-NEXT:    sbbl %edx, %eax
+; X86-NEXT:    movl %ebx, %eax
+; X86-NEXT:    sbbl %ebp, %eax
+; X86-NEXT:    movl $0, %eax
 ; X86-NEXT:    sbbl %eax, %eax
-; X86-NEXT:    movl $-1, %edx
+; X86-NEXT:    setb %al
+; X86-NEXT:    cmpl %ecx, %esi
+; X86-NEXT:    sbbl %edi, %edx
+; X86-NEXT:    sbbl %ebx, %ebp
+; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    sbbl %edx, %edx
+; X86-NEXT:    movb $-1, %dl
 ; X86-NEXT:    jb .LBB18_34
 ; X86-NEXT:  # %bb.33:
-; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 1-byte Folded Reload
+; X86-NEXT:    movl %eax, %edx
 ; X86-NEXT:  .LBB18_34:
-; X86-NEXT:    andl $3, %edx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movb %dl, 4(%eax)
-; X86-NEXT:    andl $3, %ecx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
-; X86-NEXT:    andl $3, %edx
-; X86-NEXT:    leal (%edx,%ecx,4), %ecx
-; X86-NEXT:    andl $3, %ebx
-; X86-NEXT:    shll $4, %ebx
-; X86-NEXT:    orl %ecx, %ebx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    movzbl %dl, %eax
+; X86-NEXT:    andl $3, %eax
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movb %al, 4(%edx)
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 1-byte Folded Reload
 ; X86-NEXT:    andl $3, %ecx
-; X86-NEXT:    shll $6, %ecx
-; X86-NEXT:    orl %ebx, %ecx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
-; X86-NEXT:    andl $3, %edx
-; X86-NEXT:    shll $8, %edx
-; X86-NEXT:    orl %ecx, %edx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    andl $3, %edi
+; X86-NEXT:    leal (%edi,%ecx,4), %eax
 ; X86-NEXT:    andl $3, %esi
-; X86-NEXT:    shll $10, %esi
-; X86-NEXT:    orl %edx, %esi
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
-; X86-NEXT:    andl $3, %ecx
-; X86-NEXT:    shll $12, %ecx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
+; X86-NEXT:    shll $4, %esi
+; X86-NEXT:    orl %eax, %esi
+; X86-NEXT:    andl $3, %ebx
+; X86-NEXT:    shll $6, %ebx
+; X86-NEXT:    orl %esi, %ebx
+; X86-NEXT:    andl $3, %ebp
+; X86-NEXT:    shll $8, %ebp
+; X86-NEXT:    orl %ebx, %ebp
 ; X86-NEXT:    andl $3, %edx
-; X86-NEXT:    shll $14, %edx
-; X86-NEXT:    orl %ecx, %edx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    shll $10, %edx
+; X86-NEXT:    orl %ebp, %edx
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:    andl $3, %eax
+; X86-NEXT:    shll $12, %eax
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
 ; X86-NEXT:    andl $3, %ecx
-; X86-NEXT:    shll $16, %ecx
-; X86-NEXT:    orl %edx, %ecx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
+; X86-NEXT:    shll $14, %ecx
+; X86-NEXT:    orl %eax, %ecx
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:    andl $3, %eax
+; X86-NEXT:    shll $16, %eax
+; X86-NEXT:    orl %ecx, %eax
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
 ; X86-NEXT:    andl $3, %edi
 ; X86-NEXT:    shll $18, %edi
-; X86-NEXT:    orl %ecx, %edi
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
-; X86-NEXT:    andl $3, %edx
-; X86-NEXT:    shll $20, %edx
-; X86-NEXT:    orl %edi, %edx
-; X86-NEXT:    orl %esi, %edx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
-; X86-NEXT:    andl $3, %esi
-; X86-NEXT:    shll $22, %esi
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
+; X86-NEXT:    orl %eax, %edi
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 1-byte Folded Reload
 ; X86-NEXT:    andl $3, %ecx
-; X86-NEXT:    shll $24, %ecx
-; X86-NEXT:    orl %esi, %ecx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
+; X86-NEXT:    shll $20, %ecx
+; X86-NEXT:    orl %edi, %ecx
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 1-byte Folded Reload
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
+; X86-NEXT:    orl %edx, %ecx
 ; X86-NEXT:    andl $3, %esi
-; X86-NEXT:    shll $26, %esi
-; X86-NEXT:    orl %ecx, %esi
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
-; X86-NEXT:    andl $3, %ecx
-; X86-NEXT:    shll $28, %ecx
-; X86-NEXT:    orl %esi, %ecx
-; X86-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
-; X86-NEXT:    shll $30, %esi
-; X86-NEXT:    orl %ecx, %esi
-; X86-NEXT:    orl %edx, %esi
-; X86-NEXT:    movl %esi, (%eax)
-; X86-NEXT:    addl $68, %esp
+; X86-NEXT:    shll $22, %esi
+; X86-NEXT:    andl $3, %edi
+; X86-NEXT:    shll $24, %edi
+; X86-NEXT:    orl %esi, %edi
+; X86-NEXT:    andl $3, %ebx
+; X86-NEXT:    shll $26, %ebx
+; X86-NEXT:    orl %edi, %ebx
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
+; X86-NEXT:    andl $3, %eax
+; X86-NEXT:    shll $28, %eax
+; X86-NEXT:    orl %ebx, %eax
+; X86-NEXT:    movzbl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 1-byte Folded Reload
+; X86-NEXT:    shll $30, %edx
+; X86-NEXT:    orl %eax, %edx
+; X86-NEXT:    orl %ecx, %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movl %edx, (%eax)
+; X86-NEXT:    addl $44, %esp
 ; X86-NEXT:    popl %esi
 ; X86-NEXT:    popl %edi
 ; X86-NEXT:    popl %ebx



More information about the llvm-commits mailing list