1 ; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s 2 3 ; Scalar sdiv 4 5 define i64 @fun0(i64 %a) { 6 %r = sdiv i64 %a, 2 7 ret i64 %r 8 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %a, 2 9 } 10 11 define i64 @fun1(i64 %a) { 12 %r = sdiv i64 %a, -4 13 ret i64 %r 14 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %a, -4 15 } 16 17 define i32 @fun2(i32 %a) { 18 %r = sdiv i32 %a, 8 19 ret i32 %r 20 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i32 %a, 8 21 } 22 23 define i32 @fun3(i32 %a) { 24 %r = sdiv i32 %a, -16 25 ret i32 %r 26 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i32 %a, -16 27 } 28 29 define i16 @fun4(i16 %a) { 30 %r = sdiv i16 %a, 32 31 ret i16 %r 32 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i16 %a, 32 33 } 34 35 define i16 @fun5(i16 %a) { 36 %r = sdiv i16 %a, -64 37 ret i16 %r 38 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i16 %a, -64 39 } 40 41 define i8 @fun6(i8 %a) { 42 %r = sdiv i8 %a, 64 43 ret i8 %r 44 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i8 %a, 64 45 } 46 47 define i8 @fun7(i8 %a) { 48 %r = sdiv i8 %a, -128 49 ret i8 %r 50 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i8 %a, -128 51 } 52 53 54 ; Vector sdiv 55 56 define <2 x i64> @fun8(<2 x i64> %a) { 57 %r = sdiv <2 x i64> %a, <i64 2, i64 2> 58 ret <2 x i64> %r 59 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, <i64 2, i64 2> 60 } 61 62 define <2 x i64> @fun9(<2 x i64> %a) { 63 %r = sdiv <2 x i64> %a, <i64 -4, i64 -4> 64 ret <2 x i64> %r 65 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <2 x i64> %a, <i64 -4, i64 -4> 66 } 67 68 define <4 x i32> @fun10(<4 x i32> %a) { 69 %r = sdiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8> 70 ret <4 x i32> %r 71 ; 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> 72 } 73 74 define <4 x i32> @fun11(<4 x i32> %a) { 75 %r = sdiv <4 x i32> %a, <i32 -16, i32 -16, i32 -16, i32 -16> 76 ret <4 x i32> %r 77 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <4 x i32> %a, <i32 -16 78 } 79 80 define <8 x i16> @fun12(<8 x i16> %a) { 81 %r = sdiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32> 82 ret <8 x i16> %r 83 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, <i16 32 84 } 85 86 define <8 x i16> @fun13(<8 x i16> %a) { 87 %r = sdiv <8 x i16> %a, <i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64> 88 ret <8 x i16> %r 89 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <8 x i16> %a, <i16 -64 90 } 91 92 define <16 x i8> @fun14(<16 x i8> %a) { 93 %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> 94 ret <16 x i8> %r 95 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, <i8 64 96 } 97 98 define <16 x i8> @fun15(<16 x i8> %a) { 99 %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> 100 ret <16 x i8> %r 101 ; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv <16 x i8> %a, <i8 -128 102 } 103 104 ; Scalar udiv 105 106 define i64 @fun16(i64 %a) { 107 %r = udiv i64 %a, 2 108 ret i64 %r 109 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i64 %a, 2 110 } 111 112 define i32 @fun17(i32 %a) { 113 %r = udiv i32 %a, 8 114 ret i32 %r 115 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i32 %a, 8 116 } 117 118 define i16 @fun18(i16 %a) { 119 %r = udiv i16 %a, 32 120 ret i16 %r 121 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i16 %a, 32 122 } 123 124 define i8 @fun19(i8 %a) { 125 %r = udiv i8 %a, 128 126 ret i8 %r 127 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv i8 %a, -128 128 } 129 130 ; Vector udiv 131 132 define <2 x i64> @fun20(<2 x i64> %a) { 133 %r = udiv <2 x i64> %a, <i64 2, i64 2> 134 ret <2 x i64> %r 135 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <2 x i64> %a, <i64 2 136 } 137 138 define <4 x i32> @fun21(<4 x i32> %a) { 139 %r = udiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8> 140 ret <4 x i32> %r 141 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <4 x i32> %a, <i32 8 142 } 143 144 define <8 x i16> @fun22(<8 x i16> %a) { 145 %r = udiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32> 146 ret <8 x i16> %r 147 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <8 x i16> %a, <i16 32 148 } 149 150 define <16 x i8> @fun23(<16 x i8> %a) { 151 %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> 152 ret <16 x i8> %r 153 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %r = udiv <16 x i8> %a, <i8 -128 154 } 155