; 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, ret <2 x i64> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, } define <2 x i64> @fun9(<2 x i64> %a) { %r = sdiv <2 x i64> %a, ret <2 x i64> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, } define <4 x i32> @fun10(<4 x i32> %a) { %r = sdiv <4 x i32> %a, ret <4 x i32> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, } define <4 x i32> @fun11(<4 x i32> %a) { %r = sdiv <4 x i32> %a, ret <4 x i32> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, @fun12(<2 x i32> %a) { %r = sdiv <2 x i32> %a, ret <2 x i32> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i32> %a, @fun13(<8 x i16> %a) { %r = sdiv <8 x i16> %a, ret <8 x i16> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, @fun14(<8 x i16> %a) { %r = sdiv <8 x i16> %a, ret <8 x i16> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, @fun15(<4 x i16> %a) { %r = sdiv <4 x i16> %a, ret <4 x i16> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i16> %a, @fun16(<16 x i8> %a) { %r = sdiv <16 x i8> %a, ret <16 x i8> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, @fun17(<16 x i8> %a) { %r = sdiv <16 x i8> %a, ret <16 x i8> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, @fun18(<8 x i8> %a) { %r = sdiv <8 x i8> %a, ret <8 x i8> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i8> %a, @fun23(<2 x i64> %a) { %r = udiv <2 x i64> %a, ret <2 x i64> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <2 x i64> %a, @fun24(<4 x i32> %a) { %r = udiv <4 x i32> %a, ret <4 x i32> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <4 x i32> %a, @fun25(<2 x i32> %a) { %r = udiv <2 x i32> %a, ret <2 x i32> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <2 x i32> %a, @fun26(<8 x i16> %a) { %r = udiv <8 x i16> %a, ret <8 x i16> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <8 x i16> %a, @fun27(<4 x i16> %a) { %r = udiv <4 x i16> %a, ret <4 x i16> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <4 x i16> %a, @fun28(<16 x i8> %a) { %r = udiv <16 x i8> %a, ret <16 x i8> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <16 x i8> %a, @fun29(<8 x i8> %a) { %r = udiv <8 x i8> %a, ret <8 x i8> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <8 x i8> %a, @fun38(<2 x i64> %a) { %r = srem <2 x i64> %a, ret <2 x i64> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i64> %a, } define <2 x i64> @fun39(<2 x i64> %a) { %r = srem <2 x i64> %a, ret <2 x i64> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i64> %a, } define <4 x i32> @fun40(<4 x i32> %a) { %r = srem <4 x i32> %a, ret <4 x i32> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i32> %a, } define <4 x i32> @fun41(<4 x i32> %a) { %r = srem <4 x i32> %a, ret <4 x i32> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i32> %a, @fun42(<2 x i32> %a) { %r = srem <2 x i32> %a, ret <2 x i32> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <2 x i32> %a, @fun43(<8 x i16> %a) { %r = srem <8 x i16> %a, ret <8 x i16> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i16> %a, @fun44(<8 x i16> %a) { %r = srem <8 x i16> %a, ret <8 x i16> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i16> %a, @fun45(<4 x i16> %a) { %r = srem <4 x i16> %a, ret <4 x i16> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <4 x i16> %a, @fun46(<16 x i8> %a) { %r = srem <16 x i8> %a, ret <16 x i8> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <16 x i8> %a, @fun47(<16 x i8> %a) { %r = srem <16 x i8> %a, ret <16 x i8> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <16 x i8> %a, @fun48(<8 x i8> %a) { %r = srem <8 x i8> %a, ret <8 x i8> %r ; COST: Cost Model: Found an estimated cost of 4 for instruction: %r = srem <8 x i8> %a, @fun53(<2 x i64> %a) { %r = urem <2 x i64> %a, ret <2 x i64> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <2 x i64> %a, @fun54(<4 x i32> %a) { %r = urem <4 x i32> %a, ret <4 x i32> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <4 x i32> %a, @fun55(<2 x i32> %a) { %r = urem <2 x i32> %a, ret <2 x i32> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <2 x i32> %a, @fun56(<8 x i16> %a) { %r = urem <8 x i16> %a, ret <8 x i16> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <8 x i16> %a, @fun57(<4 x i16> %a) { %r = urem <4 x i16> %a, ret <4 x i16> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <4 x i16> %a, @fun58(<16 x i8> %a) { %r = urem <16 x i8> %a, ret <16 x i8> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <16 x i8> %a, @fun59(<8 x i8> %a) { %r = urem <8 x i8> %a, ret <8 x i8> %r ; COST: Cost Model: Found an estimated cost of 1 for instruction: %r = urem <8 x i8> %a,