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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
|
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
; CHECK-DAG: %[[#int_16:]] = OpTypeInt 16 0
; CHECK-DAG: %[[#vec2_16:]] = OpTypeVector %[[#int_16]] 2
; CHECK-DAG: %[[#vec3_16:]] = OpTypeVector %[[#int_16]] 3
; CHECK-DAG: %[[#vec4_16:]] = OpTypeVector %[[#int_16]] 4
; CHECK-DAG: %[[#int_32:]] = OpTypeInt 32 0
; CHECK-DAG: %[[#vec2_32:]] = OpTypeVector %[[#int_32]] 2
; CHECK-DAG: %[[#vec3_32:]] = OpTypeVector %[[#int_32]] 3
; CHECK-DAG: %[[#vec4_32:]] = OpTypeVector %[[#int_32]] 4
; CHECK-DAG: %[[#int_64:]] = OpTypeInt 64 0
; CHECK-DAG: %[[#vec2_64:]] = OpTypeVector %[[#int_64]] 2
; CHECK-DAG: %[[#vec3_64:]] = OpTypeVector %[[#int_64]] 3
; CHECK-DAG: %[[#vec4_64:]] = OpTypeVector %[[#int_64]] 4
define spir_func noundef i16 @test_mad_uint16_t(i16 noundef %p0, i16 noundef %p1, i16 noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#int_16]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#int_16]] %[[#mul]] %[[#arg2]]
%3 = mul nuw i16 %p0, %p1
%4 = add nuw i16 %3, %p2
ret i16 %4
}
define spir_func noundef <2 x i16> @test_mad_uint16_t2(<2 x i16> noundef %p0, <2 x i16> noundef %p1, <2 x i16> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec2_16]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec2_16]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <2 x i16> %p0, %p1
%4 = add nuw <2 x i16> %3, %p2
ret <2 x i16> %4
}
define spir_func noundef <3 x i16> @test_mad_uint16_t3(<3 x i16> noundef %p0, <3 x i16> noundef %p1, <3 x i16> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec3_16]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec3_16]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <3 x i16> %p0, %p1
%4 = add nuw <3 x i16> %3, %p2
ret <3 x i16> %4
}
define spir_func noundef <4 x i16> @test_mad_uint16_t4(<4 x i16> noundef %p0, <4 x i16> noundef %p1, <4 x i16> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec4_16]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec4_16]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <4 x i16> %p0, %p1
%4 = add nuw <4 x i16> %3, %p2
ret <4 x i16> %4
}
define spir_func noundef i16 @test_mad_int16_t(i16 noundef %p0, i16 noundef %p1, i16 noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#int_16]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#int_16]] %[[#mul]] %[[#arg2]]
%3 = mul nsw i16 %p0, %p1
%4 = add nsw i16 %3, %p2
ret i16 %4
}
define spir_func noundef <2 x i16> @test_mad_int16_t2(<2 x i16> noundef %p0, <2 x i16> noundef %p1, <2 x i16> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec2_16]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec2_16]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <2 x i16> %p0, %p1
%4 = add nsw <2 x i16> %3, %p2
ret <2 x i16> %4
}
define spir_func noundef <3 x i16> @test_mad_int16_t3(<3 x i16> noundef %p0, <3 x i16> noundef %p1, <3 x i16> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec3_16]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec3_16]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <3 x i16> %p0, %p1
%4 = add nsw <3 x i16> %3, %p2
ret <3 x i16> %4
}
define spir_func noundef <4 x i16> @test_mad_int16_t4(<4 x i16> noundef %p0, <4 x i16> noundef %p1, <4 x i16> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec4_16]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec4_16]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <4 x i16> %p0, %p1
%4 = add nsw <4 x i16> %3, %p2
ret <4 x i16> %4
}
define spir_func noundef i32 @test_mad_int(i32 noundef %p0, i32 noundef %p1, i32 noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#int_32]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#int_32]] %[[#mul]] %[[#arg2]]
%3 = mul nsw i32 %p0, %p1
%4 = add nsw i32 %3, %p2
ret i32 %4
}
define spir_func noundef <2 x i32> @test_mad_int2(<2 x i32> noundef %p0, <2 x i32> noundef %p1, <2 x i32> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec2_32]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec2_32]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <2 x i32> %p0, %p1
%4 = add nsw <2 x i32> %3, %p2
ret <2 x i32> %4
}
define spir_func noundef <3 x i32> @test_mad_int3(<3 x i32> noundef %p0, <3 x i32> noundef %p1, <3 x i32> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec3_32]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec3_32]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <3 x i32> %p0, %p1
%4 = add nsw <3 x i32> %3, %p2
ret <3 x i32> %4
}
define spir_func noundef <4 x i32> @test_mad_int4(<4 x i32> noundef %p0, <4 x i32> noundef %p1, <4 x i32> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec4_32]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec4_32]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <4 x i32> %p0, %p1
%4 = add nsw <4 x i32> %3, %p2
ret <4 x i32> %4
}
define spir_func noundef i64 @test_mad_int64_t(i64 noundef %p0, i64 noundef %p1, i64 noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#int_64]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#int_64]] %[[#mul]] %[[#arg2]]
%3 = mul nsw i64 %p0, %p1
%4 = add nsw i64 %3, %p2
ret i64 %4
}
define spir_func noundef <2 x i64> @test_mad_int64_t2(<2 x i64> noundef %p0, <2 x i64> noundef %p1, <2 x i64> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec2_64]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec2_64]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <2 x i64> %p0, %p1
%4 = add nsw <2 x i64> %3, %p2
ret <2 x i64> %4
}
define spir_func noundef <3 x i64> @test_mad_int64_t3(<3 x i64> noundef %p0, <3 x i64> noundef %p1, <3 x i64> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec3_64]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec3_64]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <3 x i64> %p0, %p1
%4 = add nsw <3 x i64> %3, %p2
ret <3 x i64> %4
}
define spir_func noundef <4 x i64> @test_mad_int64_t4(<4 x i64> noundef %p0, <4 x i64> noundef %p1, <4 x i64> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec4_64]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec4_64]] %[[#mul]] %[[#arg2]]
%3 = mul nsw <4 x i64> %p0, %p1
%4 = add nsw <4 x i64> %3, %p2
ret <4 x i64> %4
}
define spir_func noundef i32 @test_mad_uint(i32 noundef %p0, i32 noundef %p1, i32 noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#int_32]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#int_32]] %[[#mul]] %[[#arg2]]
%3 = mul nuw i32 %p0, %p1
%4 = add nuw i32 %3, %p2
ret i32 %4
}
define spir_func noundef <2 x i32> @test_mad_uint2(<2 x i32> noundef %p0, <2 x i32> noundef %p1, <2 x i32> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec2_32]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec2_32]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <2 x i32> %p0, %p1
%4 = add nuw <2 x i32> %3, %p2
ret <2 x i32> %4
}
define spir_func noundef <3 x i32> @test_mad_uint3(<3 x i32> noundef %p0, <3 x i32> noundef %p1, <3 x i32> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec3_32]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec3_32]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <3 x i32> %p0, %p1
%4 = add nuw <3 x i32> %3, %p2
ret <3 x i32> %4
}
define spir_func noundef <4 x i32> @test_mad_uint4(<4 x i32> noundef %p0, <4 x i32> noundef %p1, <4 x i32> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec4_32]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec4_32]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <4 x i32> %p0, %p1
%4 = add nuw <4 x i32> %3, %p2
ret <4 x i32> %4
}
define spir_func noundef i64 @test_mad_uint64_t(i64 noundef %p0, i64 noundef %p1, i64 noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#int_64]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#int_64]] %[[#mul]] %[[#arg2]]
%3 = mul nuw i64 %p0, %p1
%4 = add nuw i64 %3, %p2
ret i64 %4
}
define spir_func noundef <2 x i64> @test_mad_uint64_t2(<2 x i64> noundef %p0, <2 x i64> noundef %p1, <2 x i64> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec2_64]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec2_64]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <2 x i64> %p0, %p1
%4 = add nuw <2 x i64> %3, %p2
ret <2 x i64> %4
}
define spir_func noundef <3 x i64> @test_mad_uint64_t3(<3 x i64> noundef %p0, <3 x i64> noundef %p1, <3 x i64> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec3_64]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec3_64]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <3 x i64> %p0, %p1
%4 = add nuw <3 x i64> %3, %p2
ret <3 x i64> %4
}
define spir_func noundef <4 x i64> @test_mad_uint64_t4(<4 x i64> noundef %p0, <4 x i64> noundef %p1, <4 x i64> noundef %p2) {
entry:
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
; CHECK: %[[#mul:]] = OpIMul %[[#vec4_64]] %[[#arg0]] %[[#arg1]]
; CHECK: OpIAdd %[[#vec4_64]] %[[#mul]] %[[#arg2]]
%3 = mul nuw <4 x i64> %p0, %p1
%4 = add nuw <4 x i64> %3, %p2
ret <4 x i64> %4
}
|