[Matrix] Factor and distribute transposes across multiplies

Now that we can fold some transposes into multiplies (CM: A * B^t and RM:
A^t * B), we want to move them around to create the optimal expressions:

* fold away double transposes while still using them to assert the shape
* sink transposes hoping they cancel out
* lift transposes when both operands are transposed

This also modifies the matrix remarks to include the number of exposed
transposes (i.e. transposes that we couldn't fold into a multiply).

The adjustment to the test remarks-inlining is a bit subtle: I am changing the
double transpose to a single transpose so that we don't remove it completely.
More importantly this changes some of the total instruction count, most
notable stores because we can no longer use a vector store.

Differential Revision: https://reviews.llvm.org/D102733
This commit is contained in:
Adam Nemet 2021-05-18 09:59:07 -07:00
parent 2ea6e13bf8
commit dfd1bbd00a
4 changed files with 1105 additions and 22 deletions

View File

@ -34,6 +34,7 @@
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/MatrixBuilder.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
@ -79,6 +80,9 @@ static cl::opt<MatrixLayoutTy> MatrixLayout(
clEnumValN(MatrixLayoutTy::RowMajor, "row-major",
"Use row-major layout")));
static cl::opt<bool> PrintAfterTransposeOpt("matrix-print-after-transpose-opt",
cl::init(false));
/// Helper function to either return Scope, if it is a subprogram or the
/// attached subprogram for a local scope.
static DISubprogram *getSubprogram(DIScope *Scope) {
@ -195,11 +199,16 @@ class LowerMatrixIntrinsics {
unsigned NumLoads = 0;
/// Number of compute operations emitted to generate this matrix.
unsigned NumComputeOps = 0;
/// Most of the time transposes can be fused with matrix multiplies or can
/// be folded away via algebraic simplifications. This is the number of
/// transposes that we failed to make "free" via such optimizations.
unsigned NumExposedTransposes = 0;
OpInfoTy &operator+=(const OpInfoTy &RHS) {
NumStores += RHS.NumStores;
NumLoads += RHS.NumLoads;
NumComputeOps += RHS.NumComputeOps;
NumExposedTransposes += RHS.NumExposedTransposes;
return *this;
}
};
@ -304,6 +313,11 @@ class LowerMatrixIntrinsics {
return *this;
}
MatrixTy &addNumExposedTransposes(unsigned N) {
OpInfo.NumExposedTransposes += N;
return *this;
}
MatrixTy &addNumComputeOps(unsigned N) {
OpInfo.NumComputeOps += N;
return *this;
@ -379,8 +393,10 @@ class LowerMatrixIntrinsics {
/// the result value of the instruction, with the only exceptions being store
/// instructions and the matrix_column_major_store intrinsics. For those, the
/// shape information indicates that those instructions should be lowered
/// using shape information as well.
DenseMap<Value *, ShapeInfo> ShapeMap;
/// using shape information as well. A ValueMap is used so that when
/// sub-passes like optimizeTransposes performs RAUW the map stays
/// up-to-date.
ValueMap<Value *, ShapeInfo> ShapeMap;
/// List of instructions to remove. While lowering, we are not replacing all
/// users of a lowered instruction, if shape information is available and
@ -403,7 +419,11 @@ public:
cast<FixedVectorType>(VT)->getNumElements());
}
//
/// Is this the minimal version executed in the backend pipelines.
bool isMinimal() const {
return !DT;
}
/// Return the estimated number of vector ops required for an operation on
/// \p VT * N.
unsigned getNumOps(Type *ST, unsigned N) {
@ -654,6 +674,110 @@ public:
return NewWorkList;
}
/// Try moving transposes in order to fold them away or into multiplies.
void optimizeTransposes() {
// First sink all transposes inside matmuls, hoping that we end up with NN,
// NT or TN variants.
for (BasicBlock &BB : reverse(Func)) {
for (auto II = BB.rbegin(); II != BB.rend();) {
Instruction &I = *II;
// We may remove II. By default continue on the next/prev instruction.
++II;
// If we were to erase II, move again.
auto EraseFromParent = [&II](Value *V) {
auto *Inst = cast<Instruction>(V);
if (Inst->use_empty()) {
if (Inst == &*II) {
++II;
}
Inst->eraseFromParent();
}
};
// If we're creating a new instruction, continue from there.
Instruction *NewInst = nullptr;
IRBuilder<> IB(&I);
MatrixBuilder<IRBuilder<>> Builder(IB);
Value *TA, *TAMA, *TAMB;
ConstantInt *R, *K, *C;
if (match(&I, m_Intrinsic<Intrinsic::matrix_transpose>(m_Value(TA)))) {
// Transpose of a transpose is a nop
Value *TATA;
if (match(TA,
m_Intrinsic<Intrinsic::matrix_transpose>(m_Value(TATA)))) {
I.replaceAllUsesWith(TATA);
EraseFromParent(&I);
EraseFromParent(TA);
}
// (A * B)^t -> B^t * A^t
// RxK KxC CxK KxR
else if (match(TA, m_Intrinsic<Intrinsic::matrix_multiply>(
m_Value(TAMA), m_Value(TAMB), m_ConstantInt(R),
m_ConstantInt(K), m_ConstantInt(C)))) {
Value *T0 = Builder.CreateMatrixTranspose(TAMB, K->getZExtValue(),
C->getZExtValue(),
TAMB->getName() + "_t");
// We are being run after shape prop, add shape for newly created
// instructions so that we lower them later.
setShapeInfo(T0, {C, K});
Value *T1 = Builder.CreateMatrixTranspose(TAMA, R->getZExtValue(),
K->getZExtValue(),
TAMA->getName() + "_t");
setShapeInfo(T1, {K, R});
NewInst = Builder.CreateMatrixMultiply(T0, T1, C->getZExtValue(),
K->getZExtValue(),
R->getZExtValue(), "mmul");
setShapeInfo(NewInst, {C, R});
I.replaceAllUsesWith(NewInst);
EraseFromParent(&I);
EraseFromParent(TA);
}
}
// If we replaced I with a new instruction, continue from there.
if (NewInst)
II = std::next(BasicBlock::reverse_iterator(NewInst));
}
}
// If we have a TT matmul, lift the transpose. We may be able to fold into
// consuming multiply.
for (BasicBlock &BB : Func) {
for (BasicBlock::iterator II = BB.begin(); II != BB.end();) {
Instruction *I = &*II;
// We may remove I.
++II;
Value *A, *B, *AT, *BT;
ConstantInt *R, *K, *C;
if (match(&*I, m_Intrinsic<Intrinsic::matrix_multiply>(
m_Value(A), m_Value(B), m_ConstantInt(R),
m_ConstantInt(K), m_ConstantInt(C))) &&
match(A, m_Intrinsic<Intrinsic::matrix_transpose>(m_Value(AT))) &&
match(B, m_Intrinsic<Intrinsic::matrix_transpose>(m_Value((BT))))) {
IRBuilder<> IB(&*I);
MatrixBuilder<IRBuilder<>> Builder(IB);
Value *M = Builder.CreateMatrixMultiply(
BT, AT, C->getZExtValue(), K->getZExtValue(), R->getZExtValue());
setShapeInfo(M, {C, R});
Value *NewInst = Builder.CreateMatrixTranspose(M, R->getZExtValue(),
C->getZExtValue());
setShapeInfo(NewInst, {C, R});
I->replaceAllUsesWith(NewInst);
if (I->use_empty())
I->eraseFromParent();
if (A->use_empty())
cast<Instruction>(A)->eraseFromParent();
if (B->use_empty())
cast<Instruction>(B)->eraseFromParent();
}
}
}
}
bool Visit() {
SmallVector<Instruction *, 32> WorkList;
@ -687,6 +811,14 @@ public:
WorkList = propagateShapeBackward(WorkList);
}
if (!isMinimal()) {
optimizeTransposes();
if (PrintAfterTransposeOpt) {
dbgs() << "Dump after matrix transpose optimization:\n";
Func.dump();
}
}
bool Changed = false;
SmallVector<CallInst *, 16> MaybeFusableInsts;
SmallVector<Instruction *, 16> MatrixInsts;
@ -1488,7 +1620,8 @@ public:
// account for later simplifications/combines.
finalizeLowering(
Inst,
Result.addNumComputeOps(2 * ArgShape.NumRows * ArgShape.NumColumns),
Result.addNumComputeOps(2 * ArgShape.NumRows * ArgShape.NumColumns)
.addNumExposedTransposes(1),
Builder);
}
@ -2003,7 +2136,9 @@ public:
Rem << ore::NV("NumStores", Counts.NumStores) << " stores, "
<< ore::NV("NumLoads", Counts.NumLoads) << " loads, "
<< ore::NV("NumComputeOps", Counts.NumComputeOps)
<< " compute ops";
<< " compute ops, "
<< ore::NV("NumExposedTransposes", Counts.NumExposedTransposes)
<< " exposed transposes";
if (SharedCounts.NumStores > 0 || SharedCounts.NumLoads > 0 ||
SharedCounts.NumComputeOps > 0) {

View File

@ -47,50 +47,50 @@
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "aarch64-apple-ios"
; CHECK-LABEL: remark: load.h:41:43: Lowered with 0 stores, 10 loads, 0 compute ops
; CHECK-LABEL: remark: load.h:41:43: Lowered with 0 stores, 10 loads, 0 compute ops, 0 exposed transposes
; CHECK-NEXT: load(addr %A)
; CHECK-LABEL: remark: load.h:41:43: Lowered with 0 stores, 10 loads, 0 compute ops
; CHECK-LABEL: remark: load.h:41:43: Lowered with 0 stores, 10 loads, 0 compute ops, 0 exposed transposes
; CHECK-NEXT: column.major.load.3x5.double(addr %B, 5)
; CHECK-LABEL: remark: load.h:41:11: Lowered with 0 stores, 1 loads, 0 compute ops
; CHECK-LABEL: remark: load.h:41:11: Lowered with 0 stores, 1 loads, 0 compute ops, 0 exposed transposes
; CHECK-NEXT: load(addr %D)
; CHECK-LABEL: remark: assign.h:32:43: Lowered with 0 stores, 10 loads, 0 compute ops
; CHECK-LABEL: remark: assign.h:32:43: Lowered with 0 stores, 10 loads, 0 compute ops, 0 exposed transposes
; CHECK-NEXT: load(addr %A)
; CHECK-LABEL: remark: assign.h:32:43: Lowered with 0 stores, 10 loads, 0 compute ops
; CHECK-LABEL: remark: assign.h:32:43: Lowered with 0 stores, 10 loads, 0 compute ops, 0 exposed transposes
; CHECK-NEXT: column.major.load.3x5.double(addr %B, 5)
; CHECK-LABEL: remark: toplevel.c:410:0: Lowered with 10 stores, 20 loads, 10 compute ops
; CHECK-LABEL: remark: toplevel.c:410:0: Lowered with 10 stores, 20 loads, 10 compute ops, 0 exposed transposes
; CHECK-NEXT: store(
; CHECK-NEXT: fadd(
; CHECK-NEXT: load(addr %A),
; CHECK-NEXT: column.major.load.3x5.double(addr %B, 5)),
; CHECK-NEXT: addr %C)
; CHECK-LABEL: remark: toplevel.c:510:0: Lowered with 1 stores, 1 loads, 8 compute ops
; CHECK-LABEL: remark: toplevel.c:510:0: Lowered with 2 stores, 1 loads, 4 compute ops, 1 exposed transposes
; CHECK-NEXT: store(
; CHECK-NEXT: transpose.1x2.float(transpose.2x1.float(load(addr %D))),
; CHECK-NEXT: transpose.2x1.float(load(addr %D)),
; CHECK-NEXT: addr %D)
; CHECK-LABEL: remark: add.h:66:11: Lowered with 0 stores, 0 loads, 10 compute ops
; CHECK-LABEL: remark: add.h:66:11: Lowered with 0 stores, 0 loads, 10 compute ops, 0 exposed transposes
; CHECK-NEXT: fadd(
; CHECK-NEXT: addr %A,
; CHECK-NEXT: scalar)
; CHECK-LABEL: remark: store.h:10:11: Lowered with 10 stores, 0 loads, 0 compute ops
; CHECK-LABEL: remark: store.h:10:11: Lowered with 10 stores, 0 loads, 0 compute ops, 0 exposed transposes
; CHECK-NEXT: store(
; CHECK-NEXT: scalar,
; CHECK-NEXT: addr %C)
; CHECK-LABEL: remark: store.h:66:11: Lowered with 1 stores, 0 loads, 0 compute ops
; CHECK-LABEL: remark: store.h:66:11: Lowered with 2 stores, 0 loads, 0 compute ops, 0 exposed transposes
; CHECK-NEXT: store(
; CHECK-NEXT: scalar,
; CHECK-NEXT: addr %D)
; CHECK-LABEL: remark: transpose.h:13:11: Lowered with 0 stores, 0 loads, 8 compute ops
; CHECK-NEXT: transpose.1x2.float(transpose.2x1.float(addr %D))
; CHECK-LABEL: remark: transpose.h:13:11: Lowered with 0 stores, 0 loads, 4 compute ops, 1 exposed transposes
; CHECK-NEXT: transpose.2x1.float(addr %D)
define void @toplevel(<15 x double>* %A, double* %B, <15 x double>* %C, <2 x float>* %D) !dbg !16 {
entry:
@ -101,8 +101,7 @@ entry:
%load = load <2 x float>, <2 x float>* %D, !dbg !104
%t1 = call <2 x float> @llvm.matrix.transpose(<2 x float> %load, i32 2, i32 1), !dbg !106
%t2 = call <2 x float> @llvm.matrix.transpose(<2 x float> %t1, i32 1, i32 2), !dbg !106
store <2 x float> %t2, <2 x float>* %D, !dbg !108
store <2 x float> %t1, <2 x float>* %D, !dbg !108
ret void
}

View File

@ -17,7 +17,9 @@
; YAML-NEXT: - NumLoads: '0'
; YAML-NEXT: - String: ' loads, '
; YAML-NEXT: - NumComputeOps: '0'
; YAML-NEXT: - String: ' compute ops'
; YAML-NEXT: - String: ' compute ops, '
; YAML-NEXT: - NumExposedTransposes: '0'
; YAML-NEXT: - String: ' exposed transposes'
; YAML-NEXT: - String: ",\nadditionally "
; YAML-NEXT: - NumStores: '0'
; YAML-NEXT: - String: ' stores, '
@ -45,7 +47,9 @@
; YAML-NEXT: - NumLoads: '45'
; YAML-NEXT: - String: ' loads, '
; YAML-NEXT: - NumComputeOps: '120'
; YAML-NEXT: - String: ' compute ops'
; YAML-NEXT: - String: ' compute ops, '
; YAML-NEXT: - NumExposedTransposes: '0'
; YAML-NEXT: - String: ' exposed transposes'
; YAML-NEXT: - String: ",\nadditionally "
; YAML-NEXT: - NumStores: '0'
; YAML-NEXT: - String: ' stores, '

View File

@ -0,0 +1,945 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; REQUIRES: aarch64-registered-target
; This test needs to be target specific due to the cost estimate in the output.
; RUN: opt -lower-matrix-intrinsics -S < %s | FileCheck %s
; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s
; RUN: opt -lower-matrix-intrinsics -S -o /dev/null -pass-remarks-output=%t < %s && FileCheck --input-file %t --check-prefix=REMARK %s
; RUN: opt -passes='lower-matrix-intrinsics' -S -o /dev/null -pass-remarks-output=%t < %s && FileCheck --input-file %t --check-prefix=REMARK %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "aarch64-apple-ios"
define void @double_transpose(<9 x double>* %A, <9 x double>* %B) {
; REMARK: Pass: lower-matrix-intrinsics
; REMARK-NEXT: Name: matrix-lowered
; REMARK-NEXT: Function: double_transpose
; REMARK-NEXT: Args:
; REMARK-NEXT: - String: 'Lowered with '
; REMARK-NEXT: - NumStores: '6'
; REMARK-NEXT: - String: ' stores, '
; REMARK-NEXT: - NumLoads: '6'
; REMARK-NEXT: - String: ' loads, '
; REMARK-NEXT: - NumComputeOps: '0'
; REMARK-NEXT: - String: ' compute ops, '
; REMARK-NEXT: - NumExposedTransposes: '0'
; REMARK-NEXT: - String: ' exposed transposes'
; REMARK-NEXT: - String: |
; REMARK: store(
; REMARK-NEXT: load(addr %A),
; REMARK-NEXT: addr %B)
; CHECK-LABEL: @double_transpose(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x double>* [[A:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST:%.*]] = bitcast double* [[TMP0]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST]], align 16
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr double, double* [[TMP0]], i64 3
; CHECK-NEXT: [[VEC_CAST1:%.*]] = bitcast double* [[VEC_GEP]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD2:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST1]], align 8
; CHECK-NEXT: [[VEC_GEP3:%.*]] = getelementptr double, double* [[TMP0]], i64 6
; CHECK-NEXT: [[VEC_CAST4:%.*]] = bitcast double* [[VEC_GEP3]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST4]], align 16
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <9 x double>* [[B:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST6:%.*]] = bitcast double* [[TMP1]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[COL_LOAD]], <3 x double>* [[VEC_CAST6]], align 16
; CHECK-NEXT: [[VEC_GEP7:%.*]] = getelementptr double, double* [[TMP1]], i64 3
; CHECK-NEXT: [[VEC_CAST8:%.*]] = bitcast double* [[VEC_GEP7]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[COL_LOAD2]], <3 x double>* [[VEC_CAST8]], align 8
; CHECK-NEXT: [[VEC_GEP9:%.*]] = getelementptr double, double* [[TMP1]], i64 6
; CHECK-NEXT: [[VEC_CAST10:%.*]] = bitcast double* [[VEC_GEP9]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[COL_LOAD5]], <3 x double>* [[VEC_CAST10]], align 16
; CHECK-NEXT: ret void
;
entry:
%a = load <9 x double>, <9 x double>* %A, align 16
%at = call <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double> %a, i32 3, i32 3)
%att = call <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double> %at, i32 3, i32 3)
store <9 x double> %att, <9 x double>* %B, align 16
ret void
}
define void @multiply_ntt(<6 x double>* %A, <6 x double>* %B, <8 x double>* %C, <8 x double>* %R) {
; REMARK: Pass: lower-matrix-intrinsics
; REMARK-NEXT: Name: matrix-lowered
; REMARK-NEXT: Function: multiply_ntt
; REMARK-NEXT: Args:
; REMARK-NEXT: - String: 'Lowered with '
; REMARK-NEXT: - NumStores: '4'
; REMARK-NEXT: - String: ' stores, '
; REMARK-NEXT: - NumLoads: '10'
; REMARK-NEXT: - String: ' loads, '
; REMARK-NEXT: - NumComputeOps: '38'
; REMARK-NEXT: - String: ' compute ops, '
; REMARK-NEXT: - NumExposedTransposes: '0'
; REMARK-NEXT: - String: ' exposed transposes'
; REMARK-NEXT: - String: |
; REMARK: store(
; REMARK-NEXT: multiply.2x3.3x4.double(
; REMARK-NEXT: load(addr %A),
; REMARK-NEXT: transpose.4x3.double(multiply.4x2.2x3.double(
; REMARK-NEXT: load(addr %C),
; REMARK-NEXT: load(addr %B)))),
; REMARK-NEXT: addr %R)
; CHECK-LABEL: @multiply_ntt(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = bitcast <6 x double>* [[A:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST:%.*]] = bitcast double* [[TMP0]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST]], align 16
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr double, double* [[TMP0]], i64 2
; CHECK-NEXT: [[VEC_CAST39:%.*]] = bitcast double* [[VEC_GEP]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD40:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST39]], align 16
; CHECK-NEXT: [[VEC_GEP41:%.*]] = getelementptr double, double* [[TMP0]], i64 4
; CHECK-NEXT: [[VEC_CAST42:%.*]] = bitcast double* [[VEC_GEP41]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD43:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST42]], align 16
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x double> [[COL_LOAD]], <2 x double> [[COL_LOAD40]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[COL_LOAD43]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x double> [[TMP1]], <4 x double> [[TMP2]], <6 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5>
; CHECK-NEXT: [[TMP4:%.*]] = bitcast <6 x double>* [[B:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST44:%.*]] = bitcast double* [[TMP4]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD45:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST44]], align 16
; CHECK-NEXT: [[VEC_GEP46:%.*]] = getelementptr double, double* [[TMP4]], i64 2
; CHECK-NEXT: [[VEC_CAST47:%.*]] = bitcast double* [[VEC_GEP46]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD48:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST47]], align 16
; CHECK-NEXT: [[VEC_GEP49:%.*]] = getelementptr double, double* [[TMP4]], i64 4
; CHECK-NEXT: [[VEC_CAST50:%.*]] = bitcast double* [[VEC_GEP49]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD51:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST50]], align 16
; CHECK-NEXT: [[TMP5:%.*]] = bitcast <8 x double>* [[C:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST52:%.*]] = bitcast double* [[TMP5]] to <4 x double>*
; CHECK-NEXT: [[COL_LOAD53:%.*]] = load <4 x double>, <4 x double>* [[VEC_CAST52]], align 16
; CHECK-NEXT: [[VEC_GEP54:%.*]] = getelementptr double, double* [[TMP5]], i64 4
; CHECK-NEXT: [[VEC_CAST55:%.*]] = bitcast double* [[VEC_GEP54]] to <4 x double>*
; CHECK-NEXT: [[COL_LOAD56:%.*]] = load <4 x double>, <4 x double>* [[VEC_CAST55]], align 16
; CHECK-NEXT: [[BLOCK57:%.*]] = shufflevector <4 x double> [[COL_LOAD53]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x double> [[COL_LOAD45]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT58:%.*]] = insertelement <2 x double> poison, double [[TMP6]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT59:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT58]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP7:%.*]] = fmul <2 x double> [[BLOCK57]], [[SPLAT_SPLAT59]]
; CHECK-NEXT: [[BLOCK60:%.*]] = shufflevector <4 x double> [[COL_LOAD56]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x double> [[COL_LOAD45]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT61:%.*]] = insertelement <2 x double> poison, double [[TMP8]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT62:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT61]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP9:%.*]] = fmul <2 x double> [[BLOCK60]], [[SPLAT_SPLAT62]]
; CHECK-NEXT: [[TMP10:%.*]] = fadd <2 x double> [[TMP7]], [[TMP9]]
; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <2 x double> [[TMP10]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <4 x double> undef, <4 x double> [[TMP11]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
; CHECK-NEXT: [[BLOCK63:%.*]] = shufflevector <4 x double> [[COL_LOAD53]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP13:%.*]] = extractelement <2 x double> [[COL_LOAD45]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT64:%.*]] = insertelement <2 x double> poison, double [[TMP13]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT65:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT64]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP14:%.*]] = fmul <2 x double> [[BLOCK63]], [[SPLAT_SPLAT65]]
; CHECK-NEXT: [[BLOCK66:%.*]] = shufflevector <4 x double> [[COL_LOAD56]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP15:%.*]] = extractelement <2 x double> [[COL_LOAD45]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT67:%.*]] = insertelement <2 x double> poison, double [[TMP15]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT68:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT67]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP16:%.*]] = fmul <2 x double> [[BLOCK66]], [[SPLAT_SPLAT68]]
; CHECK-NEXT: [[TMP17:%.*]] = fadd <2 x double> [[TMP14]], [[TMP16]]
; CHECK-NEXT: [[TMP18:%.*]] = shufflevector <2 x double> [[TMP17]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP19:%.*]] = shufflevector <4 x double> [[TMP12]], <4 x double> [[TMP18]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
; CHECK-NEXT: [[BLOCK69:%.*]] = shufflevector <4 x double> [[COL_LOAD53]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP20:%.*]] = extractelement <2 x double> [[COL_LOAD48]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT70:%.*]] = insertelement <2 x double> poison, double [[TMP20]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT71:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT70]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP21:%.*]] = fmul <2 x double> [[BLOCK69]], [[SPLAT_SPLAT71]]
; CHECK-NEXT: [[BLOCK72:%.*]] = shufflevector <4 x double> [[COL_LOAD56]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP22:%.*]] = extractelement <2 x double> [[COL_LOAD48]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT73:%.*]] = insertelement <2 x double> poison, double [[TMP22]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT74:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT73]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP23:%.*]] = fmul <2 x double> [[BLOCK72]], [[SPLAT_SPLAT74]]
; CHECK-NEXT: [[TMP24:%.*]] = fadd <2 x double> [[TMP21]], [[TMP23]]
; CHECK-NEXT: [[TMP25:%.*]] = shufflevector <2 x double> [[TMP24]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP26:%.*]] = shufflevector <4 x double> undef, <4 x double> [[TMP25]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
; CHECK-NEXT: [[BLOCK75:%.*]] = shufflevector <4 x double> [[COL_LOAD53]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP27:%.*]] = extractelement <2 x double> [[COL_LOAD48]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT76:%.*]] = insertelement <2 x double> poison, double [[TMP27]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT77:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT76]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP28:%.*]] = fmul <2 x double> [[BLOCK75]], [[SPLAT_SPLAT77]]
; CHECK-NEXT: [[BLOCK78:%.*]] = shufflevector <4 x double> [[COL_LOAD56]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP29:%.*]] = extractelement <2 x double> [[COL_LOAD48]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT79:%.*]] = insertelement <2 x double> poison, double [[TMP29]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT80:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT79]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP30:%.*]] = fmul <2 x double> [[BLOCK78]], [[SPLAT_SPLAT80]]
; CHECK-NEXT: [[TMP31:%.*]] = fadd <2 x double> [[TMP28]], [[TMP30]]
; CHECK-NEXT: [[TMP32:%.*]] = shufflevector <2 x double> [[TMP31]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP33:%.*]] = shufflevector <4 x double> [[TMP26]], <4 x double> [[TMP32]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
; CHECK-NEXT: [[BLOCK81:%.*]] = shufflevector <4 x double> [[COL_LOAD53]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP34:%.*]] = extractelement <2 x double> [[COL_LOAD51]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT82:%.*]] = insertelement <2 x double> poison, double [[TMP34]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT83:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT82]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP35:%.*]] = fmul <2 x double> [[BLOCK81]], [[SPLAT_SPLAT83]]
; CHECK-NEXT: [[BLOCK84:%.*]] = shufflevector <4 x double> [[COL_LOAD56]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP36:%.*]] = extractelement <2 x double> [[COL_LOAD51]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT85:%.*]] = insertelement <2 x double> poison, double [[TMP36]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT86:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT85]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP37:%.*]] = fmul <2 x double> [[BLOCK84]], [[SPLAT_SPLAT86]]
; CHECK-NEXT: [[TMP38:%.*]] = fadd <2 x double> [[TMP35]], [[TMP37]]
; CHECK-NEXT: [[TMP39:%.*]] = shufflevector <2 x double> [[TMP38]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP40:%.*]] = shufflevector <4 x double> undef, <4 x double> [[TMP39]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
; CHECK-NEXT: [[BLOCK87:%.*]] = shufflevector <4 x double> [[COL_LOAD53]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP41:%.*]] = extractelement <2 x double> [[COL_LOAD51]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT88:%.*]] = insertelement <2 x double> poison, double [[TMP41]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT89:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT88]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP42:%.*]] = fmul <2 x double> [[BLOCK87]], [[SPLAT_SPLAT89]]
; CHECK-NEXT: [[BLOCK90:%.*]] = shufflevector <4 x double> [[COL_LOAD56]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP43:%.*]] = extractelement <2 x double> [[COL_LOAD51]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT91:%.*]] = insertelement <2 x double> poison, double [[TMP43]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT92:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT91]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP44:%.*]] = fmul <2 x double> [[BLOCK90]], [[SPLAT_SPLAT92]]
; CHECK-NEXT: [[TMP45:%.*]] = fadd <2 x double> [[TMP42]], [[TMP44]]
; CHECK-NEXT: [[TMP46:%.*]] = shufflevector <2 x double> [[TMP45]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP47:%.*]] = shufflevector <4 x double> [[TMP40]], <4 x double> [[TMP46]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
; CHECK-NEXT: [[TMP48:%.*]] = shufflevector <4 x double> [[TMP19]], <4 x double> [[TMP33]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
; CHECK-NEXT: [[TMP49:%.*]] = shufflevector <4 x double> [[TMP47]], <4 x double> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP50:%.*]] = shufflevector <8 x double> [[TMP48]], <8 x double> [[TMP49]], <12 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>
; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <6 x double> [[TMP3]], <6 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <6 x double> [[TMP3]], <6 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <6 x double> [[TMP3]], <6 x double> poison, <2 x i32> <i32 4, i32 5>
; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <12 x double> [[TMP50]], <12 x double> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; CHECK-NEXT: [[SPLIT4:%.*]] = shufflevector <12 x double> [[TMP50]], <12 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
; CHECK-NEXT: [[SPLIT5:%.*]] = shufflevector <12 x double> [[TMP50]], <12 x double> poison, <4 x i32> <i32 8, i32 9, i32 10, i32 11>
; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <2 x double> [[SPLIT]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP51:%.*]] = extractelement <4 x double> [[SPLIT3]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[TMP51]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP52:%.*]] = fmul <2 x double> [[BLOCK]], [[SPLAT_SPLAT]]
; CHECK-NEXT: [[BLOCK6:%.*]] = shufflevector <2 x double> [[SPLIT1]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP53:%.*]] = extractelement <4 x double> [[SPLIT4]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT7:%.*]] = insertelement <2 x double> poison, double [[TMP53]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT8:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT7]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP54:%.*]] = fmul <2 x double> [[BLOCK6]], [[SPLAT_SPLAT8]]
; CHECK-NEXT: [[TMP55:%.*]] = fadd <2 x double> [[TMP52]], [[TMP54]]
; CHECK-NEXT: [[BLOCK9:%.*]] = shufflevector <2 x double> [[SPLIT2]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP56:%.*]] = extractelement <4 x double> [[SPLIT5]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT10:%.*]] = insertelement <2 x double> poison, double [[TMP56]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT11:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT10]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP57:%.*]] = fmul <2 x double> [[BLOCK9]], [[SPLAT_SPLAT11]]
; CHECK-NEXT: [[TMP58:%.*]] = fadd <2 x double> [[TMP55]], [[TMP57]]
; CHECK-NEXT: [[TMP59:%.*]] = shufflevector <2 x double> [[TMP58]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP60:%.*]] = shufflevector <2 x double> undef, <2 x double> [[TMP59]], <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[BLOCK12:%.*]] = shufflevector <2 x double> [[SPLIT]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP61:%.*]] = extractelement <4 x double> [[SPLIT3]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT13:%.*]] = insertelement <2 x double> poison, double [[TMP61]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT14:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT13]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP62:%.*]] = fmul <2 x double> [[BLOCK12]], [[SPLAT_SPLAT14]]
; CHECK-NEXT: [[BLOCK15:%.*]] = shufflevector <2 x double> [[SPLIT1]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP63:%.*]] = extractelement <4 x double> [[SPLIT4]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT16:%.*]] = insertelement <2 x double> poison, double [[TMP63]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT17:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT16]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP64:%.*]] = fmul <2 x double> [[BLOCK15]], [[SPLAT_SPLAT17]]
; CHECK-NEXT: [[TMP65:%.*]] = fadd <2 x double> [[TMP62]], [[TMP64]]
; CHECK-NEXT: [[BLOCK18:%.*]] = shufflevector <2 x double> [[SPLIT2]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP66:%.*]] = extractelement <4 x double> [[SPLIT5]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT19:%.*]] = insertelement <2 x double> poison, double [[TMP66]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT20:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT19]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP67:%.*]] = fmul <2 x double> [[BLOCK18]], [[SPLAT_SPLAT20]]
; CHECK-NEXT: [[TMP68:%.*]] = fadd <2 x double> [[TMP65]], [[TMP67]]
; CHECK-NEXT: [[TMP69:%.*]] = shufflevector <2 x double> [[TMP68]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP70:%.*]] = shufflevector <2 x double> undef, <2 x double> [[TMP69]], <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[BLOCK21:%.*]] = shufflevector <2 x double> [[SPLIT]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP71:%.*]] = extractelement <4 x double> [[SPLIT3]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT22:%.*]] = insertelement <2 x double> poison, double [[TMP71]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT23:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT22]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP72:%.*]] = fmul <2 x double> [[BLOCK21]], [[SPLAT_SPLAT23]]
; CHECK-NEXT: [[BLOCK24:%.*]] = shufflevector <2 x double> [[SPLIT1]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP73:%.*]] = extractelement <4 x double> [[SPLIT4]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT25:%.*]] = insertelement <2 x double> poison, double [[TMP73]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT26:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT25]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP74:%.*]] = fmul <2 x double> [[BLOCK24]], [[SPLAT_SPLAT26]]
; CHECK-NEXT: [[TMP75:%.*]] = fadd <2 x double> [[TMP72]], [[TMP74]]
; CHECK-NEXT: [[BLOCK27:%.*]] = shufflevector <2 x double> [[SPLIT2]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP76:%.*]] = extractelement <4 x double> [[SPLIT5]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT28:%.*]] = insertelement <2 x double> poison, double [[TMP76]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT29:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT28]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP77:%.*]] = fmul <2 x double> [[BLOCK27]], [[SPLAT_SPLAT29]]
; CHECK-NEXT: [[TMP78:%.*]] = fadd <2 x double> [[TMP75]], [[TMP77]]
; CHECK-NEXT: [[TMP79:%.*]] = shufflevector <2 x double> [[TMP78]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP80:%.*]] = shufflevector <2 x double> undef, <2 x double> [[TMP79]], <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[BLOCK30:%.*]] = shufflevector <2 x double> [[SPLIT]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP81:%.*]] = extractelement <4 x double> [[SPLIT3]], i64 3
; CHECK-NEXT: [[SPLAT_SPLATINSERT31:%.*]] = insertelement <2 x double> poison, double [[TMP81]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT32:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT31]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP82:%.*]] = fmul <2 x double> [[BLOCK30]], [[SPLAT_SPLAT32]]
; CHECK-NEXT: [[BLOCK33:%.*]] = shufflevector <2 x double> [[SPLIT1]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP83:%.*]] = extractelement <4 x double> [[SPLIT4]], i64 3
; CHECK-NEXT: [[SPLAT_SPLATINSERT34:%.*]] = insertelement <2 x double> poison, double [[TMP83]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT35:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT34]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP84:%.*]] = fmul <2 x double> [[BLOCK33]], [[SPLAT_SPLAT35]]
; CHECK-NEXT: [[TMP85:%.*]] = fadd <2 x double> [[TMP82]], [[TMP84]]
; CHECK-NEXT: [[BLOCK36:%.*]] = shufflevector <2 x double> [[SPLIT2]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP86:%.*]] = extractelement <4 x double> [[SPLIT5]], i64 3
; CHECK-NEXT: [[SPLAT_SPLATINSERT37:%.*]] = insertelement <2 x double> poison, double [[TMP86]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT38:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT37]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP87:%.*]] = fmul <2 x double> [[BLOCK36]], [[SPLAT_SPLAT38]]
; CHECK-NEXT: [[TMP88:%.*]] = fadd <2 x double> [[TMP85]], [[TMP87]]
; CHECK-NEXT: [[TMP89:%.*]] = shufflevector <2 x double> [[TMP88]], <2 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP90:%.*]] = shufflevector <2 x double> undef, <2 x double> [[TMP89]], <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP91:%.*]] = bitcast <8 x double>* [[R:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST93:%.*]] = bitcast double* [[TMP91]] to <2 x double>*
; CHECK-NEXT: store <2 x double> [[TMP60]], <2 x double>* [[VEC_CAST93]], align 16
; CHECK-NEXT: [[VEC_GEP94:%.*]] = getelementptr double, double* [[TMP91]], i64 2
; CHECK-NEXT: [[VEC_CAST95:%.*]] = bitcast double* [[VEC_GEP94]] to <2 x double>*
; CHECK-NEXT: store <2 x double> [[TMP70]], <2 x double>* [[VEC_CAST95]], align 16
; CHECK-NEXT: [[VEC_GEP96:%.*]] = getelementptr double, double* [[TMP91]], i64 4
; CHECK-NEXT: [[VEC_CAST97:%.*]] = bitcast double* [[VEC_GEP96]] to <2 x double>*
; CHECK-NEXT: store <2 x double> [[TMP80]], <2 x double>* [[VEC_CAST97]], align 16
; CHECK-NEXT: [[VEC_GEP98:%.*]] = getelementptr double, double* [[TMP91]], i64 6
; CHECK-NEXT: [[VEC_CAST99:%.*]] = bitcast double* [[VEC_GEP98]] to <2 x double>*
; CHECK-NEXT: store <2 x double> [[TMP90]], <2 x double>* [[VEC_CAST99]], align 16
; CHECK-NEXT: ret void
;
entry:
%a = load <6 x double>, <6 x double>* %A, align 16
%b = load <6 x double>, <6 x double>* %B, align 16
%c = load <8 x double>, <8 x double>* %C, align 16
%b_t = call <6 x double> @llvm.matrix.transpose.v6f64.v6f64(<6 x double> %b, i32 2, i32 3)
%c_t = call <8 x double> @llvm.matrix.transpose.v8f64.v8f64(<8 x double> %c, i32 4, i32 2)
%m1 = call <12 x double> @llvm.matrix.multiply.v12f64.v6f64.v8f64(<6 x double> %b_t, <8 x double> %c_t, i32 3, i32 2, i32 4)
%m2 = call <8 x double> @llvm.matrix.multiply.v8f64.v6f64.v12f64(<6 x double> %a, <12 x double> %m1, i32 2, i32 3, i32 4)
store <8 x double> %m2, <8 x double>* %R, align 16
ret void
}
define void @multiply_tt_t(<9 x double>* %A, <9 x double>* %B, <9 x double>* %C) {
; REMARK: Pass: lower-matrix-intrinsics
; REMARK-NEXT: Name: matrix-lowered
; REMARK-NEXT: Function: multiply_tt_t
; REMARK-NEXT: Args:
; REMARK-NEXT: - String: 'Lowered with '
; REMARK-NEXT: - NumStores: '6'
; REMARK-NEXT: - String: ' stores, '
; REMARK-NEXT: - NumLoads: '12'
; REMARK-NEXT: - String: ' loads, '
; REMARK-NEXT: - NumComputeOps: '30'
; REMARK-NEXT: - String: ' compute ops, '
; REMARK-NEXT: - NumExposedTransposes: '0'
; REMARK-NEXT: - String: ' exposed transposes'
; REMARK-NEXT: - String: |
; REMARK: store(
; REMARK-NEXT: multiply.3x3.3x3.double(
; REMARK-NEXT: load(addr %B),
; REMARK-NEXT: load(addr %A)),
; REMARK-NEXT: addr %C)
; CHECK-LABEL: @multiply_tt_t(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x double>* [[A:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST:%.*]] = bitcast double* [[TMP0]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST]], align 16
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr double, double* [[TMP0]], i64 3
; CHECK-NEXT: [[VEC_CAST1:%.*]] = bitcast double* [[VEC_GEP]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD2:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST1]], align 8
; CHECK-NEXT: [[VEC_GEP3:%.*]] = getelementptr double, double* [[TMP0]], i64 6
; CHECK-NEXT: [[VEC_CAST4:%.*]] = bitcast double* [[VEC_GEP3]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD5:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST4]], align 16
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <9 x double>* [[B:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST6:%.*]] = bitcast double* [[TMP1]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD7:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST6]], align 16
; CHECK-NEXT: [[VEC_GEP8:%.*]] = getelementptr double, double* [[TMP1]], i64 3
; CHECK-NEXT: [[VEC_CAST9:%.*]] = bitcast double* [[VEC_GEP8]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD10:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST9]], align 8
; CHECK-NEXT: [[VEC_GEP11:%.*]] = getelementptr double, double* [[TMP1]], i64 6
; CHECK-NEXT: [[VEC_CAST12:%.*]] = bitcast double* [[VEC_GEP11]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD13:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST12]], align 16
; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <3 x double> [[COL_LOAD7]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP2:%.*]] = extractelement <3 x double> [[COL_LOAD]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[TMP2]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP3:%.*]] = fmul <2 x double> [[BLOCK]], [[SPLAT_SPLAT]]
; CHECK-NEXT: [[BLOCK14:%.*]] = shufflevector <3 x double> [[COL_LOAD10]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP4:%.*]] = extractelement <3 x double> [[COL_LOAD]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT15:%.*]] = insertelement <2 x double> poison, double [[TMP4]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT16:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT15]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP5:%.*]] = fmul <2 x double> [[BLOCK14]], [[SPLAT_SPLAT16]]
; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[TMP3]], [[TMP5]]
; CHECK-NEXT: [[BLOCK17:%.*]] = shufflevector <3 x double> [[COL_LOAD13]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP7:%.*]] = extractelement <3 x double> [[COL_LOAD]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT18:%.*]] = insertelement <2 x double> poison, double [[TMP7]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT19:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT18]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP8:%.*]] = fmul <2 x double> [[BLOCK17]], [[SPLAT_SPLAT19]]
; CHECK-NEXT: [[TMP9:%.*]] = fadd <2 x double> [[TMP6]], [[TMP8]]
; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x double> [[TMP9]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP10]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK20:%.*]] = shufflevector <3 x double> [[COL_LOAD7]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP12:%.*]] = extractelement <3 x double> [[COL_LOAD]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT21:%.*]] = insertelement <1 x double> poison, double [[TMP12]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT22:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT21]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP13:%.*]] = fmul <1 x double> [[BLOCK20]], [[SPLAT_SPLAT22]]
; CHECK-NEXT: [[BLOCK23:%.*]] = shufflevector <3 x double> [[COL_LOAD10]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP14:%.*]] = extractelement <3 x double> [[COL_LOAD]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT24:%.*]] = insertelement <1 x double> poison, double [[TMP14]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT25:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT24]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP15:%.*]] = fmul <1 x double> [[BLOCK23]], [[SPLAT_SPLAT25]]
; CHECK-NEXT: [[TMP16:%.*]] = fadd <1 x double> [[TMP13]], [[TMP15]]
; CHECK-NEXT: [[BLOCK26:%.*]] = shufflevector <3 x double> [[COL_LOAD13]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP17:%.*]] = extractelement <3 x double> [[COL_LOAD]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT27:%.*]] = insertelement <1 x double> poison, double [[TMP17]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT28:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT27]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP18:%.*]] = fmul <1 x double> [[BLOCK26]], [[SPLAT_SPLAT28]]
; CHECK-NEXT: [[TMP19:%.*]] = fadd <1 x double> [[TMP16]], [[TMP18]]
; CHECK-NEXT: [[TMP20:%.*]] = shufflevector <1 x double> [[TMP19]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP21:%.*]] = shufflevector <3 x double> [[TMP11]], <3 x double> [[TMP20]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[BLOCK29:%.*]] = shufflevector <3 x double> [[COL_LOAD7]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP22:%.*]] = extractelement <3 x double> [[COL_LOAD2]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT30:%.*]] = insertelement <2 x double> poison, double [[TMP22]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT31:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT30]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP23:%.*]] = fmul <2 x double> [[BLOCK29]], [[SPLAT_SPLAT31]]
; CHECK-NEXT: [[BLOCK32:%.*]] = shufflevector <3 x double> [[COL_LOAD10]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP24:%.*]] = extractelement <3 x double> [[COL_LOAD2]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT33:%.*]] = insertelement <2 x double> poison, double [[TMP24]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT34:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT33]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP25:%.*]] = fmul <2 x double> [[BLOCK32]], [[SPLAT_SPLAT34]]
; CHECK-NEXT: [[TMP26:%.*]] = fadd <2 x double> [[TMP23]], [[TMP25]]
; CHECK-NEXT: [[BLOCK35:%.*]] = shufflevector <3 x double> [[COL_LOAD13]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP27:%.*]] = extractelement <3 x double> [[COL_LOAD2]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT36:%.*]] = insertelement <2 x double> poison, double [[TMP27]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT37:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT36]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP28:%.*]] = fmul <2 x double> [[BLOCK35]], [[SPLAT_SPLAT37]]
; CHECK-NEXT: [[TMP29:%.*]] = fadd <2 x double> [[TMP26]], [[TMP28]]
; CHECK-NEXT: [[TMP30:%.*]] = shufflevector <2 x double> [[TMP29]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP31:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP30]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK38:%.*]] = shufflevector <3 x double> [[COL_LOAD7]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP32:%.*]] = extractelement <3 x double> [[COL_LOAD2]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT39:%.*]] = insertelement <1 x double> poison, double [[TMP32]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT40:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT39]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP33:%.*]] = fmul <1 x double> [[BLOCK38]], [[SPLAT_SPLAT40]]
; CHECK-NEXT: [[BLOCK41:%.*]] = shufflevector <3 x double> [[COL_LOAD10]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP34:%.*]] = extractelement <3 x double> [[COL_LOAD2]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT42:%.*]] = insertelement <1 x double> poison, double [[TMP34]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT43:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT42]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP35:%.*]] = fmul <1 x double> [[BLOCK41]], [[SPLAT_SPLAT43]]
; CHECK-NEXT: [[TMP36:%.*]] = fadd <1 x double> [[TMP33]], [[TMP35]]
; CHECK-NEXT: [[BLOCK44:%.*]] = shufflevector <3 x double> [[COL_LOAD13]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP37:%.*]] = extractelement <3 x double> [[COL_LOAD2]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT45:%.*]] = insertelement <1 x double> poison, double [[TMP37]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT46:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT45]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP38:%.*]] = fmul <1 x double> [[BLOCK44]], [[SPLAT_SPLAT46]]
; CHECK-NEXT: [[TMP39:%.*]] = fadd <1 x double> [[TMP36]], [[TMP38]]
; CHECK-NEXT: [[TMP40:%.*]] = shufflevector <1 x double> [[TMP39]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP41:%.*]] = shufflevector <3 x double> [[TMP31]], <3 x double> [[TMP40]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[BLOCK47:%.*]] = shufflevector <3 x double> [[COL_LOAD7]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP42:%.*]] = extractelement <3 x double> [[COL_LOAD5]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT48:%.*]] = insertelement <2 x double> poison, double [[TMP42]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT49:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT48]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP43:%.*]] = fmul <2 x double> [[BLOCK47]], [[SPLAT_SPLAT49]]
; CHECK-NEXT: [[BLOCK50:%.*]] = shufflevector <3 x double> [[COL_LOAD10]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP44:%.*]] = extractelement <3 x double> [[COL_LOAD5]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT51:%.*]] = insertelement <2 x double> poison, double [[TMP44]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT52:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT51]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP45:%.*]] = fmul <2 x double> [[BLOCK50]], [[SPLAT_SPLAT52]]
; CHECK-NEXT: [[TMP46:%.*]] = fadd <2 x double> [[TMP43]], [[TMP45]]
; CHECK-NEXT: [[BLOCK53:%.*]] = shufflevector <3 x double> [[COL_LOAD13]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP47:%.*]] = extractelement <3 x double> [[COL_LOAD5]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT54:%.*]] = insertelement <2 x double> poison, double [[TMP47]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT55:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT54]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP48:%.*]] = fmul <2 x double> [[BLOCK53]], [[SPLAT_SPLAT55]]
; CHECK-NEXT: [[TMP49:%.*]] = fadd <2 x double> [[TMP46]], [[TMP48]]
; CHECK-NEXT: [[TMP50:%.*]] = shufflevector <2 x double> [[TMP49]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP51:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP50]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK56:%.*]] = shufflevector <3 x double> [[COL_LOAD7]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP52:%.*]] = extractelement <3 x double> [[COL_LOAD5]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT57:%.*]] = insertelement <1 x double> poison, double [[TMP52]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT58:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT57]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP53:%.*]] = fmul <1 x double> [[BLOCK56]], [[SPLAT_SPLAT58]]
; CHECK-NEXT: [[BLOCK59:%.*]] = shufflevector <3 x double> [[COL_LOAD10]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP54:%.*]] = extractelement <3 x double> [[COL_LOAD5]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT60:%.*]] = insertelement <1 x double> poison, double [[TMP54]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT61:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT60]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP55:%.*]] = fmul <1 x double> [[BLOCK59]], [[SPLAT_SPLAT61]]
; CHECK-NEXT: [[TMP56:%.*]] = fadd <1 x double> [[TMP53]], [[TMP55]]
; CHECK-NEXT: [[BLOCK62:%.*]] = shufflevector <3 x double> [[COL_LOAD13]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP57:%.*]] = extractelement <3 x double> [[COL_LOAD5]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT63:%.*]] = insertelement <1 x double> poison, double [[TMP57]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT64:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT63]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP58:%.*]] = fmul <1 x double> [[BLOCK62]], [[SPLAT_SPLAT64]]
; CHECK-NEXT: [[TMP59:%.*]] = fadd <1 x double> [[TMP56]], [[TMP58]]
; CHECK-NEXT: [[TMP60:%.*]] = shufflevector <1 x double> [[TMP59]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP61:%.*]] = shufflevector <3 x double> [[TMP51]], <3 x double> [[TMP60]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[TMP62:%.*]] = bitcast <9 x double>* [[C:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST65:%.*]] = bitcast double* [[TMP62]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[TMP21]], <3 x double>* [[VEC_CAST65]], align 16
; CHECK-NEXT: [[VEC_GEP66:%.*]] = getelementptr double, double* [[TMP62]], i64 3
; CHECK-NEXT: [[VEC_CAST67:%.*]] = bitcast double* [[VEC_GEP66]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[TMP41]], <3 x double>* [[VEC_CAST67]], align 8
; CHECK-NEXT: [[VEC_GEP68:%.*]] = getelementptr double, double* [[TMP62]], i64 6
; CHECK-NEXT: [[VEC_CAST69:%.*]] = bitcast double* [[VEC_GEP68]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[TMP61]], <3 x double>* [[VEC_CAST69]], align 16
; CHECK-NEXT: ret void
;
entry:
%a = load <9 x double>, <9 x double>* %A, align 16
%at = call <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double> %a, i32 3, i32 3)
%b = load <9 x double>, <9 x double>* %B, align 16
%bt = call <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double> %b, i32 3, i32 3)
%c = call <9 x double> @llvm.matrix.multiply.v9f64.v9f64.v9f64(<9 x double> %at, <9 x double> %bt, i32 3, i32 3, i32 3)
%ct = call <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double> %c, i32 3, i32 3)
store <9 x double> %ct, <9 x double>* %C, align 16
ret void
}
define void @multiply_nt_t(<6 x double>* %A, <12 x double>* %B, <8 x double>* %C) {
; REMARK: Pass: lower-matrix-intrinsics
; REMARK-NEXT: Name: matrix-lowered
; REMARK-NEXT: Function: multiply_nt_t
; REMARK-NEXT: Args:
; REMARK-NEXT: - String: 'Lowered with '
; REMARK-NEXT: - NumStores: '4'
; REMARK-NEXT: - String: ' stores, '
; REMARK-NEXT: - NumLoads: '9'
; REMARK-NEXT: - String: ' loads, '
; REMARK-NEXT: - NumComputeOps: '20'
; REMARK-NEXT: - String: ' compute ops, '
; REMARK-NEXT: - NumExposedTransposes: '0'
; REMARK-NEXT: - String: ' exposed transposes'
; REMARK-NEXT: - String: |
; REMARK: store(
; REMARK-NEXT: multiply.4x3.3x2.double(
; REMARK-NEXT: load(addr %B),
; REMARK-NEXT: transpose.2x3.double(load(addr %A))),
; REMARK-NEXT: addr %C)
; CHECK-LABEL: @multiply_nt_t(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = bitcast <6 x double>* [[A:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST:%.*]] = bitcast double* [[TMP0]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST]], align 16
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr double, double* [[TMP0]], i64 2
; CHECK-NEXT: [[VEC_CAST39:%.*]] = bitcast double* [[VEC_GEP]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD40:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST39]], align 16
; CHECK-NEXT: [[VEC_GEP41:%.*]] = getelementptr double, double* [[TMP0]], i64 4
; CHECK-NEXT: [[VEC_CAST42:%.*]] = bitcast double* [[VEC_GEP41]] to <2 x double>*
; CHECK-NEXT: [[COL_LOAD43:%.*]] = load <2 x double>, <2 x double>* [[VEC_CAST42]], align 16
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x double> [[COL_LOAD]], <2 x double> [[COL_LOAD40]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[COL_LOAD43]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x double> [[TMP1]], <4 x double> [[TMP2]], <6 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5>
; CHECK-NEXT: [[TMP4:%.*]] = bitcast <12 x double>* [[B:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST44:%.*]] = bitcast double* [[TMP4]] to <4 x double>*
; CHECK-NEXT: [[COL_LOAD45:%.*]] = load <4 x double>, <4 x double>* [[VEC_CAST44]], align 16
; CHECK-NEXT: [[VEC_GEP46:%.*]] = getelementptr double, double* [[TMP4]], i64 4
; CHECK-NEXT: [[VEC_CAST47:%.*]] = bitcast double* [[VEC_GEP46]] to <4 x double>*
; CHECK-NEXT: [[COL_LOAD48:%.*]] = load <4 x double>, <4 x double>* [[VEC_CAST47]], align 16
; CHECK-NEXT: [[VEC_GEP49:%.*]] = getelementptr double, double* [[TMP4]], i64 8
; CHECK-NEXT: [[VEC_CAST50:%.*]] = bitcast double* [[VEC_GEP49]] to <4 x double>*
; CHECK-NEXT: [[COL_LOAD51:%.*]] = load <4 x double>, <4 x double>* [[VEC_CAST50]], align 16
; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <4 x double> [[COL_LOAD45]], <4 x double> [[COL_LOAD48]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <4 x double> [[COL_LOAD51]], <4 x double> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <8 x double> [[TMP5]], <8 x double> [[TMP6]], <12 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>
; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <12 x double> [[TMP7]], <12 x double> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <12 x double> [[TMP7]], <12 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <12 x double> [[TMP7]], <12 x double> poison, <4 x i32> <i32 8, i32 9, i32 10, i32 11>
; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <6 x double> [[TMP3]], <6 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[SPLIT4:%.*]] = shufflevector <6 x double> [[TMP3]], <6 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[SPLIT5:%.*]] = shufflevector <6 x double> [[TMP3]], <6 x double> poison, <2 x i32> <i32 4, i32 5>
; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <4 x double> [[SPLIT]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x double> [[SPLIT3]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[TMP8]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP9:%.*]] = fmul <2 x double> [[BLOCK]], [[SPLAT_SPLAT]]
; CHECK-NEXT: [[BLOCK6:%.*]] = shufflevector <4 x double> [[SPLIT1]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP10:%.*]] = extractelement <2 x double> [[SPLIT4]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT7:%.*]] = insertelement <2 x double> poison, double [[TMP10]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT8:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT7]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP11:%.*]] = fmul <2 x double> [[BLOCK6]], [[SPLAT_SPLAT8]]
; CHECK-NEXT: [[TMP12:%.*]] = fadd <2 x double> [[TMP9]], [[TMP11]]
; CHECK-NEXT: [[BLOCK9:%.*]] = shufflevector <4 x double> [[SPLIT2]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP13:%.*]] = extractelement <2 x double> [[SPLIT5]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT10:%.*]] = insertelement <2 x double> poison, double [[TMP13]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT11:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT10]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP14:%.*]] = fmul <2 x double> [[BLOCK9]], [[SPLAT_SPLAT11]]
; CHECK-NEXT: [[TMP15:%.*]] = fadd <2 x double> [[TMP12]], [[TMP14]]
; CHECK-NEXT: [[TMP16:%.*]] = shufflevector <2 x double> [[TMP15]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP17:%.*]] = shufflevector <4 x double> undef, <4 x double> [[TMP16]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
; CHECK-NEXT: [[BLOCK12:%.*]] = shufflevector <4 x double> [[SPLIT]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP18:%.*]] = extractelement <2 x double> [[SPLIT3]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT13:%.*]] = insertelement <2 x double> poison, double [[TMP18]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT14:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT13]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP19:%.*]] = fmul <2 x double> [[BLOCK12]], [[SPLAT_SPLAT14]]
; CHECK-NEXT: [[BLOCK15:%.*]] = shufflevector <4 x double> [[SPLIT1]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP20:%.*]] = extractelement <2 x double> [[SPLIT4]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT16:%.*]] = insertelement <2 x double> poison, double [[TMP20]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT17:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT16]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP21:%.*]] = fmul <2 x double> [[BLOCK15]], [[SPLAT_SPLAT17]]
; CHECK-NEXT: [[TMP22:%.*]] = fadd <2 x double> [[TMP19]], [[TMP21]]
; CHECK-NEXT: [[BLOCK18:%.*]] = shufflevector <4 x double> [[SPLIT2]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP23:%.*]] = extractelement <2 x double> [[SPLIT5]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT19:%.*]] = insertelement <2 x double> poison, double [[TMP23]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT20:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT19]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP24:%.*]] = fmul <2 x double> [[BLOCK18]], [[SPLAT_SPLAT20]]
; CHECK-NEXT: [[TMP25:%.*]] = fadd <2 x double> [[TMP22]], [[TMP24]]
; CHECK-NEXT: [[TMP26:%.*]] = shufflevector <2 x double> [[TMP25]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP27:%.*]] = shufflevector <4 x double> [[TMP17]], <4 x double> [[TMP26]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
; CHECK-NEXT: [[BLOCK21:%.*]] = shufflevector <4 x double> [[SPLIT]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP28:%.*]] = extractelement <2 x double> [[SPLIT3]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT22:%.*]] = insertelement <2 x double> poison, double [[TMP28]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT23:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT22]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP29:%.*]] = fmul <2 x double> [[BLOCK21]], [[SPLAT_SPLAT23]]
; CHECK-NEXT: [[BLOCK24:%.*]] = shufflevector <4 x double> [[SPLIT1]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP30:%.*]] = extractelement <2 x double> [[SPLIT4]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT25:%.*]] = insertelement <2 x double> poison, double [[TMP30]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT26:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT25]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP31:%.*]] = fmul <2 x double> [[BLOCK24]], [[SPLAT_SPLAT26]]
; CHECK-NEXT: [[TMP32:%.*]] = fadd <2 x double> [[TMP29]], [[TMP31]]
; CHECK-NEXT: [[BLOCK27:%.*]] = shufflevector <4 x double> [[SPLIT2]], <4 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP33:%.*]] = extractelement <2 x double> [[SPLIT5]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT28:%.*]] = insertelement <2 x double> poison, double [[TMP33]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT29:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT28]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP34:%.*]] = fmul <2 x double> [[BLOCK27]], [[SPLAT_SPLAT29]]
; CHECK-NEXT: [[TMP35:%.*]] = fadd <2 x double> [[TMP32]], [[TMP34]]
; CHECK-NEXT: [[TMP36:%.*]] = shufflevector <2 x double> [[TMP35]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP37:%.*]] = shufflevector <4 x double> undef, <4 x double> [[TMP36]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
; CHECK-NEXT: [[BLOCK30:%.*]] = shufflevector <4 x double> [[SPLIT]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP38:%.*]] = extractelement <2 x double> [[SPLIT3]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT31:%.*]] = insertelement <2 x double> poison, double [[TMP38]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT32:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT31]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP39:%.*]] = fmul <2 x double> [[BLOCK30]], [[SPLAT_SPLAT32]]
; CHECK-NEXT: [[BLOCK33:%.*]] = shufflevector <4 x double> [[SPLIT1]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP40:%.*]] = extractelement <2 x double> [[SPLIT4]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT34:%.*]] = insertelement <2 x double> poison, double [[TMP40]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT35:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT34]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP41:%.*]] = fmul <2 x double> [[BLOCK33]], [[SPLAT_SPLAT35]]
; CHECK-NEXT: [[TMP42:%.*]] = fadd <2 x double> [[TMP39]], [[TMP41]]
; CHECK-NEXT: [[BLOCK36:%.*]] = shufflevector <4 x double> [[SPLIT2]], <4 x double> poison, <2 x i32> <i32 2, i32 3>
; CHECK-NEXT: [[TMP43:%.*]] = extractelement <2 x double> [[SPLIT5]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT37:%.*]] = insertelement <2 x double> poison, double [[TMP43]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT38:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT37]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP44:%.*]] = fmul <2 x double> [[BLOCK36]], [[SPLAT_SPLAT38]]
; CHECK-NEXT: [[TMP45:%.*]] = fadd <2 x double> [[TMP42]], [[TMP44]]
; CHECK-NEXT: [[TMP46:%.*]] = shufflevector <2 x double> [[TMP45]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP47:%.*]] = shufflevector <4 x double> [[TMP37]], <4 x double> [[TMP46]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
; CHECK-NEXT: [[TMP48:%.*]] = bitcast <8 x double>* [[C:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST52:%.*]] = bitcast double* [[TMP48]] to <4 x double>*
; CHECK-NEXT: store <4 x double> [[TMP27]], <4 x double>* [[VEC_CAST52]], align 16
; CHECK-NEXT: [[VEC_GEP53:%.*]] = getelementptr double, double* [[TMP48]], i64 4
; CHECK-NEXT: [[VEC_CAST54:%.*]] = bitcast double* [[VEC_GEP53]] to <4 x double>*
; CHECK-NEXT: store <4 x double> [[TMP47]], <4 x double>* [[VEC_CAST54]], align 16
; CHECK-NEXT: ret void
;
entry:
%a = load <6 x double>, <6 x double>* %A, align 16
%b = load <12 x double>, <12 x double>* %B, align 16
%bt = call <12 x double> @llvm.matrix.transpose.v12f64.v12f64(<12 x double> %b, i32 4, i32 3)
%c = call <8 x double> @llvm.matrix.multiply.v8f64.v6f64.v12f64(<6 x double> %a, <12 x double> %bt, i32 2, i32 3, i32 4)
%ct = call <8 x double> @llvm.matrix.transpose.v8f64.v8f64(<8 x double> %c, i32 2, i32 4)
store <8 x double> %ct, <8 x double>* %C, align 16
ret void
}
define void @multiply_ntt_t(<9 x double>* %A, <9 x double>* %B, <9 x double>* %C, <9 x double>* %R) {
; REMARK: Pass: lower-matrix-intrinsics
; REMARK-NEXT: Name: matrix-lowered
; REMARK-NEXT: Function: multiply_ntt_t
; REMARK-NEXT: Args:
; REMARK-NEXT: - String: 'Lowered with '
; REMARK-NEXT: - NumStores: '6'
; REMARK-NEXT: - String: ' stores, '
; REMARK-NEXT: - NumLoads: '18'
; REMARK-NEXT: - String: ' loads, '
; REMARK-NEXT: - NumComputeOps: '60'
; REMARK-NEXT: - String: ' compute ops, '
; REMARK-NEXT: - NumExposedTransposes: '0'
; REMARK-NEXT: - String: ' exposed transposes'
; REMARK-NEXT: - String: |
; REMARK: store(
; REMARK-NEXT: multiply.3x3.3x3.double(
; REMARK-NEXT: multiply.3x3.3x3.double(
; REMARK-NEXT: load(addr %C),
; REMARK-NEXT: load(addr %B)),
; REMARK-NEXT: transpose.3x3.double(load(addr %A))),
; REMARK-NEXT: addr %R)
; CHECK-LABEL: @multiply_ntt_t(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = bitcast <9 x double>* [[A:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST:%.*]] = bitcast double* [[TMP0]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST]], align 16
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr double, double* [[TMP0]], i64 3
; CHECK-NEXT: [[VEC_CAST58:%.*]] = bitcast double* [[VEC_GEP]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD59:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST58]], align 8
; CHECK-NEXT: [[VEC_GEP60:%.*]] = getelementptr double, double* [[TMP0]], i64 6
; CHECK-NEXT: [[VEC_CAST61:%.*]] = bitcast double* [[VEC_GEP60]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD62:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST61]], align 16
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <3 x double> [[COL_LOAD]], <3 x double> [[COL_LOAD59]], <6 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5>
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <3 x double> [[COL_LOAD62]], <3 x double> poison, <6 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <6 x double> [[TMP1]], <6 x double> [[TMP2]], <9 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>
; CHECK-NEXT: [[TMP4:%.*]] = bitcast <9 x double>* [[B:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST63:%.*]] = bitcast double* [[TMP4]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD64:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST63]], align 16
; CHECK-NEXT: [[VEC_GEP65:%.*]] = getelementptr double, double* [[TMP4]], i64 3
; CHECK-NEXT: [[VEC_CAST66:%.*]] = bitcast double* [[VEC_GEP65]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD67:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST66]], align 8
; CHECK-NEXT: [[VEC_GEP68:%.*]] = getelementptr double, double* [[TMP4]], i64 6
; CHECK-NEXT: [[VEC_CAST69:%.*]] = bitcast double* [[VEC_GEP68]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD70:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST69]], align 16
; CHECK-NEXT: [[TMP5:%.*]] = bitcast <9 x double>* [[C:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST71:%.*]] = bitcast double* [[TMP5]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD72:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST71]], align 16
; CHECK-NEXT: [[VEC_GEP73:%.*]] = getelementptr double, double* [[TMP5]], i64 3
; CHECK-NEXT: [[VEC_CAST74:%.*]] = bitcast double* [[VEC_GEP73]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD75:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST74]], align 8
; CHECK-NEXT: [[VEC_GEP76:%.*]] = getelementptr double, double* [[TMP5]], i64 6
; CHECK-NEXT: [[VEC_CAST77:%.*]] = bitcast double* [[VEC_GEP76]] to <3 x double>*
; CHECK-NEXT: [[COL_LOAD78:%.*]] = load <3 x double>, <3 x double>* [[VEC_CAST77]], align 16
; CHECK-NEXT: [[BLOCK79:%.*]] = shufflevector <3 x double> [[COL_LOAD72]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <3 x double> [[COL_LOAD64]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT80:%.*]] = insertelement <2 x double> poison, double [[TMP6]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT81:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT80]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP7:%.*]] = fmul <2 x double> [[BLOCK79]], [[SPLAT_SPLAT81]]
; CHECK-NEXT: [[BLOCK82:%.*]] = shufflevector <3 x double> [[COL_LOAD75]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP8:%.*]] = extractelement <3 x double> [[COL_LOAD64]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT83:%.*]] = insertelement <2 x double> poison, double [[TMP8]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT84:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT83]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP9:%.*]] = fmul <2 x double> [[BLOCK82]], [[SPLAT_SPLAT84]]
; CHECK-NEXT: [[TMP10:%.*]] = fadd <2 x double> [[TMP7]], [[TMP9]]
; CHECK-NEXT: [[BLOCK85:%.*]] = shufflevector <3 x double> [[COL_LOAD78]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP11:%.*]] = extractelement <3 x double> [[COL_LOAD64]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT86:%.*]] = insertelement <2 x double> poison, double [[TMP11]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT87:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT86]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP12:%.*]] = fmul <2 x double> [[BLOCK85]], [[SPLAT_SPLAT87]]
; CHECK-NEXT: [[TMP13:%.*]] = fadd <2 x double> [[TMP10]], [[TMP12]]
; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <2 x double> [[TMP13]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP15:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP14]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK88:%.*]] = shufflevector <3 x double> [[COL_LOAD72]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP16:%.*]] = extractelement <3 x double> [[COL_LOAD64]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT89:%.*]] = insertelement <1 x double> poison, double [[TMP16]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT90:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT89]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP17:%.*]] = fmul <1 x double> [[BLOCK88]], [[SPLAT_SPLAT90]]
; CHECK-NEXT: [[BLOCK91:%.*]] = shufflevector <3 x double> [[COL_LOAD75]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP18:%.*]] = extractelement <3 x double> [[COL_LOAD64]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT92:%.*]] = insertelement <1 x double> poison, double [[TMP18]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT93:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT92]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP19:%.*]] = fmul <1 x double> [[BLOCK91]], [[SPLAT_SPLAT93]]
; CHECK-NEXT: [[TMP20:%.*]] = fadd <1 x double> [[TMP17]], [[TMP19]]
; CHECK-NEXT: [[BLOCK94:%.*]] = shufflevector <3 x double> [[COL_LOAD78]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP21:%.*]] = extractelement <3 x double> [[COL_LOAD64]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT95:%.*]] = insertelement <1 x double> poison, double [[TMP21]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT96:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT95]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP22:%.*]] = fmul <1 x double> [[BLOCK94]], [[SPLAT_SPLAT96]]
; CHECK-NEXT: [[TMP23:%.*]] = fadd <1 x double> [[TMP20]], [[TMP22]]
; CHECK-NEXT: [[TMP24:%.*]] = shufflevector <1 x double> [[TMP23]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP25:%.*]] = shufflevector <3 x double> [[TMP15]], <3 x double> [[TMP24]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[BLOCK97:%.*]] = shufflevector <3 x double> [[COL_LOAD72]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP26:%.*]] = extractelement <3 x double> [[COL_LOAD67]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT98:%.*]] = insertelement <2 x double> poison, double [[TMP26]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT99:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT98]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP27:%.*]] = fmul <2 x double> [[BLOCK97]], [[SPLAT_SPLAT99]]
; CHECK-NEXT: [[BLOCK100:%.*]] = shufflevector <3 x double> [[COL_LOAD75]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP28:%.*]] = extractelement <3 x double> [[COL_LOAD67]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT101:%.*]] = insertelement <2 x double> poison, double [[TMP28]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT102:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT101]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP29:%.*]] = fmul <2 x double> [[BLOCK100]], [[SPLAT_SPLAT102]]
; CHECK-NEXT: [[TMP30:%.*]] = fadd <2 x double> [[TMP27]], [[TMP29]]
; CHECK-NEXT: [[BLOCK103:%.*]] = shufflevector <3 x double> [[COL_LOAD78]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP31:%.*]] = extractelement <3 x double> [[COL_LOAD67]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT104:%.*]] = insertelement <2 x double> poison, double [[TMP31]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT105:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT104]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP32:%.*]] = fmul <2 x double> [[BLOCK103]], [[SPLAT_SPLAT105]]
; CHECK-NEXT: [[TMP33:%.*]] = fadd <2 x double> [[TMP30]], [[TMP32]]
; CHECK-NEXT: [[TMP34:%.*]] = shufflevector <2 x double> [[TMP33]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP35:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP34]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK106:%.*]] = shufflevector <3 x double> [[COL_LOAD72]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP36:%.*]] = extractelement <3 x double> [[COL_LOAD67]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT107:%.*]] = insertelement <1 x double> poison, double [[TMP36]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT108:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT107]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP37:%.*]] = fmul <1 x double> [[BLOCK106]], [[SPLAT_SPLAT108]]
; CHECK-NEXT: [[BLOCK109:%.*]] = shufflevector <3 x double> [[COL_LOAD75]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP38:%.*]] = extractelement <3 x double> [[COL_LOAD67]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT110:%.*]] = insertelement <1 x double> poison, double [[TMP38]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT111:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT110]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP39:%.*]] = fmul <1 x double> [[BLOCK109]], [[SPLAT_SPLAT111]]
; CHECK-NEXT: [[TMP40:%.*]] = fadd <1 x double> [[TMP37]], [[TMP39]]
; CHECK-NEXT: [[BLOCK112:%.*]] = shufflevector <3 x double> [[COL_LOAD78]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP41:%.*]] = extractelement <3 x double> [[COL_LOAD67]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT113:%.*]] = insertelement <1 x double> poison, double [[TMP41]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT114:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT113]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP42:%.*]] = fmul <1 x double> [[BLOCK112]], [[SPLAT_SPLAT114]]
; CHECK-NEXT: [[TMP43:%.*]] = fadd <1 x double> [[TMP40]], [[TMP42]]
; CHECK-NEXT: [[TMP44:%.*]] = shufflevector <1 x double> [[TMP43]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP45:%.*]] = shufflevector <3 x double> [[TMP35]], <3 x double> [[TMP44]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[BLOCK115:%.*]] = shufflevector <3 x double> [[COL_LOAD72]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP46:%.*]] = extractelement <3 x double> [[COL_LOAD70]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT116:%.*]] = insertelement <2 x double> poison, double [[TMP46]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT117:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT116]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP47:%.*]] = fmul <2 x double> [[BLOCK115]], [[SPLAT_SPLAT117]]
; CHECK-NEXT: [[BLOCK118:%.*]] = shufflevector <3 x double> [[COL_LOAD75]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP48:%.*]] = extractelement <3 x double> [[COL_LOAD70]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT119:%.*]] = insertelement <2 x double> poison, double [[TMP48]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT120:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT119]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP49:%.*]] = fmul <2 x double> [[BLOCK118]], [[SPLAT_SPLAT120]]
; CHECK-NEXT: [[TMP50:%.*]] = fadd <2 x double> [[TMP47]], [[TMP49]]
; CHECK-NEXT: [[BLOCK121:%.*]] = shufflevector <3 x double> [[COL_LOAD78]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP51:%.*]] = extractelement <3 x double> [[COL_LOAD70]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT122:%.*]] = insertelement <2 x double> poison, double [[TMP51]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT123:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT122]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP52:%.*]] = fmul <2 x double> [[BLOCK121]], [[SPLAT_SPLAT123]]
; CHECK-NEXT: [[TMP53:%.*]] = fadd <2 x double> [[TMP50]], [[TMP52]]
; CHECK-NEXT: [[TMP54:%.*]] = shufflevector <2 x double> [[TMP53]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP55:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP54]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK124:%.*]] = shufflevector <3 x double> [[COL_LOAD72]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP56:%.*]] = extractelement <3 x double> [[COL_LOAD70]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT125:%.*]] = insertelement <1 x double> poison, double [[TMP56]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT126:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT125]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP57:%.*]] = fmul <1 x double> [[BLOCK124]], [[SPLAT_SPLAT126]]
; CHECK-NEXT: [[BLOCK127:%.*]] = shufflevector <3 x double> [[COL_LOAD75]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP58:%.*]] = extractelement <3 x double> [[COL_LOAD70]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT128:%.*]] = insertelement <1 x double> poison, double [[TMP58]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT129:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT128]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP59:%.*]] = fmul <1 x double> [[BLOCK127]], [[SPLAT_SPLAT129]]
; CHECK-NEXT: [[TMP60:%.*]] = fadd <1 x double> [[TMP57]], [[TMP59]]
; CHECK-NEXT: [[BLOCK130:%.*]] = shufflevector <3 x double> [[COL_LOAD78]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP61:%.*]] = extractelement <3 x double> [[COL_LOAD70]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT131:%.*]] = insertelement <1 x double> poison, double [[TMP61]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT132:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT131]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP62:%.*]] = fmul <1 x double> [[BLOCK130]], [[SPLAT_SPLAT132]]
; CHECK-NEXT: [[TMP63:%.*]] = fadd <1 x double> [[TMP60]], [[TMP62]]
; CHECK-NEXT: [[TMP64:%.*]] = shufflevector <1 x double> [[TMP63]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP65:%.*]] = shufflevector <3 x double> [[TMP55]], <3 x double> [[TMP64]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[TMP66:%.*]] = shufflevector <3 x double> [[TMP25]], <3 x double> [[TMP45]], <6 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5>
; CHECK-NEXT: [[TMP67:%.*]] = shufflevector <3 x double> [[TMP65]], <3 x double> poison, <6 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP68:%.*]] = shufflevector <6 x double> [[TMP66]], <6 x double> [[TMP67]], <9 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>
; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <9 x double> [[TMP68]], <9 x double> poison, <3 x i32> <i32 0, i32 1, i32 2>
; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <9 x double> [[TMP68]], <9 x double> poison, <3 x i32> <i32 3, i32 4, i32 5>
; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <9 x double> [[TMP68]], <9 x double> poison, <3 x i32> <i32 6, i32 7, i32 8>
; CHECK-NEXT: [[SPLIT4:%.*]] = shufflevector <9 x double> [[TMP3]], <9 x double> poison, <3 x i32> <i32 0, i32 1, i32 2>
; CHECK-NEXT: [[SPLIT5:%.*]] = shufflevector <9 x double> [[TMP3]], <9 x double> poison, <3 x i32> <i32 3, i32 4, i32 5>
; CHECK-NEXT: [[SPLIT6:%.*]] = shufflevector <9 x double> [[TMP3]], <9 x double> poison, <3 x i32> <i32 6, i32 7, i32 8>
; CHECK-NEXT: [[BLOCK:%.*]] = shufflevector <3 x double> [[SPLIT]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP69:%.*]] = extractelement <3 x double> [[SPLIT4]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[TMP69]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP70:%.*]] = fmul <2 x double> [[BLOCK]], [[SPLAT_SPLAT]]
; CHECK-NEXT: [[BLOCK7:%.*]] = shufflevector <3 x double> [[SPLIT2]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP71:%.*]] = extractelement <3 x double> [[SPLIT5]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT8:%.*]] = insertelement <2 x double> poison, double [[TMP71]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT9:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT8]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP72:%.*]] = fmul <2 x double> [[BLOCK7]], [[SPLAT_SPLAT9]]
; CHECK-NEXT: [[TMP73:%.*]] = fadd <2 x double> [[TMP70]], [[TMP72]]
; CHECK-NEXT: [[BLOCK10:%.*]] = shufflevector <3 x double> [[SPLIT3]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP74:%.*]] = extractelement <3 x double> [[SPLIT6]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT11:%.*]] = insertelement <2 x double> poison, double [[TMP74]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT12:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT11]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP75:%.*]] = fmul <2 x double> [[BLOCK10]], [[SPLAT_SPLAT12]]
; CHECK-NEXT: [[TMP76:%.*]] = fadd <2 x double> [[TMP73]], [[TMP75]]
; CHECK-NEXT: [[TMP77:%.*]] = shufflevector <2 x double> [[TMP76]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP78:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP77]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK13:%.*]] = shufflevector <3 x double> [[SPLIT]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP79:%.*]] = extractelement <3 x double> [[SPLIT4]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT14:%.*]] = insertelement <1 x double> poison, double [[TMP79]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT15:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT14]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP80:%.*]] = fmul <1 x double> [[BLOCK13]], [[SPLAT_SPLAT15]]
; CHECK-NEXT: [[BLOCK16:%.*]] = shufflevector <3 x double> [[SPLIT2]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP81:%.*]] = extractelement <3 x double> [[SPLIT5]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT17:%.*]] = insertelement <1 x double> poison, double [[TMP81]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT18:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT17]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP82:%.*]] = fmul <1 x double> [[BLOCK16]], [[SPLAT_SPLAT18]]
; CHECK-NEXT: [[TMP83:%.*]] = fadd <1 x double> [[TMP80]], [[TMP82]]
; CHECK-NEXT: [[BLOCK19:%.*]] = shufflevector <3 x double> [[SPLIT3]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP84:%.*]] = extractelement <3 x double> [[SPLIT6]], i64 0
; CHECK-NEXT: [[SPLAT_SPLATINSERT20:%.*]] = insertelement <1 x double> poison, double [[TMP84]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT21:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT20]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP85:%.*]] = fmul <1 x double> [[BLOCK19]], [[SPLAT_SPLAT21]]
; CHECK-NEXT: [[TMP86:%.*]] = fadd <1 x double> [[TMP83]], [[TMP85]]
; CHECK-NEXT: [[TMP87:%.*]] = shufflevector <1 x double> [[TMP86]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP88:%.*]] = shufflevector <3 x double> [[TMP78]], <3 x double> [[TMP87]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[BLOCK22:%.*]] = shufflevector <3 x double> [[SPLIT]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP89:%.*]] = extractelement <3 x double> [[SPLIT4]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT23:%.*]] = insertelement <2 x double> poison, double [[TMP89]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT24:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT23]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP90:%.*]] = fmul <2 x double> [[BLOCK22]], [[SPLAT_SPLAT24]]
; CHECK-NEXT: [[BLOCK25:%.*]] = shufflevector <3 x double> [[SPLIT2]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP91:%.*]] = extractelement <3 x double> [[SPLIT5]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT26:%.*]] = insertelement <2 x double> poison, double [[TMP91]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT27:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT26]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP92:%.*]] = fmul <2 x double> [[BLOCK25]], [[SPLAT_SPLAT27]]
; CHECK-NEXT: [[TMP93:%.*]] = fadd <2 x double> [[TMP90]], [[TMP92]]
; CHECK-NEXT: [[BLOCK28:%.*]] = shufflevector <3 x double> [[SPLIT3]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP94:%.*]] = extractelement <3 x double> [[SPLIT6]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT29:%.*]] = insertelement <2 x double> poison, double [[TMP94]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT30:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT29]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP95:%.*]] = fmul <2 x double> [[BLOCK28]], [[SPLAT_SPLAT30]]
; CHECK-NEXT: [[TMP96:%.*]] = fadd <2 x double> [[TMP93]], [[TMP95]]
; CHECK-NEXT: [[TMP97:%.*]] = shufflevector <2 x double> [[TMP96]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP98:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP97]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK31:%.*]] = shufflevector <3 x double> [[SPLIT]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP99:%.*]] = extractelement <3 x double> [[SPLIT4]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT32:%.*]] = insertelement <1 x double> poison, double [[TMP99]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT33:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT32]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP100:%.*]] = fmul <1 x double> [[BLOCK31]], [[SPLAT_SPLAT33]]
; CHECK-NEXT: [[BLOCK34:%.*]] = shufflevector <3 x double> [[SPLIT2]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP101:%.*]] = extractelement <3 x double> [[SPLIT5]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT35:%.*]] = insertelement <1 x double> poison, double [[TMP101]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT36:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT35]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP102:%.*]] = fmul <1 x double> [[BLOCK34]], [[SPLAT_SPLAT36]]
; CHECK-NEXT: [[TMP103:%.*]] = fadd <1 x double> [[TMP100]], [[TMP102]]
; CHECK-NEXT: [[BLOCK37:%.*]] = shufflevector <3 x double> [[SPLIT3]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP104:%.*]] = extractelement <3 x double> [[SPLIT6]], i64 1
; CHECK-NEXT: [[SPLAT_SPLATINSERT38:%.*]] = insertelement <1 x double> poison, double [[TMP104]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT39:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT38]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP105:%.*]] = fmul <1 x double> [[BLOCK37]], [[SPLAT_SPLAT39]]
; CHECK-NEXT: [[TMP106:%.*]] = fadd <1 x double> [[TMP103]], [[TMP105]]
; CHECK-NEXT: [[TMP107:%.*]] = shufflevector <1 x double> [[TMP106]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP108:%.*]] = shufflevector <3 x double> [[TMP98]], <3 x double> [[TMP107]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[BLOCK40:%.*]] = shufflevector <3 x double> [[SPLIT]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP109:%.*]] = extractelement <3 x double> [[SPLIT4]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT41:%.*]] = insertelement <2 x double> poison, double [[TMP109]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT42:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT41]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP110:%.*]] = fmul <2 x double> [[BLOCK40]], [[SPLAT_SPLAT42]]
; CHECK-NEXT: [[BLOCK43:%.*]] = shufflevector <3 x double> [[SPLIT2]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP111:%.*]] = extractelement <3 x double> [[SPLIT5]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT44:%.*]] = insertelement <2 x double> poison, double [[TMP111]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT45:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT44]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP112:%.*]] = fmul <2 x double> [[BLOCK43]], [[SPLAT_SPLAT45]]
; CHECK-NEXT: [[TMP113:%.*]] = fadd <2 x double> [[TMP110]], [[TMP112]]
; CHECK-NEXT: [[BLOCK46:%.*]] = shufflevector <3 x double> [[SPLIT3]], <3 x double> poison, <2 x i32> <i32 0, i32 1>
; CHECK-NEXT: [[TMP114:%.*]] = extractelement <3 x double> [[SPLIT6]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT47:%.*]] = insertelement <2 x double> poison, double [[TMP114]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT48:%.*]] = shufflevector <2 x double> [[SPLAT_SPLATINSERT47]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: [[TMP115:%.*]] = fmul <2 x double> [[BLOCK46]], [[SPLAT_SPLAT48]]
; CHECK-NEXT: [[TMP116:%.*]] = fadd <2 x double> [[TMP113]], [[TMP115]]
; CHECK-NEXT: [[TMP117:%.*]] = shufflevector <2 x double> [[TMP116]], <2 x double> poison, <3 x i32> <i32 0, i32 1, i32 undef>
; CHECK-NEXT: [[TMP118:%.*]] = shufflevector <3 x double> undef, <3 x double> [[TMP117]], <3 x i32> <i32 3, i32 4, i32 2>
; CHECK-NEXT: [[BLOCK49:%.*]] = shufflevector <3 x double> [[SPLIT]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP119:%.*]] = extractelement <3 x double> [[SPLIT4]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT50:%.*]] = insertelement <1 x double> poison, double [[TMP119]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT51:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT50]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP120:%.*]] = fmul <1 x double> [[BLOCK49]], [[SPLAT_SPLAT51]]
; CHECK-NEXT: [[BLOCK52:%.*]] = shufflevector <3 x double> [[SPLIT2]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP121:%.*]] = extractelement <3 x double> [[SPLIT5]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT53:%.*]] = insertelement <1 x double> poison, double [[TMP121]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT54:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT53]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP122:%.*]] = fmul <1 x double> [[BLOCK52]], [[SPLAT_SPLAT54]]
; CHECK-NEXT: [[TMP123:%.*]] = fadd <1 x double> [[TMP120]], [[TMP122]]
; CHECK-NEXT: [[BLOCK55:%.*]] = shufflevector <3 x double> [[SPLIT3]], <3 x double> poison, <1 x i32> <i32 2>
; CHECK-NEXT: [[TMP124:%.*]] = extractelement <3 x double> [[SPLIT6]], i64 2
; CHECK-NEXT: [[SPLAT_SPLATINSERT56:%.*]] = insertelement <1 x double> poison, double [[TMP124]], i32 0
; CHECK-NEXT: [[SPLAT_SPLAT57:%.*]] = shufflevector <1 x double> [[SPLAT_SPLATINSERT56]], <1 x double> poison, <1 x i32> zeroinitializer
; CHECK-NEXT: [[TMP125:%.*]] = fmul <1 x double> [[BLOCK55]], [[SPLAT_SPLAT57]]
; CHECK-NEXT: [[TMP126:%.*]] = fadd <1 x double> [[TMP123]], [[TMP125]]
; CHECK-NEXT: [[TMP127:%.*]] = shufflevector <1 x double> [[TMP126]], <1 x double> poison, <3 x i32> <i32 0, i32 undef, i32 undef>
; CHECK-NEXT: [[TMP128:%.*]] = shufflevector <3 x double> [[TMP118]], <3 x double> [[TMP127]], <3 x i32> <i32 0, i32 1, i32 3>
; CHECK-NEXT: [[TMP129:%.*]] = bitcast <9 x double>* [[R:%.*]] to double*
; CHECK-NEXT: [[VEC_CAST133:%.*]] = bitcast double* [[TMP129]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[TMP88]], <3 x double>* [[VEC_CAST133]], align 16
; CHECK-NEXT: [[VEC_GEP134:%.*]] = getelementptr double, double* [[TMP129]], i64 3
; CHECK-NEXT: [[VEC_CAST135:%.*]] = bitcast double* [[VEC_GEP134]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[TMP108]], <3 x double>* [[VEC_CAST135]], align 8
; CHECK-NEXT: [[VEC_GEP136:%.*]] = getelementptr double, double* [[TMP129]], i64 6
; CHECK-NEXT: [[VEC_CAST137:%.*]] = bitcast double* [[VEC_GEP136]] to <3 x double>*
; CHECK-NEXT: store <3 x double> [[TMP128]], <3 x double>* [[VEC_CAST137]], align 16
; CHECK-NEXT: ret void
;
entry:
%a = load <9 x double>, <9 x double>* %A, align 16
%b = load <9 x double>, <9 x double>* %B, align 16
%bt = call <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double> %b, i32 3, i32 3)
%c = load <9 x double>, <9 x double>* %C, align 16
%ct = call <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double> %c, i32 3, i32 3)
%btct = call <9 x double> @llvm.matrix.multiply.v9f64.v9f64.v9f64(<9 x double> %bt, <9 x double> %ct, i32 3, i32 3, i32 3)
%abtct= call <9 x double> @llvm.matrix.multiply.v9f64.v9f64.v9f64(<9 x double> %a, <9 x double> %btct, i32 3, i32 3, i32 3)
%abtct_t = call <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double> %abtct, i32 3, i32 3)
store <9 x double> %abtct_t, <9 x double>* %R, align 16
ret void
}
declare <9 x double> @llvm.matrix.multiply.v9f64.v9f64.v9f64(<9 x double>, <9 x double>, i32, i32, i32)
declare <12 x double> @llvm.matrix.multiply.v12f64.v6f64.v8f64(<6 x double>, <8 x double>, i32, i32, i32)
declare <8 x double> @llvm.matrix.multiply.v8f64.v6f64.v12f64(<6 x double> %a, <12 x double>, i32, i32, i32)
declare <9 x double> @llvm.matrix.transpose.v9f64.v9f64(<9 x double>, i32, i32)
declare <6 x double> @llvm.matrix.transpose.v6f64.v6f64(<6 x double>, i32, i32)
declare <8 x double> @llvm.matrix.transpose.v8f64.v8f64(<8 x double>, i32, i32)
declare <12 x double> @llvm.matrix.transpose.v12f64.v12f64(<12 x double>, i32, i32)