aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-10-25 21:47:22 +0000
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-10-25 21:47:22 +0000
commitff3c72bc7c5cb096cc570f3b7d21f9b50501d239 (patch)
tree23865783424c2f26aa22d8c3072b36c9d3a05ba2 /test/Analysis
parent441900b083e3f315dac3a05b4cfa52b7e41c3d12 (diff)
[SystemZ] Improve handling and cost estimates of vector integer div/rem
Enable the DAG optimization that converts vector div/rem with constants into multiply+shifts sequences by expanding them early. This is needed since ISD::SMUL_LOHI is 'Custom' lowered on SystemZ, and will therefore not be available to BuildSDIV after legalization. Better cost values for these instructions based on how they will be implemented (a constant divisor is cheaper). Review: Ulrich Weigand https://reviews.llvm.org/D53196 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/CostModel/SystemZ/div-pow2.ll154
-rw-r--r--test/Analysis/CostModel/SystemZ/divrem-const.ll291
-rw-r--r--test/Analysis/CostModel/SystemZ/divrem-pow2.ll383
-rw-r--r--test/Analysis/CostModel/SystemZ/divrem-reg.ll286
-rw-r--r--test/Analysis/CostModel/SystemZ/int-arith.ll187
-rw-r--r--test/Analysis/CostModel/SystemZ/memop-folding-int-arith.ll28
6 files changed, 974 insertions, 355 deletions
diff --git a/test/Analysis/CostModel/SystemZ/div-pow2.ll b/test/Analysis/CostModel/SystemZ/div-pow2.ll
deleted file mode 100644
index 9ef2dd71e8f..00000000000
--- a/test/Analysis/CostModel/SystemZ/div-pow2.ll
+++ /dev/null
@@ -1,154 +0,0 @@
-; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
-
-; Scalar sdiv
-
-define i64 @fun0(i64 %a) {
- %r = sdiv i64 %a, 2
- ret i64 %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %a, 2
-}
-
-define i64 @fun1(i64 %a) {
- %r = sdiv i64 %a, -4
- ret i64 %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %a, -4
-}
-
-define i32 @fun2(i32 %a) {
- %r = sdiv i32 %a, 8
- ret i32 %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i32 %a, 8
-}
-
-define i32 @fun3(i32 %a) {
- %r = sdiv i32 %a, -16
- ret i32 %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i32 %a, -16
-}
-
-define i16 @fun4(i16 %a) {
- %r = sdiv i16 %a, 32
- ret i16 %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i16 %a, 32
-}
-
-define i16 @fun5(i16 %a) {
- %r = sdiv i16 %a, -64
- ret i16 %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i16 %a, -64
-}
-
-define i8 @fun6(i8 %a) {
- %r = sdiv i8 %a, 64
- ret i8 %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i8 %a, 64
-}
-
-define i8 @fun7(i8 %a) {
- %r = sdiv i8 %a, -128
- ret i8 %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i8 %a, -128
-}
-
-
-; Vector sdiv
-
-define <2 x i64> @fun8(<2 x i64> %a) {
- %r = sdiv <2 x i64> %a, <i64 2, i64 2>
- ret <2 x i64> %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, <i64 2, i64 2>
-}
-
-define <2 x i64> @fun9(<2 x i64> %a) {
- %r = sdiv <2 x i64> %a, <i64 -4, i64 -4>
- ret <2 x i64> %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, <i64 -4, i64 -4>
-}
-
-define <4 x i32> @fun10(<4 x i32> %a) {
- %r = sdiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
- ret <4 x i32> %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
-}
-
-define <4 x i32> @fun11(<4 x i32> %a) {
- %r = sdiv <4 x i32> %a, <i32 -16, i32 -16, i32 -16, i32 -16>
- ret <4 x i32> %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, <i32 -16
-}
-
-define <8 x i16> @fun12(<8 x i16> %a) {
- %r = sdiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
- ret <8 x i16> %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, <i16 32
-}
-
-define <8 x i16> @fun13(<8 x i16> %a) {
- %r = sdiv <8 x i16> %a, <i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64>
- ret <8 x i16> %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, <i16 -64
-}
-
-define <16 x i8> @fun14(<16 x i8> %a) {
- %r = sdiv <16 x i8> %a, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
- ret <16 x i8> %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, <i8 64
-}
-
-define <16 x i8> @fun15(<16 x i8> %a) {
- %r = sdiv <16 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
- ret <16 x i8> %r
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, <i8 -128
-}
-
-; Scalar udiv
-
-define i64 @fun16(i64 %a) {
- %r = udiv i64 %a, 2
- ret i64 %r
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i64 %a, 2
-}
-
-define i32 @fun17(i32 %a) {
- %r = udiv i32 %a, 8
- ret i32 %r
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i32 %a, 8
-}
-
-define i16 @fun18(i16 %a) {
- %r = udiv i16 %a, 32
- ret i16 %r
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i16 %a, 32
-}
-
-define i8 @fun19(i8 %a) {
- %r = udiv i8 %a, 128
- ret i8 %r
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i8 %a, -128
-}
-
-; Vector udiv
-
-define <2 x i64> @fun20(<2 x i64> %a) {
- %r = udiv <2 x i64> %a, <i64 2, i64 2>
- ret <2 x i64> %r
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <2 x i64> %a, <i64 2
-}
-
-define <4 x i32> @fun21(<4 x i32> %a) {
- %r = udiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
- ret <4 x i32> %r
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <4 x i32> %a, <i32 8
-}
-
-define <8 x i16> @fun22(<8 x i16> %a) {
- %r = udiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
- ret <8 x i16> %r
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <8 x i16> %a, <i16 32
-}
-
-define <16 x i8> @fun23(<16 x i8> %a) {
- %r = udiv <16 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
- ret <16 x i8> %r
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <16 x i8> %a, <i8 -128
-}
diff --git a/test/Analysis/CostModel/SystemZ/divrem-const.ll b/test/Analysis/CostModel/SystemZ/divrem-const.ll
new file mode 100644
index 00000000000..0889d0f96af
--- /dev/null
+++ b/test/Analysis/CostModel/SystemZ/divrem-const.ll
@@ -0,0 +1,291 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 \
+; RUN: | FileCheck %s -check-prefix=COST
+
+; Check that all divide/remainder instructions are implemented by cheaper instructions.
+; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -o - | FileCheck %s
+; CHECK-NOT: dsg
+; CHECK-NOT: dl
+
+; Check costs of divisions/remainders by a vector of constants that is *not*
+; a power of two. A sequence containing a multiply and shifts will replace
+; the divide instruction.
+
+; Scalar sdiv
+
+define i64 @fun0(i64 %a) {
+ %r = sdiv i64 %a, 20
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = sdiv i64 %a, 20
+}
+
+define i32 @fun1(i32 %a) {
+ %r = sdiv i32 %a, 20
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = sdiv i32 %a, 20
+}
+
+define i16 @fun2(i16 %a) {
+ %r = sdiv i16 %a, 20
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = sdiv i16 %a, 20
+}
+
+define i8 @fun3(i8 %a) {
+ %r = sdiv i8 %a, 20
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = sdiv i8 %a, 20
+}
+
+; Vector sdiv
+
+define <2 x i64> @fun4(<2 x i64> %a) {
+ %r = sdiv <2 x i64> %a, <i64 20, i64 21>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 24 for instruction: %r = sdiv <2 x i64>
+}
+
+define <4 x i32> @fun5(<4 x i32> %a) {
+ %r = sdiv <4 x i32> %a, <i32 20, i32 20, i32 20, i32 20>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 49 for instruction: %r = sdiv <4 x i32>
+}
+
+define <2 x i32> @fun6(<2 x i32> %a) {
+ %r = sdiv <2 x i32> %a, <i32 20, i32 21>
+ ret <2 x i32> %r
+; COST: Cost Model: Found an estimated cost of 25 for instruction: %r = sdiv <2 x i32>
+}
+
+define <8 x i16> @fun7(<8 x i16> %a) {
+ %r = sdiv <8 x i16> %a, <i16 20, i16 20, i16 20, i16 20, i16 20, i16 20, i16 20, i16 20>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 97 for instruction: %r = sdiv <8 x i16>
+}
+
+define <4 x i16> @fun8(<4 x i16> %a) {
+ %r = sdiv <4 x i16> %a, <i16 20, i16 20, i16 20, i16 21>
+ ret <4 x i16> %r
+; COST: Cost Model: Found an estimated cost of 49 for instruction: %r = sdiv <4 x i16>
+}
+
+define <16 x i8> @fun9(<16 x i8> %a) {
+ %r = sdiv <16 x i8> %a, <i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 193 for instruction: %r = sdiv <16 x i8>
+}
+
+define <8 x i8> @fun10(<8 x i8> %a) {
+ %r = sdiv <8 x i8> %a, <i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 21>
+ ret <8 x i8> %r
+; COST: Cost Model: Found an estimated cost of 97 for instruction: %r = sdiv <8 x i8>
+}
+
+; Scalar udiv
+
+define i64 @fun11(i64 %a) {
+ %r = udiv i64 %a, 20
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = udiv i64 %a, 20
+}
+
+define i32 @fun12(i32 %a) {
+ %r = udiv i32 %a, 20
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = udiv i32 %a, 20
+}
+
+define i16 @fun13(i16 %a) {
+ %r = udiv i16 %a, 20
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = udiv i16 %a, 20
+}
+
+define i8 @fun14(i8 %a) {
+ %r = udiv i8 %a, 20
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = udiv i8
+}
+
+; Vector udiv
+
+define <2 x i64> @fun15(<2 x i64> %a) {
+ %r = udiv <2 x i64> %a, <i64 20, i64 20>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 24 for instruction: %r = udiv <2 x i64>
+}
+
+define <4 x i32> @fun16(<4 x i32> %a) {
+ %r = udiv <4 x i32> %a, <i32 20, i32 20, i32 20, i32 21>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 49 for instruction: %r = udiv <4 x i32>
+}
+
+define <2 x i32> @fun17(<2 x i32> %a) {
+ %r = udiv <2 x i32> %a, <i32 20, i32 20>
+ ret <2 x i32> %r
+; COST: Cost Model: Found an estimated cost of 25 for instruction: %r = udiv <2 x i32>
+}
+
+define <8 x i16> @fun18(<8 x i16> %a) {
+ %r = udiv <8 x i16> %a, <i16 20, i16 20, i16 20, i16 20, i16 20, i16 20, i16 20, i16 21>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 97 for instruction: %r = udiv <8 x i16>
+}
+
+define <4 x i16> @fun19(<4 x i16> %a) {
+ %r = udiv <4 x i16> %a, <i16 20, i16 20, i16 20, i16 20>
+ ret <4 x i16> %r
+; COST: Cost Model: Found an estimated cost of 49 for instruction: %r = udiv <4 x i16>
+}
+
+define <16 x i8> @fun20(<16 x i8> %a) {
+ %r = udiv <16 x i8> %a, <i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 21>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 193 for instruction: %r = udiv <16 x i8>
+}
+
+define <8 x i8> @fun21(<8 x i8> %a) {
+ %r = udiv <8 x i8> %a, <i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20>
+ ret <8 x i8> %r
+; COST: Cost Model: Found an estimated cost of 97 for instruction: %r = udiv <8 x i8>
+}
+
+; Scalar srem
+
+define i64 @fun22(i64 %a) {
+ %r = srem i64 %a, 20
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = srem i64
+}
+
+define i32 @fun23(i32 %a) {
+ %r = srem i32 %a, 20
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = srem i32
+}
+
+define i16 @fun24(i16 %a) {
+ %r = srem i16 %a, 20
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = srem i16
+}
+
+define i8 @fun25(i8 %a) {
+ %r = srem i8 %a, 20
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = srem i8
+}
+
+; Vector srem
+
+define <2 x i64> @fun26(<2 x i64> %a) {
+ %r = srem <2 x i64> %a, <i64 20, i64 21>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 24 for instruction: %r = srem <2 x i64>
+}
+
+define <4 x i32> @fun27(<4 x i32> %a) {
+ %r = srem <4 x i32> %a, <i32 20, i32 20, i32 20, i32 20>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 49 for instruction: %r = srem <4 x i32>
+}
+
+define <2 x i32> @fun28(<2 x i32> %a) {
+ %r = srem <2 x i32> %a, <i32 20, i32 21>
+ ret <2 x i32> %r
+; COST: Cost Model: Found an estimated cost of 25 for instruction: %r = srem <2 x i32>
+}
+
+define <8 x i16> @fun29(<8 x i16> %a) {
+ %r = srem <8 x i16> %a, <i16 20, i16 20, i16 20, i16 20, i16 20, i16 20, i16 20, i16 20>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 97 for instruction: %r = srem <8 x i16>
+}
+
+define <4 x i16> @fun30(<4 x i16> %a) {
+ %r = srem <4 x i16> %a, <i16 20, i16 20, i16 20, i16 21>
+ ret <4 x i16> %r
+; COST: Cost Model: Found an estimated cost of 49 for instruction: %r = srem <4 x i16>
+}
+
+define <16 x i8> @fun31(<16 x i8> %a) {
+ %r = srem <16 x i8> %a, <i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 193 for instruction: %r = srem <16 x i8>
+}
+
+define <8 x i8> @fun32(<8 x i8> %a) {
+ %r = srem <8 x i8> %a, <i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 21>
+ ret <8 x i8> %r
+; COST: Cost Model: Found an estimated cost of 97 for instruction: %r = srem <8 x i8>
+}
+
+; Scalar urem
+
+define i64 @fun33(i64 %a) {
+ %r = urem i64 %a, 20
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = urem i64
+}
+
+define i32 @fun34(i32 %a) {
+ %r = urem i32 %a, 20
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = urem i32
+}
+
+define i16 @fun35(i16 %a) {
+ %r = urem i16 %a, 20
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = urem i16
+}
+
+define i8 @fun36(i8 %a) {
+ %r = urem i8 %a, 20
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 10 for instruction: %r = urem i8
+}
+
+; Vector urem
+
+define <2 x i64> @fun37(<2 x i64> %a) {
+ %r = urem <2 x i64> %a, <i64 20, i64 20>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 24 for instruction: %r = urem <2 x i64>
+}
+
+define <4 x i32> @fun38(<4 x i32> %a) {
+ %r = urem <4 x i32> %a, <i32 20, i32 20, i32 20, i32 21>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 49 for instruction: %r = urem <4 x i32>
+}
+
+define <2 x i32> @fun39(<2 x i32> %a) {
+ %r = urem <2 x i32> %a, <i32 20, i32 20>
+ ret <2 x i32> %r
+; COST: Cost Model: Found an estimated cost of 25 for instruction: %r = urem <2 x i32>
+}
+
+define <8 x i16> @fun40(<8 x i16> %a) {
+ %r = urem <8 x i16> %a, <i16 20, i16 20, i16 20, i16 20, i16 20, i16 20, i16 20, i16 21>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 97 for instruction: %r = urem <8 x i16>
+}
+
+define <4 x i16> @fun41(<4 x i16> %a) {
+ %r = urem <4 x i16> %a, <i16 20, i16 20, i16 20, i16 20>
+ ret <4 x i16> %r
+; COST: Cost Model: Found an estimated cost of 49 for instruction: %r = urem <4 x i16>
+}
+
+define <16 x i8> @fun42(<16 x i8> %a) {
+ %r = urem <16 x i8> %a, <i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 21>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 193 for instruction: %r = urem <16 x i8>
+}
+
+define <8 x i8> @fun43(<8 x i8> %a) {
+ %r = urem <8 x i8> %a, <i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20, i8 20>
+ ret <8 x i8> %r
+; COST: Cost Model: Found an estimated cost of 97 for instruction: %r = urem <8 x i8>
+}
diff --git a/test/Analysis/CostModel/SystemZ/divrem-pow2.ll b/test/Analysis/CostModel/SystemZ/divrem-pow2.ll
new file mode 100644
index 00000000000..ad67ef9405f
--- /dev/null
+++ b/test/Analysis/CostModel/SystemZ/divrem-pow2.ll
@@ -0,0 +1,383 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 \
+; RUN: | FileCheck %s -check-prefix=COST
+
+; Check that all divide/remainder instructions are implemented by cheaper instructions.
+; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -o - | FileCheck %s
+; CHECK-NOT: dsg
+; CHECK-NOT: dl
+
+; Scalar sdiv
+
+define i64 @fun0(i64 %a) {
+ %r = sdiv i64 %a, 2
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %a, 2
+}
+
+define i64 @fun1(i64 %a) {
+ %r = sdiv i64 %a, -4
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %a, -4
+}
+
+define i32 @fun2(i32 %a) {
+ %r = sdiv i32 %a, 8
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i32 %a, 8
+}
+
+define i32 @fun3(i32 %a) {
+ %r = sdiv i32 %a, -16
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i32 %a, -16
+}
+
+define i16 @fun4(i16 %a) {
+ %r = sdiv i16 %a, 32
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i16 %a, 32
+}
+
+define i16 @fun5(i16 %a) {
+ %r = sdiv i16 %a, -64
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i16 %a, -64
+}
+
+define i8 @fun6(i8 %a) {
+ %r = sdiv i8 %a, 64
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i8 %a, 64
+}
+
+define i8 @fun7(i8 %a) {
+ %r = sdiv i8 %a, -128
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i8 %a, -128
+}
+
+; Vector sdiv
+
+define <2 x i64> @fun8(<2 x i64> %a) {
+ %r = sdiv <2 x i64> %a, <i64 2, i64 2>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, <i64 2, i64 2>
+}
+
+define <2 x i64> @fun9(<2 x i64> %a) {
+ %r = sdiv <2 x i64> %a, <i64 -4, i64 -4>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, <i64 -4, i64 -4>
+}
+
+define <4 x i32> @fun10(<4 x i32> %a) {
+ %r = sdiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
+}
+
+define <4 x i32> @fun11(<4 x i32> %a) {
+ %r = sdiv <4 x i32> %a, <i32 -16, i32 -16, i32 -16, i32 -16>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, <i32 -16
+}
+
+define <2 x i32> @fun12(<2 x i32> %a) {
+ %r = sdiv <2 x i32> %a, <i32 -16, i32 -16>
+ ret <2 x i32> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i32> %a, <i32 -16
+}
+
+define <8 x i16> @fun13(<8 x i16> %a) {
+ %r = sdiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, <i16 32
+}
+
+define <8 x i16> @fun14(<8 x i16> %a) {
+ %r = sdiv <8 x i16> %a, <i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, <i16 -64
+}
+
+define <4 x i16> @fun15(<4 x i16> %a) {
+ %r = sdiv <4 x i16> %a, <i16 32, i16 32, i16 32, i16 32>
+ ret <4 x i16> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i16> %a, <i16 32
+}
+
+define <16 x i8> @fun16(<16 x i8> %a) {
+ %r = sdiv <16 x i8> %a, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, <i8 64
+}
+
+define <16 x i8> @fun17(<16 x i8> %a) {
+ %r = sdiv <16 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, <i8 -128
+}
+
+define <8 x i8> @fun18(<8 x i8> %a) {
+ %r = sdiv <8 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
+ ret <8 x i8> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i8> %a, <i8 -128
+}
+
+; Scalar udiv
+
+define i64 @fun19(i64 %a) {
+ %r = udiv i64 %a, 2
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i64 %a, 2
+}
+
+define i32 @fun20(i32 %a) {
+ %r = udiv i32 %a, 8
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i32 %a, 8
+}
+
+define i16 @fun21(i16 %a) {
+ %r = udiv i16 %a, 32
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i16 %a, 32
+}
+
+define i8 @fun22(i8 %a) {
+ %r = udiv i8 %a, 128
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i8 %a, -128
+}
+
+; Vector udiv
+
+define <2 x i64> @fun23(<2 x i64> %a) {
+ %r = udiv <2 x i64> %a, <i64 2, i64 2>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <2 x i64> %a, <i64 2
+}
+
+define <4 x i32> @fun24(<4 x i32> %a) {
+ %r = udiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <4 x i32> %a, <i32 8
+}
+
+define <2 x i32> @fun25(<2 x i32> %a) {
+ %r = udiv <2 x i32> %a, <i32 8, i32 8>
+ ret <2 x i32> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <2 x i32> %a, <i32 8
+}
+
+define <8 x i16> @fun26(<8 x i16> %a) {
+ %r = udiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <8 x i16> %a, <i16 32
+}
+
+define <4 x i16> @fun27(<4 x i16> %a) {
+ %r = udiv <4 x i16> %a, <i16 32, i16 32, i16 32, i16 32>
+ ret <4 x i16> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <4 x i16> %a, <i16 32
+}
+
+define <16 x i8> @fun28(<16 x i8> %a) {
+ %r = udiv <16 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <16 x i8> %a, <i8 -128
+}
+
+define <8 x i8> @fun29(<8 x i8> %a) {
+ %r = udiv <8 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
+ ret <8 x i8> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <8 x i8> %a, <i8 -128
+}
+
+; Scalar srem
+
+define i64 @fun30(i64 %a) {
+ %r = srem i64 %a, 2
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i64 %a, 2
+}
+
+define i64 @fun31(i64 %a) {
+ %r = srem i64 %a, -4
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i64 %a, -4
+}
+
+define i32 @fun32(i32 %a) {
+ %r = srem i32 %a, 8
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i32 %a, 8
+}
+
+define i32 @fun33(i32 %a) {
+ %r = srem i32 %a, -16
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i32 %a, -16
+}
+
+define i16 @fun34(i16 %a) {
+ %r = srem i16 %a, 32
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i16 %a, 32
+}
+
+define i16 @fun35(i16 %a) {
+ %r = srem i16 %a, -64
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i16 %a, -64
+}
+
+define i8 @fun36(i8 %a) {
+ %r = srem i8 %a, 64
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i8 %a, 64
+}
+
+define i8 @fun37(i8 %a) {
+ %r = srem i8 %a, -128
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i8 %a, -128
+}
+
+; Vector srem
+
+define <2 x i64> @fun38(<2 x i64> %a) {
+ %r = srem <2 x i64> %a, <i64 2, i64 2>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i64> %a, <i64 2, i64 2>
+}
+
+define <2 x i64> @fun39(<2 x i64> %a) {
+ %r = srem <2 x i64> %a, <i64 -4, i64 -4>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i64> %a, <i64 -4, i64 -4>
+}
+
+define <4 x i32> @fun40(<4 x i32> %a) {
+ %r = srem <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
+}
+
+define <4 x i32> @fun41(<4 x i32> %a) {
+ %r = srem <4 x i32> %a, <i32 -16, i32 -16, i32 -16, i32 -16>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i32> %a, <i32 -16
+}
+
+define <2 x i32> @fun42(<2 x i32> %a) {
+ %r = srem <2 x i32> %a, <i32 -16, i32 -16>
+ ret <2 x i32> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i32> %a, <i32 -16
+}
+
+define <8 x i16> @fun43(<8 x i16> %a) {
+ %r = srem <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i16> %a, <i16 32
+}
+
+define <8 x i16> @fun44(<8 x i16> %a) {
+ %r = srem <8 x i16> %a, <i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i16> %a, <i16 -64
+}
+
+define <4 x i16> @fun45(<4 x i16> %a) {
+ %r = srem <4 x i16> %a, <i16 32, i16 32, i16 32, i16 32>
+ ret <4 x i16> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i16> %a, <i16 32
+}
+
+define <16 x i8> @fun46(<16 x i8> %a) {
+ %r = srem <16 x i8> %a, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <16 x i8> %a, <i8 64
+}
+
+define <16 x i8> @fun47(<16 x i8> %a) {
+ %r = srem <16 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <16 x i8> %a, <i8 -128
+}
+
+define <8 x i8> @fun48(<8 x i8> %a) {
+ %r = srem <8 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
+ ret <8 x i8> %r
+; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i8> %a, <i8 -128
+}
+
+; Scalar urem
+
+define i64 @fun49(i64 %a) {
+ %r = urem i64 %a, 2
+ ret i64 %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem i64 %a, 2
+}
+
+define i32 @fun50(i32 %a) {
+ %r = urem i32 %a, 8
+ ret i32 %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem i32 %a, 8
+}
+
+define i16 @fun51(i16 %a) {
+ %r = urem i16 %a, 32
+ ret i16 %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem i16 %a, 32
+}
+
+define i8 @fun52(i8 %a) {
+ %r = urem i8 %a, 128
+ ret i8 %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem i8 %a, -128
+}
+
+; Vector urem
+
+define <2 x i64> @fun53(<2 x i64> %a) {
+ %r = urem <2 x i64> %a, <i64 2, i64 2>
+ ret <2 x i64> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <2 x i64> %a, <i64 2
+}
+
+define <4 x i32> @fun54(<4 x i32> %a) {
+ %r = urem <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
+ ret <4 x i32> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <4 x i32> %a, <i32 8
+}
+
+define <2 x i32> @fun55(<2 x i32> %a) {
+ %r = urem <2 x i32> %a, <i32 8, i32 8>
+ ret <2 x i32> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <2 x i32> %a, <i32 8
+}
+
+define <8 x i16> @fun56(<8 x i16> %a) {
+ %r = urem <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
+ ret <8 x i16> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <8 x i16> %a, <i16 32
+}
+
+define <4 x i16> @fun57(<4 x i16> %a) {
+ %r = urem <4 x i16> %a, <i16 32, i16 32, i16 32, i16 32>
+ ret <4 x i16> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <4 x i16> %a, <i16 32
+}
+
+define <16 x i8> @fun58(<16 x i8> %a) {
+ %r = urem <16 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
+ ret <16 x i8> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <16 x i8> %a, <i8 -128
+}
+
+define <8 x i8> @fun59(<8 x i8> %a) {
+ %r = urem <8 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
+ ret <8 x i8> %r
+; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <8 x i8> %a, <i8 -128
+}
diff --git a/test/Analysis/CostModel/SystemZ/divrem-reg.ll b/test/Analysis/CostModel/SystemZ/divrem-reg.ll
new file mode 100644
index 00000000000..0cb1293cf3b
--- /dev/null
+++ b/test/Analysis/CostModel/SystemZ/divrem-reg.ll
@@ -0,0 +1,286 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
+
+; Check costs of divisions by register
+;
+; Note: Vectorization of division/remainder is temporarily disabled for high
+; vectorization factors by returning 1000.
+
+; Scalar sdiv
+
+define i64 @fun0(i64 %a, i64 %b) {
+ %r = sdiv i64 %a, %b
+ ret i64 %r
+; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = sdiv i64
+}
+
+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
+}
+
+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
+}
+
+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
+}
+
+; Vector sdiv
+
+define <2 x i64> @fun4(<2 x i64> %a, <2 x i64> %b) {
+ %r = sdiv <2 x i64> %a, %b
+ ret <2 x i64> %r
+; CHECK: Cost Model: Found an estimated cost of 47 for instruction: %r = sdiv <2 x i64>
+}
+
+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>
+}
+
+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>
+}
+
+define <8 x i16> @fun7(<8 x i16> %a, <8 x i16> %b) {
+ %r = sdiv <8 x i16> %a, %b
+ ret <8 x i16> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = sdiv <8 x i16>
+}
+
+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>
+}
+
+define <16 x i8> @fun9(<16 x i8> %a, <16 x i8> %b) {
+ %r = sdiv <16 x i8> %a, %b
+ ret <16 x i8> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = sdiv <16 x i8>
+}
+
+define <8 x i8> @fun10(<8 x i8> %a, <8 x i8> %b) {
+ %r = sdiv <8 x i8> %a, %b
+ ret <8 x i8> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = sdiv <8 x i8>
+}
+
+; Scalar udiv
+
+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
+}
+
+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
+}
+
+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
+}
+
+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
+}
+
+; Vector udiv
+
+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>
+}
+
+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>
+}
+
+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>
+}
+
+define <8 x i16> @fun18(<8 x i16> %a, <8 x i16> %b) {
+ %r = udiv <8 x i16> %a, %b
+ ret <8 x i16> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = udiv <8 x i16>
+}
+
+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>
+}
+
+define <16 x i8> @fun20(<16 x i8> %a, <16 x i8> %b) {
+ %r = udiv <16 x i8> %a, %b
+ ret <16 x i8> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = udiv <16 x i8>
+}
+
+define <8 x i8> @fun21(<8 x i8> %a, <8 x i8> %b) {
+ %r = udiv <8 x i8> %a, %b
+ ret <8 x i8> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = udiv <8 x i8>
+}
+
+; Scalar srem
+
+define i64 @fun22(i64 %a, i64 %b) {
+ %r = srem i64 %a, %b
+ ret i64 %r
+; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = srem i64
+}
+
+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
+}
+
+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
+}
+
+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
+}
+
+; Vector srem
+
+define <2 x i64> @fun26(<2 x i64> %a, <2 x i64> %b) {
+ %r = srem <2 x i64> %a, %b
+ ret <2 x i64> %r
+; CHECK: Cost Model: Found an estimated cost of 47 for instruction: %r = srem <2 x i64>
+}
+
+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>
+}
+
+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>
+}
+
+define <8 x i16> @fun29(<8 x i16> %a, <8 x i16> %b) {
+ %r = srem <8 x i16> %a, %b
+ ret <8 x i16> %r
+; CHECK: ost Model: Found an estimated cost of 1000 for instruction: %r = srem <8 x i16>
+}
+
+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>
+}
+
+define <16 x i8> @fun31(<16 x i8> %a, <16 x i8> %b) {
+ %r = srem <16 x i8> %a, %b
+ ret <16 x i8> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = srem <16 x i8>
+}
+
+define <8 x i8> @fun32(<8 x i8> %a, <8 x i8> %b) {
+ %r = srem <8 x i8> %a, %b
+ ret <8 x i8> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = srem <8 x i8>
+}
+
+; Scalar urem
+
+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
+}
+
+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
+}
+
+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
+}
+
+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
+}
+
+; Vector urem
+
+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>
+}
+
+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>
+}
+
+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>
+}
+
+define <8 x i16> @fun40(<8 x i16> %a, <8 x i16> %b) {
+ %r = urem <8 x i16> %a, %b
+ ret <8 x i16> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = urem <8 x i16>
+}
+
+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>
+}
+
+define <16 x i8> @fun42(<16 x i8> %a, <16 x i8> %b) {
+ %r = urem <16 x i8> %a, %b
+ ret <16 x i8> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = urem <16 x i8>
+}
+
+define <8 x i8> @fun43(<8 x i8> %a, <8 x i8> %b) {
+ %r = urem <8 x i8> %a, %b
+ ret <8 x i8> %r
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = urem <8 x i8>
+}
diff --git a/test/Analysis/CostModel/SystemZ/int-arith.ll b/test/Analysis/CostModel/SystemZ/int-arith.ll
index 3ecf4342b94..f9a55dfe742 100644
--- a/test/Analysis/CostModel/SystemZ/int-arith.ll
+++ b/test/Analysis/CostModel/SystemZ/int-arith.ll
@@ -2,9 +2,6 @@
;
; Note: The scalarized vector instructions costs are not including any
; extracts, due to the undef operands.
-;
-; Note: Vectorization of division/remainder is temporarily disabled for high
-; vectorization factors by returning 1000.
define void @add() {
%res0 = add i8 undef, undef
@@ -143,187 +140,3 @@ define void @mul() {
ret void;
}
-
-define void @sdiv() {
- %res0 = sdiv i8 undef, undef
- %res1 = sdiv i16 undef, undef
- %res2 = sdiv i32 undef, undef
- %res3 = sdiv i64 undef, undef
- %res4 = sdiv <2 x i8> undef, undef
- %res5 = sdiv <2 x i16> undef, undef
- %res6 = sdiv <2 x i32> undef, undef
- %res7 = sdiv <2 x i64> undef, undef
- %res8 = sdiv <4 x i8> undef, undef
- %res9 = sdiv <4 x i16> undef, undef
- %res10 = sdiv <4 x i32> undef, undef
- %res11 = sdiv <4 x i64> undef, undef
- %res12 = sdiv <8 x i8> undef, undef
- %res13 = sdiv <8 x i16> undef, undef
- %res14 = sdiv <8 x i32> undef, undef
- %res15 = sdiv <8 x i64> undef, undef
- %res16 = sdiv <16 x i8> undef, undef
- %res17 = sdiv <16 x i16> undef, undef
- %res18 = sdiv <16 x i32> undef, undef
- %res19 = sdiv <16 x i64> undef, undef
-
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res0 = sdiv i8 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res1 = sdiv i16 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res2 = sdiv i32 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res3 = sdiv i64 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res4 = sdiv <2 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res5 = sdiv <2 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res6 = sdiv <2 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 3 for instruction: %res7 = sdiv <2 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res8 = sdiv <4 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res9 = sdiv <4 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res10 = sdiv <4 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res11 = sdiv <4 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res12 = sdiv <8 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res13 = sdiv <8 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res14 = sdiv <8 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res15 = sdiv <8 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res16 = sdiv <16 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res17 = sdiv <16 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res18 = sdiv <16 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res19 = sdiv <16 x i64> undef, undef
-
- ret void;
-}
-
-define void @srem() {
- %res0 = srem i8 undef, undef
- %res1 = srem i16 undef, undef
- %res2 = srem i32 undef, undef
- %res3 = srem i64 undef, undef
- %res4 = srem <2 x i8> undef, undef
- %res5 = srem <2 x i16> undef, undef
- %res6 = srem <2 x i32> undef, undef
- %res7 = srem <2 x i64> undef, undef
- %res8 = srem <4 x i8> undef, undef
- %res9 = srem <4 x i16> undef, undef
- %res10 = srem <4 x i32> undef, undef
- %res11 = srem <4 x i64> undef, undef
- %res12 = srem <8 x i8> undef, undef
- %res13 = srem <8 x i16> undef, undef
- %res14 = srem <8 x i32> undef, undef
- %res15 = srem <8 x i64> undef, undef
- %res16 = srem <16 x i8> undef, undef
- %res17 = srem <16 x i16> undef, undef
- %res18 = srem <16 x i32> undef, undef
- %res19 = srem <16 x i64> undef, undef
-
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res0 = srem i8 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res1 = srem i16 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res2 = srem i32 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %res3 = srem i64 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res4 = srem <2 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res5 = srem <2 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res6 = srem <2 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 3 for instruction: %res7 = srem <2 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res8 = srem <4 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res9 = srem <4 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res10 = srem <4 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res11 = srem <4 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res12 = srem <8 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res13 = srem <8 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res14 = srem <8 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res15 = srem <8 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res16 = srem <16 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res17 = srem <16 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res18 = srem <16 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res19 = srem <16 x i64> undef, undef
-
- ret void;
-}
-
-define void @udiv() {
- %res0 = udiv i8 undef, undef
- %res1 = udiv i16 undef, undef
- %res2 = udiv i32 undef, undef
- %res3 = udiv i64 undef, undef
- %res4 = udiv <2 x i8> undef, undef
- %res5 = udiv <2 x i16> undef, undef
- %res6 = udiv <2 x i32> undef, undef
- %res7 = udiv <2 x i64> undef, undef
- %res8 = udiv <4 x i8> undef, undef
- %res9 = udiv <4 x i16> undef, undef
- %res10 = udiv <4 x i32> undef, undef
- %res11 = udiv <4 x i64> undef, undef
- %res12 = udiv <8 x i8> undef, undef
- %res13 = udiv <8 x i16> undef, undef
- %res14 = udiv <8 x i32> undef, undef
- %res15 = udiv <8 x i64> undef, undef
- %res16 = udiv <16 x i8> undef, undef
- %res17 = udiv <16 x i16> undef, undef
- %res18 = udiv <16 x i32> undef, undef
- %res19 = udiv <16 x i64> undef, undef
-
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res0 = udiv i8 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res1 = udiv i16 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res2 = udiv i32 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res3 = udiv i64 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res4 = udiv <2 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res5 = udiv <2 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res6 = udiv <2 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 5 for instruction: %res7 = udiv <2 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res8 = udiv <4 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res9 = udiv <4 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res10 = udiv <4 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res11 = udiv <4 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res12 = udiv <8 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res13 = udiv <8 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res14 = udiv <8 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res15 = udiv <8 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res16 = udiv <16 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res17 = udiv <16 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res18 = udiv <16 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res19 = udiv <16 x i64> undef, undef
-
- ret void;
-}
-
-define void @urem() {
- %res0 = urem i8 undef, undef
- %res1 = urem i16 undef, undef
- %res2 = urem i32 undef, undef
- %res3 = urem i64 undef, undef
- %res4 = urem <2 x i8> undef, undef
- %res5 = urem <2 x i16> undef, undef
- %res6 = urem <2 x i32> undef, undef
- %res7 = urem <2 x i64> undef, undef
- %res8 = urem <4 x i8> undef, undef
- %res9 = urem <4 x i16> undef, undef
- %res10 = urem <4 x i32> undef, undef
- %res11 = urem <4 x i64> undef, undef
- %res12 = urem <8 x i8> undef, undef
- %res13 = urem <8 x i16> undef, undef
- %res14 = urem <8 x i32> undef, undef
- %res15 = urem <8 x i64> undef, undef
- %res16 = urem <16 x i8> undef, undef
- %res17 = urem <16 x i16> undef, undef
- %res18 = urem <16 x i32> undef, undef
- %res19 = urem <16 x i64> undef, undef
-
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res0 = urem i8 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %res1 = urem i16 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res2 = urem i32 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %res3 = urem i64 undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res4 = urem <2 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res5 = urem <2 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res6 = urem <2 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 5 for instruction: %res7 = urem <2 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res8 = urem <4 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res9 = urem <4 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res10 = urem <4 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res11 = urem <4 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res12 = urem <8 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res13 = urem <8 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res14 = urem <8 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res15 = urem <8 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res16 = urem <16 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res17 = urem <16 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res18 = urem <16 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res19 = urem <16 x i64> undef, undef
-
- ret void;
-}
diff --git a/test/Analysis/CostModel/SystemZ/memop-folding-int-arith.ll b/test/Analysis/CostModel/SystemZ/memop-folding-int-arith.ll
index 1b6a50d303f..1ca16bab538 100644
--- a/test/Analysis/CostModel/SystemZ/memop-folding-int-arith.ll
+++ b/test/Analysis/CostModel/SystemZ/memop-folding-int-arith.ll
@@ -90,16 +90,16 @@ define void @mul() {
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %4 = mul i64 %li64_0, %li64_1
}
-define void @sdiv() {
+define void @sdiv(i32 %arg32, i64 %arg64) {
%li32 = load i32, i32* undef
- sdiv i32 %li32, undef
+ sdiv i32 %li32, %arg32
%li32_0 = load i32, i32* undef
%li32_1 = load i32, i32* undef
sdiv i32 %li32_0, %li32_1
%li64 = load i64, i64* undef
- sdiv i64 %li64, undef
+ sdiv i64 %li64, %arg64
%li64_0 = load i64, i64* undef
%li64_1 = load i64, i64* undef
@@ -107,27 +107,27 @@ define void @sdiv() {
ret void;
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li32 = load i32, i32* undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %1 = sdiv i32 %li32, 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 0 for instruction: %li32_0 = load i32, i32* undef
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li32_1 = load i32, i32* undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %2 = sdiv i32 %li32_0, %li32_1
+; 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 0 for instruction: %li64 = load i64, i64* undef
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %3 = sdiv i64 %li64, 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 0 for instruction: %li64_0 = load i64, i64* undef
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li64_1 = load i64, i64* undef
-; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %4 = sdiv i64 %li64_0, %li64_1
+; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %4 = sdiv i64 %li64_0, %li64_1
}
-define void @udiv() {
+define void @udiv(i32 %arg32, i64 %arg64) {
%li32 = load i32, i32* undef
- udiv i32 %li32, undef
+ udiv i32 %li32, %arg32
%li32_0 = load i32, i32* undef
%li32_1 = load i32, i32* undef
udiv i32 %li32_0, %li32_1
%li64 = load i64, i64* undef
- udiv i64 %li64, undef
+ udiv i64 %li64, %arg64
%li64_0 = load i64, i64* undef
%li64_1 = load i64, i64* undef
@@ -135,15 +135,15 @@ define void @udiv() {
ret void;
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %li32 = load i32, i32* undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %1 = udiv i32 %li32, 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 0 for instruction: %li32_0 = load i32, i32* undef
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li32_1 = load i32, i32* undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %2 = udiv i32 %li32_0, %li32_1
+; 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 0 for instruction: %li64 = load i64, i64* undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %3 = udiv i64 %li64, 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 0 for instruction: %li64_0 = load i64, i64* undef
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %li64_1 = load i64, i64* undef
-; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %4 = udiv i64 %li64_0, %li64_1
+; CHECK: Cost Model: Found an estimated cost of 21 for instruction: %4 = udiv i64 %li64_0, %li64_1
}
define void @and() {