[SystemZ::TTI] i8/i16 operands extension costs revisited
Three minor changes to these extra costs: * For ICmp instructions, instead of adding 2 all the time for extending each operand, this is only done if that operand is neither a load or an immediate. * The operands extension costs for divides removed, because we now use a high cost already for the divide (20). * The costs for lhsr/ashr extra costs removed as this did not seem useful. Review: Ulrich Weigand https://reviews.llvm.org/D55053 llvm-svn: 347961
This commit is contained in:
parent
8cfb12b9bd
commit
b1d014883c
|
@ -467,9 +467,6 @@ int SystemZTTIImpl::getArithmeticInstrCost(
|
|||
if (Opcode == Instruction::FRem)
|
||||
return LIBCALL_COST;
|
||||
|
||||
if (Opcode == Instruction::LShr || Opcode == Instruction::AShr)
|
||||
return (ScalarBits >= 32 ? 1 : 2 /*ext*/);
|
||||
|
||||
// Or requires one instruction, although it has custom handling for i64.
|
||||
if (Opcode == Instruction::Or)
|
||||
return 1;
|
||||
|
@ -484,12 +481,8 @@ int SystemZTTIImpl::getArithmeticInstrCost(
|
|||
return (SignedDivRem ? SDivPow2Cost : 1);
|
||||
if (DivRemConst)
|
||||
return DivMulSeqCost;
|
||||
if (SignedDivRem)
|
||||
// sext of op(s) for narrow types
|
||||
return DivInstrCost + (ScalarBits < 32 ? 3 : (ScalarBits == 32 ? 1 : 0));
|
||||
if (UnsignedDivRem)
|
||||
// Clearing of low 64 bit reg + sext of op(s) for narrow types + dl[g]r
|
||||
return DivInstrCost + (ScalarBits < 32 ? 3 : 1);
|
||||
if (SignedDivRem || UnsignedDivRem)
|
||||
return DivInstrCost;
|
||||
}
|
||||
|
||||
// Fallback to the default implementation.
|
||||
|
@ -779,6 +772,18 @@ int SystemZTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
|
|||
return BaseT::getCastInstrCost(Opcode, Dst, Src, I);
|
||||
}
|
||||
|
||||
// Scalar i8 / i16 operations will typically be made after first extending
|
||||
// the operands to i32.
|
||||
static unsigned getOperandsExtensionCost(const Instruction *I) {
|
||||
unsigned ExtCost = 0;
|
||||
for (Value *Op : I->operands())
|
||||
// A load of i8 or i16 sign/zero extends to i32.
|
||||
if (!isa<LoadInst>(Op) && !isa<ConstantInt>(Op))
|
||||
ExtCost++;
|
||||
|
||||
return ExtCost;
|
||||
}
|
||||
|
||||
int SystemZTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
|
||||
Type *CondTy, const Instruction *I) {
|
||||
if (ValTy->isVectorTy()) {
|
||||
|
@ -835,17 +840,8 @@ int SystemZTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
|
|||
switch (Opcode) {
|
||||
case Instruction::ICmp: {
|
||||
unsigned Cost = 1;
|
||||
if (ValTy->isIntegerTy() && ValTy->getScalarSizeInBits() <= 16) {
|
||||
if (I != nullptr) {
|
||||
// Single instruction for comparison of memory with a small immediate.
|
||||
if (const LoadInst* Ld = dyn_cast<LoadInst>(I->getOperand(0))) {
|
||||
const Instruction *FoldedValue = nullptr;
|
||||
if (isFoldableLoad(Ld, FoldedValue))
|
||||
return Cost;
|
||||
}
|
||||
}
|
||||
Cost += 2; // extend both operands
|
||||
}
|
||||
if (ValTy->isIntegerTy() && ValTy->getScalarSizeInBits() <= 16)
|
||||
Cost += (I != nullptr ? getOperandsExtensionCost(I) : 2);
|
||||
return Cost;
|
||||
}
|
||||
case Instruction::Select:
|
||||
|
|
|
@ -16,19 +16,19 @@ define i64 @fun0(i64 %a, i64 %b) {
|
|||
define i32 @fun1(i32 %a, i32 %b) {
|
||||
%r = sdiv i32 %a, %b
|
||||
ret i32 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %r = sdiv i32 %a, %b
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = sdiv i32 %a, %b
|
||||
}
|
||||
|
||||
define i16 @fun2(i16 %a, i16 %b) {
|
||||
%r = sdiv i16 %a, %b
|
||||
ret i16 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 23 for instruction: %r = sdiv i16 %a, %b
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = sdiv i16 %a, %b
|
||||
}
|
||||
|
||||
define i8 @fun3(i8 %a, i8 %b) {
|
||||
%r = sdiv i8 %a, %b
|
||||
ret i8 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 23 for instruction: %r = sdiv i8 %a, %b
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = sdiv i8 %a, %b
|
||||
}
|
||||
|
||||
; Vector sdiv
|
||||
|
@ -42,13 +42,13 @@ define <2 x i64> @fun4(<2 x i64> %a, <2 x i64> %b) {
|
|||
define <4 x i32> @fun5(<4 x i32> %a, <4 x i32> %b) {
|
||||
%r = sdiv <4 x i32> %a, %b
|
||||
ret <4 x i32> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 98 for instruction: %r = sdiv <4 x i32>
|
||||
; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = sdiv <4 x i32>
|
||||
}
|
||||
|
||||
define <2 x i32> @fun6(<2 x i32> %a, <2 x i32> %b) {
|
||||
%r = sdiv <2 x i32> %a, %b
|
||||
ret <2 x i32> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 50 for instruction: %r = sdiv <2 x i32>
|
||||
; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %r = sdiv <2 x i32>
|
||||
}
|
||||
|
||||
define <8 x i16> @fun7(<8 x i16> %a, <8 x i16> %b) {
|
||||
|
@ -60,7 +60,7 @@ define <8 x i16> @fun7(<8 x i16> %a, <8 x i16> %b) {
|
|||
define <4 x i16> @fun8(<4 x i16> %a, <4 x i16> %b) {
|
||||
%r = sdiv <4 x i16> %a, %b
|
||||
ret <4 x i16> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 106 for instruction: %r = sdiv <4 x i16>
|
||||
; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = sdiv <4 x i16>
|
||||
}
|
||||
|
||||
define <16 x i8> @fun9(<16 x i8> %a, <16 x i8> %b) {
|
||||
|
@ -80,25 +80,25 @@ define <8 x i8> @fun10(<8 x i8> %a, <8 x i8> %b) {
|
|||
define i64 @fun11(i64 %a, i64 %b) {
|
||||
%r = udiv i64 %a, %b
|
||||
ret i64 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %r = udiv i64 %a, %b
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = udiv i64 %a, %b
|
||||
}
|
||||
|
||||
define i32 @fun12(i32 %a, i32 %b) {
|
||||
%r = udiv i32 %a, %b
|
||||
ret i32 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %r = udiv i32
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = udiv i32
|
||||
}
|
||||
|
||||
define i16 @fun13(i16 %a, i16 %b) {
|
||||
%r = udiv i16 %a, %b
|
||||
ret i16 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 23 for instruction: %r = udiv i16
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = udiv i16
|
||||
}
|
||||
|
||||
define i8 @fun14(i8 %a, i8 %b) {
|
||||
%r = udiv i8 %a, %b
|
||||
ret i8 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 23 for instruction: %r = udiv i8
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = udiv i8
|
||||
}
|
||||
|
||||
; Vector udiv
|
||||
|
@ -106,19 +106,19 @@ define i8 @fun14(i8 %a, i8 %b) {
|
|||
define <2 x i64> @fun15(<2 x i64> %a, <2 x i64> %b) {
|
||||
%r = udiv <2 x i64> %a, %b
|
||||
ret <2 x i64> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 49 for instruction: %r = udiv <2 x i64>
|
||||
; CHECK: Cost Model: Found an estimated cost of 47 for instruction: %r = udiv <2 x i64>
|
||||
}
|
||||
|
||||
define <4 x i32> @fun16(<4 x i32> %a, <4 x i32> %b) {
|
||||
%r = udiv <4 x i32> %a, %b
|
||||
ret <4 x i32> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 98 for instruction: %r = udiv <4 x i32>
|
||||
; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = udiv <4 x i32>
|
||||
}
|
||||
|
||||
define <2 x i32> @fun17(<2 x i32> %a, <2 x i32> %b) {
|
||||
%r = udiv <2 x i32> %a, %b
|
||||
ret <2 x i32> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 50 for instruction: %r = udiv <2 x i32>
|
||||
; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %r = udiv <2 x i32>
|
||||
}
|
||||
|
||||
define <8 x i16> @fun18(<8 x i16> %a, <8 x i16> %b) {
|
||||
|
@ -130,7 +130,7 @@ define <8 x i16> @fun18(<8 x i16> %a, <8 x i16> %b) {
|
|||
define <4 x i16> @fun19(<4 x i16> %a, <4 x i16> %b) {
|
||||
%r = udiv <4 x i16> %a, %b
|
||||
ret <4 x i16> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 106 for instruction: %r = udiv <4 x i16>
|
||||
; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = udiv <4 x i16>
|
||||
}
|
||||
|
||||
define <16 x i8> @fun20(<16 x i8> %a, <16 x i8> %b) {
|
||||
|
@ -156,19 +156,19 @@ define i64 @fun22(i64 %a, i64 %b) {
|
|||
define i32 @fun23(i32 %a, i32 %b) {
|
||||
%r = srem i32 %a, %b
|
||||
ret i32 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %r = srem i32
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = srem i32
|
||||
}
|
||||
|
||||
define i16 @fun24(i16 %a, i16 %b) {
|
||||
%r = srem i16 %a, %b
|
||||
ret i16 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 23 for instruction: %r = srem i16
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = srem i16
|
||||
}
|
||||
|
||||
define i8 @fun25(i8 %a, i8 %b) {
|
||||
%r = srem i8 %a, %b
|
||||
ret i8 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 23 for instruction: %r = srem i8
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = srem i8
|
||||
}
|
||||
|
||||
; Vector srem
|
||||
|
@ -182,13 +182,13 @@ define <2 x i64> @fun26(<2 x i64> %a, <2 x i64> %b) {
|
|||
define <4 x i32> @fun27(<4 x i32> %a, <4 x i32> %b) {
|
||||
%r = srem <4 x i32> %a, %b
|
||||
ret <4 x i32> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 98 for instruction: %r = srem <4 x i32>
|
||||
; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = srem <4 x i32>
|
||||
}
|
||||
|
||||
define <2 x i32> @fun28(<2 x i32> %a, <2 x i32> %b) {
|
||||
%r = srem <2 x i32> %a, %b
|
||||
ret <2 x i32> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 50 for instruction: %r = srem <2 x i32>
|
||||
; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %r = srem <2 x i32>
|
||||
}
|
||||
|
||||
define <8 x i16> @fun29(<8 x i16> %a, <8 x i16> %b) {
|
||||
|
@ -200,7 +200,7 @@ define <8 x i16> @fun29(<8 x i16> %a, <8 x i16> %b) {
|
|||
define <4 x i16> @fun30(<4 x i16> %a, <4 x i16> %b) {
|
||||
%r = srem <4 x i16> %a, %b
|
||||
ret <4 x i16> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 106 for instruction: %r = srem <4 x i16>
|
||||
; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = srem <4 x i16>
|
||||
}
|
||||
|
||||
define <16 x i8> @fun31(<16 x i8> %a, <16 x i8> %b) {
|
||||
|
@ -220,25 +220,25 @@ define <8 x i8> @fun32(<8 x i8> %a, <8 x i8> %b) {
|
|||
define i64 @fun33(i64 %a, i64 %b) {
|
||||
%r = urem i64 %a, %b
|
||||
ret i64 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %r = urem i64
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = urem i64
|
||||
}
|
||||
|
||||
define i32 @fun34(i32 %a, i32 %b) {
|
||||
%r = urem i32 %a, %b
|
||||
ret i32 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %r = urem i32
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = urem i32
|
||||
}
|
||||
|
||||
define i16 @fun35(i16 %a, i16 %b) {
|
||||
%r = urem i16 %a, %b
|
||||
ret i16 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 23 for instruction: %r = urem i16
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = urem i16
|
||||
}
|
||||
|
||||
define i8 @fun36(i8 %a, i8 %b) {
|
||||
%r = urem i8 %a, %b
|
||||
ret i8 %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 23 for instruction: %r = urem i8
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = urem i8
|
||||
}
|
||||
|
||||
; Vector urem
|
||||
|
@ -246,19 +246,19 @@ define i8 @fun36(i8 %a, i8 %b) {
|
|||
define <2 x i64> @fun37(<2 x i64> %a, <2 x i64> %b) {
|
||||
%r = urem <2 x i64> %a, %b
|
||||
ret <2 x i64> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 49 for instruction: %r = urem <2 x i64>
|
||||
; CHECK: Cost Model: Found an estimated cost of 47 for instruction: %r = urem <2 x i64>
|
||||
}
|
||||
|
||||
define <4 x i32> @fun38(<4 x i32> %a, <4 x i32> %b) {
|
||||
%r = urem <4 x i32> %a, %b
|
||||
ret <4 x i32> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 98 for instruction: %r = urem <4 x i32>
|
||||
; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = urem <4 x i32>
|
||||
}
|
||||
|
||||
define <2 x i32> @fun39(<2 x i32> %a, <2 x i32> %b) {
|
||||
%r = urem <2 x i32> %a, %b
|
||||
ret <2 x i32> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 50 for instruction: %r = urem <2 x i32>
|
||||
; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %r = urem <2 x i32>
|
||||
}
|
||||
|
||||
define <8 x i16> @fun40(<8 x i16> %a, <8 x i16> %b) {
|
||||
|
@ -270,7 +270,7 @@ define <8 x i16> @fun40(<8 x i16> %a, <8 x i16> %b) {
|
|||
define <4 x i16> @fun41(<4 x i16> %a, <4 x i16> %b) {
|
||||
%r = urem <4 x i16> %a, %b
|
||||
ret <4 x i16> %r
|
||||
; CHECK: Cost Model: Found an estimated cost of 106 for instruction: %r = urem <4 x i16>
|
||||
; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = urem <4 x i16>
|
||||
}
|
||||
|
||||
define <16 x i8> @fun42(<16 x i8> %a, <16 x i8> %b) {
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 \
|
||||
; RUN: | FileCheck %s
|
||||
;
|
||||
; Test that i8/i16 operands get extra costs for extensions to i32 only in
|
||||
; cases where this is needed.
|
||||
|
||||
define void @icmp() {
|
||||
%li8_0 = load i8, i8* undef
|
||||
%li8_1 = load i8, i8* undef
|
||||
icmp slt i8 %li8_0, %li8_1
|
||||
|
||||
%a0 = add i8 %li8_0, 1
|
||||
%a1 = add i8 %li8_1, 1
|
||||
icmp slt i8 %a0, %a1
|
||||
|
||||
icmp slt i8 %a0, 123
|
||||
|
||||
%li16_0 = load i16, i16* undef
|
||||
%li16_1 = load i16, i16* undef
|
||||
icmp slt i16 %li16_0, %li16_1
|
||||
|
||||
%a2 = add i16 %li16_0, 1
|
||||
%a3 = add i16 %li16_1, 1
|
||||
icmp slt i16 %a2, %a3
|
||||
|
||||
icmp slt i16 %a2, 123
|
||||
|
||||
ret void;
|
||||
; CHECK: Printing analysis 'Cost Model Analysis' for function 'icmp':
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li8_0 = load i8, i8* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li8_1 = load i8, i8* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %1 = icmp slt i8 %li8_0, %li8_1
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %a0 = add i8 %li8_0, 1
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %a1 = add i8 %li8_1, 1
|
||||
; CHECK: Cost Model: Found an estimated cost of 3 for instruction: %2 = icmp slt i8 %a0, %a1
|
||||
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %3 = icmp slt i8 %a0, 123
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li16_0 = load i16, i16* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li16_1 = load i16, i16* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %4 = icmp slt i16 %li16_0, %li16_1
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %a2 = add i16 %li16_0, 1
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %a3 = add i16 %li16_1, 1
|
||||
; CHECK: Cost Model: Found an estimated cost of 3 for instruction: %5 = icmp slt i16 %a2, %a3
|
||||
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %6 = icmp slt i16 %a2, 123
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: ret void
|
||||
}
|
|
@ -68,8 +68,8 @@ define void @ashr() {
|
|||
%res18 = ashr <16 x i32> undef, undef
|
||||
%res19 = ashr <16 x i64> undef, undef
|
||||
|
||||
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res0 = ashr i8 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res1 = ashr i16 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res0 = ashr i8 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res1 = ashr i16 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res2 = ashr i32 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res3 = ashr i64 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res4 = ashr <2 x i8> undef, undef
|
||||
|
@ -114,8 +114,8 @@ define void @lshr() {
|
|||
%res18 = lshr <16 x i32> undef, undef
|
||||
%res19 = lshr <16 x i64> undef, undef
|
||||
|
||||
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res0 = lshr i8 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res1 = lshr i16 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res0 = lshr i8 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res1 = lshr i16 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res2 = lshr i32 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res3 = lshr i64 undef, undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res4 = lshr <2 x i8> undef, undef
|
||||
|
|
|
@ -433,10 +433,10 @@ define void @sdiv_lhs(i32 %arg32, i64 %arg64) {
|
|||
|
||||
; An sdiv loaded dividend (lhs) operand is *not* foldable.
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li32 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %1 = sdiv i32 %li32, %arg32
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %1 = sdiv i32 %li32, %arg32
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li32_0 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li32_1 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %2 = sdiv i32 %li32_0, %li32_1
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %2 = sdiv i32 %li32_0, %li32_1
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li64 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %3 = sdiv i64 %li64, %arg64
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li64_0 = load i64, i64* undef
|
||||
|
@ -481,12 +481,12 @@ define void @sdiv_rhs(i32 %arg32, i64 %arg64) {
|
|||
|
||||
; An sdiv loaded divisor (rhs) operand is foldable.
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li32 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %1 = sdiv i32 %arg32, %li32
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %1 = sdiv i32 %arg32, %li32
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li64 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %2 = sdiv i64 %arg64, %li64
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li64_2 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %tr = trunc i64 %li64_2 to i32
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %3 = sdiv i32 undef, %tr
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %3 = sdiv i32 undef, %tr
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li32_2 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %sext_0 = sext i32 %li32_2 to i64
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %4 = sdiv i64 undef, %sext_0
|
||||
|
@ -525,15 +525,15 @@ define void @udiv_lhs(i32 %arg32, i64 %arg64) {
|
|||
|
||||
; An udiv loaded dividend (lhs) operand is *not* foldable.
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li32 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %1 = udiv i32 %li32, %arg32
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %1 = udiv i32 %li32, %arg32
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li32_0 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li32_1 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %2 = udiv i32 %li32_0, %li32_1
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %2 = udiv i32 %li32_0, %li32_1
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li64 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %3 = udiv i64 %li64, %arg64
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %3 = udiv i64 %li64, %arg64
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li64_0 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li64_1 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %4 = udiv i64 %li64_0, %li64_1
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %4 = udiv i64 %li64_0, %li64_1
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li64_2 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %tr_0 = trunc i64 %li64_2 to i32
|
||||
; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %5 = udiv i32 %tr_0, undef
|
||||
|
@ -563,15 +563,15 @@ define void @udiv_rhs(i32 %arg32, i64 %arg64) {
|
|||
|
||||
; An udiv loaded divisor (rhs) operand is foldable.
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li32 = load i32, i32* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %1 = udiv i32 %arg32, %li32
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %1 = udiv i32 %arg32, %li32
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li64 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %2 = udiv i64 %arg64, %li64
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %2 = udiv i64 %arg64, %li64
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li64_2 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %tr_0 = trunc i64 %li64_2 to i32
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %3 = udiv i32 undef, %tr_0
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %3 = udiv i32 undef, %tr_0
|
||||
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li64_3 = load i64, i64* undef
|
||||
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %tr_1 = trunc i64 %li64_3 to i32
|
||||
; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %4 = udiv i64 undef, %li64_3
|
||||
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %4 = udiv i64 undef, %li64_3
|
||||
}
|
||||
|
||||
define void @and() {
|
||||
|
|
Loading…
Reference in New Issue