Bug type: crash
Component: VectorCombine
Bug location: llvm/lib/Transforms/Vectorize/VectorCombine.cpp: VectorCombine::foldShuffleOfSelects
Issue title: A/F: `I >= 0 && I < (NumOpElts * 2) && "Out-of-bounds shuffle mask element" after upstream commit 5d1029b
Labels: crash
llvm:transforms
Reported by: dyung

One of our internal tests recently started hitting an assertion failure when building which I bisected back to 5d1029b4a87f36a394c169b89b26a74d17f7ff01. I was able to reduce the test case to the following code:
```c++
typedef float e __attribute__((__vector_size__(16)));
e g(e h, e j) { return __builtin_ia32_cmpltps(j, h); }
e k(float, float l, float n, float) { return {n, l}; }
e o, p;
typedef union q {
  e r;
} t;
typedef union u {
  e r;
} w;
union aa {
  t ab;
  w ac;
  float f[];
  aa(t v) : ab(v) {}
  e ad;
  aa(e v) : ad(v) {}
};
#define ae(v) aa(v).ab
#define af(v) aa(v).ac
#define ag(a, b, c, d) ae(k(d, c, b, a))
#define ah(v, ai) aa(v).f[ai]
#define aj(a, b) af(g(a.r, b.r))
#define ak(a, b, m) ae(al(a.r, b.r, m.r))
t am(t an, t abcd) {
  e ao = __builtin_shufflevector(an.r, abcd.r, 0, 4, 1, 5);
  t ap = ae(ao);
  return ap;
}
e al(e, e, e aq) {
  e ar = __builtin_ia32_blendvps(o, p, aq);
  return ar;
}
float as(t v, int s) { return ah(v, s); }
w at(t a, t b) { return aj(a, b); }
t au(w aq) {
  t b, a;
  return ak(a, b, aq);
}
t av(t an, t abcd) { return am(an, abcd); }
t aw_x, bl, bq_ay;
t bf();
struct bc {
  t bd;
  bc(t bg) { bd = bg; }
  t be() { return bd; }
};
struct bh {
  t bi;
  int i;
  bh(t bg, int bj) : bi(bg), i(bj) {}
  operator float() {
    float bk = as(bi, i);
    return bk;
  }
};
float bm_x;
struct bm {
  bm(float y, float z) { bl = ag(bm_x, y, z, 0.0f); }
  bm(bc y, bc z) {
    q bn = z.be(), bo(bn), bp = y.be();
    bl = av(bo, bp);
  }
  bh operator[](int bj) { return bh(bl, bj); }
};
bc bq() {
  t __trans_tmp_3 = bf();
  u bb = at(bq_ay, aw_x);
  __trans_tmp_3 = au(bb);
  return __trans_tmp_3;
}
bm bs() { return bm(bq(), bq()); }
void bx() {
  unsigned char by, bz;
  bm ca = bs();
  bz = ca[1];
  by = ca[2];
  bm(bz, by);
}
```
If compiled with a compiler that includes 5d1029b4a87f36a394c169b89b26a74d17f7ff01 and with optimizations and AVX enabled, the compiler hits an assertion failure:
```
$ ~/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang -c -O2 -mavx repro.cpp
clang: /home/dyung/src/upstream/llvm_clean_git/llvm/lib/IR/Instructions.cpp:1906: bool isSingleSourceMaskImpl(llvm::ArrayRef<int>, int): Assertion `I >= 0 && I < (NumOpElts * 2) && "Out-of-bounds shuffle mask element"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang -c -O2 repro.cpp -mavx
1.      <eof> parser at end of file
2.      Optimizer
3.      Running pass "function<eager-inv>(float2int,lower-constant-intrinsics,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O2>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)" on module "repro.cpp"
4.      Running pass "vector-combine" on function "_Z2bxv"
 #0 0x0000561cf26380ef llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x224f0ef)
 #1 0x0000561cf2635c04 llvm::sys::CleanupOnSignal(unsigned long) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x224cc04)
 #2 0x0000561cf2586258 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f5f727e6420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f5f722b300b raise /build/glibc-FcRMwW/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f5f72292859 abort /build/glibc-FcRMwW/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007f5f72292729 get_sysdep_segment_value /build/glibc-FcRMwW/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007f5f72292729 _nl_load_domain /build/glibc-FcRMwW/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007f5f722a3fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x0000561cf203aa46 isSingleSourceMaskImpl(llvm::ArrayRef<int>, int) Instructions.cpp:0:0
#10 0x0000561cf20436e4 llvm::ShuffleVectorInst::isSelectMask(llvm::ArrayRef<int>, int) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x1c5a6e4)
#11 0x0000561cf116c2b0 llvm::X86TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xd832b0)
#12 0x0000561cf17404ed llvm::TargetTransformInfo::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) const (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x13574ed)
#13 0x0000561cf42a667a (anonymous namespace)::VectorCombine::foldShuffleOfSelects(llvm::Instruction&) VectorCombine.cpp:0:0
#14 0x0000561cf42c0e55 (anonymous namespace)::VectorCombine::run()::'lambda'(llvm::Instruction&)::operator()(llvm::Instruction&) const (.isra.0) VectorCombine.cpp:0:0
#15 0x0000561cf42c1d85 llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x3ed8d85)
#16 0x0000561cf3b8f1a6 llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x37a61a6)
#17 0x0000561cf20deb09 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x1cf5b09)
#18 0x0000561cf11a9906 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xdc0906)
#19 0x0000561cf20dd372 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x1cf4372)
#20 0x0000561cf11aa2c6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xdc12c6)
#21 0x0000561cf20dcd91 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x1cf3d91)
#22 0x0000561cf28d99aa (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#23 0x0000561cf28dd9db clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x24f49db)
#24 0x0000561cf3021121 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c38121)
#25 0x0000561cf4a4170c clang::ParseAST(clang::Sema&, bool, bool) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x465870c)
#26 0x0000561cf3021548 clang::CodeGenAction::ExecuteAction() (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c38548)
#27 0x0000561cf32f80f9 clang::FrontendAction::Execute() (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2f0f0f9)
#28 0x0000561cf3278f4e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2e8ff4e)
#29 0x0000561cf33ed2b6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x30042b6)
#30 0x0000561cf1125ccd cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xd3cccd)
#31 0x0000561cf111d5ca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#32 0x0000561cf306b3cd void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#33 0x0000561cf2586760 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x219d760)
#34 0x0000561cf306b9ef clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#35 0x0000561cf302c9c4 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c439c4)
#36 0x0000561cf302da5e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c44a5e)
#37 0x0000561cf3035ef5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c4cef5)
#38 0x0000561cf1122aab clang_main(int, char**, llvm::ToolContext const&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xd39aab)
#39 0x0000561cf10546bb main (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xc6b6bb)
#40 0x00007f5f72294083 __libc_start_main /build/glibc-FcRMwW/glibc-2.31/csu/../csu/libc-start.c:342:3
#41 0x0000561cf111d05e _start (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xd3405e)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 21.0.0 (https://github.com/llvm/llvm-project.git 5d1029b4a87f36a394c169b89b26a74d17f7ff01)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin
Build config: +assertions
```

Comments: author: ParkHanbum
body: Can you help me compile the sample?
never mind. I get the crash.
author: ParkHanbum
body: ```
define void @test(<4 x i1> %z, <4 x float> %1, <4 x float> %2) {
%a = select <4 x i1> %z, <4 x float> %1, <4 x float> %2
%b = select <4 x i1> %z, <4 x float> %1, <4 x float> %2
%c = shufflevector <4 x float> %a, <4 x float> %b, <2 x i32> <i32 0, i32 5>
ret void
}
```
The problematic IR is shown above.

```
  * frame #4: 0x00000001043d7fe8 clang++`isIdentityMaskImpl(llvm::ArrayRef<int>, int) (.cold.3) + 36
    frame #5: 0x0000000100fd5334 clang++`llvm::ShuffleVectorInst::isSelectMask(llvm::ArrayRef<int>, int) + 256
    frame #6: 0x0000000100095ff8 clang++`llvm::BasicTTIImplBase<llvm::X86TTIImpl>::improveShuffleKindFromMask(llvm::TargetTransformInfo::ShuffleKind, llvm::ArrayRef<int>, llvm::VectorType*, int&, llvm::VectorType*&) const + 184
    frame #7: 0x000000010033e104 clang++`llvm::X86TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) + 128
```

This is where the crash happens.


```
  OldCost += TTI.getShuffleCost(SK, DstVecTy, Mask, CostKind, 0, nullptr,
                                {I.getOperand(0), I.getOperand(1)}, &I);
```

The problematic IR is shown above.

To calculate the OldCost, call getShuffleCost.
The DstVecTy passed as an argument is `<2 x float>` and the Mask is <i32 0, i32 5>.

The second Mask specifier is 5, which is greater than NumOpElts * 2 of DstVecTy, so this assertion seems to be thrown.
(If we increase the Mask to <3 x i32> <i32 0, i32 5, i32 5> or decrease the Mask size to <2 x i32> <i32 0, i32 3>, the error will not occur.)

I will add a fix after further analysis.



author: RKSimon
body: @ParkHanbum You must use the source type not destination type for getShuffleCost
author: ParkHanbum
body: @RKSimon I'm sorry, I made a mistake. I'll push up the patch quickly.

author: RKSimon
body: You just need the fix + test coverage - no need to revert the existing patch if you are prompt

Fix patch:
commit 0ee8f699780569d7a6b94d61cd833285bb67eca1
Author: hanbeom <kese111@gmail.com>
Date:   Sat Mar 8 01:40:26 2025 +0900

    [VectorCombine] Fix invalid shuffle cost argument of foldShuffleOfSelects (#130281)
    
    In the previous code (#128032), it specified the destination vector as the
    getShuffleCost argument. Because the shuffle mask specifies the indices
    of the two vectors specified as elements, the maximum value is twice the
    size of the source vector. This causes a problem if the destination
    vector is smaller than the source vector and specify an index in the
    mask that exceeds the size of the destination vector.
    
    Fix the problem by correcting the previous code, which was using wrong
    argument in the Cost calculation.
    
    Fixes #130250

diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 4d4a1a6e04d3..019d79567b4a 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -2037,7 +2037,6 @@ bool VectorCombine::foldShuffleOfSelects(Instruction &I) {
                      m_Mask(Mask))))
     return false;
 
-  auto *DstVecTy = dyn_cast<FixedVectorType>(I.getType());
   auto *C1VecTy = dyn_cast<FixedVectorType>(C1->getType());
   auto *C2VecTy = dyn_cast<FixedVectorType>(C2->getType());
   if (!C1VecTy || !C2VecTy || C1VecTy != C2VecTy)
@@ -2051,24 +2050,26 @@ bool VectorCombine::foldShuffleOfSelects(Instruction &I) {
        (SI0FOp->getFastMathFlags() != SI1FOp->getFastMathFlags())))
     return false;
 
+  auto *SrcVecTy = dyn_cast<FixedVectorType>(T1->getType());
+  auto *DstVecTy = dyn_cast<FixedVectorType>(I.getType());
   auto SK = TargetTransformInfo::SK_PermuteTwoSrc;
   auto SelOp = Instruction::Select;
   InstructionCost OldCost = TTI.getCmpSelInstrCost(
-      SelOp, T1->getType(), C1VecTy, CmpInst::BAD_ICMP_PREDICATE, CostKind);
-  OldCost += TTI.getCmpSelInstrCost(SelOp, T2->getType(), C2VecTy,
+      SelOp, SrcVecTy, C1VecTy, CmpInst::BAD_ICMP_PREDICATE, CostKind);
+  OldCost += TTI.getCmpSelInstrCost(SelOp, SrcVecTy, C2VecTy,
                                     CmpInst::BAD_ICMP_PREDICATE, CostKind);
-  OldCost += TTI.getShuffleCost(SK, DstVecTy, Mask, CostKind, 0, nullptr,
+  OldCost += TTI.getShuffleCost(SK, SrcVecTy, Mask, CostKind, 0, nullptr,
                                 {I.getOperand(0), I.getOperand(1)}, &I);
 
-  auto *C1C2VecTy = cast<FixedVectorType>(
-      toVectorTy(Type::getInt1Ty(I.getContext()), DstVecTy->getNumElements()));
   InstructionCost NewCost =
-      TTI.getShuffleCost(SK, C1C2VecTy, Mask, CostKind, 0, nullptr, {C1, C2});
+      TTI.getShuffleCost(SK, C1VecTy, Mask, CostKind, 0, nullptr, {C1, C2});
   NewCost +=
-      TTI.getShuffleCost(SK, DstVecTy, Mask, CostKind, 0, nullptr, {T1, T2});
+      TTI.getShuffleCost(SK, SrcVecTy, Mask, CostKind, 0, nullptr, {T1, T2});
   NewCost +=
-      TTI.getShuffleCost(SK, DstVecTy, Mask, CostKind, 0, nullptr, {F1, F2});
-  NewCost += TTI.getCmpSelInstrCost(SelOp, DstVecTy, DstVecTy,
+      TTI.getShuffleCost(SK, SrcVecTy, Mask, CostKind, 0, nullptr, {F1, F2});
+  auto *C1C2ShuffledVecTy = cast<FixedVectorType>(
+      toVectorTy(Type::getInt1Ty(I.getContext()), DstVecTy->getNumElements()));
+  NewCost += TTI.getCmpSelInstrCost(SelOp, DstVecTy, C1C2ShuffledVecTy,
                                     CmpInst::BAD_ICMP_PREDICATE, CostKind);
 
   LLVM_DEBUG(dbgs() << "Found a shuffle feeding two selects: " << I


Regression tests:
file: llvm/test/Transforms/PhaseOrdering/X86/blendv-select.ll
commands: opt < %s -O3 -S -mtriple=x86_64-- -mcpu=x86-64-v2
opt < %s -O3 -S -mtriple=x86_64-- -mcpu=x86-64-v3
opt < %s -O3 -S -mtriple=x86_64-- -mcpu=x86-64-v4
tests: test_name: x86_pblendvb_v8f32_v4f32
test_body: define <8 x float> @x86_pblendvb_v8f32_v4f32(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d) {
  %a.bc = bitcast <8 x float> %a to <32 x i8>
  %b.bc = bitcast <8 x float> %b to <32 x i8>
  %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %cmp = fcmp olt <8 x float> %c, %d
  %sext = sext <8 x i1> %cmp to <8 x i32>
  %sext.bc = bitcast <8 x i32> %sext to <32 x i8>
  %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)
  %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)
  %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %res = bitcast <32 x i8> %concat to <8 x float>
  ret <8 x float> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

test_name: x86_pblendvb_v32i16_v16i16
test_body: define <8 x i64> @x86_pblendvb_v32i16_v16i16(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c, <8 x i64> %d) {
  %a.bc = bitcast <8 x i64> %a to <64 x i8>
  %b.bc = bitcast <8 x i64> %b to <64 x i8>
  %c.bc = bitcast <8 x i64> %c to <32 x i16>
  %d.bc = bitcast <8 x i64> %d to <32 x i16>
  %a.lo = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.lo = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %a.hi = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %b.hi = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %cmp = icmp slt <32 x i16> %c.bc, %d.bc
  %sext = sext <32 x i1> %cmp to <32 x i16>
  %sext.bc = bitcast <32 x i16> %sext to <64 x i8>
  %sext.lo = shufflevector <64 x i8> %sext.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sext.hi = shufflevector <64 x i8> %sext.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %sel.lo = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.lo, <32 x i8> %b.lo, <32 x i8> %sext.lo)
  %sel.hi = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.hi, <32 x i8> %b.hi, <32 x i8> %sext.hi)
  %concat = shufflevector <32 x i8> %sel.lo, <32 x i8> %sel.hi, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %res = bitcast <64 x i8> %concat to <8 x i64>
  ret <8 x i64> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8>, <32 x i8>, <32 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

test_name: x86_pblendvb_v64i8_v32i8
test_body: define <8 x i64> @x86_pblendvb_v64i8_v32i8(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c, <8 x i64> %d) {
  %a.bc = bitcast <8 x i64> %a to <64 x i8>
  %b.bc = bitcast <8 x i64> %b to <64 x i8>
  %c.bc = bitcast <8 x i64> %c to <64 x i8>
  %d.bc = bitcast <8 x i64> %d to <64 x i8>
  %a.lo = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.lo = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %a.hi = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %b.hi = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %cmp = icmp slt <64 x i8> %c.bc, %d.bc
  %sext = sext <64 x i1> %cmp to <64 x i8>
  %sext.lo = shufflevector <64 x i8> %sext, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sext.hi = shufflevector <64 x i8> %sext, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %sel.lo = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.lo, <32 x i8> %b.lo, <32 x i8> %sext.lo)
  %sel.hi = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.hi, <32 x i8> %b.hi, <32 x i8> %sext.hi)
  %concat = shufflevector <32 x i8> %sel.lo, <32 x i8> %sel.hi, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %res = bitcast <64 x i8> %concat to <8 x i64>
  ret <8 x i64> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8>, <32 x i8>, <32 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

test_name: x86_pblendvb_v4f64_v2f64
test_body: define <4 x double> @x86_pblendvb_v4f64_v2f64(<4 x double> %a, <4 x double> %b, <4 x double> %c, <4 x double> %d) {
  %a.bc = bitcast <4 x double> %a to <32 x i8>
  %b.bc = bitcast <4 x double> %b to <32 x i8>
  %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %cmp = fcmp olt <4 x double> %c, %d
  %sext = sext <4 x i1> %cmp to <4 x i64>
  %sext.bc = bitcast <4 x i64> %sext to <32 x i8>
  %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)
  %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)
  %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %res = bitcast <32 x i8> %concat to <4 x double>
  ret <4 x double> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

test_name: x86_pblendvb_v16i16_v8i16
test_body: define <4 x i64> @x86_pblendvb_v16i16_v8i16(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c, <4 x i64> %d) {
  %a.bc = bitcast <4 x i64> %a to <32 x i8>
  %b.bc = bitcast <4 x i64> %b to <32 x i8>
  %c.bc = bitcast <4 x i64> %c to <16 x i16>
  %d.bc = bitcast <4 x i64> %d to <16 x i16>
  %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %cmp = icmp slt <16 x i16> %c.bc, %d.bc
  %sext = sext <16 x i1> %cmp to <16 x i16>
  %sext.bc = bitcast <16 x i16> %sext to <32 x i8>
  %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)
  %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)
  %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %res = bitcast <32 x i8> %concat to <4 x i64>
  ret <4 x i64> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

test_name: x86_pblendvb_v8i32_v4i32
test_body: define <4 x i64> @x86_pblendvb_v8i32_v4i32(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c, <4 x i64> %d) {
  %a.bc = bitcast <4 x i64> %a to <32 x i8>
  %b.bc = bitcast <4 x i64> %b to <32 x i8>
  %c.bc = bitcast <4 x i64> %c to <8 x i32>
  %d.bc = bitcast <4 x i64> %d to <8 x i32>
  %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %cmp = icmp slt <8 x i32> %c.bc, %d.bc
  %sext = sext <8 x i1> %cmp to <8 x i32>
  %sext.bc = bitcast <8 x i32> %sext to <32 x i8>
  %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)
  %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)
  %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %res = bitcast <32 x i8> %concat to <4 x i64>
  ret <4 x i64> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

test_name: x86_pblendvb_v4i64_v2i64
test_body: define <4 x i64> @x86_pblendvb_v4i64_v2i64(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c, <4 x i64> %d) {
  %a.bc = bitcast <4 x i64> %a to <32 x i8>
  %b.bc = bitcast <4 x i64> %b to <32 x i8>
  %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %cmp = icmp slt <4 x i64> %c, %d
  %sext = sext <4 x i1> %cmp to <4 x i64>
  %sext.bc = bitcast <4 x i64> %sext to <32 x i8>
  %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)
  %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)
  %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %res = bitcast <32 x i8> %concat to <4 x i64>
  ret <4 x i64> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

test_name: x86_pblendvb_v32i8_v16i8
test_body: define <4 x i64> @x86_pblendvb_v32i8_v16i8(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c, <4 x i64> %d) {
  %a.bc = bitcast <4 x i64> %a to <32 x i8>
  %b.bc = bitcast <4 x i64> %b to <32 x i8>
  %c.bc = bitcast <4 x i64> %c to <32 x i8>
  %d.bc = bitcast <4 x i64> %d to <32 x i8>
  %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %cmp = icmp slt <32 x i8> %c.bc, %d.bc
  %sext = sext <32 x i1> %cmp to <32 x i8>
  %sext.lo = shufflevector <32 x i8> %sext, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %sext.hi = shufflevector <32 x i8> %sext, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)
  %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)
  %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %res = bitcast <32 x i8> %concat to <4 x i64>
  ret <4 x i64> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

test_name: x86_pblendvb_v16i32_v8i32
test_body: define <8 x i64> @x86_pblendvb_v16i32_v8i32(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c, <8 x i64> %d) {
  %a.bc = bitcast <8 x i64> %a to <64 x i8>
  %b.bc = bitcast <8 x i64> %b to <64 x i8>
  %c.bc = bitcast <8 x i64> %c to <16 x i32>
  %d.bc = bitcast <8 x i64> %d to <16 x i32>
  %a.lo = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %b.lo = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %a.hi = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %b.hi = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %cmp = icmp slt <16 x i32> %c.bc, %d.bc
  %sext = sext <16 x i1> %cmp to <16 x i32>
  %sext.bc = bitcast <16 x i32> %sext to <64 x i8>
  %sext.lo = shufflevector <64 x i8> %sext.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
  %sext.hi = shufflevector <64 x i8> %sext.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %sel.lo = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.lo, <32 x i8> %b.lo, <32 x i8> %sext.lo)
  %sel.hi = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.hi, <32 x i8> %b.hi, <32 x i8> %sext.hi)
  %concat = shufflevector <32 x i8> %sel.lo, <32 x i8> %sel.hi, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
  %res = bitcast <64 x i8> %concat to <8 x i64>
  ret <8 x i64> %res
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8>, <32 x i8>, <32 x i8>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

file: llvm/test/Transforms/VectorCombine/AArch64/shuffletoidentity.ll
commands: opt -passes=vector-combine -S %s
tests: test_name: bitcast_smax_v8i32_v4i32
test_body: target triple = "aarch64"

define <4 x i64> @bitcast_smax_v8i32_v4i32(<4 x i64> %a, <4 x i64> %b) {
  %a.bc0 = bitcast <4 x i64> %a to <8 x i32>
  %b.bc0 = bitcast <4 x i64> %b to <8 x i32>
  %cmp = icmp slt <8 x i32> %a.bc0, %b.bc0
  %cmp.lo = shufflevector <8 x i1> %cmp, <8 x i1> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  %cmp.hi = shufflevector <8 x i1> %cmp, <8 x i1> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
  %a.bc1 = bitcast <4 x i64> %a to <8 x i32>
  %b.bc1 = bitcast <4 x i64> %b to <8 x i32>
  %a.lo = shufflevector <8 x i32> %a.bc1, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  %b.lo = shufflevector <8 x i32> %b.bc1, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  %lo = select <4 x i1> %cmp.lo, <4 x i32> %b.lo, <4 x i32> %a.lo
  %a.bc2 = bitcast <4 x i64> %a to <8 x i32>
  %b.bc2 = bitcast <4 x i64> %b to <8 x i32>
  %a.hi = shufflevector <8 x i32> %a.bc2, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
  %b.hi = shufflevector <8 x i32> %b.bc2, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
  %hi = select <4 x i1> %cmp.hi, <4 x i32> %b.hi, <4 x i32> %a.hi
  %concat = shufflevector <4 x i32> %lo, <4 x i32> %hi, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %res = bitcast <8 x i32> %concat to <4 x i64>
  ret <4 x i64> %res
}

file: llvm/test/Transforms/VectorCombine/X86/shuffle-of-selects.ll
commands: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mcpu=x86-64-v2
opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mcpu=x86-64-v3
opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mcpu=x86-64-v4
tests: test_name: src_v8tov16_i16
test_body: define <16 x i16> @src_v8tov16_i16(<8 x i1> %a, <8 x i1> %b, <8 x i16> %x, <8 x i16> %y, <8 x i16> %z) {
  %select.xz = select <8 x i1> %a, <8 x i16> %x, <8 x i16> %z
  %select.yx = select <8 x i1> %b, <8 x i16> %y, <8 x i16> %x
  %res = shufflevector <8 x i16> %select.xz, <8 x i16> %select.yx, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  ret <16 x i16> %res
}

test_name: src_v4tov8_float
test_body: define <8 x float> @src_v4tov8_float(<4 x i1> %a, <4 x i1> %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) {
  %select.xz = select <4 x i1> %a, <4 x float> %x, <4 x float> %z
  %select.yx = select <4 x i1> %b, <4 x float> %y, <4 x float> %x
  %res = shufflevector <4 x float> %select.xz, <4 x float> %select.yx, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  ret <8 x float> %res
}

test_name: src_v4tov8_i16
test_body: define <8 x i16> @src_v4tov8_i16(<4 x i1> %a, <4 x i1> %b, <4 x i16> %x, <4 x i16> %y, <4 x i16> %z) {
  %select.xz = select <4 x i1> %a, <4 x i16> %x, <4 x i16> %z
  %select.yx = select <4 x i1> %b, <4 x i16> %y, <4 x i16> %x
  %res = shufflevector <4 x i16> %select.xz, <4 x i16> %select.yx, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  ret <8 x i16> %res
}

test_name: src_v2tov4_i64
test_body: define <4 x i64> @src_v2tov4_i64(<2 x i1> %a, <2 x i1> %b, <2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {
  %select.xz = select <2 x i1> %a, <2 x i64> %x, <2 x i64> %z
  %select.yx = select <2 x i1> %b, <2 x i64> %y, <2 x i64> %x
  %res = shufflevector <2 x i64> %select.xz, <2 x i64> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  ret <4 x i64> %res
}

test_name: src_v2tov2_i64
test_body: define <2 x i64> @src_v2tov2_i64(<2 x i1> %a, <2 x i1> %b, <2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {
  %select.xz = select <2 x i1> %a, <2 x i64> %x, <2 x i64> %z
  %select.yx = select <2 x i1> %b, <2 x i64> %y, <2 x i64> %x
  %res = shufflevector <2 x i64> %select.xz, <2 x i64> %select.yx, <2 x i32> <i32 0, i32 3>
  ret <2 x i64> %res
}

test_name: src_v2tov4_i32
test_body: define <4 x i32> @src_v2tov4_i32(<2 x i1> %a, <2 x i1> %b, <2 x i32> %x, <2 x i32> %y, <2 x i32> %z) {
  %select.xz = select <2 x i1> %a, <2 x i32> %x, <2 x i32> %z
  %select.yx = select <2 x i1> %b, <2 x i32> %y, <2 x i32> %x
  %res = shufflevector <2 x i32> %select.xz, <2 x i32> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  ret <4 x i32> %res
}

test_name: src_v2tov2_double
test_body: define <2 x double> @src_v2tov2_double(<2 x i1> %a, <2 x i1> %b, <2 x double> %x, <2 x double> %y, <2 x double> %z) {
  %select.xz = select <2 x i1> %a, <2 x double> %x, <2 x double> %z
  %select.yx = select <2 x i1> %b, <2 x double> %y, <2 x double> %x
  %res = shufflevector <2 x double> %select.xz, <2 x double> %select.yx, <2 x i32> <i32 0, i32 3>
  ret <2 x double> %res
}

test_name: test_mask0
test_body: define <2 x float> @test_mask0(<4 x i1> %c, <4 x float> %x, <4 x float> %y, <4 x float> %z) {
  %select.xy = select <4 x i1> %c, <4 x float> %x, <4 x float> %y
  %select.yz = select <4 x i1> %c, <4 x float> %y, <4 x float> %z
  %res = shufflevector <4 x float> %select.xy, <4 x float> %select.yz, <2 x i32> <i32 4, i32 7>
  ret <2 x float> %res
}

test_name: src_v2tov4_i16
test_body: define <4 x i16> @src_v2tov4_i16(<2 x i1> %a, <2 x i1> %b, <2 x i16> %x, <2 x i16> %y, <2 x i16> %z) {
  %select.xz = select <2 x i1> %a, <2 x i16> %x, <2 x i16> %z
  %select.yx = select <2 x i1> %b, <2 x i16> %y, <2 x i16> %x
  %res = shufflevector <2 x i16> %select.xz, <2 x i16> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  ret <4 x i16> %res
}

test_name: src_v4tov8_i32
test_body: define <8 x i32> @src_v4tov8_i32(<4 x i1> %a, <4 x i1> %b, <4 x i32> %x, <4 x i32> %y, <4 x i32> %z) {
  %select.xz = select <4 x i1> %a, <4 x i32> %x, <4 x i32> %z
  %select.yx = select <4 x i1> %b, <4 x i32> %y, <4 x i32> %x
  %res = shufflevector <4 x i32> %select.xz, <4 x i32> %select.yx, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  ret <8 x i32> %res
}

test_name: src_v8tov8_i16
test_body: define <8 x i16> @src_v8tov8_i16(<8 x i1> %a, <8 x i1> %b, <8 x i16> %x, <8 x i16> %y, <8 x i16> %z) {
  %select.xz = select <8 x i1> %a, <8 x i16> %x, <8 x i16> %z
  %select.yx = select <8 x i1> %b, <8 x i16> %y, <8 x i16> %x
  %res = shufflevector <8 x i16> %select.xz, <8 x i16> %select.yx, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  ret <8 x i16> %res
}

test_name: src_v2tov4_float
test_body: define <4 x float> @src_v2tov4_float(<2 x i1> %a, <2 x i1> %b, <2 x float> %x, <2 x float> %y, <2 x float> %z) {
  %select.xz = select <2 x i1> %a, <2 x float> %x, <2 x float> %z
  %select.yx = select <2 x i1> %b, <2 x float> %y, <2 x float> %x
  %res = shufflevector <2 x float> %select.xz, <2 x float> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  ret <4 x float> %res
}

test_name: test_mask1
test_body: define <2 x float> @test_mask1(<4 x i1> %c, <4 x float> %x, <4 x float> %y, <4 x float> %z) {
  %select.xy = select <4 x i1> %c, <4 x float> %x, <4 x float> %y
  %select.yz = select <4 x i1> %c, <4 x float> %y, <4 x float> %z
  %res = shufflevector <4 x float> %select.xy, <4 x float> %select.yz, <2 x i32> <i32 7, i32 4>
  ret <2 x float> %res
}

test_name: src_v2tov4_double
test_body: define <4 x double> @src_v2tov4_double(<2 x i1> %a, <2 x i1> %b, <2 x double> %x, <2 x double> %y, <2 x double> %z) {
  %select.xz = select <2 x i1> %a, <2 x double> %x, <2 x double> %z
  %select.yx = select <2 x i1> %b, <2 x double> %y, <2 x double> %x
  %res = shufflevector <2 x double> %select.xz, <2 x double> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  ret <4 x double> %res
}

test_name: src_v2tov4_float_nnan
test_body: define <4 x float> @src_v2tov4_float_nnan(<2 x i1> %a, <2 x i1> %b, <2 x float> %x, <2 x float> %y, <2 x float> %z) {
  %select.xz = select nnan <2 x i1> %a, <2 x float> %x, <2 x float> %z
  %select.yx = select nnan <2 x i1> %b, <2 x float> %y, <2 x float> %x
  %res = shufflevector <2 x float> %select.xz, <2 x float> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  ret <4 x float> %res
}