[llvm] [LoongArch] Support getArithmeticInstCost (PR #165187)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 29 02:07:54 PDT 2025


https://github.com/tangaac updated https://github.com/llvm/llvm-project/pull/165187

>From c6fad9ea0935edd17445fcefbb1ab7c806665157 Mon Sep 17 00:00:00 2001
From: tangaac <tangyan01 at loongson.cn>
Date: Mon, 27 Oct 2025 10:26:15 +0800
Subject: [PATCH 1/3] Support getArithmeticInstCost

---
 .../LoongArchTargetTransformInfo.cpp          |  327 +++++
 .../LoongArch/LoongArchTargetTransformInfo.h  |    6 +
 .../Analysis/CostModel/LoongArch/arith-fp.ll  |  135 ++
 .../Analysis/CostModel/LoongArch/arith-int.ll | 1161 +++++++++++++++++
 .../Analysis/CostModel/RISCV/arith-int.ll     | 1074 +--------------
 .../Analysis/CostModel/X86/bswap-store.ll     |    2 +-
 6 files changed, 1636 insertions(+), 1069 deletions(-)
 create mode 100644 llvm/test/Analysis/CostModel/LoongArch/arith-fp.ll
 create mode 100644 llvm/test/Analysis/CostModel/LoongArch/arith-int.ll

diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
index f548a8dd0532b..3eafa9b0d6b41 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
@@ -14,11 +14,47 @@
 //===----------------------------------------------------------------------===//
 
 #include "LoongArchTargetTransformInfo.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/CodeGen/CostTable.h"
+#include "llvm/CodeGen/ISDOpcodes.h"
+#include "llvm/Support/InstructionCost.h"
+#include <optional>
 
 using namespace llvm;
 
 #define DEBUG_TYPE "loongarchtti"
 
+struct CostKindCosts {
+  unsigned LatencyCost = ~0U;
+  unsigned RecipThroughputCost = ~0U;
+  unsigned CodeSizeCost = ~0U;
+  unsigned SizeAndLatencyCost = ~0U;
+
+  std::optional<unsigned>
+  operator[](TargetTransformInfo::TargetCostKind Kind) const {
+    unsigned Cost = ~0U;
+    switch (Kind) {
+    case llvm::TargetTransformInfo::TCK_Latency:
+      Cost = LatencyCost;
+      break;
+    case TargetTransformInfo::TCK_RecipThroughput:
+      Cost = RecipThroughputCost;
+      break;
+    case TargetTransformInfo::TCK_CodeSize:
+      Cost = CodeSizeCost;
+      break;
+    case TargetTransformInfo::TCK_SizeAndLatency:
+      Cost = SizeAndLatencyCost;
+      break;
+    }
+    if (Cost == ~0U)
+      return std::nullopt;
+    return Cost;
+  }
+};
+using CostKindTblEntry = CostTblEntryT<CostKindCosts>;
+using TypeConversionCostTblEntry = TypeConversionCostTblEntryT<CostKindCosts>;
+
 TypeSize LoongArchTTIImpl::getRegisterBitWidth(
     TargetTransformInfo::RegisterKind K) const {
   TypeSize DefSize = TargetTransformInfoImplBase::getRegisterBitWidth(K);
@@ -111,4 +147,295 @@ bool LoongArchTTIImpl::shouldExpandReduction(const IntrinsicInst *II) const {
   }
 }
 
+InstructionCost LoongArchTTIImpl::getArithmeticInstrCost(
+    unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
+    TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
+    ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+
+  std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Ty);
+  int ISD = TLI->InstructionOpcodeToISD(Opcode);
+
+  // Vector multiply by pow2 will be simplified to shifts.
+  // Vector multiply by -pow2 will be simplified to shifts/negates.
+  if (ISD == ISD::MUL && Op2Info.isConstant() &&
+      (Op2Info.isPowerOf2() || Op2Info.isNegatedPowerOf2())) {
+    InstructionCost Cost =
+        getArithmeticInstrCost(Instruction::Shl, Ty, CostKind,
+                               Op1Info.getNoProps(), Op2Info.getNoProps());
+    if (Op2Info.isNegatedPowerOf2())
+      Cost += getArithmeticInstrCost(Instruction::Sub, Ty, CostKind);
+    return Cost;
+  }
+
+  // On LoongArch, vector signed division by constants power-of-two are
+  // normally expanded to the sequence SRA + SRL + ADD + SRA.
+  // The OperandValue properties may not be the same as that of the previous
+  // operation; conservatively assume OP_None.
+  if ((ISD == ISD::SDIV || ISD == ISD::SREM) && Op2Info.isConstant() &&
+      Op2Info.isPowerOf2()) {
+    InstructionCost Cost =
+        2 * getArithmeticInstrCost(Instruction::AShr, Ty, CostKind,
+                                   Op1Info.getNoProps(), Op2Info.getNoProps());
+    Cost += getArithmeticInstrCost(Instruction::LShr, Ty, CostKind,
+                                   Op1Info.getNoProps(), Op2Info.getNoProps());
+    Cost += getArithmeticInstrCost(Instruction::Add, Ty, CostKind,
+                                   Op1Info.getNoProps(), Op2Info.getNoProps());
+
+    if (ISD == ISD::SREM) {
+      // For SREM: (X % C) is the equivalent of (X - (X/C)*C)
+      Cost +=
+          getArithmeticInstrCost(Instruction::Mul, Ty, CostKind,
+                                 Op1Info.getNoProps(), Op2Info.getNoProps());
+      Cost +=
+          getArithmeticInstrCost(Instruction::Sub, Ty, CostKind,
+                                 Op1Info.getNoProps(), Op2Info.getNoProps());
+    }
+
+    return Cost;
+  }
+  // Vector unsigned division/remainder will be simplified to shifts/masks.
+  if ((ISD == ISD::UDIV || ISD == ISD::UREM) && Op2Info.isConstant() &&
+      Op2Info.isPowerOf2()) {
+    if (ISD == ISD::UDIV)
+      return getArithmeticInstrCost(Instruction::LShr, Ty, CostKind,
+                                    Op1Info.getNoProps(), Op2Info.getNoProps());
+    // UREM
+    return getArithmeticInstrCost(Instruction::And, Ty, CostKind,
+                                  Op1Info.getNoProps(), Op2Info.getNoProps());
+  }
+
+  static const CostKindTblEntry LSXCostTable[]{
+      {ISD::ADD, MVT::v16i8, {1, 1}}, // vaddi.b/vadd.b
+      {ISD::ADD, MVT::v8i16, {1, 1}}, // vaddi.h/vadd.h
+      {ISD::ADD, MVT::v4i32, {1, 1}}, // vaddi.w/vadd.w
+      {ISD::ADD, MVT::v2i64, {1, 1}}, // vaddi.d/vadd.d
+
+      {ISD::SUB, MVT::v16i8, {1, 1}}, // vsubi.b/vsub.b
+      {ISD::SUB, MVT::v8i16, {1, 1}}, // vsubi.h/vsub.h
+      {ISD::SUB, MVT::v4i32, {1, 1}}, // vsubi.w/vsub.w
+      {ISD::SUB, MVT::v2i64, {1, 1}}, // vsubi.d/vsub.d
+
+      {ISD::MUL, MVT::v16i8, {4, 2}}, // vmul.b
+      {ISD::MUL, MVT::v8i16, {4, 2}}, // vmul.h
+      {ISD::MUL, MVT::v4i32, {4, 2}}, // vmul.w
+      {ISD::MUL, MVT::v2i64, {4, 2}}, // vmul.d
+
+      {ISD::SDIV, MVT::v16i8, {38, 76}}, // vdiv.b
+      {ISD::SDIV, MVT::v8i16, {24, 44}}, // vdiv.h
+      {ISD::SDIV, MVT::v4i32, {17, 28}}, // vdiv.w
+      {ISD::SDIV, MVT::v2i64, {14, 19}}, // vdiv.d
+
+      {ISD::UDIV, MVT::v16i8, {38, 80}}, // vdiv.bu
+      {ISD::UDIV, MVT::v8i16, {24, 44}}, // vdiv.hu
+      {ISD::UDIV, MVT::v4i32, {17, 28}}, // vdiv.wu
+      {ISD::UDIV, MVT::v2i64, {14, 19}}, // vdiv.du
+
+      {ISD::SREM, MVT::v16i8, {38, 76}}, // vmod.b
+      {ISD::SREM, MVT::v8i16, {24, 44}}, // vmod.h
+      {ISD::SREM, MVT::v4i32, {17, 27}}, // vmod.w
+      {ISD::SREM, MVT::v2i64, {14, 19}}, // vmod.d
+
+      {ISD::UREM, MVT::v16i8, {38, 80}}, // vmod.bu
+      {ISD::UREM, MVT::v8i16, {24, 44}}, // vmod.hu
+      {ISD::UREM, MVT::v4i32, {17, 28}}, // vmod.wu
+      {ISD::UREM, MVT::v2i64, {14, 19}}, // vmod.du
+
+      {ISD::SHL, MVT::v16i8, {1, 1}}, // vslli.b/vsll.b
+      {ISD::SHL, MVT::v8i16, {1, 1}}, // vslli.h/vsll.h
+      {ISD::SHL, MVT::v4i32, {1, 1}}, // vslli.w/vsll.w
+      {ISD::SHL, MVT::v2i64, {1, 1}}, // vslli.d/vsll.d
+
+      {ISD::SRL, MVT::v16i8, {1, 1}}, // vsrli.b/vsrl.b
+      {ISD::SRL, MVT::v8i16, {1, 1}}, // vsrli.h/vsrl.h
+      {ISD::SRL, MVT::v4i32, {1, 1}}, // vsrli.w/vsrl.w
+      {ISD::SRL, MVT::v2i64, {1, 1}}, // vsrli.d/vsrl.d
+
+      {ISD::SRA, MVT::v16i8, {1, 1}}, // vsrai.b/vsra.b
+      {ISD::SRA, MVT::v8i16, {1, 1}}, // vsrai.h/vsra.h
+      {ISD::SRA, MVT::v4i32, {1, 1}}, // vsrai.w/vsra.w
+      {ISD::SRA, MVT::v2i64, {1, 1}}, // vsrai.d/vsra.d
+
+      {ISD::AND, MVT::v16i8, {1, 1}}, // vand.b/vand.v
+      {ISD::AND, MVT::v8i16, {1, 1}}, // vand.v
+      {ISD::AND, MVT::v4i32, {1, 1}}, // vand.v
+      {ISD::AND, MVT::v2i64, {1, 1}}, // vand.v
+
+      {ISD::OR, MVT::v16i8, {1, 1}}, // vori.b/vor.v
+      {ISD::OR, MVT::v8i16, {1, 1}}, // vor.v
+      {ISD::OR, MVT::v4i32, {1, 1}}, // vor.v
+      {ISD::OR, MVT::v2i64, {1, 1}}, // vor.v
+
+      {ISD::XOR, MVT::v16i8, {1, 1}}, // vxori.b/vxor.v
+      {ISD::XOR, MVT::v8i16, {1, 1}}, // vxor.v
+      {ISD::XOR, MVT::v4i32, {1, 1}}, // vxor.v
+      {ISD::XOR, MVT::v2i64, {1, 1}}, // vxor.v
+
+      {ISD::FADD, MVT::v4f32, {3, 1}}, // vfadd.s
+      {ISD::FADD, MVT::v2f64, {3, 1}}, // vfadd.d
+
+      {ISD::FSUB, MVT::v4f32, {3, 1}}, // vfsub.s
+      {ISD::FSUB, MVT::v2f64, {3, 1}}, // vfsub.d
+
+      {ISD::FMUL, MVT::v4f32, {5, 2}}, // vfmul.s
+      {ISD::FMUL, MVT::v2f64, {5, 2}}, // vfmul.d
+
+      {ISD::FDIV, MVT::v4f32, {16, 26}}, // vfdiv.s
+      {ISD::FDIV, MVT::v2f64, {12, 18}}, // vfdiv.d
+  };
+
+  if (ST->hasExtLSX()) {
+    if (const auto *Entry = CostTableLookup(LSXCostTable, ISD, LT.second))
+      if (auto KindCost = Entry->Cost[CostKind])
+        return LT.first * *KindCost;
+  }
+
+  static const CostKindTblEntry LASXUniformConstCostTable[]{
+      {ISD::ADD, MVT::v32i8, {1, 1}},  // xvaddi.b/xvadd.b
+      {ISD::ADD, MVT::v16i16, {1, 1}}, // xvaddi.h/xvadd.h
+      {ISD::ADD, MVT::v8i32, {1, 1}},  // xvaddi.w/xvadd.w
+      {ISD::ADD, MVT::v4i64, {1, 1}},  // xvaddi.d/xvadd.d
+
+      {ISD::SUB, MVT::v32i8, {1, 1}},  // xvsubi.b/xvsub.b
+      {ISD::SUB, MVT::v16i16, {1, 1}}, // xvsubi.h/xvsub.h
+      {ISD::SUB, MVT::v8i32, {1, 1}},  // xvsubi.w/xvsub.w
+      {ISD::SUB, MVT::v4i64, {1, 1}},  // xvsubi.d/xvsub.d
+
+      {ISD::MUL, MVT::v32i8, {4, 2}},  // xvmul.b
+      {ISD::MUL, MVT::v16i16, {4, 2}}, // xvmul.h
+      {ISD::MUL, MVT::v8i32, {4, 2}},  // xvmul.w
+      {ISD::MUL, MVT::v4i64, {4, 2}},  // xvmul.d
+
+      {ISD::SDIV, MVT::v32i8, {38, 76}},  // xvdiv.b
+      {ISD::SDIV, MVT::v16i16, {24, 43}}, // xvdiv.h
+      {ISD::SDIV, MVT::v8i32, {17, 28}},  // xvdiv.w
+      {ISD::SDIV, MVT::v4i64, {14, 19}},  // xvdiv.d
+
+      {ISD::UDIV, MVT::v32i8, {38, 76}},  // xvdiv.bu
+      {ISD::UDIV, MVT::v16i16, {24, 43}}, // xvdiv.hu
+      {ISD::UDIV, MVT::v8i32, {17, 28}},  // xvdiv.wu
+      {ISD::UDIV, MVT::v4i64, {14, 19}},  // xvdiv.du
+
+      {ISD::SREM, MVT::v32i8, {38, 76}},  // xvmod.b
+      {ISD::SREM, MVT::v16i16, {24, 44}}, // xvmod.h
+      {ISD::SREM, MVT::v8i32, {17, 28}},  // xvmod.w
+      {ISD::SREM, MVT::v4i64, {14, 19}},  // xvmod.d
+
+      {ISD::UREM, MVT::v32i8, {38, 76}},  // xvmod.bu
+      {ISD::UREM, MVT::v16i16, {24, 43}}, // xvmod.hu
+      {ISD::UREM, MVT::v8i32, {17, 28}},  // xvmod.wu
+      {ISD::UREM, MVT::v4i64, {14, 19}},  // xvmod.du
+
+      {ISD::SHL, MVT::v32i8, {1, 1}},  // xvslli.b/xvsll.b
+      {ISD::SHL, MVT::v16i16, {1, 1}}, // xvslli.h/xvsll.h
+      {ISD::SHL, MVT::v8i32, {1, 1}},  // xvslli.w/xvsll.w
+      {ISD::SHL, MVT::v4i64, {1, 1}},  // xvslli.d/xvsll.d
+
+      {ISD::SRL, MVT::v32i8, {1, 1}},  // xvsrli.b/xvsrl.b
+      {ISD::SRL, MVT::v16i16, {1, 1}}, // xvsrli.h/xvsrl.h
+      {ISD::SRL, MVT::v8i32, {1, 1}},  // xvsrli.w/xvsrl.w
+      {ISD::SRL, MVT::v4i64, {1, 1}},  // xvsrli.d/xvsrl.d
+
+      {ISD::SRA, MVT::v32i8, {1, 1}},  // xvsrai.b/xvsra.b
+      {ISD::SRA, MVT::v16i16, {1, 1}}, // xvsrai.h/xvsra.h
+      {ISD::SRA, MVT::v8i32, {1, 1}},  // xvsrai.w/xvsra.w
+      {ISD::SRA, MVT::v4i64, {1, 1}},  // xvsrai.d/xvsra.d
+
+      {ISD::AND, MVT::v32i8, {1, 1}},  // xvandi.b/xvand.v
+      {ISD::AND, MVT::v16i16, {1, 1}}, // xvand.v
+      {ISD::AND, MVT::v8i32, {1, 1}},  // xvand.v
+      {ISD::AND, MVT::v4i64, {1, 1}},  // xvand.v
+
+      {ISD::OR, MVT::v32i8, {1, 1}},  // xvori.b/xvor.v
+      {ISD::OR, MVT::v16i16, {1, 1}}, // xvor.v
+      {ISD::OR, MVT::v8i32, {1, 1}},  // xvor.v
+      {ISD::OR, MVT::v4i64, {1, 1}},  // xvor.v
+
+      {ISD::XOR, MVT::v32i8, {1, 1}},  // xvxori.b/xvxor.v
+      {ISD::XOR, MVT::v16i16, {1, 1}}, // xvxor.v
+      {ISD::XOR, MVT::v8i32, {1, 1}},  // xvxor.v
+      {ISD::XOR, MVT::v4i64, {1, 1}},  // xvxor.v
+
+      {ISD::FADD, MVT::v8f32, {3, 1}}, // xvfadd.s
+      {ISD::FADD, MVT::v4f64, {3, 1}}, // xvfadd.d
+
+      {ISD::FSUB, MVT::v8f32, {3, 1}}, // xvfsub.s
+      {ISD::FSUB, MVT::v4f64, {3, 1}}, // xvfsub.d
+
+      {ISD::FMUL, MVT::v8f32, {5, 2}}, // xvfmul.s
+      {ISD::FMUL, MVT::v4f64, {5, 2}}, // xvfmul.d
+
+      {ISD::FDIV, MVT::v8f32, {15, 26}}, // xvfdiv.s
+      {ISD::FDIV, MVT::v4f64, {12, 18}}, // xvfdiv.d
+  };
+
+  if (ST->hasExtLASX()) {
+    if (const auto *Entry =
+            CostTableLookup(LASXUniformConstCostTable, ISD, LT.second))
+      if (auto KindCost = Entry->Cost[CostKind])
+        return LT.first * *KindCost;
+  }
+
+  static const CostKindTblEntry LA64CostTable[]{
+      {ISD::ADD, MVT::i64, {1, 1}}, // addi.d/add.d
+      {ISD::SUB, MVT::i64, {1, 1}}, // subi.d/sub.d
+      {ISD::MUL, MVT::i64, {4, 2}}, // mul.d
+
+      {ISD::SDIV, MVT::i64, {18, 26}}, // div.d
+      {ISD::UDIV, MVT::i64, {18, 26}}, // div.du
+      {ISD::SREM, MVT::i64, {18, 26}}, // mod.d
+      {ISD::UREM, MVT::i64, {18, 26}}, // mod.du
+
+      {ISD::SHL, MVT::i64, {1, 1}}, // slli.d/sll.d
+      {ISD::SRL, MVT::i64, {1, 1}}, // srli.d/srl.d
+      {ISD::SRA, MVT::i64, {1, 1}}, // srai.d/sra.d
+
+      {ISD::AND, MVT::i64, {1, 1}}, // andi.d/and.d
+      {ISD::OR, MVT::i64, {1, 1}},  // ori.d/or.d
+      {ISD::XOR, MVT::i64, {1, 1}}, // xori.d/xor.d
+
+      {ISD::FADD, MVT::f64, {3, 1}},  // fadd.d
+      {ISD::FSUB, MVT::f64, {3, 1}},  // fsub.d
+      {ISD::FMUL, MVT::f64, {5, 2}},  // fmul.d
+      {ISD::FDIV, MVT::f64, {12, 9}}, // fdiv.d
+  };
+
+  if (ST->is64Bit()) {
+    if (const auto *Entry = CostTableLookup(LA64CostTable, ISD, LT.second))
+      if (auto KindCost = Entry->Cost[CostKind])
+        return LT.first * *KindCost;
+  }
+
+  static const CostKindTblEntry LA32CostTable[]{
+      {ISD::ADD, MVT::i32, {1, 1}}, // addi.w/add.w
+      {ISD::SUB, MVT::i32, {1, 1}}, // subi.w/sub.w
+      {ISD::MUL, MVT::i32, {4, 2}}, // mul.w
+
+      {ISD::SDIV, MVT::i32, {11, 24}}, // div.w
+      {ISD::UDIV, MVT::i32, {12, 24}}, // div.wu
+      {ISD::SREM, MVT::i32, {11, 24}}, // mod.w
+      {ISD::UREM, MVT::i32, {12, 24}}, // mod.wu
+
+      {ISD::SHL, MVT::i32, {1, 1}}, // slli.w/sll.w
+      {ISD::SRL, MVT::i32, {1, 1}}, // srli.w/srl.w
+      {ISD::SRA, MVT::i32, {1, 1}}, // srai.w/sra.w
+
+      {ISD::AND, MVT::i32, {1, 1}}, // andi.w/and.w
+      {ISD::OR, MVT::i32, {1, 1}},  // ori.w/or.w
+      {ISD::XOR, MVT::i32, {1, 1}}, // xori.w/xor.w
+
+      {ISD::FADD, MVT::f32, {3, 1}}, // fadd.s
+      {ISD::FSUB, MVT::f32, {3, 1}}, // fsub.s
+      {ISD::FMUL, MVT::f32, {5, 2}}, // fmul.s
+      {ISD::FDIV, MVT::f32, {9, 8}}, // fdiv.s
+  };
+
+  if (const auto *Entry = CostTableLookup(LA32CostTable, ISD, LT.second))
+    if (auto KindCost = Entry->Cost[CostKind])
+      return LT.first * *KindCost;
+
+  // Fallback to the default implementation.
+  return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
+                                       Args, CxtI);
+}
+
 // TODO: Implement more hooks to provide TTI machinery for LoongArch.
diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
index e3f16c7804994..f59bdf2d3749f 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
@@ -54,6 +54,12 @@ class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {
   bool enableWritePrefetching() const override;
 
   bool shouldExpandReduction(const IntrinsicInst *II) const override;
+  InstructionCost getArithmeticInstrCost(
+      unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
+      TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
+      TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
+      ArrayRef<const Value *> Args = {},
+      const Instruction *CxtI = nullptr) const override;
 
   // TODO: Implement more hooks to provide TTI machinery for LoongArch.
 };
diff --git a/llvm/test/Analysis/CostModel/LoongArch/arith-fp.ll b/llvm/test/Analysis/CostModel/LoongArch/arith-fp.ll
new file mode 100644
index 0000000000000..6da0d72d7a2be
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/LoongArch/arith-fp.ll
@@ -0,0 +1,135 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lsx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LSX
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lasx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LASX
+
+define void @fadd() {
+; LSX-LABEL: 'fadd'
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V1F32 = fadd float poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fadd <2 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fadd <4 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:6 SizeLat:1 for: %V8F32 = fadd <8 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V1F64 = fadd double poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F64 = fadd <2 x double> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:6 SizeLat:1 for: %V4F64 = fadd <4 x double> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret void
+;
+; LASX-LABEL: 'fadd'
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V1F32 = fadd float poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fadd <2 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fadd <4 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = fadd <8 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V1F64 = fadd double poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F64 = fadd <2 x double> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F64 = fadd <4 x double> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret void
+;
+   %V1F32 = fadd float poison, poison
+   %V2F32 = fadd <2 x float> poison, poison
+   %V4F32 = fadd <4 x float> poison, poison
+   %V8F32 = fadd <8 x float> poison, poison
+
+   %V1F64 = fadd double poison, poison
+   %V2F64 = fadd <2 x double> poison, poison
+   %V4F64 = fadd <4 x double> poison, poison
+
+   ret void
+}
+
+define void @fsub() {
+; LSX-LABEL: 'fsub'
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V1F32 = fsub float poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fsub <2 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fsub <4 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:6 SizeLat:1 for: %V8F32 = fsub <8 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V1F64 = fsub double poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F64 = fsub <2 x double> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:6 SizeLat:1 for: %V4F64 = fsub <4 x double> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret void
+;
+; LASX-LABEL: 'fsub'
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V1F32 = fsub float poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F32 = fsub <2 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F32 = fsub <4 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V8F32 = fsub <8 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V1F64 = fsub double poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V2F64 = fsub <2 x double> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %V4F64 = fsub <4 x double> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret void
+;
+   %V1F32 = fsub float poison, poison
+   %V2F32 = fsub <2 x float> poison, poison
+   %V4F32 = fsub <4 x float> poison, poison
+   %V8F32 = fsub <8 x float> poison, poison
+
+   %V1F64 = fsub double poison, poison
+   %V2F64 = fsub <2 x double> poison, poison
+   %V4F64 = fsub <4 x double> poison, poison
+
+   ret void
+}
+
+define void @fmul() {
+; LSX-LABEL: 'fmul'
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V1F32 = fmul float poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V2F32 = fmul <2 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V4F32 = fmul <4 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:10 SizeLat:1 for: %V8F32 = fmul <8 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V1F64 = fmul double poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V2F64 = fmul <2 x double> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:10 SizeLat:1 for: %V4F64 = fmul <4 x double> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret void
+;
+; LASX-LABEL: 'fmul'
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V1F32 = fmul float poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V2F32 = fmul <2 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V4F32 = fmul <4 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V8F32 = fmul <8 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V1F64 = fmul double poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V2F64 = fmul <2 x double> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %V4F64 = fmul <4 x double> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret void
+;
+   %V1F32 = fmul float poison, poison
+   %V2F32 = fmul <2 x float> poison, poison
+   %V4F32 = fmul <4 x float> poison, poison
+   %V8F32 = fmul <8 x float> poison, poison
+
+   %V1F64 = fmul double poison, poison
+   %V2F64 = fmul <2 x double> poison, poison
+   %V4F64 = fmul <4 x double> poison, poison
+
+   ret void
+}
+
+define void @fdiv() {
+; LSX-LABEL: 'fdiv'
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:4 Lat:9 SizeLat:4 for: %V1F32 = fdiv float poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:16 SizeLat:4 for: %V2F32 = fdiv <2 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:16 SizeLat:4 for: %V4F32 = fdiv <4 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:52 CodeSize:4 Lat:32 SizeLat:4 for: %V8F32 = fdiv <8 x float> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:9 CodeSize:4 Lat:12 SizeLat:4 for: %V1F64 = fdiv double poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:18 CodeSize:4 Lat:12 SizeLat:4 for: %V2F64 = fdiv <2 x double> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:4 Lat:24 SizeLat:4 for: %V4F64 = fdiv <4 x double> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret void
+;
+; LASX-LABEL: 'fdiv'
+; LASX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:4 Lat:9 SizeLat:4 for: %V1F32 = fdiv float poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:16 SizeLat:4 for: %V2F32 = fdiv <2 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:16 SizeLat:4 for: %V4F32 = fdiv <4 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:15 SizeLat:4 for: %V8F32 = fdiv <8 x float> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:9 CodeSize:4 Lat:12 SizeLat:4 for: %V1F64 = fdiv double poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:18 CodeSize:4 Lat:12 SizeLat:4 for: %V2F64 = fdiv <2 x double> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:18 CodeSize:4 Lat:12 SizeLat:4 for: %V4F64 = fdiv <4 x double> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret void
+;
+   %V1F32 = fdiv float poison, poison
+   %V2F32 = fdiv <2 x float> poison, poison
+   %V4F32 = fdiv <4 x float> poison, poison
+   %V8F32 = fdiv <8 x float> poison, poison
+
+   %V1F64 = fdiv double poison, poison
+   %V2F64 = fdiv <2 x double> poison, poison
+   %V4F64 = fdiv <4 x double> poison, poison
+
+   ret void
+}
diff --git a/llvm/test/Analysis/CostModel/LoongArch/arith-int.ll b/llvm/test/Analysis/CostModel/LoongArch/arith-int.ll
new file mode 100644
index 0000000000000..fb449141526b1
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/LoongArch/arith-int.ll
@@ -0,0 +1,1161 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lsx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LSX
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lasx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LASX
+
+define i32 @add() {
+; LSX-LABEL: 'add'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = add i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = add <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = add <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = add <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = add <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = add <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = add i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = add <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = add <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = add <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = add <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = add i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = add <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = add <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = add <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = add i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = add <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = add <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'add'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = add i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = add <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = add <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = add <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = add <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = add <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = add i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = add <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = add <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = add <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = add <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = add i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = add <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = add <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = add <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = add i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = add <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = add <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = add i8 poison, poison
+   %V2I8 = add <2 x i8> poison, poison
+   %V4I8 = add <4 x i8> poison, poison
+   %V8I8 = add <8 x i8> poison, poison
+   %V16I8 = add <16 x i8> poison, poison
+   %V32I8 = add <32 x i8> poison, poison
+
+   %V1I16 = add i16 poison, poison
+   %V2I16 = add <2 x i16> poison, poison
+   %V4I16 = add <4 x i16> poison, poison
+   %V8I16 = add <8 x i16> poison, poison
+   %V16I16 = add <16 x i16> poison, poison
+
+   %V1I32 = add i32 poison, poison
+   %V2I32 = add <2 x i32> poison, poison
+   %V4I32 = add <4 x i32> poison, poison
+   %V8I32 = add <8 x i32> poison, poison
+
+   %V1I64 = add i64 poison, poison
+   %V2I64 = add <2 x i64> poison, poison
+   %V4I64 = add <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @sub() {
+; LSX-LABEL: 'sub'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = sub i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = sub <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = sub <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = sub <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = sub <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = sub <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = sub i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = sub <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = sub <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = sub <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = sub <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = sub i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = sub <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = sub <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = sub <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = sub i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = sub <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = sub <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'sub'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = sub i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = sub <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = sub <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = sub <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = sub <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = sub <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = sub i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = sub <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = sub <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = sub <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = sub <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = sub i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = sub <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = sub <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = sub <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = sub i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = sub <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = sub <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = sub i8 poison, poison
+   %V2I8 = sub <2 x i8> poison, poison
+   %V4I8 = sub <4 x i8> poison, poison
+   %V8I8 = sub <8 x i8> poison, poison
+   %V16I8 = sub <16 x i8> poison, poison
+   %V32I8 = sub <32 x i8> poison, poison
+
+   %V1I16 = sub i16 poison, poison
+   %V2I16 = sub <2 x i16> poison, poison
+   %V4I16 = sub <4 x i16> poison, poison
+   %V8I16 = sub <8 x i16> poison, poison
+   %V16I16 = sub <16 x i16> poison, poison
+
+   %V1I32 = sub i32 poison, poison
+   %V2I32 = sub <2 x i32> poison, poison
+   %V4I32 = sub <4 x i32> poison, poison
+   %V8I32 = sub <8 x i32> poison, poison
+
+   %V1I64 = sub i64 poison, poison
+   %V2I64 = sub <2 x i64> poison, poison
+   %V4I64 = sub <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @mul() {
+; LSX-LABEL: 'mul'
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V1I8 = mul i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V2I8 = mul <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V4I8 = mul <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V8I8 = mul <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V16I8 = mul <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:8 SizeLat:1 for: %V32I8 = mul <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V1I16 = mul i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V2I16 = mul <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V4I16 = mul <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V8I16 = mul <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:8 SizeLat:1 for: %V16I16 = mul <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V1I32 = mul i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V2I32 = mul <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V4I32 = mul <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:8 SizeLat:1 for: %V8I32 = mul <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V1I64 = mul i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V2I64 = mul <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:8 SizeLat:1 for: %V4I64 = mul <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'mul'
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V1I8 = mul i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V2I8 = mul <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V4I8 = mul <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V8I8 = mul <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V16I8 = mul <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V32I8 = mul <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V1I16 = mul i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V2I16 = mul <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V4I16 = mul <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V8I16 = mul <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V16I16 = mul <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V1I32 = mul i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V2I32 = mul <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V4I32 = mul <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V8I32 = mul <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V1I64 = mul i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V2I64 = mul <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %V4I64 = mul <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = mul i8 poison, poison
+   %V2I8 = mul <2 x i8> poison, poison
+   %V4I8 = mul <4 x i8> poison, poison
+   %V8I8 = mul <8 x i8> poison, poison
+   %V16I8 = mul <16 x i8> poison, poison
+   %V32I8 = mul <32 x i8> poison, poison
+
+   %V1I16 = mul i16 poison, poison
+   %V2I16 = mul <2 x i16> poison, poison
+   %V4I16 = mul <4 x i16> poison, poison
+   %V8I16 = mul <8 x i16> poison, poison
+   %V16I16 = mul <16 x i16> poison, poison
+
+   %V1I32 = mul i32 poison, poison
+   %V2I32 = mul <2 x i32> poison, poison
+   %V4I32 = mul <4 x i32> poison, poison
+   %V8I32 = mul <8 x i32> poison, poison
+
+   %V1I64 = mul i64 poison, poison
+   %V2I64 = mul <2 x i64> poison, poison
+   %V4I64 = mul <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @sdiv() {
+; LSX-LABEL: 'sdiv'
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I8 = sdiv i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V2I8 = sdiv <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V4I8 = sdiv <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V8I8 = sdiv <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V16I8 = sdiv <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:152 CodeSize:4 Lat:76 SizeLat:4 for: %V32I8 = sdiv <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I16 = sdiv i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V2I16 = sdiv <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V4I16 = sdiv <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V8I16 = sdiv <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:88 CodeSize:4 Lat:48 SizeLat:4 for: %V16I16 = sdiv <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I32 = sdiv i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V2I32 = sdiv <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V4I32 = sdiv <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:56 CodeSize:4 Lat:34 SizeLat:4 for: %V8I32 = sdiv <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I64 = sdiv i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V2I64 = sdiv <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:38 CodeSize:4 Lat:28 SizeLat:4 for: %V4I64 = sdiv <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'sdiv'
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I8 = sdiv i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V2I8 = sdiv <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V4I8 = sdiv <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V8I8 = sdiv <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V16I8 = sdiv <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V32I8 = sdiv <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I16 = sdiv i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V2I16 = sdiv <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V4I16 = sdiv <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V8I16 = sdiv <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:43 CodeSize:4 Lat:24 SizeLat:4 for: %V16I16 = sdiv <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I32 = sdiv i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V2I32 = sdiv <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V4I32 = sdiv <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V8I32 = sdiv <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I64 = sdiv i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V2I64 = sdiv <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V4I64 = sdiv <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = sdiv i8 poison, poison
+   %V2I8 = sdiv <2 x i8> poison, poison
+   %V4I8 = sdiv <4 x i8> poison, poison
+   %V8I8 = sdiv <8 x i8> poison, poison
+   %V16I8 = sdiv <16 x i8> poison, poison
+   %V32I8 = sdiv <32 x i8> poison, poison
+
+   %V1I16 = sdiv i16 poison, poison
+   %V2I16 = sdiv <2 x i16> poison, poison
+   %V4I16 = sdiv <4 x i16> poison, poison
+   %V8I16 = sdiv <8 x i16> poison, poison
+   %V16I16 = sdiv <16 x i16> poison, poison
+
+   %V1I32 = sdiv i32 poison, poison
+   %V2I32 = sdiv <2 x i32> poison, poison
+   %V4I32 = sdiv <4 x i32> poison, poison
+   %V8I32 = sdiv <8 x i32> poison, poison
+
+   %V1I64 = sdiv i64 poison, poison
+   %V2I64 = sdiv <2 x i64> poison, poison
+   %V4I64 = sdiv <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @udiv() {
+; LSX-LABEL: 'udiv'
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I8 = udiv i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V2I8 = udiv <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V4I8 = udiv <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V8I8 = udiv <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V16I8 = udiv <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:160 CodeSize:4 Lat:76 SizeLat:4 for: %V32I8 = udiv <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I16 = udiv i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V2I16 = udiv <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V4I16 = udiv <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V8I16 = udiv <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:88 CodeSize:4 Lat:48 SizeLat:4 for: %V16I16 = udiv <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I32 = udiv i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V2I32 = udiv <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V4I32 = udiv <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:56 CodeSize:4 Lat:34 SizeLat:4 for: %V8I32 = udiv <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I64 = udiv i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V2I64 = udiv <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:38 CodeSize:4 Lat:28 SizeLat:4 for: %V4I64 = udiv <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'udiv'
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I8 = udiv i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V2I8 = udiv <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V4I8 = udiv <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V8I8 = udiv <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V16I8 = udiv <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V32I8 = udiv <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I16 = udiv i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V2I16 = udiv <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V4I16 = udiv <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V8I16 = udiv <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:43 CodeSize:4 Lat:24 SizeLat:4 for: %V16I16 = udiv <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I32 = udiv i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V2I32 = udiv <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V4I32 = udiv <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V8I32 = udiv <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I64 = udiv i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V2I64 = udiv <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V4I64 = udiv <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = udiv i8 poison, poison
+   %V2I8 = udiv <2 x i8> poison, poison
+   %V4I8 = udiv <4 x i8> poison, poison
+   %V8I8 = udiv <8 x i8> poison, poison
+   %V16I8 = udiv <16 x i8> poison, poison
+   %V32I8 = udiv <32 x i8> poison, poison
+
+   %V1I16 = udiv i16 poison, poison
+   %V2I16 = udiv <2 x i16> poison, poison
+   %V4I16 = udiv <4 x i16> poison, poison
+   %V8I16 = udiv <8 x i16> poison, poison
+   %V16I16 = udiv <16 x i16> poison, poison
+
+   %V1I32 = udiv i32 poison, poison
+   %V2I32 = udiv <2 x i32> poison, poison
+   %V4I32 = udiv <4 x i32> poison, poison
+   %V8I32 = udiv <8 x i32> poison, poison
+
+   %V1I64 = udiv i64 poison, poison
+   %V2I64 = udiv <2 x i64> poison, poison
+   %V4I64 = udiv <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @srem() {
+; LSX-LABEL: 'srem'
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I8 = srem i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V2I8 = srem <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V4I8 = srem <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V8I8 = srem <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V16I8 = srem <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:152 CodeSize:4 Lat:76 SizeLat:4 for: %V32I8 = srem <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I16 = srem i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V2I16 = srem <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V4I16 = srem <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V8I16 = srem <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:88 CodeSize:4 Lat:48 SizeLat:4 for: %V16I16 = srem <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I32 = srem i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:27 CodeSize:4 Lat:17 SizeLat:4 for: %V2I32 = srem <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:27 CodeSize:4 Lat:17 SizeLat:4 for: %V4I32 = srem <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:54 CodeSize:4 Lat:34 SizeLat:4 for: %V8I32 = srem <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I64 = srem i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V2I64 = srem <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:38 CodeSize:4 Lat:28 SizeLat:4 for: %V4I64 = srem <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'srem'
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I8 = srem i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V2I8 = srem <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V4I8 = srem <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V8I8 = srem <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V16I8 = srem <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V32I8 = srem <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I16 = srem i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V2I16 = srem <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V4I16 = srem <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V8I16 = srem <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V16I16 = srem <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I32 = srem i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:27 CodeSize:4 Lat:17 SizeLat:4 for: %V2I32 = srem <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:27 CodeSize:4 Lat:17 SizeLat:4 for: %V4I32 = srem <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V8I32 = srem <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I64 = srem i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V2I64 = srem <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V4I64 = srem <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = srem i8 poison, poison
+   %V2I8 = srem <2 x i8> poison, poison
+   %V4I8 = srem <4 x i8> poison, poison
+   %V8I8 = srem <8 x i8> poison, poison
+   %V16I8 = srem <16 x i8> poison, poison
+   %V32I8 = srem <32 x i8> poison, poison
+
+   %V1I16 = srem i16 poison, poison
+   %V2I16 = srem <2 x i16> poison, poison
+   %V4I16 = srem <4 x i16> poison, poison
+   %V8I16 = srem <8 x i16> poison, poison
+   %V16I16 = srem <16 x i16> poison, poison
+
+   %V1I32 = srem i32 poison, poison
+   %V2I32 = srem <2 x i32> poison, poison
+   %V4I32 = srem <4 x i32> poison, poison
+   %V8I32 = srem <8 x i32> poison, poison
+
+   %V1I64 = srem i64 poison, poison
+   %V2I64 = srem <2 x i64> poison, poison
+   %V4I64 = srem <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @urem() {
+; LSX-LABEL: 'urem'
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I8 = urem i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V2I8 = urem <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V4I8 = urem <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V8I8 = urem <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V16I8 = urem <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:160 CodeSize:4 Lat:76 SizeLat:4 for: %V32I8 = urem <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I16 = urem i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V2I16 = urem <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V4I16 = urem <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V8I16 = urem <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:88 CodeSize:4 Lat:48 SizeLat:4 for: %V16I16 = urem <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I32 = urem i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V2I32 = urem <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V4I32 = urem <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:56 CodeSize:4 Lat:34 SizeLat:4 for: %V8I32 = urem <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I64 = urem i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V2I64 = urem <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:38 CodeSize:4 Lat:28 SizeLat:4 for: %V4I64 = urem <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'urem'
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I8 = urem i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V2I8 = urem <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V4I8 = urem <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V8I8 = urem <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:80 CodeSize:4 Lat:38 SizeLat:4 for: %V16I8 = urem <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:76 CodeSize:4 Lat:38 SizeLat:4 for: %V32I8 = urem <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I16 = urem i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V2I16 = urem <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V4I16 = urem <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:4 Lat:24 SizeLat:4 for: %V8I16 = urem <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:43 CodeSize:4 Lat:24 SizeLat:4 for: %V16I16 = urem <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I32 = urem i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V2I32 = urem <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V4I32 = urem <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:4 Lat:17 SizeLat:4 for: %V8I32 = urem <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:26 CodeSize:4 Lat:18 SizeLat:4 for: %V1I64 = urem i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V2I64 = urem <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of RThru:19 CodeSize:4 Lat:14 SizeLat:4 for: %V4I64 = urem <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = urem i8 poison, poison
+   %V2I8 = urem <2 x i8> poison, poison
+   %V4I8 = urem <4 x i8> poison, poison
+   %V8I8 = urem <8 x i8> poison, poison
+   %V16I8 = urem <16 x i8> poison, poison
+   %V32I8 = urem <32 x i8> poison, poison
+
+   %V1I16 = urem i16 poison, poison
+   %V2I16 = urem <2 x i16> poison, poison
+   %V4I16 = urem <4 x i16> poison, poison
+   %V8I16 = urem <8 x i16> poison, poison
+   %V16I16 = urem <16 x i16> poison, poison
+
+   %V1I32 = urem i32 poison, poison
+   %V2I32 = urem <2 x i32> poison, poison
+   %V4I32 = urem <4 x i32> poison, poison
+   %V8I32 = urem <8 x i32> poison, poison
+
+   %V1I64 = urem i64 poison, poison
+   %V2I64 = urem <2 x i64> poison, poison
+   %V4I64 = urem <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @and() {
+; LSX-LABEL: 'and'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = and i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = and <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = and <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = and <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = and <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = and <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = and i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = and <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = and <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = and <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = and <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = and i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = and <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = and <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = and <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = and i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = and <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = and <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'and'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = and i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = and <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = and <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = and <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = and <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = and <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = and i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = and <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = and <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = and <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = and <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = and i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = and <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = and <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = and <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = and i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = and <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = and <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = and i8 poison, poison
+   %V2I8 = and <2 x i8> poison, poison
+   %V4I8 = and <4 x i8> poison, poison
+   %V8I8 = and <8 x i8> poison, poison
+   %V16I8 = and <16 x i8> poison, poison
+   %V32I8 = and <32 x i8> poison, poison
+
+   %V1I16 = and i16 poison, poison
+   %V2I16 = and <2 x i16> poison, poison
+   %V4I16 = and <4 x i16> poison, poison
+   %V8I16 = and <8 x i16> poison, poison
+   %V16I16 = and <16 x i16> poison, poison
+
+   %V1I32 = and i32 poison, poison
+   %V2I32 = and <2 x i32> poison, poison
+   %V4I32 = and <4 x i32> poison, poison
+   %V8I32 = and <8 x i32> poison, poison
+
+   %V1I64 = and i64 poison, poison
+   %V2I64 = and <2 x i64> poison, poison
+   %V4I64 = and <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @or() {
+; LSX-LABEL: 'or'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = or i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = or <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = or <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = or <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = or <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = or <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = or i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = or <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = or <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = or <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = or <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = or i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = or <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = or <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = or <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = or i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = or <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = or <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'or'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = or i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = or <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = or <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = or <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = or <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = or <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = or i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = or <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = or <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = or <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = or <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = or i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = or <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = or <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = or <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = or i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = or <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = or <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = or i8 poison, poison
+   %V2I8 = or <2 x i8> poison, poison
+   %V4I8 = or <4 x i8> poison, poison
+   %V8I8 = or <8 x i8> poison, poison
+   %V16I8 = or <16 x i8> poison, poison
+   %V32I8 = or <32 x i8> poison, poison
+
+   %V1I16 = or i16 poison, poison
+   %V2I16 = or <2 x i16> poison, poison
+   %V4I16 = or <4 x i16> poison, poison
+   %V8I16 = or <8 x i16> poison, poison
+   %V16I16 = or <16 x i16> poison, poison
+
+   %V1I32 = or i32 poison, poison
+   %V2I32 = or <2 x i32> poison, poison
+   %V4I32 = or <4 x i32> poison, poison
+   %V8I32 = or <8 x i32> poison, poison
+
+   %V1I64 = or i64 poison, poison
+   %V2I64 = or <2 x i64> poison, poison
+   %V4I64 = or <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @xor() {
+; LSX-LABEL: 'xor'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = xor i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = xor <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = xor <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = xor <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = xor <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = xor <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = xor i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = xor <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = xor <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = xor <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = xor <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = xor i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = xor <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = xor <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = xor <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = xor i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = xor <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = xor <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'xor'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = xor i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = xor <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = xor <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = xor <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = xor <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = xor <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = xor i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = xor <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = xor <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = xor <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = xor <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = xor i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = xor <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = xor <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = xor <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = xor i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = xor <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = xor <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = xor i8 poison, poison
+   %V2I8 = xor <2 x i8> poison, poison
+   %V4I8 = xor <4 x i8> poison, poison
+   %V8I8 = xor <8 x i8> poison, poison
+   %V16I8 = xor <16 x i8> poison, poison
+   %V32I8 = xor <32 x i8> poison, poison
+
+   %V1I16 = xor i16 poison, poison
+   %V2I16 = xor <2 x i16> poison, poison
+   %V4I16 = xor <4 x i16> poison, poison
+   %V8I16 = xor <8 x i16> poison, poison
+   %V16I16 = xor <16 x i16> poison, poison
+
+   %V1I32 = xor i32 poison, poison
+   %V2I32 = xor <2 x i32> poison, poison
+   %V4I32 = xor <4 x i32> poison, poison
+   %V8I32 = xor <8 x i32> poison, poison
+
+   %V1I64 = xor i64 poison, poison
+   %V2I64 = xor <2 x i64> poison, poison
+   %V4I64 = xor <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @shl() {
+; LSX-LABEL: 'shl'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = shl i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = shl <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = shl <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = shl <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = shl <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = shl <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = shl i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = shl <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = shl <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = shl <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = shl <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = shl i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = shl <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = shl <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = shl <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = shl i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = shl <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = shl <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'shl'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = shl i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = shl <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = shl <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = shl <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = shl <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = shl <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = shl i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = shl <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = shl <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = shl <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = shl <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = shl i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = shl <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = shl <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = shl <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = shl i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = shl <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = shl <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = shl i8 poison, poison
+   %V2I8 = shl <2 x i8> poison, poison
+   %V4I8 = shl <4 x i8> poison, poison
+   %V8I8 = shl <8 x i8> poison, poison
+   %V16I8 = shl <16 x i8> poison, poison
+   %V32I8 = shl <32 x i8> poison, poison
+
+   %V1I16 = shl i16 poison, poison
+   %V2I16 = shl <2 x i16> poison, poison
+   %V4I16 = shl <4 x i16> poison, poison
+   %V8I16 = shl <8 x i16> poison, poison
+   %V16I16 = shl <16 x i16> poison, poison
+
+   %V1I32 = shl i32 poison, poison
+   %V2I32 = shl <2 x i32> poison, poison
+   %V4I32 = shl <4 x i32> poison, poison
+   %V8I32 = shl <8 x i32> poison, poison
+
+   %V1I64 = shl i64 poison, poison
+   %V2I64 = shl <2 x i64> poison, poison
+   %V4I64 = shl <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @lshr() {
+; LSX-LABEL: 'lshr'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = lshr i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = lshr <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = lshr <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = lshr <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = lshr <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = lshr <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = lshr i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = lshr <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = lshr <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = lshr <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = lshr <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = lshr i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = lshr <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = lshr <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = lshr <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = lshr i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = lshr <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = lshr <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'lshr'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = lshr i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = lshr <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = lshr <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = lshr <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = lshr <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = lshr <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = lshr i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = lshr <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = lshr <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = lshr <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = lshr <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = lshr i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = lshr <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = lshr <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = lshr <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = lshr i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = lshr <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = lshr <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = lshr i8 poison, poison
+   %V2I8 = lshr <2 x i8> poison, poison
+   %V4I8 = lshr <4 x i8> poison, poison
+   %V8I8 = lshr <8 x i8> poison, poison
+   %V16I8 = lshr <16 x i8> poison, poison
+   %V32I8 = lshr <32 x i8> poison, poison
+
+   %V1I16 = lshr i16 poison, poison
+   %V2I16 = lshr <2 x i16> poison, poison
+   %V4I16 = lshr <4 x i16> poison, poison
+   %V8I16 = lshr <8 x i16> poison, poison
+   %V16I16 = lshr <16 x i16> poison, poison
+
+   %V1I32 = lshr i32 poison, poison
+   %V2I32 = lshr <2 x i32> poison, poison
+   %V4I32 = lshr <4 x i32> poison, poison
+   %V8I32 = lshr <8 x i32> poison, poison
+
+   %V1I64 = lshr i64 poison, poison
+   %V2I64 = lshr <2 x i64> poison, poison
+   %V4I64 = lshr <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+define i32 @ashr() {
+; LSX-LABEL: 'ashr'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = ashr i8 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = ashr <2 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = ashr <4 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = ashr <8 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = ashr <16 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = ashr <32 x i8> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = ashr i16 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = ashr <2 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = ashr <4 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = ashr <8 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = ashr <16 x i16> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = ashr i32 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = ashr <2 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = ashr <4 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = ashr <8 x i32> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = ashr i64 poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = ashr <2 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = ashr <4 x i64> poison, poison
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'ashr'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = ashr i8 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = ashr <2 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = ashr <4 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = ashr <8 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = ashr <16 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = ashr <32 x i8> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = ashr i16 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = ashr <2 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = ashr <4 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = ashr <8 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = ashr <16 x i16> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = ashr i32 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = ashr <2 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = ashr <4 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = ashr <8 x i32> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = ashr i64 poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = ashr <2 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = ashr <4 x i64> poison, poison
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = ashr i8 poison, poison
+   %V2I8 = ashr <2 x i8> poison, poison
+   %V4I8 = ashr <4 x i8> poison, poison
+   %V8I8 = ashr <8 x i8> poison, poison
+   %V16I8 = ashr <16 x i8> poison, poison
+   %V32I8 = ashr <32 x i8> poison, poison
+
+   %V1I16 = ashr i16 poison, poison
+   %V2I16 = ashr <2 x i16> poison, poison
+   %V4I16 = ashr <4 x i16> poison, poison
+   %V8I16 = ashr <8 x i16> poison, poison
+   %V16I16 = ashr <16 x i16> poison, poison
+
+   %V1I32 = ashr i32 poison, poison
+   %V2I32 = ashr <2 x i32> poison, poison
+   %V4I32 = ashr <4 x i32> poison, poison
+   %V8I32 = ashr <8 x i32> poison, poison
+
+   %V1I64 = ashr i64 poison, poison
+   %V2I64 = ashr <2 x i64> poison, poison
+   %V4I64 = ashr <4 x i64> poison, poison
+
+   ret i32 poison
+}
+
+
+define i32 @sdiv_constant() {
+; LSX-LABEL: 'sdiv_constant'
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V1I8 = sdiv i8 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V2I8 = sdiv <2 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V4I8 = sdiv <4 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V8I8 = sdiv <8 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V16I8 = sdiv <16 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:4 Lat:8 SizeLat:4 for: %V32I8 = sdiv <32 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V1I16 = sdiv i16 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V2I16 = sdiv <2 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V4I16 = sdiv <4 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V8I16 = sdiv <8 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:4 Lat:8 SizeLat:4 for: %V16I16 = sdiv <16 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V1I32 = sdiv i32 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V2I32 = sdiv <2 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V4I32 = sdiv <4 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:4 Lat:8 SizeLat:4 for: %V8I32 = sdiv <8 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V1I64 = sdiv i64 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 4 for: %V2I64 = sdiv <2 x i64> poison, splat (i64 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:4 Lat:8 SizeLat:4 for: %V4I64 = sdiv <4 x i64> poison, splat (i64 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'sdiv_constant'
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V1I8 = sdiv i8 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V2I8 = sdiv <2 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V4I8 = sdiv <4 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V8I8 = sdiv <8 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V16I8 = sdiv <16 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V32I8 = sdiv <32 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V1I16 = sdiv i16 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V2I16 = sdiv <2 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V4I16 = sdiv <4 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V8I16 = sdiv <8 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V16I16 = sdiv <16 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V1I32 = sdiv i32 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V2I32 = sdiv <2 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V4I32 = sdiv <4 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V8I32 = sdiv <8 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V1I64 = sdiv i64 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V2I64 = sdiv <2 x i64> poison, splat (i64 2)
+; LASX-NEXT:  Cost Model: Found costs of 4 for: %V4I64 = sdiv <4 x i64> poison, splat (i64 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = sdiv i8 poison, 2
+   %V2I8 = sdiv <2 x i8> poison, splat (i8 2)
+   %V4I8 = sdiv <4 x i8> poison, splat (i8 2)
+   %V8I8 = sdiv <8 x i8> poison, splat (i8 2)
+   %V16I8 = sdiv <16 x i8> poison, splat (i8 2)
+   %V32I8 = sdiv <32 x i8> poison, splat (i8 2)
+
+   %V1I16 = sdiv i16 poison, 2
+   %V2I16 = sdiv <2 x i16> poison, splat (i16 2)
+   %V4I16 = sdiv <4 x i16> poison, splat (i16 2)
+   %V8I16 = sdiv <8 x i16> poison, splat (i16 2)
+   %V16I16 = sdiv <16 x i16> poison, splat (i16 2)
+
+   %V1I32 = sdiv i32 poison, 2
+   %V2I32 = sdiv <2 x i32> poison, splat (i32 2)
+   %V4I32 = sdiv <4 x i32> poison, splat (i32 2)
+   %V8I32 = sdiv <8 x i32> poison, splat (i32 2)
+
+   %V1I64 = sdiv i64 poison, 2
+   %V2I64 = sdiv <2 x i64> poison, splat (i64 2)
+   %V4I64 = sdiv <4 x i64> poison, splat (i64 2)
+
+   ret i32 poison
+}
+
+define i32 @udiv_constant() {
+; LSX-LABEL: 'udiv_constant'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = udiv i8 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = udiv <2 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = udiv <4 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = udiv <8 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = udiv <16 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = udiv <32 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = udiv i16 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = udiv <2 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = udiv <4 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = udiv <8 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = udiv <16 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = udiv i32 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = udiv <2 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = udiv <4 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = udiv <8 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = udiv i64 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = udiv <2 x i64> poison, splat (i64 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = udiv <4 x i64> poison, splat (i64 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'udiv_constant'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = udiv i8 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = udiv <2 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = udiv <4 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = udiv <8 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = udiv <16 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = udiv <32 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = udiv i16 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = udiv <2 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = udiv <4 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = udiv <8 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = udiv <16 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = udiv i32 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = udiv <2 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = udiv <4 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = udiv <8 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = udiv i64 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = udiv <2 x i64> poison, splat (i64 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = udiv <4 x i64> poison, splat (i64 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = udiv i8 poison, 2
+   %V2I8 = udiv <2 x i8> poison, splat (i8 2)
+   %V4I8 = udiv <4 x i8> poison, splat (i8 2)
+   %V8I8 = udiv <8 x i8> poison, splat (i8 2)
+   %V16I8 = udiv <16 x i8> poison, splat (i8 2)
+   %V32I8 = udiv <32 x i8> poison, splat (i8 2)
+
+   %V1I16 = udiv i16 poison, 2
+   %V2I16 = udiv <2 x i16> poison, splat (i16 2)
+   %V4I16 = udiv <4 x i16> poison, splat (i16 2)
+   %V8I16 = udiv <8 x i16> poison, splat (i16 2)
+   %V16I16 = udiv <16 x i16> poison, splat (i16 2)
+
+   %V1I32 = udiv i32 poison, 2
+   %V2I32 = udiv <2 x i32> poison, splat (i32 2)
+   %V4I32 = udiv <4 x i32> poison, splat (i32 2)
+   %V8I32 = udiv <8 x i32> poison, splat (i32 2)
+
+   %V1I64 = udiv i64 poison, 2
+   %V2I64 = udiv <2 x i64> poison, splat (i64 2)
+   %V4I64 = udiv <4 x i64> poison, splat (i64 2)
+
+   ret i32 poison
+}
+
+define i32 @srem_constant() {
+; LSX-LABEL: 'srem_constant'
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V1I8 = srem i8 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V2I8 = srem <2 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V4I8 = srem <4 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V8I8 = srem <8 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V16I8 = srem <16 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:6 Lat:18 SizeLat:6 for: %V32I8 = srem <32 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V1I16 = srem i16 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V2I16 = srem <2 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V4I16 = srem <4 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V8I16 = srem <8 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:6 Lat:18 SizeLat:6 for: %V16I16 = srem <16 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V1I32 = srem i32 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V2I32 = srem <2 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V4I32 = srem <4 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:6 Lat:18 SizeLat:6 for: %V8I32 = srem <8 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V1I64 = srem i64 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V2I64 = srem <2 x i64> poison, splat (i64 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:6 Lat:18 SizeLat:6 for: %V4I64 = srem <4 x i64> poison, splat (i64 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'srem_constant'
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V1I8 = srem i8 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V2I8 = srem <2 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V4I8 = srem <4 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V8I8 = srem <8 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V16I8 = srem <16 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V32I8 = srem <32 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V1I16 = srem i16 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V2I16 = srem <2 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V4I16 = srem <4 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V8I16 = srem <8 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V16I16 = srem <16 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V1I32 = srem i32 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V2I32 = srem <2 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V4I32 = srem <4 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V8I32 = srem <8 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V1I64 = srem i64 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V2I64 = srem <2 x i64> poison, splat (i64 2)
+; LASX-NEXT:  Cost Model: Found costs of RThru:7 CodeSize:6 Lat:9 SizeLat:6 for: %V4I64 = srem <4 x i64> poison, splat (i64 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = srem i8 poison, 2
+   %V2I8 = srem <2 x i8> poison, splat (i8 2)
+   %V4I8 = srem <4 x i8> poison, splat (i8 2)
+   %V8I8 = srem <8 x i8> poison, splat (i8 2)
+   %V16I8 = srem <16 x i8> poison, splat (i8 2)
+   %V32I8 = srem <32 x i8> poison, splat (i8 2)
+
+   %V1I16 = srem i16 poison, 2
+   %V2I16 = srem <2 x i16> poison, splat (i16 2)
+   %V4I16 = srem <4 x i16> poison, splat (i16 2)
+   %V8I16 = srem <8 x i16> poison, splat (i16 2)
+   %V16I16 = srem <16 x i16> poison, splat (i16 2)
+
+   %V1I32 = srem i32 poison, 2
+   %V2I32 = srem <2 x i32> poison, splat (i32 2)
+   %V4I32 = srem <4 x i32> poison, splat (i32 2)
+   %V8I32 = srem <8 x i32> poison, splat (i32 2)
+
+   %V1I64 = srem i64 poison, 2
+   %V2I64 = srem <2 x i64> poison, splat (i64 2)
+   %V4I64 = srem <4 x i64> poison, splat (i64 2)
+
+   ret i32 poison
+}
+
+define i32 @urem_constant() {
+; LSX-LABEL: 'urem_constant'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = urem i8 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = urem <2 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = urem <4 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = urem <8 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = urem <16 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V32I8 = urem <32 x i8> poison, splat (i8 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = urem i16 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = urem <2 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = urem <4 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = urem <8 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V16I16 = urem <16 x i16> poison, splat (i16 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = urem i32 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = urem <2 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = urem <4 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V8I32 = urem <8 x i32> poison, splat (i32 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = urem i64 poison, 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = urem <2 x i64> poison, splat (i64 2)
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %V4I64 = urem <4 x i64> poison, splat (i64 2)
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'urem_constant'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I8 = urem i8 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I8 = urem <2 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I8 = urem <4 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I8 = urem <8 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I8 = urem <16 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V32I8 = urem <32 x i8> poison, splat (i8 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I16 = urem i16 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I16 = urem <2 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I16 = urem <4 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I16 = urem <8 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V16I16 = urem <16 x i16> poison, splat (i16 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I32 = urem i32 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I32 = urem <2 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I32 = urem <4 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V8I32 = urem <8 x i32> poison, splat (i32 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V1I64 = urem i64 poison, 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V2I64 = urem <2 x i64> poison, splat (i64 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %V4I64 = urem <4 x i64> poison, splat (i64 2)
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+   %V1I8 = urem i8 poison, 2
+   %V2I8 = urem <2 x i8> poison, splat (i8 2)
+   %V4I8 = urem <4 x i8> poison, splat (i8 2)
+   %V8I8 = urem <8 x i8> poison, splat (i8 2)
+   %V16I8 = urem <16 x i8> poison, splat (i8 2)
+   %V32I8 = urem <32 x i8> poison, splat (i8 2)
+
+   %V1I16 = urem i16 poison, 2
+   %V2I16 = urem <2 x i16> poison, splat (i16 2)
+   %V4I16 = urem <4 x i16> poison, splat (i16 2)
+   %V8I16 = urem <8 x i16> poison, splat (i16 2)
+   %V16I16 = urem <16 x i16> poison, splat (i16 2)
+
+   %V1I32 = urem i32 poison, 2
+   %V2I32 = urem <2 x i32> poison, splat (i32 2)
+   %V4I32 = urem <4 x i32> poison, splat (i32 2)
+   %V8I32 = urem <8 x i32> poison, splat (i32 2)
+
+   %V1I64 = urem i64 poison, 2
+   %V2I64 = urem <2 x i64> poison, splat (i64 2)
+   %V4I64 = urem <4 x i64> poison, splat (i64 2)
+
+   ret i32 poison
+}
diff --git a/llvm/test/Analysis/CostModel/RISCV/arith-int.ll b/llvm/test/Analysis/CostModel/RISCV/arith-int.ll
index 5afc199e52d43..e10eca68abd51 100644
--- a/llvm/test/Analysis/CostModel/RISCV/arith-int.ll
+++ b/llvm/test/Analysis/CostModel/RISCV/arith-int.ll
@@ -1,82 +1,5 @@
-; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv64 -mattr=+v,+f,+d,+zfh,+zvfh < %s | FileCheck %s
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv64 -mcpu=sifive-x280 < %s | FileCheck %s --check-prefix=SIFIVE-X280
-; Check that we don't crash querying costs when vectors are not enabled.
-; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv64
 
 define i32 @add() {
-; CHECK-LABEL: 'add'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = add i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = add i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = add i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = add <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = add <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = add <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = add <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = add <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = add <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = add <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = add <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = add <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = add <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = add <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = add <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = add <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = add <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = add <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = add <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = add <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = add <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = add <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = add <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = add <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = add <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = add <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = add <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = add <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = add <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = add <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = add <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = add <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = add <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'add'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = add i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = add i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = add i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = add <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = add <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = add <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = add <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = add <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = add <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = add <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = add <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = add <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = add <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = add <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = add <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = add <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = add <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = add <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = add <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = add <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = add <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = add <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = add <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = add <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = add <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = add <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = add <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = add <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = add <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = add <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = add <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = add <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = add <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = add i16 undef, undef
   %I32 = add i32 undef, undef
   %I64 = add i64 undef, undef
@@ -121,78 +44,6 @@ define i32 @add() {
 }
 
 define i32 @sub() {
-; CHECK-LABEL: 'sub'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = sub i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = sub i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = sub i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = sub <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = sub <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = sub <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = sub <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = sub <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = sub <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = sub <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = sub <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = sub <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = sub <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = sub <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = sub <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = sub <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = sub <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = sub <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = sub <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = sub <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = sub <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = sub <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = sub <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = sub <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = sub <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = sub <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = sub <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = sub <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = sub <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = sub <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = sub <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = sub <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = sub <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'sub'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = sub i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = sub i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = sub i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = sub <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = sub <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = sub <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = sub <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = sub <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = sub <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = sub <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = sub <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = sub <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = sub <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = sub <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = sub <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = sub <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = sub <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = sub <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = sub <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = sub <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = sub <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = sub <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = sub <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = sub <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = sub <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = sub <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = sub <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = sub <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = sub <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = sub <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = sub <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = sub <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = sub <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = sub i16 undef, undef
   %I32 = sub i32 undef, undef
   %I64 = sub i64 undef, undef
@@ -237,78 +88,6 @@ define i32 @sub() {
 }
 
 define i32 @mul() {
-; CHECK-LABEL: 'mul'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = mul i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = mul i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = mul i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = mul <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = mul <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = mul <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = mul <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = mul <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = mul <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = mul <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = mul <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = mul <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = mul <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = mul <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = mul <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = mul <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = mul <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = mul <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = mul <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = mul <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = mul <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = mul <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = mul <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = mul <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = mul <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = mul <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = mul <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = mul <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = mul <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = mul <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = mul <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = mul <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = mul <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'mul'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = mul i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = mul i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = mul i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = mul <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = mul <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = mul <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = mul <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = mul <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = mul <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = mul <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = mul <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = mul <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = mul <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = mul <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = mul <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = mul <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = mul <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = mul <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = mul <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = mul <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = mul <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = mul <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = mul <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = mul <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = mul <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = mul <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = mul <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = mul <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = mul <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = mul <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = mul <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = mul <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = mul <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = mul i16 undef, undef
   %I32 = mul i32 undef, undef
   %I64 = mul i64 undef, undef
@@ -353,78 +132,6 @@ define i32 @mul() {
 }
 
 define i32 @shl() {
-; CHECK-LABEL: 'shl'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = shl i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = shl i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = shl i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = shl <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = shl <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = shl <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = shl <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = shl <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = shl <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = shl <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = shl <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = shl <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = shl <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = shl <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = shl <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = shl <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = shl <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = shl <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = shl <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = shl <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = shl <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = shl <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = shl <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = shl <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = shl <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = shl <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = shl <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = shl <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = shl <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = shl <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = shl <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = shl <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = shl <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'shl'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = shl i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = shl i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = shl i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = shl <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = shl <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = shl <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = shl <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = shl <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = shl <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = shl <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = shl <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = shl <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = shl <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = shl <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = shl <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = shl <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = shl <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = shl <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = shl <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = shl <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = shl <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = shl <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = shl <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = shl <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = shl <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = shl <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = shl <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = shl <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = shl <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = shl <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = shl <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = shl <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = shl <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = shl i16 undef, undef
   %I32 = shl i32 undef, undef
   %I64 = shl i64 undef, undef
@@ -469,78 +176,6 @@ define i32 @shl() {
 }
 
 define i32 @lshr() {
-; CHECK-LABEL: 'lshr'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = lshr i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = lshr i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = lshr i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = lshr <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = lshr <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = lshr <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = lshr <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = lshr <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = lshr <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = lshr <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = lshr <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = lshr <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = lshr <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = lshr <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = lshr <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = lshr <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = lshr <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = lshr <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = lshr <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = lshr <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = lshr <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = lshr <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = lshr <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = lshr <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = lshr <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = lshr <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = lshr <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = lshr <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = lshr <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = lshr <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = lshr <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = lshr <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = lshr <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'lshr'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = lshr i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = lshr i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = lshr i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = lshr <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = lshr <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = lshr <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = lshr <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = lshr <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = lshr <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = lshr <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = lshr <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = lshr <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = lshr <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = lshr <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = lshr <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = lshr <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = lshr <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = lshr <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = lshr <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = lshr <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = lshr <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = lshr <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = lshr <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = lshr <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = lshr <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = lshr <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = lshr <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = lshr <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = lshr <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = lshr <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = lshr <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = lshr <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = lshr <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = lshr i16 undef, undef
   %I32 = lshr i32 undef, undef
   %I64 = lshr i64 undef, undef
@@ -585,78 +220,6 @@ define i32 @lshr() {
 }
 
 define i32 @ashr() {
-; CHECK-LABEL: 'ashr'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = ashr i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = ashr i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = ashr i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = ashr <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = ashr <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = ashr <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = ashr <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = ashr <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = ashr <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = ashr <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = ashr <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = ashr <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = ashr <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = ashr <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = ashr <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = ashr <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = ashr <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = ashr <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = ashr <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = ashr <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = ashr <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = ashr <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = ashr <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = ashr <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = ashr <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = ashr <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = ashr <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = ashr <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = ashr <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = ashr <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = ashr <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = ashr <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = ashr <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'ashr'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = ashr i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = ashr i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = ashr i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = ashr <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = ashr <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = ashr <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = ashr <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = ashr <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = ashr <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = ashr <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = ashr <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = ashr <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = ashr <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = ashr <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = ashr <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = ashr <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = ashr <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = ashr <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = ashr <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = ashr <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = ashr <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = ashr <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = ashr <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = ashr <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = ashr <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = ashr <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = ashr <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = ashr <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = ashr <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = ashr <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = ashr <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = ashr <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = ashr <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = ashr i16 undef, undef
   %I32 = ashr i32 undef, undef
   %I64 = ashr i64 undef, undef
@@ -701,78 +264,6 @@ define i32 @ashr() {
 }
 
 define i32 @udiv() {
-; CHECK-LABEL: 'udiv'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = udiv i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = udiv <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = udiv <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = udiv <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = udiv <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = udiv <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = udiv <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = udiv <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = udiv <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = udiv <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = udiv <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = udiv <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = udiv <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = udiv <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = udiv <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = udiv <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = udiv <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = udiv <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = udiv <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = udiv <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = udiv <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = udiv <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = udiv <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = udiv <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = udiv <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = udiv <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = udiv <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = udiv <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = udiv <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = udiv <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = udiv <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'udiv'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = udiv i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = udiv <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = udiv <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = udiv <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = udiv <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = udiv <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = udiv <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = udiv <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = udiv <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = udiv <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = udiv <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = udiv <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = udiv <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = udiv <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = udiv <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = udiv <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = udiv <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = udiv <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = udiv <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = udiv <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = udiv <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = udiv <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = udiv <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = udiv <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = udiv <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = udiv <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = udiv <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = udiv <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = udiv <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = udiv <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = udiv <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = udiv i16 undef, undef
   %I32 = udiv i32 undef, undef
   %I64 = udiv i64 undef, undef
@@ -817,78 +308,6 @@ define i32 @udiv() {
 }
 
 define i32 @urem() {
-; CHECK-LABEL: 'urem'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = urem i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = urem i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = urem i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = urem <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = urem <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = urem <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = urem <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = urem <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = urem <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = urem <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = urem <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = urem <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = urem <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = urem <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = urem <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = urem <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = urem <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = urem <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = urem <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = urem <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = urem <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = urem <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = urem <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = urem <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = urem <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = urem <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = urem <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = urem <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = urem <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = urem <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = urem <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = urem <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = urem <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'urem'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = urem i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = urem i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = urem i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = urem <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = urem <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = urem <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = urem <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = urem <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = urem <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = urem <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = urem <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = urem <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = urem <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = urem <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = urem <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = urem <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = urem <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = urem <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = urem <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = urem <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = urem <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = urem <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = urem <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = urem <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = urem <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = urem <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = urem <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = urem <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = urem <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = urem <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = urem <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = urem <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = urem <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = urem i16 undef, undef
   %I32 = urem i32 undef, undef
   %I64 = urem i64 undef, undef
@@ -933,78 +352,6 @@ define i32 @urem() {
 }
 
 define i32 @sdiv() {
-; CHECK-LABEL: 'sdiv'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = sdiv i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = sdiv <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = sdiv <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = sdiv <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = sdiv <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = sdiv <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = sdiv <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = sdiv <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = sdiv <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = sdiv <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = sdiv <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = sdiv <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = sdiv <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = sdiv <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = sdiv <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = sdiv <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = sdiv <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = sdiv <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = sdiv <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = sdiv <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = sdiv <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = sdiv <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = sdiv <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = sdiv <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = sdiv <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = sdiv <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = sdiv <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = sdiv <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = sdiv <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = sdiv <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = sdiv <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'sdiv'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = sdiv i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = sdiv <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = sdiv <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = sdiv <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = sdiv <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = sdiv <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = sdiv <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = sdiv <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = sdiv <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = sdiv <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = sdiv <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = sdiv <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = sdiv <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = sdiv <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = sdiv <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = sdiv <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = sdiv <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = sdiv <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = sdiv <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = sdiv <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = sdiv <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = sdiv <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = sdiv <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = sdiv <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = sdiv <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = sdiv <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = sdiv <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = sdiv <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = sdiv <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = sdiv <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = sdiv <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = sdiv i16 undef, undef
   %I32 = sdiv i32 undef, undef
   %I64 = sdiv i64 undef, undef
@@ -1049,78 +396,6 @@ define i32 @sdiv() {
 }
 
 define i32 @srem() {
-; CHECK-LABEL: 'srem'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = srem i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = srem i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = srem i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = srem <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = srem <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = srem <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = srem <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = srem <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = srem <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = srem <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = srem <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV4I16 = srem <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV8I16 = srem <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV16I16 = srem <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV32I16 = srem <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = srem <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = srem <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = srem <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = srem <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = srem <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = srem <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I32 = srem <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I32 = srem <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I32 = srem <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I32 = srem <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = srem <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = srem <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = srem <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = srem <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I64 = srem <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I64 = srem <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I64 = srem <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I64 = srem <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'srem'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = srem i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = srem i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = srem i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I16 = srem <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I16 = srem <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I16 = srem <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = srem <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = srem <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = srem <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I16 = srem <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV2I16 = srem <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV4I16 = srem <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV8I16 = srem <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV16I16 = srem <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV32I16 = srem <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I32 = srem <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = srem <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = srem <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = srem <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = srem <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %NXV1I32 = srem <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV2I32 = srem <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV4I32 = srem <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV8I32 = srem <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV16I32 = srem <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V1I64 = srem <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = srem <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = srem <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = srem <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %NXV1I64 = srem <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %NXV2I64 = srem <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %NXV4I64 = srem <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %NXV8I64 = srem <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   %I16 = srem i16 undef, undef
   %I32 = srem i32 undef, undef
   %I64 = srem i64 undef, undef
@@ -1165,173 +440,32 @@ define i32 @srem() {
 }
 
 
-; For constants, have to account for cost of materializing the constant itself
-; This test exercises a few interesting constant patterns at VLEN=128
 define void @add_of_constant() {
-; CHECK-LABEL: 'add_of_constant'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %1 = add <4 x i32> poison, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = add <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %3 = add <4 x i32> zeroinitializer, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %4 = add <2 x i64> zeroinitializer, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = add <4 x i32> splat (i32 1), undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %6 = add <2 x i64> splat (i64 1), undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = add <4 x i32> splat (i32 4096), undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %8 = add <4 x i32> <i32 1, i32 1, i32 2, i32 1>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %9 = add <4 x i32> <i32 2, i32 1, i32 1, i32 1>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %10 = add <4 x i32> <i32 0, i32 1, i32 2, i32 3>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %11 = add <4 x i32> <i32 1, i32 2, i32 3, i32 4>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %12 = add <4 x i32> <i32 -1, i32 -2, i32 -3, i32 -4>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %13 = add <4 x i32> <i32 2, i32 4, i32 6, i32 8>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %14 = add <4 x i32> <i32 -1, i32 0, i32 2, i32 1>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %15 = add <4 x i32> <i32 256, i32 4096, i32 57, i32 1>, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
-;
-; SIFIVE-X280-LABEL: 'add_of_constant'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %1 = add <4 x i32> poison, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = add <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %3 = add <4 x i32> zeroinitializer, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %4 = add <2 x i64> zeroinitializer, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = add <4 x i32> splat (i32 1), undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %6 = add <2 x i64> splat (i64 1), undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = add <4 x i32> splat (i32 4096), undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %8 = add <4 x i32> <i32 1, i32 1, i32 2, i32 1>, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %9 = add <4 x i32> <i32 2, i32 1, i32 1, i32 1>, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %10 = add <4 x i32> <i32 0, i32 1, i32 2, i32 3>, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %11 = add <4 x i32> <i32 1, i32 2, i32 3, i32 4>, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %12 = add <4 x i32> <i32 -1, i32 -2, i32 -3, i32 -4>, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %13 = add <4 x i32> <i32 2, i32 4, i32 6, i32 8>, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %14 = add <4 x i32> <i32 -1, i32 0, i32 2, i32 1>, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %15 = add <4 x i32> <i32 256, i32 4096, i32 57, i32 1>, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
-;
-
-  ; poison and undef
-  add <4 x i32> poison, undef
+
+    add <4 x i32> poison, undef
   add <4 x i32> undef, undef
 
-  ; Various splats
-  add <4 x i32> zeroinitializer, undef
+    add <4 x i32> zeroinitializer, undef
   add <2 x i64> zeroinitializer, undef
   add <4 x i32> <i32 1, i32 1, i32 1, i32 1>, undef
   add <2 x i64> <i64 1, i64 1>, undef
   add <4 x i32> <i32 4096, i32 4096, i32 4096, i32 4096>, undef
 
-  ; Nearly splats
-  add <4 x i32> <i32 1, i32 1, i32 2, i32 1>, undef
+    add <4 x i32> <i32 1, i32 1, i32 2, i32 1>, undef
   add <4 x i32> <i32 2, i32 1, i32 1, i32 1>, undef
 
-  ; Step vector functions
-  add <4 x i32> <i32 0, i32 1, i32 2, i32 3>, undef
+    add <4 x i32> <i32 0, i32 1, i32 2, i32 3>, undef
   add <4 x i32> <i32 1, i32 2, i32 3, i32 4>, undef
   add <4 x i32> <i32 -1, i32 -2, i32 -3, i32 -4>, undef
   add <4 x i32> <i32 2, i32 4, i32 6, i32 8>, undef
 
-  ; General case 128 bit constants
-  add <4 x i32> <i32 -1, i32 0, i32 2, i32 1>, undef
+    add <4 x i32> <i32 -1, i32 0, i32 2, i32 1>, undef
   add <4 x i32> <i32 256, i32 4096, i32 57, i32 1>, undef
 
   ret void
 }
 
 define i32 @and() {
-; CHECK-LABEL: 'and'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %1 = and i1 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = and i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %3 = and i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %4 = and i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = and <1 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %6 = and <2 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = and <4 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %8 = and <8 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %9 = and <16 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %10 = and <32 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %11 = and <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %12 = and <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %13 = and <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %14 = and <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %15 = and <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %16 = and <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %17 = and <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %18 = and <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %19 = and <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %20 = and <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %21 = and <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %22 = and <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %23 = and <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %24 = and <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %25 = and <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %26 = and <vscale x 1 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %27 = and <vscale x 2 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %28 = and <vscale x 4 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %29 = and <vscale x 8 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %30 = and <vscale x 16 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %31 = and <vscale x 32 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %32 = and <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %33 = and <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %34 = and <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %35 = and <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %36 = and <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %37 = and <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %38 = and <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %39 = and <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %40 = and <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %41 = and <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %42 = and <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %43 = and <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %44 = and <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %45 = and <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %46 = and <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'and'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %1 = and i1 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = and i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %3 = and i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %4 = and i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = and <1 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %6 = and <2 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = and <4 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %8 = and <8 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %9 = and <16 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %10 = and <32 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %11 = and <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %12 = and <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %13 = and <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %14 = and <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %15 = and <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %16 = and <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %17 = and <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %18 = and <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %19 = and <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %20 = and <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %21 = and <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %22 = and <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %23 = and <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %24 = and <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %25 = and <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %26 = and <vscale x 1 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %27 = and <vscale x 2 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %28 = and <vscale x 4 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %29 = and <vscale x 8 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %30 = and <vscale x 16 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %31 = and <vscale x 32 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %32 = and <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %33 = and <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %34 = and <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %35 = and <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %36 = and <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %37 = and <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %38 = and <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %39 = and <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %40 = and <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %41 = and <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %42 = and <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %43 = and <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %44 = and <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %45 = and <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %46 = and <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   and i1 undef, undef
   and i16 undef, undef
   and i32 undef, undef
@@ -1390,104 +524,6 @@ define i32 @and() {
 }
 
 define i32 @or() {
-; CHECK-LABEL: 'or'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %1 = or i1 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = or i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %3 = or i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %4 = or i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = or <1 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %6 = or <2 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = or <4 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %8 = or <8 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %9 = or <16 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %10 = or <32 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %11 = or <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %12 = or <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %13 = or <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %14 = or <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %15 = or <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %16 = or <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %17 = or <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %18 = or <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %19 = or <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %20 = or <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %21 = or <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %22 = or <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %23 = or <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %24 = or <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %25 = or <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %26 = or <vscale x 1 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %27 = or <vscale x 2 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %28 = or <vscale x 4 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %29 = or <vscale x 8 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %30 = or <vscale x 16 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %31 = or <vscale x 32 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %32 = or <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %33 = or <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %34 = or <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %35 = or <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %36 = or <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %37 = or <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %38 = or <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %39 = or <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %40 = or <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %41 = or <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %42 = or <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %43 = or <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %44 = or <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %45 = or <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %46 = or <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'or'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %1 = or i1 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = or i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %3 = or i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %4 = or i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = or <1 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %6 = or <2 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = or <4 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %8 = or <8 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %9 = or <16 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %10 = or <32 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %11 = or <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %12 = or <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %13 = or <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %14 = or <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %15 = or <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %16 = or <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %17 = or <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %18 = or <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %19 = or <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %20 = or <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %21 = or <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %22 = or <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %23 = or <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %24 = or <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %25 = or <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %26 = or <vscale x 1 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %27 = or <vscale x 2 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %28 = or <vscale x 4 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %29 = or <vscale x 8 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %30 = or <vscale x 16 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %31 = or <vscale x 32 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %32 = or <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %33 = or <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %34 = or <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %35 = or <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %36 = or <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %37 = or <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %38 = or <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %39 = or <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %40 = or <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %41 = or <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %42 = or <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %43 = or <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %44 = or <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %45 = or <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %46 = or <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   or i1 undef, undef
   or i16 undef, undef
   or i32 undef, undef
@@ -1546,104 +582,6 @@ define i32 @or() {
 }
 
 define i32 @xor() {
-; CHECK-LABEL: 'xor'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %1 = xor i1 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = xor i16 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %3 = xor i32 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %4 = xor i64 undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = xor <1 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %6 = xor <2 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = xor <4 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %8 = xor <8 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %9 = xor <16 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %10 = xor <32 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %11 = xor <1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %12 = xor <2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %13 = xor <4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %14 = xor <8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %15 = xor <16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %16 = xor <32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %17 = xor <1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %18 = xor <2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %19 = xor <4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %20 = xor <8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %21 = xor <16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %22 = xor <1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %23 = xor <2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %24 = xor <4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %25 = xor <8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %26 = xor <vscale x 1 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %27 = xor <vscale x 2 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %28 = xor <vscale x 4 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %29 = xor <vscale x 8 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %30 = xor <vscale x 16 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %31 = xor <vscale x 32 x i1> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %32 = xor <vscale x 1 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %33 = xor <vscale x 2 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %34 = xor <vscale x 4 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %35 = xor <vscale x 8 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %36 = xor <vscale x 16 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %37 = xor <vscale x 32 x i16> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %38 = xor <vscale x 1 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %39 = xor <vscale x 2 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %40 = xor <vscale x 4 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %41 = xor <vscale x 8 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %42 = xor <vscale x 16 x i32> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %43 = xor <vscale x 1 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %44 = xor <vscale x 2 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %45 = xor <vscale x 4 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %46 = xor <vscale x 8 x i64> undef, undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
-; SIFIVE-X280-LABEL: 'xor'
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %1 = xor i1 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = xor i16 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %3 = xor i32 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %4 = xor i64 undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %5 = xor <1 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %6 = xor <2 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %7 = xor <4 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %8 = xor <8 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %9 = xor <16 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %10 = xor <32 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %11 = xor <1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %12 = xor <2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %13 = xor <4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %14 = xor <8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %15 = xor <16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %16 = xor <32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %17 = xor <1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %18 = xor <2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %19 = xor <4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %20 = xor <8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %21 = xor <16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %22 = xor <1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %23 = xor <2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %24 = xor <4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %25 = xor <8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %26 = xor <vscale x 1 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %27 = xor <vscale x 2 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %28 = xor <vscale x 4 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %29 = xor <vscale x 8 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %30 = xor <vscale x 16 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %31 = xor <vscale x 32 x i1> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %32 = xor <vscale x 1 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %33 = xor <vscale x 2 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %34 = xor <vscale x 4 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %35 = xor <vscale x 8 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %36 = xor <vscale x 16 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %37 = xor <vscale x 32 x i16> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %38 = xor <vscale x 1 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %39 = xor <vscale x 2 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %40 = xor <vscale x 4 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %41 = xor <vscale x 8 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %42 = xor <vscale x 16 x i32> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %43 = xor <vscale x 1 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %44 = xor <vscale x 2 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %45 = xor <vscale x 4 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %46 = xor <vscale x 8 x i64> undef, undef
-; SIFIVE-X280-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
-;
   xor i1 undef, undef
   xor i16 undef, undef
   xor i32 undef, undef
diff --git a/llvm/test/Analysis/CostModel/X86/bswap-store.ll b/llvm/test/Analysis/CostModel/X86/bswap-store.ll
index 4fcc72e3ee75d..117530ac2fb3a 100644
--- a/llvm/test/Analysis/CostModel/X86/bswap-store.ll
+++ b/llvm/test/Analysis/CostModel/X86/bswap-store.ll
@@ -4,7 +4,7 @@
 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X64-FASTMOVBE
 
 ; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output                           | FileCheck %s --check-prefixes=ALL,X32
-; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe             | FileCheck %s --check-prefixes=ALL,X32-MOVBE
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe             | FileCheck %s --check-prefixes=ALL,X32-MOVB
 ; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X32-FASTMOVBE
 
 declare i16 @llvm.bswap.i16(i16)

>From 645a6e79b046093e8185465d1f5fe3d4b8c71573 Mon Sep 17 00:00:00 2001
From: tangaac <tangyan01 at loongson.cn>
Date: Tue, 28 Oct 2025 17:20:44 +0800
Subject: [PATCH 2/3] Support getVectorInstrCost

---
 .../LoongArchTargetTransformInfo.cpp          |  76 ++++
 .../LoongArch/LoongArchTargetTransformInfo.h  |   6 +
 .../CostModel/LoongArch/vector-extract.ll     | 378 ++++++++++++++++++
 .../CostModel/LoongArch/vector-insert.ll      | 362 +++++++++++++++++
 4 files changed, 822 insertions(+)
 create mode 100644 llvm/test/Analysis/CostModel/LoongArch/vector-extract.ll
 create mode 100644 llvm/test/Analysis/CostModel/LoongArch/vector-insert.ll

diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
index 3eafa9b0d6b41..93a4685fcaa0f 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
@@ -438,4 +438,80 @@ InstructionCost LoongArchTTIImpl::getArithmeticInstrCost(
                                        Args, CxtI);
 }
 
+InstructionCost LoongArchTTIImpl::getVectorInstrCost(
+    unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
+    const Value *Op0, const Value *Op1) const {
+
+  assert(Val->isVectorTy() && "This must be a vector type");
+
+  std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Val);
+  int ISD = TLI->InstructionOpcodeToISD(Opcode);
+
+  InstructionCost RegisterFileMoveCost = 0;
+
+  static const CostKindTblEntry LSXCostTable[]{
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v16i8, {3, 4}}, // vpickve2gr.b
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v8i16, {3, 4}}, // vpickve2gr.h
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v4i32, {3, 4}}, // vpickve2gr.w
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v2i64, {3, 4}}, // vpickve2gr.d
+
+      {ISD::INSERT_VECTOR_ELT, MVT::v16i8, {3, 4}}, // vinsgr2vr.b
+      {ISD::INSERT_VECTOR_ELT, MVT::v8i16, {3, 4}}, // vinsgr2vr.h
+      {ISD::INSERT_VECTOR_ELT, MVT::v4i32, {3, 4}}, // vinsgr2vr.w
+      {ISD::INSERT_VECTOR_ELT, MVT::v2i64, {3, 4}}, // vinsgr2vr.d
+
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v4f32, {1, 1}}, // vreplvei.w
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v2f64, {1, 1}}, // vreplvei.d
+
+      {ISD::INSERT_VECTOR_ELT, MVT::v4f32, {1, 1}}, // vextrins.w
+      {ISD::INSERT_VECTOR_ELT, MVT::v2f64, {1, 1}}, // vextrins.d
+  };
+
+  static const CostKindTblEntry LASXCostTable[]{
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v32i8, {3, 4}},  // vpickve2gr.b
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v16i16, {3, 4}}, // vpickve2gr.h
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v8i32, {5, 4}},  // xvpickve2gr.w
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v4i64, {5, 4}},  // xvpickve2gr.d
+
+      {ISD::INSERT_VECTOR_ELT, MVT::v32i8, {3, 4}},  // vinsgr2vr.b
+      {ISD::INSERT_VECTOR_ELT, MVT::v16i16, {3, 4}}, // vinsgr2vr.h
+      {ISD::INSERT_VECTOR_ELT, MVT::v8i32, {4, 4}},  // xvinsgr2vr.w
+      {ISD::INSERT_VECTOR_ELT, MVT::v4i64, {4, 4}},  // xvinsgr2vr.d
+
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v8f32, {2, 1}}, // xvinsve0.w
+      {ISD::EXTRACT_VECTOR_ELT, MVT::v4f64, {2, 1}}, // xvinsve0.d
+
+      {ISD::INSERT_VECTOR_ELT, MVT::v8f32, {3, 1}}, // xvpickve.w
+      {ISD::INSERT_VECTOR_ELT, MVT::v4f64, {3, 1}}, // xvpickve.d
+  };
+
+  if (Index != -1U &&
+      (ISD == ISD::EXTRACT_VECTOR_ELT || ISD == ISD::INSERT_VECTOR_ELT)) {
+
+    if (!LT.second.isVector())
+      return TTI::TCC_Free;
+
+    unsigned SizeInBits = LT.second.getSizeInBits();
+    unsigned NumElts = LT.second.getVectorNumElements();
+    Index = Index % NumElts;
+
+    if (SizeInBits > 128 && Index >= NumElts / 2 && !Val->isFPOrFPVectorTy()) {
+      RegisterFileMoveCost += (ISD == ISD::INSERT_VECTOR_ELT ? 2 : 1);
+    }
+
+    if (ST->hasExtLSX())
+      if (auto *Entry = CostTableLookup(LSXCostTable, ISD, LT.second))
+        if (auto KindCost = Entry->Cost[CostKind])
+          return LT.first * *KindCost + RegisterFileMoveCost;
+
+    if (ST->hasExtLASX())
+      if (auto *Entry = CostTableLookup(LASXCostTable, ISD, LT.second))
+        if (auto KindCost = Entry->Cost[CostKind])
+          return LT.first * *KindCost + RegisterFileMoveCost;
+  }
+
+  return BaseT::getVectorInstrCost(Opcode, Val, CostKind, Index, Op0, Op1) +
+         RegisterFileMoveCost;
+}
+
 // TODO: Implement more hooks to provide TTI machinery for LoongArch.
diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
index f59bdf2d3749f..ab575ef7fe4ba 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
@@ -61,6 +61,12 @@ class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {
       ArrayRef<const Value *> Args = {},
       const Instruction *CxtI = nullptr) const override;
 
+  using BaseT::getVectorInstrCost;
+  InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
+                                     TTI::TargetCostKind CostKind,
+                                     unsigned Index, const Value *Op0,
+                                     const Value *Op1) const override;
+
   // TODO: Implement more hooks to provide TTI machinery for LoongArch.
 };
 
diff --git a/llvm/test/Analysis/CostModel/LoongArch/vector-extract.ll b/llvm/test/Analysis/CostModel/LoongArch/vector-extract.ll
new file mode 100644
index 0000000000000..f184f5b155842
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/LoongArch/vector-extract.ll
@@ -0,0 +1,378 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lsx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LSX
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lasx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LASX
+
+define i32 @extract_double(i32 %arg) {
+; LSX-LABEL: 'extract_double'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_a = extractelement <2 x double> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_0 = extractelement <2 x double> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_1 = extractelement <2 x double> poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4f64_a = extractelement <4 x double> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v4f64_0 = extractelement <4 x double> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v4f64_3 = extractelement <4 x double> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'extract_double'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_a = extractelement <2 x double> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_0 = extractelement <2 x double> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_1 = extractelement <2 x double> poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4f64_a = extractelement <4 x double> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v4f64_0 = extractelement <4 x double> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v4f64_3 = extractelement <4 x double> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2f64_a = extractelement <2 x double> poison, i32 %arg
+  %v2f64_0 = extractelement <2 x double> poison, i32 0
+  %v2f64_1 = extractelement <2 x double> poison, i32 1
+
+  %v4f64_a = extractelement <4 x double> poison, i32 %arg
+  %v4f64_0 = extractelement <4 x double> poison, i32 0
+  %v4f64_3 = extractelement <4 x double> poison, i32 3
+
+  ret i32 poison
+}
+
+define i32 @extract_float(i32 %arg) {
+; LSX-LABEL: 'extract_float'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_a = extractelement <2 x float> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_0 = extractelement <2 x float> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_1 = extractelement <2 x float> poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_a = extractelement <4 x float> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_0 = extractelement <4 x float> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_3 = extractelement <4 x float> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8f32_a = extractelement <8 x float> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_0 = extractelement <8 x float> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_3 = extractelement <8 x float> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_4 = extractelement <8 x float> poison, i32 4
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_7 = extractelement <8 x float> poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'extract_float'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_a = extractelement <2 x float> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_0 = extractelement <2 x float> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_1 = extractelement <2 x float> poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_a = extractelement <4 x float> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_0 = extractelement <4 x float> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_3 = extractelement <4 x float> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8f32_a = extractelement <8 x float> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_0 = extractelement <8 x float> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_3 = extractelement <8 x float> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_4 = extractelement <8 x float> poison, i32 4
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_7 = extractelement <8 x float> poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2f32_a = extractelement <2 x float> poison, i32 %arg
+  %v2f32_0 = extractelement <2 x float> poison, i32 0
+  %v2f32_1 = extractelement <2 x float> poison, i32 1
+
+  %v4f32_a = extractelement <4 x float> poison, i32 %arg
+  %v4f32_0 = extractelement <4 x float> poison, i32 0
+  %v4f32_3 = extractelement <4 x float> poison, i32 3
+
+  %v8f32_a = extractelement <8 x float> poison, i32 %arg
+  %v8f32_0 = extractelement <8 x float> poison, i32 0
+  %v8f32_3 = extractelement <8 x float> poison, i32 3
+  %v8f32_4 = extractelement <8 x float> poison, i32 4
+  %v8f32_7 = extractelement <8 x float> poison, i32 7
+
+  ret i32 poison
+}
+
+define i32 @extract_i64(i32 %arg) {
+; LSX-LABEL: 'extract_i64'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i64_a = extractelement <2 x i64> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i64_0 = extractelement <2 x i64> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i64_1 = extractelement <2 x i64> poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i64_a = extractelement <4 x i64> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v4i64_0 = extractelement <4 x i64> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v4i64_3 = extractelement <4 x i64> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'extract_i64'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i64_a = extractelement <2 x i64> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i64_0 = extractelement <2 x i64> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i64_1 = extractelement <2 x i64> poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i64_a = extractelement <4 x i64> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:5 SizeLat:1 for: %v4i64_0 = extractelement <4 x i64> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:6 SizeLat:2 for: %v4i64_3 = extractelement <4 x i64> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i64_a = extractelement <2 x i64> poison, i32 %arg
+  %v2i64_0 = extractelement <2 x i64> poison, i32 0
+  %v2i64_1 = extractelement <2 x i64> poison, i32 1
+
+  %v4i64_a = extractelement <4 x i64> poison, i32 %arg
+  %v4i64_0 = extractelement <4 x i64> poison, i32 0
+  %v4i64_3 = extractelement <4 x i64> poison, i32 3
+
+  ret i32 poison
+}
+
+define i32 @extract_i32(i32 %arg) {
+; LSX-LABEL: 'extract_i32'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i32_a = extractelement <2 x i32> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i32_0 = extractelement <2 x i32> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i32_1 = extractelement <2 x i32> poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i32_a = extractelement <4 x i32> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i32_0 = extractelement <4 x i32> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i32_3 = extractelement <4 x i32> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8i32_a = extractelement <8 x i32> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v8i32_0 = extractelement <8 x i32> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v8i32_3 = extractelement <8 x i32> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v8i32_4 = extractelement <8 x i32> poison, i32 4
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v8i32_7 = extractelement <8 x i32> poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v16i32_a = extractelement <16 x i32> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:16 CodeSize:1 Lat:12 SizeLat:1 for: %v16i32_0 = extractelement <16 x i32> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:16 CodeSize:1 Lat:12 SizeLat:1 for: %v16i32_3 = extractelement <16 x i32> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of RThru:16 CodeSize:1 Lat:12 SizeLat:1 for: %v16i32_8 = extractelement <16 x i32> poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:16 CodeSize:1 Lat:12 SizeLat:1 for: %v16i32_15 = extractelement <16 x i32> poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'extract_i32'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i32_a = extractelement <2 x i32> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i32_0 = extractelement <2 x i32> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i32_1 = extractelement <2 x i32> poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i32_a = extractelement <4 x i32> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i32_0 = extractelement <4 x i32> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i32_3 = extractelement <4 x i32> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8i32_a = extractelement <8 x i32> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:5 SizeLat:1 for: %v8i32_0 = extractelement <8 x i32> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:5 SizeLat:1 for: %v8i32_3 = extractelement <8 x i32> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:6 SizeLat:2 for: %v8i32_4 = extractelement <8 x i32> poison, i32 4
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:6 SizeLat:2 for: %v8i32_7 = extractelement <8 x i32> poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v16i32_a = extractelement <16 x i32> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:10 SizeLat:1 for: %v16i32_0 = extractelement <16 x i32> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:10 SizeLat:1 for: %v16i32_3 = extractelement <16 x i32> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:10 SizeLat:1 for: %v16i32_8 = extractelement <16 x i32> poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:9 CodeSize:2 Lat:11 SizeLat:2 for: %v16i32_15 = extractelement <16 x i32> poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i32_a = extractelement <2 x i32> poison, i32 %arg
+  %v2i32_0 = extractelement <2 x i32> poison, i32 0
+  %v2i32_1 = extractelement <2 x i32> poison, i32 1
+
+  %v4i32_a = extractelement <4 x i32> poison, i32 %arg
+  %v4i32_0 = extractelement <4 x i32> poison, i32 0
+  %v4i32_3 = extractelement <4 x i32> poison, i32 3
+
+  %v8i32_a = extractelement <8 x i32> poison, i32 %arg
+  %v8i32_0 = extractelement <8 x i32> poison, i32 0
+  %v8i32_3 = extractelement <8 x i32> poison, i32 3
+  %v8i32_4 = extractelement <8 x i32> poison, i32 4
+  %v8i32_7 = extractelement <8 x i32> poison, i32 7
+
+  %v16i32_a = extractelement <16 x i32> poison, i32 %arg
+  %v16i32_0 = extractelement <16 x i32> poison, i32 0
+  %v16i32_3 = extractelement <16 x i32> poison, i32 3
+  %v16i32_8 = extractelement <16 x i32> poison, i32 8
+  %v16i32_15 = extractelement <16 x i32> poison, i32 15
+
+  ret i32 poison
+}
+
+define i32 @extract_i16(i32 %arg) {
+; LSX-LABEL: 'extract_i16'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i16_a = extractelement <2 x i16> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i16_0 = extractelement <2 x i16> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i16_1 = extractelement <2 x i16> poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i16_a = extractelement <4 x i16> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i16_0 = extractelement <4 x i16> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i16_3 = extractelement <4 x i16> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8i16_a = extractelement <8 x i16> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i16_0 = extractelement <8 x i16> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i16_7 = extractelement <8 x i16> poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v16i16_a = extractelement <16 x i16> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v16i16_0 = extractelement <16 x i16> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v16i16_7 = extractelement <16 x i16> poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v16i16_8 = extractelement <16 x i16> poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v16i16_15 = extractelement <16 x i16> poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'extract_i16'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i16_a = extractelement <2 x i16> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i16_0 = extractelement <2 x i16> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i16_1 = extractelement <2 x i16> poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i16_a = extractelement <4 x i16> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i16_0 = extractelement <4 x i16> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i16_3 = extractelement <4 x i16> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8i16_a = extractelement <8 x i16> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i16_0 = extractelement <8 x i16> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i16_7 = extractelement <8 x i16> poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v16i16_a = extractelement <16 x i16> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i16_0 = extractelement <16 x i16> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i16_7 = extractelement <16 x i16> poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:4 SizeLat:2 for: %v16i16_8 = extractelement <16 x i16> poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:4 SizeLat:2 for: %v16i16_15 = extractelement <16 x i16> poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i16_a = extractelement <2 x i16> poison, i32 %arg
+  %v2i16_0 = extractelement <2 x i16> poison, i32 0
+  %v2i16_1 = extractelement <2 x i16> poison, i32 1
+
+  %v4i16_a = extractelement <4 x i16> poison, i32 %arg
+  %v4i16_0 = extractelement <4 x i16> poison, i32 0
+  %v4i16_3 = extractelement <4 x i16> poison, i32 3
+
+  %v8i16_a = extractelement <8 x i16> poison, i32 %arg
+  %v8i16_0 = extractelement <8 x i16> poison, i32 0
+  %v8i16_7 = extractelement <8 x i16> poison, i32 7
+
+  %v16i16_a = extractelement <16 x i16> poison, i32 %arg
+  %v16i16_0 = extractelement <16 x i16> poison, i32 0
+  %v16i16_7 = extractelement <16 x i16> poison, i32 7
+  %v16i16_8 = extractelement <16 x i16> poison, i32 8
+  %v16i16_15 = extractelement <16 x i16> poison, i32 15
+
+  ret i32 poison
+}
+
+define i32 @extract_i8(i32 %arg) {
+; LSX-LABEL: 'extract_i8'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i8_a = extractelement <2 x i8> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i8_0 = extractelement <2 x i8> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i8_1 = extractelement <2 x i8> poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i8_a = extractelement <4 x i8> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i8_0 = extractelement <4 x i8> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i8_3 = extractelement <4 x i8> poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8i8_a = extractelement <8 x i8> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i8_0 = extractelement <8 x i8> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i8_7 = extractelement <8 x i8> poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v16i8_a = extractelement <16 x i8> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_0 = extractelement <16 x i8> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_8 = extractelement <16 x i8> poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_15 = extractelement <16 x i8> poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v32i8_a = extractelement <32 x i8> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_0 = extractelement <32 x i8> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_7 = extractelement <32 x i8> poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_8 = extractelement <32 x i8> poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_15 = extractelement <32 x i8> poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_24 = extractelement <32 x i8> poison, i32 24
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_31 = extractelement <32 x i8> poison, i32 31
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'extract_i8'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i8_a = extractelement <2 x i8> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i8_0 = extractelement <2 x i8> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i8_1 = extractelement <2 x i8> poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i8_a = extractelement <4 x i8> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i8_0 = extractelement <4 x i8> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i8_3 = extractelement <4 x i8> poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8i8_a = extractelement <8 x i8> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i8_0 = extractelement <8 x i8> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i8_7 = extractelement <8 x i8> poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v16i8_a = extractelement <16 x i8> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_0 = extractelement <16 x i8> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_8 = extractelement <16 x i8> poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_15 = extractelement <16 x i8> poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v32i8_a = extractelement <32 x i8> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i8_0 = extractelement <32 x i8> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i8_7 = extractelement <32 x i8> poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i8_8 = extractelement <32 x i8> poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i8_15 = extractelement <32 x i8> poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:4 SizeLat:2 for: %v32i8_24 = extractelement <32 x i8> poison, i32 24
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:4 SizeLat:2 for: %v32i8_31 = extractelement <32 x i8> poison, i32 31
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i8_a = extractelement <2 x i8> poison, i32 %arg
+  %v2i8_0 = extractelement <2 x i8> poison, i32 0
+  %v2i8_1 = extractelement <2 x i8> poison, i32 1
+
+  %v4i8_a = extractelement <4 x i8> poison, i32 %arg
+  %v4i8_0 = extractelement <4 x i8> poison, i32 0
+  %v4i8_3 = extractelement <4 x i8> poison, i32 3
+
+  %v8i8_a = extractelement <8 x i8> poison, i32 %arg
+  %v8i8_0 = extractelement <8 x i8> poison, i32 0
+  %v8i8_7 = extractelement <8 x i8> poison, i32 7
+
+  %v16i8_a = extractelement <16 x i8> poison, i32 %arg
+  %v16i8_0 = extractelement <16 x i8> poison, i32 0
+  %v16i8_8 = extractelement <16 x i8> poison, i32 8
+  %v16i8_15 = extractelement <16 x i8> poison, i32 15
+
+  %v32i8_a = extractelement <32 x i8> poison, i32 %arg
+  %v32i8_0 = extractelement <32 x i8> poison, i32 0
+  %v32i8_7 = extractelement <32 x i8> poison, i32 7
+  %v32i8_8 = extractelement <32 x i8> poison, i32 8
+  %v32i8_15 = extractelement <32 x i8> poison, i32 15
+  %v32i8_24 = extractelement <32 x i8> poison, i32 24
+  %v32i8_31 = extractelement <32 x i8> poison, i32 31
+
+  ret i32 poison
+}
+
+define i32 @extract_i1(i32 %arg) {
+; LSX-LABEL: 'extract_i1'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i1_a = extractelement <2 x i1> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i1_0 = extractelement <2 x i1> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i1_1 = extractelement <2 x i1> poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i1_a = extractelement <4 x i1> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i1_0 = extractelement <4 x i1> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i1_2 = extractelement <4 x i1> poison, i32 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8i1_a = extractelement <8 x i1> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i1_0 = extractelement <8 x i1> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i1_4 = extractelement <8 x i1> poison, i32 4
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v16i1_a = extractelement <16 x i1> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_0 = extractelement <16 x i1> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_8 = extractelement <16 x i1> poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_15 = extractelement <16 x i1> poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v32i1_a = extractelement <32 x i1> poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_0 = extractelement <32 x i1> poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_7 = extractelement <32 x i1> poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_8 = extractelement <32 x i1> poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_15 = extractelement <32 x i1> poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_24 = extractelement <32 x i1> poison, i32 24
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_31 = extractelement <32 x i1> poison, i32 31
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'extract_i1'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i1_a = extractelement <2 x i1> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i1_0 = extractelement <2 x i1> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i1_1 = extractelement <2 x i1> poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i1_a = extractelement <4 x i1> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i1_0 = extractelement <4 x i1> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i1_2 = extractelement <4 x i1> poison, i32 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8i1_a = extractelement <8 x i1> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i1_0 = extractelement <8 x i1> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i1_4 = extractelement <8 x i1> poison, i32 4
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v16i1_a = extractelement <16 x i1> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_0 = extractelement <16 x i1> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_8 = extractelement <16 x i1> poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_15 = extractelement <16 x i1> poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v32i1_a = extractelement <32 x i1> poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i1_0 = extractelement <32 x i1> poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i1_7 = extractelement <32 x i1> poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i1_8 = extractelement <32 x i1> poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i1_15 = extractelement <32 x i1> poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:4 SizeLat:2 for: %v32i1_24 = extractelement <32 x i1> poison, i32 24
+; LASX-NEXT:  Cost Model: Found costs of RThru:5 CodeSize:2 Lat:4 SizeLat:2 for: %v32i1_31 = extractelement <32 x i1> poison, i32 31
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i1_a = extractelement <2 x i1> poison, i32 %arg
+  %v2i1_0 = extractelement <2 x i1> poison, i32 0
+  %v2i1_1 = extractelement <2 x i1> poison, i32 1
+
+  %v4i1_a = extractelement <4 x i1> poison, i32 %arg
+  %v4i1_0 = extractelement <4 x i1> poison, i32 0
+  %v4i1_2 = extractelement <4 x i1> poison, i32 2
+
+  %v8i1_a = extractelement <8 x i1> poison, i32 %arg
+  %v8i1_0 = extractelement <8 x i1> poison, i32 0
+  %v8i1_4 = extractelement <8 x i1> poison, i32 4
+
+  %v16i1_a = extractelement <16 x i1> poison, i32 %arg
+  %v16i1_0 = extractelement <16 x i1> poison, i32 0
+  %v16i1_8 = extractelement <16 x i1> poison, i32 8
+  %v16i1_15 = extractelement <16 x i1> poison, i32 15
+
+  %v32i1_a = extractelement <32 x i1> poison, i32 %arg
+  %v32i1_0 = extractelement <32 x i1> poison, i32 0
+  %v32i1_7 = extractelement <32 x i1> poison, i32 7
+  %v32i1_8 = extractelement <32 x i1> poison, i32 8
+  %v32i1_15 = extractelement <32 x i1> poison, i32 15
+  %v32i1_24 = extractelement <32 x i1> poison, i32 24
+  %v32i1_31 = extractelement <32 x i1> poison, i32 31
+
+  ret i32 poison
+}
diff --git a/llvm/test/Analysis/CostModel/LoongArch/vector-insert.ll b/llvm/test/Analysis/CostModel/LoongArch/vector-insert.ll
new file mode 100644
index 0000000000000..c91a946739ba8
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/LoongArch/vector-insert.ll
@@ -0,0 +1,362 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lsx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LSX
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lasx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LASX
+
+define i32 @insert_double(i32 %arg) {
+; LSX-LABEL: 'insert_double'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_a = insertelement <2 x double> poison, double poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_0 = insertelement <2 x double> poison, double poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_1 = insertelement <2 x double> poison, double poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4f64_a = insertelement <4 x double> poison, double poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v4f64_0 = insertelement <4 x double> poison, double poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v4f64_3 = insertelement <4 x double> poison, double poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'insert_double'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_a = insertelement <2 x double> poison, double poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_0 = insertelement <2 x double> poison, double poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f64_1 = insertelement <2 x double> poison, double poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4f64_a = insertelement <4 x double> poison, double poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v4f64_0 = insertelement <4 x double> poison, double poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v4f64_3 = insertelement <4 x double> poison, double poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2f64_a = insertelement <2 x double> poison, double poison, i32 %arg
+  %v2f64_0 = insertelement <2 x double> poison, double poison, i32 0
+  %v2f64_1 = insertelement <2 x double> poison, double poison, i32 1
+
+  %v4f64_a = insertelement <4 x double> poison, double poison, i32 %arg
+  %v4f64_0 = insertelement <4 x double> poison, double poison, i32 0
+  %v4f64_3 = insertelement <4 x double> poison, double poison, i32 3
+
+  ret i32 poison
+}
+
+define i32 @insert_float(i32 %arg) {
+; LSX-LABEL: 'insert_float'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_a = insertelement <2 x float> poison, float poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_0 = insertelement <2 x float> poison, float poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_1 = insertelement <2 x float> poison, float poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_a = insertelement <4 x float> poison, float poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_0 = insertelement <4 x float> poison, float poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_3 = insertelement <4 x float> poison, float poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8f32_a = insertelement <8 x float> poison, float poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_0 = insertelement <8 x float> poison, float poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_3 = insertelement <8 x float> poison, float poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_4 = insertelement <8 x float> poison, float poison, i32 4
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:1 for: %v8f32_7 = insertelement <8 x float> poison, float poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'insert_float'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_a = insertelement <2 x float> poison, float poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_0 = insertelement <2 x float> poison, float poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2f32_1 = insertelement <2 x float> poison, float poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_a = insertelement <4 x float> poison, float poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_0 = insertelement <4 x float> poison, float poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4f32_3 = insertelement <4 x float> poison, float poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8f32_a = insertelement <8 x float> poison, float poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v8f32_0 = insertelement <8 x float> poison, float poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v8f32_3 = insertelement <8 x float> poison, float poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v8f32_4 = insertelement <8 x float> poison, float poison, i32 4
+; LASX-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v8f32_7 = insertelement <8 x float> poison, float poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2f32_a = insertelement <2 x float> poison, float poison, i32 %arg
+  %v2f32_0 = insertelement <2 x float> poison, float poison, i32 0
+  %v2f32_1 = insertelement <2 x float> poison, float poison, i32 1
+
+  %v4f32_a = insertelement <4 x float> poison, float poison, i32 %arg
+  %v4f32_0 = insertelement <4 x float> poison, float poison, i32 0
+  %v4f32_3 = insertelement <4 x float> poison, float poison, i32 3
+
+  %v8f32_a = insertelement <8 x float> poison, float poison, i32 %arg
+  %v8f32_0 = insertelement <8 x float> poison, float poison, i32 0
+  %v8f32_3 = insertelement <8 x float> poison, float poison, i32 3
+  %v8f32_4 = insertelement <8 x float> poison, float poison, i32 4
+  %v8f32_7 = insertelement <8 x float> poison, float poison, i32 7
+
+  ret i32 poison
+}
+
+define i32 @insert_i64(i32 %arg) {
+; LSX-LABEL: 'insert_i64'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i64_a = insertelement <2 x i64> poison, i64 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i64_0 = insertelement <2 x i64> poison, i64 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i64_1 = insertelement <2 x i64> poison, i64 poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i64_a = insertelement <4 x i64> poison, i64 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v4i64_0 = insertelement <4 x i64> poison, i64 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v4i64_3 = insertelement <4 x i64> poison, i64 poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'insert_i64'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i64_a = insertelement <2 x i64> poison, i64 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i64_0 = insertelement <2 x i64> poison, i64 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i64_1 = insertelement <2 x i64> poison, i64 poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i64_a = insertelement <4 x i64> poison, i64 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:4 SizeLat:1 for: %v4i64_0 = insertelement <4 x i64> poison, i64 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:6 SizeLat:3 for: %v4i64_3 = insertelement <4 x i64> poison, i64 poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i64_a = insertelement <2 x i64> poison, i64 poison, i32 %arg
+  %v2i64_0 = insertelement <2 x i64> poison, i64 poison, i32 0
+  %v2i64_1 = insertelement <2 x i64> poison, i64 poison, i32 1
+
+  %v4i64_a = insertelement <4 x i64> poison, i64 poison, i32 %arg
+  %v4i64_0 = insertelement <4 x i64> poison, i64 poison, i32 0
+  %v4i64_3 = insertelement <4 x i64> poison, i64 poison, i32 3
+
+  ret i32 poison
+}
+
+define i32 @insert_i32(i32 %arg) {
+; LSX-LABEL: 'insert_i32'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i32_a = insertelement <2 x i32> poison, i32 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i32_0 = insertelement <2 x i32> poison, i32 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i32_1 = insertelement <2 x i32> poison, i32 poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i32_a = insertelement <4 x i32> poison, i32 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i32_0 = insertelement <4 x i32> poison, i32 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i32_3 = insertelement <4 x i32> poison, i32 poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8i32_a = insertelement <8 x i32> poison, i32 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v8i32_0 = insertelement <8 x i32> poison, i32 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v8i32_3 = insertelement <8 x i32> poison, i32 poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v8i32_4 = insertelement <8 x i32> poison, i32 poison, i32 4
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v8i32_7 = insertelement <8 x i32> poison, i32 poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'insert_i32'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i32_a = insertelement <2 x i32> poison, i32 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i32_0 = insertelement <2 x i32> poison, i32 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i32_1 = insertelement <2 x i32> poison, i32 poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i32_a = insertelement <4 x i32> poison, i32 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i32_0 = insertelement <4 x i32> poison, i32 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i32_3 = insertelement <4 x i32> poison, i32 poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8i32_a = insertelement <8 x i32> poison, i32 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:4 SizeLat:1 for: %v8i32_0 = insertelement <8 x i32> poison, i32 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:4 SizeLat:1 for: %v8i32_3 = insertelement <8 x i32> poison, i32 poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:6 SizeLat:3 for: %v8i32_4 = insertelement <8 x i32> poison, i32 poison, i32 4
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:6 SizeLat:3 for: %v8i32_7 = insertelement <8 x i32> poison, i32 poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i32_a = insertelement <2 x i32> poison, i32 poison, i32 %arg
+  %v2i32_0 = insertelement <2 x i32> poison, i32 poison, i32 0
+  %v2i32_1 = insertelement <2 x i32> poison, i32 poison, i32 1
+
+  %v4i32_a = insertelement <4 x i32> poison, i32 poison, i32 %arg
+  %v4i32_0 = insertelement <4 x i32> poison, i32 poison, i32 0
+  %v4i32_3 = insertelement <4 x i32> poison, i32 poison, i32 3
+
+  %v8i32_a = insertelement <8 x i32> poison, i32 poison, i32 %arg
+  %v8i32_0 = insertelement <8 x i32> poison, i32 poison, i32 0
+  %v8i32_3 = insertelement <8 x i32> poison, i32 poison, i32 3
+  %v8i32_4 = insertelement <8 x i32> poison, i32 poison, i32 4
+  %v8i32_7 = insertelement <8 x i32> poison, i32 poison, i32 7
+
+  ret i32 poison
+}
+
+define i32 @insert_i16(i32 %arg) {
+; LSX-LABEL: 'insert_i16'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i16_a = insertelement <2 x i16> poison, i16 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i16_0 = insertelement <2 x i16> poison, i16 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i16_1 = insertelement <2 x i16> poison, i16 poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i16_a = insertelement <4 x i16> poison, i16 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i16_0 = insertelement <4 x i16> poison, i16 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i16_3 = insertelement <4 x i16> poison, i16 poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8i16_a = insertelement <8 x i16> poison, i16 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i16_0 = insertelement <8 x i16> poison, i16 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i16_7 = insertelement <8 x i16> poison, i16 poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v16i16_a = insertelement <16 x i16> poison, i16 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v16i16_0 = insertelement <16 x i16> poison, i16 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v16i16_7 = insertelement <16 x i16> poison, i16 poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v16i16_8 = insertelement <16 x i16> poison, i16 poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v16i16_15 = insertelement <16 x i16> poison, i16 poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'insert_i16'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i16_a = insertelement <2 x i16> poison, i16 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i16_0 = insertelement <2 x i16> poison, i16 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i16_1 = insertelement <2 x i16> poison, i16 poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i16_a = insertelement <4 x i16> poison, i16 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i16_0 = insertelement <4 x i16> poison, i16 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i16_3 = insertelement <4 x i16> poison, i16 poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8i16_a = insertelement <8 x i16> poison, i16 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i16_0 = insertelement <8 x i16> poison, i16 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i16_7 = insertelement <8 x i16> poison, i16 poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v16i16_a = insertelement <16 x i16> poison, i16 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i16_0 = insertelement <16 x i16> poison, i16 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i16_7 = insertelement <16 x i16> poison, i16 poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:5 SizeLat:3 for: %v16i16_8 = insertelement <16 x i16> poison, i16 poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:5 SizeLat:3 for: %v16i16_15 = insertelement <16 x i16> poison, i16 poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i16_a = insertelement <2 x i16> poison, i16 poison, i32 %arg
+  %v2i16_0 = insertelement <2 x i16> poison, i16 poison, i32 0
+  %v2i16_1 = insertelement <2 x i16> poison, i16 poison, i32 1
+
+  %v4i16_a = insertelement <4 x i16> poison, i16 poison, i32 %arg
+  %v4i16_0 = insertelement <4 x i16> poison, i16 poison, i32 0
+  %v4i16_3 = insertelement <4 x i16> poison, i16 poison, i32 3
+
+  %v8i16_a = insertelement <8 x i16> poison, i16 poison, i32 %arg
+  %v8i16_0 = insertelement <8 x i16> poison, i16 poison, i32 0
+  %v8i16_7 = insertelement <8 x i16> poison, i16 poison, i32 7
+
+  %v16i16_a  = insertelement <16 x i16> poison, i16 poison, i32 %arg
+  %v16i16_0  = insertelement <16 x i16> poison, i16 poison, i32 0
+  %v16i16_7  = insertelement <16 x i16> poison, i16 poison, i32 7
+  %v16i16_8  = insertelement <16 x i16> poison, i16 poison, i32 8
+  %v16i16_15 = insertelement <16 x i16> poison, i16 poison, i32 15
+
+  ret i32 poison
+}
+
+define i32 @insert_i8(i32 %arg) {
+; LSX-LABEL: 'insert_i8'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i8_a = insertelement <2 x i8> poison, i8 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i8_0 = insertelement <2 x i8> poison, i8 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i8_3 = insertelement <2 x i8> poison, i8 poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i8_a = insertelement <4 x i8> poison, i8 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i8_0 = insertelement <4 x i8> poison, i8 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i8_3 = insertelement <4 x i8> poison, i8 poison, i32 3
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8i8_a = insertelement <8 x i8> poison, i8 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i8_0 = insertelement <8 x i8> poison, i8 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i8_7 = insertelement <8 x i8> poison, i8 poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v16i8_a = insertelement <16 x i8> poison, i8 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_0 = insertelement <16 x i8> poison, i8 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_8 = insertelement <16 x i8> poison, i8 poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_15 = insertelement <16 x i8> poison, i8 poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v32i8_a = insertelement <32 x i8> poison, i8 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_0 = insertelement <32 x i8> poison, i8 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_7 = insertelement <32 x i8> poison, i8 poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_8 = insertelement <32 x i8> poison, i8 poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_15 = insertelement <32 x i8> poison, i8 poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_24 = insertelement <32 x i8> poison, i8 poison, i32 24
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i8_31 = insertelement <32 x i8> poison, i8 poison, i32 31
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'insert_i8'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i8_a = insertelement <2 x i8> poison, i8 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i8_0 = insertelement <2 x i8> poison, i8 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i8_3 = insertelement <2 x i8> poison, i8 poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i8_a = insertelement <4 x i8> poison, i8 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i8_0 = insertelement <4 x i8> poison, i8 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i8_3 = insertelement <4 x i8> poison, i8 poison, i32 3
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8i8_a = insertelement <8 x i8> poison, i8 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i8_0 = insertelement <8 x i8> poison, i8 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i8_7 = insertelement <8 x i8> poison, i8 poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v16i8_a = insertelement <16 x i8> poison, i8 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_0 = insertelement <16 x i8> poison, i8 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_8 = insertelement <16 x i8> poison, i8 poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i8_15 = insertelement <16 x i8> poison, i8 poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v32i8_a = insertelement <32 x i8> poison, i8 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i8_0 = insertelement <32 x i8> poison, i8 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i8_7 = insertelement <32 x i8> poison, i8 poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i8_8 = insertelement <32 x i8> poison, i8 poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i8_15 = insertelement <32 x i8> poison, i8 poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:5 SizeLat:3 for: %v32i8_24 = insertelement <32 x i8> poison, i8 poison, i32 24
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:5 SizeLat:3 for: %v32i8_31 = insertelement <32 x i8> poison, i8 poison, i32 31
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i8_a   = insertelement <2 x i8> poison, i8 poison, i32 %arg
+  %v2i8_0   = insertelement <2 x i8> poison, i8 poison, i32 0
+  %v2i8_3   = insertelement <2 x i8> poison, i8 poison, i32 1
+
+  %v4i8_a   = insertelement <4 x i8> poison, i8 poison, i32 %arg
+  %v4i8_0   = insertelement <4 x i8> poison, i8 poison, i32 0
+  %v4i8_3   = insertelement <4 x i8> poison, i8 poison, i32 3
+
+  %v8i8_a   = insertelement <8 x i8> poison, i8 poison, i32 %arg
+  %v8i8_0   = insertelement <8 x i8> poison, i8 poison, i32 0
+  %v8i8_7   = insertelement <8 x i8> poison, i8 poison, i32 7
+
+  %v16i8_a  = insertelement <16 x i8> poison, i8 poison, i32 %arg
+  %v16i8_0  = insertelement <16 x i8> poison, i8 poison, i32 0
+  %v16i8_8  = insertelement <16 x i8> poison, i8 poison, i32 8
+  %v16i8_15 = insertelement <16 x i8> poison, i8 poison, i32 15
+
+  %v32i8_a  = insertelement <32 x i8> poison, i8 poison, i32 %arg
+  %v32i8_0  = insertelement <32 x i8> poison, i8 poison, i32 0
+  %v32i8_7  = insertelement <32 x i8> poison, i8 poison, i32 7
+  %v32i8_8  = insertelement <32 x i8> poison, i8 poison, i32 8
+  %v32i8_15 = insertelement <32 x i8> poison, i8 poison, i32 15
+  %v32i8_24 = insertelement <32 x i8> poison, i8 poison, i32 24
+  %v32i8_31 = insertelement <32 x i8> poison, i8 poison, i32 31
+
+  ret i32 poison
+}
+
+define i32 @insert_i1(i32 %arg) {
+; LSX-LABEL: 'insert_i1'
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v2i1_a = insertelement <2 x i1> poison, i1 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i1_0 = insertelement <2 x i1> poison, i1 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i1_1 = insertelement <2 x i1> poison, i1 poison, i32 1
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v4i1_a = insertelement <4 x i1> poison, i1 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i1_0 = insertelement <4 x i1> poison, i1 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i1_2 = insertelement <4 x i1> poison, i1 poison, i32 2
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v8i1_a = insertelement <8 x i1> poison, i1 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i1_0 = insertelement <8 x i1> poison, i1 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i1_4 = insertelement <8 x i1> poison, i1 poison, i32 4
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v16i1_a = insertelement <16 x i1> poison, i1 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_0 = insertelement <16 x i1> poison, i1 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_8 = insertelement <16 x i1> poison, i1 poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_15 = insertelement <16 x i1> poison, i1 poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of 1 for: %v32i1_a = insertelement <32 x i1> poison, i1 poison, i32 %arg
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_0 = insertelement <32 x i1> poison, i1 poison, i32 0
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_7 = insertelement <32 x i1> poison, i1 poison, i32 7
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_8 = insertelement <32 x i1> poison, i1 poison, i32 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_15 = insertelement <32 x i1> poison, i1 poison, i32 15
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_24 = insertelement <32 x i1> poison, i1 poison, i32 24
+; LSX-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:1 Lat:6 SizeLat:1 for: %v32i1_31 = insertelement <32 x i1> poison, i1 poison, i32 31
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'insert_i1'
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v2i1_a = insertelement <2 x i1> poison, i1 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i1_0 = insertelement <2 x i1> poison, i1 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v2i1_1 = insertelement <2 x i1> poison, i1 poison, i32 1
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v4i1_a = insertelement <4 x i1> poison, i1 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i1_0 = insertelement <4 x i1> poison, i1 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v4i1_2 = insertelement <4 x i1> poison, i1 poison, i32 2
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v8i1_a = insertelement <8 x i1> poison, i1 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i1_0 = insertelement <8 x i1> poison, i1 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v8i1_4 = insertelement <8 x i1> poison, i1 poison, i32 4
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v16i1_a = insertelement <16 x i1> poison, i1 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_0 = insertelement <16 x i1> poison, i1 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_8 = insertelement <16 x i1> poison, i1 poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v16i1_15 = insertelement <16 x i1> poison, i1 poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of 1 for: %v32i1_a = insertelement <32 x i1> poison, i1 poison, i32 %arg
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i1_0 = insertelement <32 x i1> poison, i1 poison, i32 0
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i1_7 = insertelement <32 x i1> poison, i1 poison, i32 7
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i1_8 = insertelement <32 x i1> poison, i1 poison, i32 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:1 Lat:3 SizeLat:1 for: %v32i1_15 = insertelement <32 x i1> poison, i1 poison, i32 15
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:5 SizeLat:3 for: %v32i1_24 = insertelement <32 x i1> poison, i1 poison, i32 24
+; LASX-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:3 Lat:5 SizeLat:3 for: %v32i1_31 = insertelement <32 x i1> poison, i1 poison, i32 31
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  %v2i1_a  = insertelement <2 x i1> poison, i1 poison, i32 %arg
+  %v2i1_0  = insertelement <2 x i1> poison, i1 poison, i32 0
+  %v2i1_1  = insertelement <2 x i1> poison, i1 poison, i32 1
+
+  %v4i1_a  = insertelement <4 x i1> poison, i1 poison, i32 %arg
+  %v4i1_0  = insertelement <4 x i1> poison, i1 poison, i32 0
+  %v4i1_2  = insertelement <4 x i1> poison, i1 poison, i32 2
+
+  %v8i1_a  = insertelement <8 x i1> poison, i1 poison, i32 %arg
+  %v8i1_0  = insertelement <8 x i1> poison, i1 poison, i32 0
+  %v8i1_4  = insertelement <8 x i1> poison, i1 poison, i32 4
+
+  %v16i1_a  = insertelement <16 x i1> poison, i1 poison, i32 %arg
+  %v16i1_0  = insertelement <16 x i1> poison, i1 poison, i32 0
+  %v16i1_8  = insertelement <16 x i1> poison, i1 poison, i32 8
+  %v16i1_15 = insertelement <16 x i1> poison, i1 poison, i32 15
+
+  %v32i1_a  = insertelement <32 x i1> poison, i1 poison, i32 %arg
+  %v32i1_0  = insertelement <32 x i1> poison, i1 poison, i32 0
+  %v32i1_7  = insertelement <32 x i1> poison, i1 poison, i32 7
+  %v32i1_8  = insertelement <32 x i1> poison, i1 poison, i32 8
+  %v32i1_15 = insertelement <32 x i1> poison, i1 poison, i32 15
+  %v32i1_24 = insertelement <32 x i1> poison, i1 poison, i32 24
+  %v32i1_31 = insertelement <32 x i1> poison, i1 poison, i32 31
+
+  ret i32 poison
+}

>From 0bd0d3c9dc1763665a710f19cc2f5ec396ab612d Mon Sep 17 00:00:00 2001
From: tangaac <tangyan01 at loongson.cn>
Date: Wed, 29 Oct 2025 16:51:58 +0800
Subject: [PATCH 3/3] Support getMemoryOpCost

---
 .../llvm/Analysis/TargetTransformInfoImpl.h   |   3 -
 .../LoongArchTargetTransformInfo.cpp          |  25 +++
 .../LoongArch/LoongArchTargetTransformInfo.h  |   5 +
 .../CostModel/LoongArch/load-store.ll         | 144 ++++++++++++++++++
 4 files changed, 174 insertions(+), 3 deletions(-)
 create mode 100644 llvm/test/Analysis/CostModel/LoongArch/load-store.ll

diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index 4cd607c0d0c8d..386bdb3cf5875 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -1473,9 +1473,6 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
                                         OpInfo, I);
     }
     case Instruction::Load: {
-      // FIXME: Arbitary cost which could come from the backend.
-      if (CostKind == TTI::TCK_Latency)
-        return 4;
       auto *LI = cast<LoadInst>(U);
       Type *LoadType = U->getType();
       // If there is a non-register sized type, the cost estimation may expand
diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
index 93a4685fcaa0f..c4aacc93446cd 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
@@ -514,4 +514,29 @@ InstructionCost LoongArchTTIImpl::getVectorInstrCost(
          RegisterFileMoveCost;
 }
 
+InstructionCost LoongArchTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
+                                                  Align Alignment,
+                                                  unsigned AddressSpace,
+                                                  TTI::TargetCostKind CostKind,
+                                                  TTI::OperandValueInfo OpInfo,
+                                                  const Instruction *I) const {
+
+  // Legalize the type.
+  std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Src);
+
+  switch (CostKind) {
+  default:
+    return BaseT::getMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
+                                  CostKind, OpInfo, I);
+  case TTI::TCK_RecipThroughput:
+    return 2 * LT.first;
+  case TTI::TCK_Latency:
+    unsigned Cost = 4;
+    if (Src->isFloatingPointTy() || Src->isVectorTy()) {
+      Cost += 1;
+    }
+    return Cost * LT.first;
+  }
+}
+
 // TODO: Implement more hooks to provide TTI machinery for LoongArch.
diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
index ab575ef7fe4ba..24d9133680b4c 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
@@ -66,6 +66,11 @@ class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {
                                      TTI::TargetCostKind CostKind,
                                      unsigned Index, const Value *Op0,
                                      const Value *Op1) const override;
+  InstructionCost getMemoryOpCost(
+      unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
+      TTI::TargetCostKind CostKind,
+      TTI::OperandValueInfo OpInfo = {TTI::OK_AnyValue, TTI::OP_None},
+      const Instruction *I = nullptr) const override;
 
   // TODO: Implement more hooks to provide TTI machinery for LoongArch.
 };
diff --git a/llvm/test/Analysis/CostModel/LoongArch/load-store.ll b/llvm/test/Analysis/CostModel/LoongArch/load-store.ll
new file mode 100644
index 0000000000000..b176d093fc5a7
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/LoongArch/load-store.ll
@@ -0,0 +1,144 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lsx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LSX
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all -mtriple=loongarch64 -mattr=+lasx 2>&1 -disable-output < %s | FileCheck %s --check-prefixes=LASX
+
+define i32 @store(i32 %arg) {
+; LSX-LABEL: 'store'
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: store i8 poison, ptr poison, align 1
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: store i16 poison, ptr poison, align 2
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: store i32 poison, ptr poison, align 4
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: store i64 poison, ptr poison, align 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store float poison, ptr poison, align 4
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store double poison, ptr poison, align 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <16 x i8> poison, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <8 x i16> poison, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <4 x i32> poison, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <2 x i64> poison, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <4 x float> poison, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <2 x double> poison, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: store <32 x i8> poison, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: store <16 x i16> poison, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: store <8 x i32> poison, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: store <4 x i64> poison, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: store <8 x float> poison, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: store <4 x double> poison, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'store'
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: store i8 poison, ptr poison, align 1
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: store i16 poison, ptr poison, align 2
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: store i32 poison, ptr poison, align 4
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: store i64 poison, ptr poison, align 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store float poison, ptr poison, align 4
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store double poison, ptr poison, align 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <16 x i8> poison, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <8 x i16> poison, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <4 x i32> poison, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <2 x i64> poison, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <4 x float> poison, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <2 x double> poison, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <32 x i8> poison, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <16 x i16> poison, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <8 x i32> poison, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <4 x i64> poison, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <8 x float> poison, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: store <4 x double> poison, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  store i8 poison, ptr poison
+  store i16 poison, ptr poison
+  store i32 poison, ptr poison
+  store i64 poison, ptr poison
+
+  store float poison, ptr poison
+  store double poison, ptr poison
+
+  store <16 x i8> poison, ptr poison
+  store <8 x i16> poison, ptr poison
+  store <4 x i32> poison, ptr poison
+  store <2 x i64> poison, ptr poison
+
+  store <4 x float> poison, ptr poison
+  store <2 x double> poison, ptr poison
+
+  store <32 x i8> poison, ptr poison
+  store <16 x i16> poison, ptr poison
+  store <8 x i32> poison, ptr poison
+  store <4 x i64> poison, ptr poison
+
+  store <8 x float> poison, ptr poison
+  store <4 x double> poison, ptr poison
+
+  ret i32 poison
+}
+
+define i32 @load(i32 %arg) {
+; LSX-LABEL: 'load'
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %1 = load i8, ptr poison, align 1
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %2 = load i16, ptr poison, align 2
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %3 = load i32, ptr poison, align 4
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %4 = load i64, ptr poison, align 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %5 = load float, ptr poison, align 4
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %6 = load double, ptr poison, align 8
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %7 = load <16 x i8>, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %8 = load <8 x i16>, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %9 = load <4 x i32>, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %10 = load <2 x i64>, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %11 = load <4 x float>, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %12 = load <2 x double>, ptr poison, align 16
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: %13 = load <32 x i8>, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: %14 = load <16 x i16>, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: %15 = load <8 x i32>, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: %16 = load <4 x i64>, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: %17 = load <8 x float>, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of RThru:4 CodeSize:2 Lat:10 SizeLat:2 for: %18 = load <4 x double>, ptr poison, align 32
+; LSX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+; LASX-LABEL: 'load'
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %1 = load i8, ptr poison, align 1
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %2 = load i16, ptr poison, align 2
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %3 = load i32, ptr poison, align 4
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:1 for: %4 = load i64, ptr poison, align 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %5 = load float, ptr poison, align 4
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %6 = load double, ptr poison, align 8
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %7 = load <16 x i8>, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %8 = load <8 x i16>, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %9 = load <4 x i32>, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %10 = load <2 x i64>, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %11 = load <4 x float>, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %12 = load <2 x double>, ptr poison, align 16
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %13 = load <32 x i8>, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %14 = load <16 x i16>, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %15 = load <8 x i32>, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %16 = load <4 x i64>, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %17 = load <8 x float>, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:5 SizeLat:1 for: %18 = load <4 x double>, ptr poison, align 32
+; LASX-NEXT:  Cost Model: Found costs of 1 for: ret i32 poison
+;
+  load i8, ptr poison
+  load i16, ptr poison
+  load i32, ptr poison
+  load i64, ptr poison
+
+  load float, ptr poison
+  load double, ptr poison
+
+  load <16 x i8>, ptr poison
+  load <8 x i16>, ptr poison
+  load <4 x i32>, ptr poison
+  load <2 x i64>, ptr poison
+
+  load <4 x float>, ptr poison
+  load <2 x double>, ptr poison
+
+  load <32 x i8>, ptr poison
+  load <16 x i16>, ptr poison
+  load <8 x i32>, ptr poison
+  load <4 x i64>, ptr poison
+
+  load <8 x float>, ptr poison
+  load <4 x double>, ptr poison
+
+  ret i32 poison
+}



More information about the llvm-commits mailing list