1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 \
; RUN: | FileCheck %s -check-prefixes=CHECK,Z13
; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z15 \
; RUN: | FileCheck %s -check-prefixes=CHECK,Z15
define void @bswap_i64(i64 %arg, <2 x i64> %arg2) {
; CHECK: Printing analysis 'Cost Model Analysis' for function 'bswap_i64':
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call i64
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call <2 x i64>
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %swp4 = tail call <4 x i64>
%swp1 = tail call i64 @llvm.bswap.i64(i64 %arg)
%swp2 = tail call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %arg2)
%swp4 = tail call <4 x i64> @llvm.bswap.v4i64(<4 x i64> undef)
ret void
}
define void @bswap_i32(i32 %arg, <2 x i32> %arg2, <4 x i32> %arg4) {
; CHECK: Printing analysis 'Cost Model Analysis' for function 'bswap_i32':
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call i32
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call <2 x i32>
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp4 = tail call <4 x i32>
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %swp8 = tail call <8 x i32>
%swp1 = tail call i32 @llvm.bswap.i32(i32 %arg)
%swp2 = tail call <2 x i32> @llvm.bswap.v2i32(<2 x i32> %arg2)
%swp4 = tail call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %arg4)
%swp8 = tail call <8 x i32> @llvm.bswap.v8i32(<8 x i32> undef)
ret void
}
define void @bswap_i16(i16 %arg, <2 x i16> %arg2, <4 x i16> %arg4,
<8 x i16> %arg8) {
; CHECK: Printing analysis 'Cost Model Analysis' for function 'bswap_i16':
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call i16 @llvm.bswap.i16(i16 %arg)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %arg2)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp4 = tail call <4 x i16> @llvm.bswap.v4i16(<4 x i16> %arg4)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp8 = tail call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %arg8)
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %swp16 = tail call <16 x i16> @llvm.bswap.v16i16(<16 x i16> undef)
%swp1 = tail call i16 @llvm.bswap.i16(i16 %arg)
%swp2 = tail call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %arg2)
%swp4 = tail call <4 x i16> @llvm.bswap.v4i16(<4 x i16> %arg4)
%swp8 = tail call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %arg8)
%swp16 = tail call <16 x i16> @llvm.bswap.v16i16(<16 x i16> undef)
ret void
}
; Test that store/load reversed is reflected in costs.
define void @bswap_i64_mem(i64* %src, i64 %arg, i64* %dst) {
; CHECK: Printing analysis 'Cost Model Analysis' for function 'bswap_i64_mem':
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %Ld1 = load i64, i64* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call i64 @llvm.bswap.i64(i64 %Ld1)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call i64 @llvm.bswap.i64(i64 %arg)
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: store i64 %swp2, i64* %dst
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %Ld2 = load i64, i64* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp3 = tail call i64 @llvm.bswap.i64(i64 %Ld2)
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: store i64 %swp3, i64* %dst
%Ld1 = load i64, i64* %src
%swp1 = tail call i64 @llvm.bswap.i64(i64 %Ld1)
%swp2 = tail call i64 @llvm.bswap.i64(i64 %arg)
store i64 %swp2, i64* %dst
%Ld2 = load i64, i64* %src
%swp3 = tail call i64 @llvm.bswap.i64(i64 %Ld2)
store i64 %swp3, i64* %dst
ret void
}
define void @bswap_v2i64_mem(<2 x i64>* %src, <2 x i64> %arg, <2 x i64>* %dst) {
; CHECK:Printing analysis 'Cost Model Analysis' for function 'bswap_v2i64_mem':
; Z13: Cost Model: Found an estimated cost of 1 for instruction: %Ld1 = load <2 x i64>, <2 x i64>* %src
; Z15: Cost Model: Found an estimated cost of 0 for instruction: %Ld1 = load <2 x i64>, <2 x i64>* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %Ld1)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %arg)
; Z13: Cost Model: Found an estimated cost of 1 for instruction: store <2 x i64> %swp2, <2 x i64>* %dst
; Z15: Cost Model: Found an estimated cost of 0 for instruction: store <2 x i64> %swp2, <2 x i64>* %dst
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %Ld2 = load <2 x i64>, <2 x i64>* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp3 = tail call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %Ld2)
; Z13: Cost Model: Found an estimated cost of 1 for instruction: store <2 x i64> %swp3, <2 x i64>* %dst
; Z15: Cost Model: Found an estimated cost of 0 for instruction: store <2 x i64> %swp3, <2 x i64>* %dst
%Ld1 = load <2 x i64>, <2 x i64>* %src
%swp1 = tail call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %Ld1)
%swp2 = tail call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %arg)
store <2 x i64> %swp2, <2 x i64>* %dst
%Ld2 = load <2 x i64>, <2 x i64>* %src
%swp3 = tail call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %Ld2)
store <2 x i64> %swp3, <2 x i64>* %dst
ret void
}
define void @bswap_i32_mem(i32* %src, i32 %arg, i32* %dst) {
; CHECK: Printing analysis 'Cost Model Analysis' for function 'bswap_i32_mem':
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %Ld1 = load i32, i32* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call i32 @llvm.bswap.i32(i32 %Ld1)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call i32 @llvm.bswap.i32(i32 %arg)
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: store i32 %swp2, i32* %dst
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %Ld2 = load i32, i32* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp3 = tail call i32 @llvm.bswap.i32(i32 %Ld2)
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: store i32 %swp3, i32* %dst
%Ld1 = load i32, i32* %src
%swp1 = tail call i32 @llvm.bswap.i32(i32 %Ld1)
%swp2 = tail call i32 @llvm.bswap.i32(i32 %arg)
store i32 %swp2, i32* %dst
%Ld2 = load i32, i32* %src
%swp3 = tail call i32 @llvm.bswap.i32(i32 %Ld2)
store i32 %swp3, i32* %dst
ret void
}
define void @bswap_v4i32_mem(<4 x i32>* %src, <4 x i32> %arg, <4 x i32>* %dst) {
; CHECK: Printing analysis 'Cost Model Analysis' for function 'bswap_v4i32_mem':
; Z13: Cost Model: Found an estimated cost of 1 for instruction: %Ld1 = load <4 x i32>, <4 x i32>* %src
; Z15: Cost Model: Found an estimated cost of 0 for instruction: %Ld1 = load <4 x i32>, <4 x i32>* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %Ld1)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %arg)
; Z13: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> %swp2, <4 x i32>* %dst
; Z15: Cost Model: Found an estimated cost of 0 for instruction: store <4 x i32> %swp2, <4 x i32>* %dst
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %Ld2 = load <4 x i32>, <4 x i32>* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp3 = tail call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %Ld2)
; Z13: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> %swp3, <4 x i32>* %dst
; Z15: Cost Model: Found an estimated cost of 0 for instruction: store <4 x i32> %swp3, <4 x i32>* %dst
%Ld1 = load <4 x i32>, <4 x i32>* %src
%swp1 = tail call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %Ld1)
%swp2 = tail call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %arg)
store <4 x i32> %swp2, <4 x i32>* %dst
%Ld2 = load <4 x i32>, <4 x i32>* %src
%swp3 = tail call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %Ld2)
store <4 x i32> %swp3, <4 x i32>* %dst
ret void
}
define void @bswap_i16_mem(i16* %src, i16 %arg, i16* %dst) {
; CHECK: Printing analysis 'Cost Model Analysis' for function 'bswap_i16_mem':
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: %Ld1 = load i16, i16* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call i16 @llvm.bswap.i16(i16 %Ld1)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call i16 @llvm.bswap.i16(i16 %arg)
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: store i16 %swp2, i16* %dst
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %Ld2 = load i16, i16* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp3 = tail call i16 @llvm.bswap.i16(i16 %Ld2)
; CHECK: Cost Model: Found an estimated cost of 0 for instruction: store i16 %swp3, i16* %dst
%Ld1 = load i16, i16* %src
%swp1 = tail call i16 @llvm.bswap.i16(i16 %Ld1)
%swp2 = tail call i16 @llvm.bswap.i16(i16 %arg)
store i16 %swp2, i16* %dst
%Ld2 = load i16, i16* %src
%swp3 = tail call i16 @llvm.bswap.i16(i16 %Ld2)
store i16 %swp3, i16* %dst
ret void
}
define void @bswap_v8i16_mem(<8 x i16>* %src, <8 x i16> %arg, <8 x i16>* %dst) {
; CHECK: Printing analysis 'Cost Model Analysis' for function 'bswap_v8i16_mem':
; Z13: Cost Model: Found an estimated cost of 1 for instruction: %Ld1 = load <8 x i16>, <8 x i16>* %src
; Z15: Cost Model: Found an estimated cost of 0 for instruction: %Ld1 = load <8 x i16>, <8 x i16>* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp1 = tail call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %Ld1)
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp2 = tail call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %arg)
; Z13: Cost Model: Found an estimated cost of 1 for instruction: store <8 x i16> %swp2, <8 x i16>* %dst
; Z15: Cost Model: Found an estimated cost of 0 for instruction: store <8 x i16> %swp2, <8 x i16>* %dst
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %Ld2 = load <8 x i16>, <8 x i16>* %src
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %swp3 = tail call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %Ld2)
; Z13: Cost Model: Found an estimated cost of 1 for instruction: store <8 x i16> %swp3, <8 x i16>* %dst
; Z15: Cost Model: Found an estimated cost of 0 for instruction: store <8 x i16> %swp3, <8 x i16>* %dst
%Ld1 = load <8 x i16>, <8 x i16>* %src
%swp1 = tail call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %Ld1)
%swp2 = tail call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %arg)
store <8 x i16> %swp2, <8 x i16>* %dst
%Ld2 = load <8 x i16>, <8 x i16>* %src
%swp3 = tail call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %Ld2)
store <8 x i16> %swp3, <8 x i16>* %dst
ret void
}
declare i64 @llvm.bswap.i64(i64)
declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
declare <4 x i64> @llvm.bswap.v4i64(<4 x i64>)
declare i32 @llvm.bswap.i32(i32)
declare <2 x i32> @llvm.bswap.v2i32(<2 x i32>)
declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
declare <8 x i32> @llvm.bswap.v8i32(<8 x i32>)
declare i16 @llvm.bswap.i16(i16)
declare <2 x i16> @llvm.bswap.v2i16(<2 x i16>)
declare <4 x i16> @llvm.bswap.v4i16(<4 x i16>)
declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>)
declare <16 x i16> @llvm.bswap.v16i16(<16 x i16>)
|