diff options
author | Casey Dahlin <sadmac@google.com> | 2017-04-26 10:39:46 -0700 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2019-04-30 18:15:46 +0530 |
commit | 63c740fca48e7a7aa3bfc3a16ce5bbe1a6b5c3b3 (patch) | |
tree | c32a5d7752f25b91b7e71c51752204d59aabb7a3 | |
parent | b4bb47c012b8af71a6f2ae2759c5dbbd57981d15 (diff) |
Precompile intermediate sources
Certain code in Mesa is generated by python scripts that want modules
that aren't part of Android's standard build requirements. This patch
introduces pre-generated versions of those files for our usage.
Test: Build now completes without needing additional python modules on
the host.
Bug: 32336912
Change-Id: I3db6b86db0ebf7f2fba78a0b3aa34e169471fd1a
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
-rw-r--r-- | prebuilt-intermediates/glsl/ir_expression_operation.h | 145 | ||||
-rw-r--r-- | prebuilt-intermediates/glsl/ir_expression_operation_constant.h | 1450 | ||||
-rw-r--r-- | prebuilt-intermediates/glsl/ir_expression_operation_strings.h | 254 | ||||
-rw-r--r-- | prebuilt-intermediates/main/format_pack.c | 11175 | ||||
-rw-r--r-- | prebuilt-intermediates/main/format_unpack.c | 7549 | ||||
-rw-r--r-- | prebuilt-intermediates/nir/nir_builder_opcodes.h | 949 | ||||
-rw-r--r-- | prebuilt-intermediates/nir/nir_constant_expressions.c | 10338 | ||||
-rw-r--r-- | prebuilt-intermediates/nir/nir_opcodes.c | 2582 | ||||
-rw-r--r-- | prebuilt-intermediates/nir/nir_opcodes.h | 220 | ||||
-rw-r--r-- | prebuilt-intermediates/nir/nir_opt_algebraic.c | 21885 | ||||
-rw-r--r-- | src/compiler/Android.glsl.gen.mk | 16 | ||||
-rw-r--r-- | src/compiler/Android.nir.gen.mk | 26 | ||||
-rw-r--r-- | src/mesa/Android.gen.mk | 29 |
13 files changed, 56572 insertions, 46 deletions
diff --git a/prebuilt-intermediates/glsl/ir_expression_operation.h b/prebuilt-intermediates/glsl/ir_expression_operation.h new file mode 100644 index 00000000000..152a93977d0 --- /dev/null +++ b/prebuilt-intermediates/glsl/ir_expression_operation.h @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +enum ir_expression_operation { + ir_unop_bit_not, + ir_unop_logic_not, + ir_unop_neg, + ir_unop_abs, + ir_unop_sign, + ir_unop_rcp, + ir_unop_rsq, + ir_unop_sqrt, + ir_unop_exp, + ir_unop_log, + ir_unop_exp2, + ir_unop_log2, + ir_unop_f2i, + ir_unop_f2u, + ir_unop_i2f, + ir_unop_f2b, + ir_unop_b2f, + ir_unop_i2b, + ir_unop_b2i, + ir_unop_u2f, + ir_unop_i2u, + ir_unop_u2i, + ir_unop_d2f, + ir_unop_f2d, + ir_unop_d2i, + ir_unop_i2d, + ir_unop_d2u, + ir_unop_u2d, + ir_unop_d2b, + ir_unop_bitcast_i2f, + ir_unop_bitcast_f2i, + ir_unop_bitcast_u2f, + ir_unop_bitcast_f2u, + ir_unop_trunc, + ir_unop_ceil, + ir_unop_floor, + ir_unop_fract, + ir_unop_round_even, + ir_unop_sin, + ir_unop_cos, + ir_unop_dFdx, + ir_unop_dFdx_coarse, + ir_unop_dFdx_fine, + ir_unop_dFdy, + ir_unop_dFdy_coarse, + ir_unop_dFdy_fine, + ir_unop_pack_snorm_2x16, + ir_unop_pack_snorm_4x8, + ir_unop_pack_unorm_2x16, + ir_unop_pack_unorm_4x8, + ir_unop_pack_half_2x16, + ir_unop_unpack_snorm_2x16, + ir_unop_unpack_snorm_4x8, + ir_unop_unpack_unorm_2x16, + ir_unop_unpack_unorm_4x8, + ir_unop_unpack_half_2x16, + ir_unop_bitfield_reverse, + ir_unop_bit_count, + ir_unop_find_msb, + ir_unop_find_lsb, + ir_unop_saturate, + ir_unop_pack_double_2x32, + ir_unop_unpack_double_2x32, + ir_unop_frexp_sig, + ir_unop_frexp_exp, + ir_unop_noise, + ir_unop_subroutine_to_int, + ir_unop_interpolate_at_centroid, + ir_unop_get_buffer_size, + ir_unop_ssbo_unsized_array_length, + ir_unop_vote_any, + ir_unop_vote_all, + ir_unop_vote_eq, + ir_binop_add, + ir_binop_sub, + ir_binop_mul, + ir_binop_imul_high, + ir_binop_div, + ir_binop_carry, + ir_binop_borrow, + ir_binop_mod, + ir_binop_less, + ir_binop_greater, + ir_binop_lequal, + ir_binop_gequal, + ir_binop_equal, + ir_binop_nequal, + ir_binop_all_equal, + ir_binop_any_nequal, + ir_binop_lshift, + ir_binop_rshift, + ir_binop_bit_and, + ir_binop_bit_xor, + ir_binop_bit_or, + ir_binop_logic_and, + ir_binop_logic_xor, + ir_binop_logic_or, + ir_binop_dot, + ir_binop_min, + ir_binop_max, + ir_binop_pow, + ir_binop_ubo_load, + ir_binop_ldexp, + ir_binop_vector_extract, + ir_binop_interpolate_at_offset, + ir_binop_interpolate_at_sample, + ir_triop_fma, + ir_triop_lrp, + ir_triop_csel, + ir_triop_bitfield_extract, + ir_triop_vector_insert, + ir_quadop_bitfield_insert, + ir_quadop_vector, + + /* Sentinels marking the last of each kind of operation. */ + ir_last_unop = ir_unop_vote_eq, + ir_last_binop = ir_binop_interpolate_at_sample, + ir_last_triop = ir_triop_vector_insert, + ir_last_quadop = ir_quadop_vector, + ir_last_opcode = ir_quadop_vector +}; diff --git a/prebuilt-intermediates/glsl/ir_expression_operation_constant.h b/prebuilt-intermediates/glsl/ir_expression_operation_constant.h new file mode 100644 index 00000000000..a757e360fed --- /dev/null +++ b/prebuilt-intermediates/glsl/ir_expression_operation_constant.h @@ -0,0 +1,1450 @@ + switch (this->operation) { + case ir_unop_bit_not: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = ~ op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = ~ op[0]->value.i[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_logic_not: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_BOOL: + data.b[c] = !op[0]->value.b[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_neg: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = -((int) op[0]->value.u[c]); + break; + case GLSL_TYPE_INT: + data.i[c] = -op[0]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = -op[0]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = -op[0]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_abs: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c] < 0 ? -op[0]->value.i[c] : op[0]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = fabsf(op[0]->value.f[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = fabs(op[0]->value.d[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_sign: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_INT: + data.i[c] = (op[0]->value.i[c] > 0) - (op[0]->value.i[c] < 0); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = float((op[0]->value.f[c] > 0.0F) - (op[0]->value.f[c] < 0.0F)); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = double((op[0]->value.d[c] > 0.0) - (op[0]->value.d[c] < 0.0)); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_rcp: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] != 0.0F ? 1.0F / op[0]->value.f[c] : 0.0F; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c] != 0.0 ? 1.0 / op[0]->value.d[c] : 0.0; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_rsq: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = 1.0F / sqrtf(op[0]->value.f[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = 1.0 / sqrt(op[0]->value.d[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_sqrt: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = sqrtf(op[0]->value.f[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = sqrt(op[0]->value.d[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_exp: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = expf(op[0]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_log: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = logf(op[0]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_exp2: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = exp2f(op[0]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_log2: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = log2f(op[0]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_f2i: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.i[c] = (int) op[0]->value.f[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_f2u: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.u[c] = (unsigned) op[0]->value.f[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_i2f: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_INT: + data.f[c] = (float) op[0]->value.i[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_f2b: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] != 0.0F ? true : false; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_b2f: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_BOOL: + data.f[c] = op[0]->value.b[c] ? 1.0F : 0.0F; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_i2b: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] ? true : false; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] ? true : false; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_b2i: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_BOOL: + data.i[c] = op[0]->value.b[c] ? 1 : 0; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_u2f: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.f[c] = (float) op[0]->value.u[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_i2u: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_INT: + data.u[c] = op[0]->value.i[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_u2i: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.i[c] = op[0]->value.u[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_d2f: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_DOUBLE: + data.f[c] = op[0]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_f2d: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.d[c] = op[0]->value.f[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_d2i: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_DOUBLE: + data.i[c] = op[0]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_i2d: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_INT: + data.d[c] = op[0]->value.i[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_d2u: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_DOUBLE: + data.u[c] = op[0]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_u2d: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.d[c] = op[0]->value.u[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_d2b: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_DOUBLE: + data.b[c] = op[0]->value.d[c] != 0.0; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_bitcast_i2f: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_INT: + data.f[c] = bitcast_u2f(op[0]->value.i[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_bitcast_f2i: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.i[c] = bitcast_f2u(op[0]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_bitcast_u2f: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.f[c] = bitcast_u2f(op[0]->value.u[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_bitcast_f2u: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.u[c] = bitcast_f2u(op[0]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_trunc: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = truncf(op[0]->value.f[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = trunc(op[0]->value.d[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_ceil: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = ceilf(op[0]->value.f[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = ceil(op[0]->value.d[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_floor: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = floorf(op[0]->value.f[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = floor(op[0]->value.d[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_fract: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] - floorf(op[0]->value.f[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c] - floor(op[0]->value.d[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_round_even: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = _mesa_roundevenf(op[0]->value.f[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = _mesa_roundeven(op[0]->value.d[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_sin: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = sinf(op[0]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_cos: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = cosf(op[0]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_dFdx: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = 0.0f; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_dFdx_coarse: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = 0.0f; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_dFdx_fine: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = 0.0f; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_dFdy: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = 0.0f; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_dFdy_coarse: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = 0.0f; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_dFdy_fine: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = 0.0f; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_pack_snorm_2x16: + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.u[0] = pack_2x16(pack_snorm_1x16, op[0]->value.f[0], op[0]->value.f[1]); + break; + default: + unreachable("invalid type"); + } + break; + + case ir_unop_pack_snorm_4x8: + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.u[0] = pack_4x8(pack_snorm_1x8, op[0]->value.f[0], op[0]->value.f[1], op[0]->value.f[2], op[0]->value.f[3]); + break; + default: + unreachable("invalid type"); + } + break; + + case ir_unop_pack_unorm_2x16: + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.u[0] = pack_2x16(pack_unorm_1x16, op[0]->value.f[0], op[0]->value.f[1]); + break; + default: + unreachable("invalid type"); + } + break; + + case ir_unop_pack_unorm_4x8: + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.u[0] = pack_4x8(pack_unorm_1x8, op[0]->value.f[0], op[0]->value.f[1], op[0]->value.f[2], op[0]->value.f[3]); + break; + default: + unreachable("invalid type"); + } + break; + + case ir_unop_pack_half_2x16: + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.u[0] = pack_2x16(pack_half_1x16, op[0]->value.f[0], op[0]->value.f[1]); + break; + default: + unreachable("invalid type"); + } + break; + + case ir_unop_unpack_snorm_2x16: + unpack_2x16(unpack_snorm_1x16, op[0]->value.u[0], &data.f[0], &data.f[1]); + break; + + case ir_unop_unpack_snorm_4x8: + unpack_4x8(unpack_snorm_1x8, op[0]->value.u[0], &data.f[0], &data.f[1], &data.f[2], &data.f[3]); + break; + + case ir_unop_unpack_unorm_2x16: + unpack_2x16(unpack_unorm_1x16, op[0]->value.u[0], &data.f[0], &data.f[1]); + break; + + case ir_unop_unpack_unorm_4x8: + unpack_4x8(unpack_unorm_1x8, op[0]->value.u[0], &data.f[0], &data.f[1], &data.f[2], &data.f[3]); + break; + + case ir_unop_unpack_half_2x16: + unpack_2x16(unpack_half_1x16, op[0]->value.u[0], &data.f[0], &data.f[1]); + break; + + case ir_unop_bitfield_reverse: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = bitfield_reverse(op[0]->value.u[c]); + break; + case GLSL_TYPE_INT: + data.i[c] = bitfield_reverse(op[0]->value.i[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_bit_count: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.i[c] = _mesa_bitcount(op[0]->value.u[c]); + break; + case GLSL_TYPE_INT: + data.i[c] = _mesa_bitcount(op[0]->value.i[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_find_msb: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.i[c] = find_msb_uint(op[0]->value.u[c]); + break; + case GLSL_TYPE_INT: + data.i[c] = find_msb_int(op[0]->value.i[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_find_lsb: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.i[c] = find_msb_uint(op[0]->value.u[c] & -op[0]->value.u[c]); + break; + case GLSL_TYPE_INT: + data.i[c] = find_msb_uint(op[0]->value.i[c] & -op[0]->value.i[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_saturate: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = CLAMP(op[0]->value.f[c], 0.0f, 1.0f); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_unop_pack_double_2x32: + memcpy(&data.d[0], &op[0]->value.u[0], sizeof(double)); + break; + + case ir_unop_unpack_double_2x32: + memcpy(&data.u[0], &op[0]->value.d[0], sizeof(double)); + break; + + case ir_binop_add: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] + op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] + op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] + op[1]->value.f[c1]; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c0] + op[1]->value.d[c1]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_sub: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] - op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] - op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1]; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c0] - op[1]->value.d[c1]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_mul: + /* Check for equal types, or unequal types involving scalars */ + if ((op[0]->type == op[1]->type && !op[0]->type->is_matrix()) + || op0_scalar || op1_scalar) { + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] * op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] * op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] * op[1]->value.f[c1]; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c0] * op[1]->value.d[c1]; + break; + default: + unreachable("invalid type"); + } + } + } else { + assert(op[0]->type->is_matrix() || op[1]->type->is_matrix()); + + /* Multiply an N-by-M matrix with an M-by-P matrix. Since either + * matrix can be a GLSL vector, either N or P can be 1. + * + * For vec*mat, the vector is treated as a row vector. This + * means the vector is a 1-row x M-column matrix. + * + * For mat*vec, the vector is treated as a column vector. Since + * matrix_columns is 1 for vectors, this just works. + */ + const unsigned n = op[0]->type->is_vector() + ? 1 : op[0]->type->vector_elements; + const unsigned m = op[1]->type->vector_elements; + const unsigned p = op[1]->type->matrix_columns; + for (unsigned j = 0; j < p; j++) { + for (unsigned i = 0; i < n; i++) { + for (unsigned k = 0; k < m; k++) { + if (op[0]->type->base_type == GLSL_TYPE_DOUBLE) + data.d[i+n*j] += op[0]->value.d[i+n*k]*op[1]->value.d[k+m*j]; + else + data.f[i+n*j] += op[0]->value.f[i+n*k]*op[1]->value.f[k+m*j]; + } + } + } + } + break; + + case ir_binop_div: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[1]->value.u[c1] == 0 ? 0 : op[0]->value.u[c0] / op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[1]->value.i[c1] == 0 ? 0 : op[0]->value.i[c0] / op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] / op[1]->value.f[c1]; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c0] / op[1]->value.d[c1]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_mod: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[1]->value.u[c1] == 0 ? 0 : op[0]->value.u[c0] % op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[1]->value.i[c1] == 0 ? 0 : op[0]->value.i[c0] % op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1] * floorf(op[0]->value.f[c0] / op[1]->value.f[c1]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c0] - op[1]->value.d[c1] * floor(op[0]->value.d[c0] / op[1]->value.d[c1]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_less: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] < op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] < op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] < op[1]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.b[c] = op[0]->value.d[c] < op[1]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_greater: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] > op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] > op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] > op[1]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.b[c] = op[0]->value.d[c] > op[1]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_lequal: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] <= op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] <= op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] <= op[1]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.b[c] = op[0]->value.d[c] <= op[1]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_gequal: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] >= op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] >= op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] >= op[1]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.b[c] = op[0]->value.d[c] >= op[1]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_equal: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] == op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] == op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] == op[1]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.b[c] = op[0]->value.d[c] == op[1]->value.d[c]; + break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] == op[1]->value.b[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_nequal: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] != op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] != op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] != op[1]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.b[c] = op[0]->value.d[c] != op[1]->value.d[c]; + break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] != op[1]->value.b[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_all_equal: + data.b[0] = op[0]->has_value(op[1]); + break; + + case ir_binop_any_nequal: + data.b[0] = !op[0]->has_value(op[1]); + break; + + case ir_binop_lshift: + assert(op[0]->type->base_type == GLSL_TYPE_UINT || + op[0]->type->base_type == GLSL_TYPE_INT); + assert(op[1]->type->base_type == GLSL_TYPE_UINT || + op[1]->type->base_type == GLSL_TYPE_INT); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] << op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] << op[1]->value.i[c1]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_rshift: + assert(op[0]->type->base_type == GLSL_TYPE_UINT || + op[0]->type->base_type == GLSL_TYPE_INT); + assert(op[1]->type->base_type == GLSL_TYPE_UINT || + op[1]->type->base_type == GLSL_TYPE_INT); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] >> op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] >> op[1]->value.i[c1]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_bit_and: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] & op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] & op[1]->value.i[c1]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_bit_xor: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] ^ op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] ^ op[1]->value.i[c1]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_bit_or: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] | op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] | op[1]->value.i[c1]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_logic_and: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] && op[1]->value.b[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_logic_xor: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] != op[1]->value.b[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_logic_or: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] || op[1]->value.b[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_dot: + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[0] = dot_f(op[0], op[1]); + break; + case GLSL_TYPE_DOUBLE: + data.d[0] = dot_d(op[0], op[1]); + break; + default: + unreachable("invalid type"); + } + break; + + case ir_binop_min: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = MIN2(op[0]->value.u[c0], op[1]->value.u[c1]); + break; + case GLSL_TYPE_INT: + data.i[c] = MIN2(op[0]->value.i[c0], op[1]->value.i[c1]); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = MIN2(op[0]->value.f[c0], op[1]->value.f[c1]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = MIN2(op[0]->value.d[c0], op[1]->value.d[c1]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_max: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = MAX2(op[0]->value.u[c0], op[1]->value.u[c1]); + break; + case GLSL_TYPE_INT: + data.i[c] = MAX2(op[0]->value.i[c0], op[1]->value.i[c1]); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = MAX2(op[0]->value.f[c0], op[1]->value.f[c1]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = MAX2(op[0]->value.d[c0], op[1]->value.d[c1]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_pow: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = powf(op[0]->value.f[c], op[1]->value.f[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_ldexp: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = ldexpf_flush_subnormal(op[0]->value.f[c], op[1]->value.i[c]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = ldexp_flush_subnormal(op[0]->value.d[c], op[1]->value.i[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_binop_vector_extract: { + const int c = CLAMP(op[1]->value.i[0], 0, + (int) op[0]->type->vector_elements - 1); + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[0] = op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[0] = op[0]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[0] = op[0]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.d[0] = op[0]->value.d[c]; + break; + case GLSL_TYPE_BOOL: + data.b[0] = op[0]->value.b[c]; + break; + default: + unreachable("invalid type"); + } + break; + } + + case ir_triop_fma: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] * op[1]->value.f[c] + op[2]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c] * op[1]->value.d[c] + op[2]->value.d[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_triop_lrp: { + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT || + op[0]->type->base_type == GLSL_TYPE_DOUBLE); + assert(op[1]->type->base_type == GLSL_TYPE_FLOAT || + op[1]->type->base_type == GLSL_TYPE_DOUBLE); + assert(op[2]->type->base_type == GLSL_TYPE_FLOAT || + op[2]->type->base_type == GLSL_TYPE_DOUBLE); + + unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, c2 = 0; c < components; c2 += c2_inc, c++) { + switch (this->type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] * (1.0f - op[2]->value.f[c2]) + (op[1]->value.f[c] * op[2]->value.f[c2]); + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.d[c] * (1.0 - op[2]->value.d[c2]) + (op[1]->value.d[c] * op[2]->value.d[c2]); + break; + default: + unreachable("invalid type"); + } + } + break; + } + + case ir_triop_csel: + for (unsigned c = 0; c < components; c++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.b[c] ? op[1]->value.u[c] : op[2]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.b[c] ? op[1]->value.i[c] : op[2]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.b[c] ? op[1]->value.f[c] : op[2]->value.f[c]; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[0]->value.b[c] ? op[1]->value.d[c] : op[2]->value.d[c]; + break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] ? op[1]->value.b[c] : op[2]->value.b[c]; + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_triop_bitfield_extract: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.i[c] = bitfield_extract_uint(op[0]->value.u[c], op[1]->value.i[c], op[2]->value.i[c]); + break; + case GLSL_TYPE_INT: + data.i[c] = bitfield_extract_int(op[0]->value.i[c], op[1]->value.i[c], op[2]->value.i[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_triop_vector_insert: { + const unsigned idx = op[2]->value.u[0]; + + memcpy(&data, &op[0]->value, sizeof(data)); + + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + data.u[idx] = op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.i[idx] = op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.f[idx] = op[1]->value.f[0]; + break; + case GLSL_TYPE_DOUBLE: + data.d[idx] = op[1]->value.d[0]; + break; + case GLSL_TYPE_BOOL: + data.b[idx] = op[1]->value.b[0]; + break; + default: + unreachable("invalid type"); + } + break; + } + + case ir_quadop_bitfield_insert: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = bitfield_insert(op[0]->value.u[c], op[1]->value.u[c], op[2]->value.i[c], op[3]->value.i[c]); + break; + case GLSL_TYPE_INT: + data.i[c] = bitfield_insert(op[0]->value.i[c], op[1]->value.i[c], op[2]->value.i[c], op[3]->value.i[c]); + break; + default: + unreachable("invalid type"); + } + } + break; + + case ir_quadop_vector: + for (unsigned c = 0; c < this->type->vector_elements; c++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[c]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[c]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[c]->value.f[0]; + break; + case GLSL_TYPE_DOUBLE: + data.d[c] = op[c]->value.d[0]; + break; + case GLSL_TYPE_BOOL: + data.b[c] = op[c]->value.b[0]; + break; + default: + unreachable("invalid type"); + } + } + break; + + default: + /* FINISHME: Should handle all expression types. */ + return NULL; + } + diff --git a/prebuilt-intermediates/glsl/ir_expression_operation_strings.h b/prebuilt-intermediates/glsl/ir_expression_operation_strings.h new file mode 100644 index 00000000000..8842996b57a --- /dev/null +++ b/prebuilt-intermediates/glsl/ir_expression_operation_strings.h @@ -0,0 +1,254 @@ +/* + * Copyright (C) 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +const char *const ir_expression_operation_strings[] = { + "~", + "!", + "neg", + "abs", + "sign", + "rcp", + "rsq", + "sqrt", + "exp", + "log", + "exp2", + "log2", + "f2i", + "f2u", + "i2f", + "f2b", + "b2f", + "i2b", + "b2i", + "u2f", + "i2u", + "u2i", + "d2f", + "f2d", + "d2i", + "i2d", + "d2u", + "u2d", + "d2b", + "bitcast_i2f", + "bitcast_f2i", + "bitcast_u2f", + "bitcast_f2u", + "trunc", + "ceil", + "floor", + "fract", + "round_even", + "sin", + "cos", + "dFdx", + "dFdxCoarse", + "dFdxFine", + "dFdy", + "dFdyCoarse", + "dFdyFine", + "packSnorm2x16", + "packSnorm4x8", + "packUnorm2x16", + "packUnorm4x8", + "packHalf2x16", + "unpackSnorm2x16", + "unpackSnorm4x8", + "unpackUnorm2x16", + "unpackUnorm4x8", + "unpackHalf2x16", + "bitfield_reverse", + "bit_count", + "find_msb", + "find_lsb", + "sat", + "packDouble2x32", + "unpackDouble2x32", + "frexp_sig", + "frexp_exp", + "noise", + "subroutine_to_int", + "interpolate_at_centroid", + "get_buffer_size", + "ssbo_unsized_array_length", + "vote_any", + "vote_all", + "vote_eq", + "+", + "-", + "*", + "imul_high", + "/", + "carry", + "borrow", + "%", + "<", + ">", + "<=", + ">=", + "==", + "!=", + "all_equal", + "any_nequal", + "<<", + ">>", + "&", + "^", + "|", + "&&", + "^^", + "||", + "dot", + "min", + "max", + "pow", + "ubo_load", + "ldexp", + "vector_extract", + "interpolate_at_offset", + "interpolate_at_sample", + "fma", + "lrp", + "csel", + "bitfield_extract", + "vector_insert", + "bitfield_insert", + "vector", +}; + +const char *const ir_expression_operation_enum_strings[] = { + "bit_not", + "logic_not", + "neg", + "abs", + "sign", + "rcp", + "rsq", + "sqrt", + "exp", + "log", + "exp2", + "log2", + "f2i", + "f2u", + "i2f", + "f2b", + "b2f", + "i2b", + "b2i", + "u2f", + "i2u", + "u2i", + "d2f", + "f2d", + "d2i", + "i2d", + "d2u", + "u2d", + "d2b", + "bitcast_i2f", + "bitcast_f2i", + "bitcast_u2f", + "bitcast_f2u", + "trunc", + "ceil", + "floor", + "fract", + "round_even", + "sin", + "cos", + "dFdx", + "dFdx_coarse", + "dFdx_fine", + "dFdy", + "dFdy_coarse", + "dFdy_fine", + "pack_snorm_2x16", + "pack_snorm_4x8", + "pack_unorm_2x16", + "pack_unorm_4x8", + "pack_half_2x16", + "unpack_snorm_2x16", + "unpack_snorm_4x8", + "unpack_unorm_2x16", + "unpack_unorm_4x8", + "unpack_half_2x16", + "bitfield_reverse", + "bit_count", + "find_msb", + "find_lsb", + "saturate", + "pack_double_2x32", + "unpack_double_2x32", + "frexp_sig", + "frexp_exp", + "noise", + "subroutine_to_int", + "interpolate_at_centroid", + "get_buffer_size", + "ssbo_unsized_array_length", + "vote_any", + "vote_all", + "vote_eq", + "add", + "sub", + "mul", + "imul_high", + "div", + "carry", + "borrow", + "mod", + "less", + "greater", + "lequal", + "gequal", + "equal", + "nequal", + "all_equal", + "any_nequal", + "lshift", + "rshift", + "bit_and", + "bit_xor", + "bit_or", + "logic_and", + "logic_xor", + "logic_or", + "dot", + "min", + "max", + "pow", + "ubo_load", + "ldexp", + "vector_extract", + "interpolate_at_offset", + "interpolate_at_sample", + "fma", + "lrp", + "csel", + "bitfield_extract", + "vector_insert", + "bitfield_insert", + "vector", +}; diff --git a/prebuilt-intermediates/main/format_pack.c b/prebuilt-intermediates/main/format_pack.c new file mode 100644 index 00000000000..3408081d479 --- /dev/null +++ b/prebuilt-intermediates/main/format_pack.c @@ -0,0 +1,11175 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (c) 2011 VMware, Inc. + * Copyright (c) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Color, depth, stencil packing functions. + * Used to pack basic color, depth and stencil formats to specific + * hardware formats. + * + * There are both per-pixel and per-row packing functions: + * - The former will be used by swrast to write values to the color, depth, + * stencil buffers when drawing points, lines and masked spans. + * - The later will be used for image-oriented functions like glDrawPixels, + * glAccum, and glTexImage. + */ + +#include <stdint.h> + +#include "format_pack.h" +#include "format_utils.h" +#include "macros.h" +#include "util/format_rgb9e5.h" +#include "util/format_r11g11b10f.h" +#include "util/format_srgb.h" + +#define UNPACK(SRC, OFFSET, BITS) (((SRC) >> (OFFSET)) & MAX_UINT(BITS)) +#define PACK(SRC, OFFSET, BITS) (((SRC) & MAX_UINT(BITS)) << (OFFSET)) + + + +/* ubyte packing functions */ + + +static inline void +pack_ubyte_a8b8g8r8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_x8b8g8r8_unorm(const GLubyte src[4], void *dst) +{ + + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint32_t d = 0; + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8b8a8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8b8x8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b8g8r8a8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b8g8r8x8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_a8r8g8b8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_x8r8g8b8_unorm(const GLubyte src[4], void *dst) +{ + + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + uint32_t d = 0; + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_l16a16_unorm(const GLubyte src[4], void *dst) +{ + + + uint16_t l = + _mesa_unorm_to_unorm(src[0], 8, 16); + + + uint16_t a = + _mesa_unorm_to_unorm(src[3], 8, 16); + + uint32_t d = 0; + d |= PACK(l, 0, 16); + d |= PACK(a, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_a16l16_unorm(const GLubyte src[4], void *dst) +{ + + + uint16_t a = + _mesa_unorm_to_unorm(src[3], 8, 16); + + + uint16_t l = + _mesa_unorm_to_unorm(src[0], 8, 16); + + uint32_t d = 0; + d |= PACK(a, 0, 16); + d |= PACK(l, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b5g6r5_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 5); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 6); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 5); + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 6); + d |= PACK(r, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_r5g6b5_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 5); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 6); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 5); + + uint16_t d = 0; + d |= PACK(r, 0, 5); + d |= PACK(g, 5, 6); + d |= PACK(b, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_b4g4r4a4_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 4); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 4); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 4); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 4); + + uint16_t d = 0; + d |= PACK(b, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(r, 8, 4); + d |= PACK(a, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_b4g4r4x4_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 4); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 4); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 4); + + + uint16_t d = 0; + d |= PACK(b, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(r, 8, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a4r4g4b4_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 4); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 4); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 4); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 4); + + uint16_t d = 0; + d |= PACK(a, 0, 4); + d |= PACK(r, 4, 4); + d |= PACK(g, 8, 4); + d |= PACK(b, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a1b5g5r5_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 1); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 5); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 5); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 5); + + uint16_t d = 0; + d |= PACK(a, 0, 1); + d |= PACK(b, 1, 5); + d |= PACK(g, 6, 5); + d |= PACK(r, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_b5g5r5a1_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 5); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 5); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 5); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 1); + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(r, 10, 5); + d |= PACK(a, 15, 1); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_b5g5r5x1_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 5); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 5); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 5); + + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(r, 10, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a1r5g5b5_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 1); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 5); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 5); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 5); + + uint16_t d = 0; + d |= PACK(a, 0, 1); + d |= PACK(r, 1, 5); + d |= PACK(g, 6, 5); + d |= PACK(b, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_l8a8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t l = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + uint16_t d = 0; + d |= PACK(l, 0, 8); + d |= PACK(a, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a8l8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + + uint8_t l = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint16_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(l, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + uint16_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_g8r8_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint16_t d = 0; + d |= PACK(g, 0, 8); + d |= PACK(r, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_l4a4_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t l = + _mesa_unorm_to_unorm(src[0], 8, 4); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 4); + + uint8_t d = 0; + d |= PACK(l, 0, 4); + d |= PACK(a, 4, 4); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_ubyte_b2g3r3_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 2); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 3); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 3); + + uint8_t d = 0; + d |= PACK(b, 0, 2); + d |= PACK(g, 2, 3); + d |= PACK(r, 5, 3); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_ubyte_r16g16_unorm(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 16); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 16); + + uint32_t d = 0; + d |= PACK(r, 0, 16); + d |= PACK(g, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_g16r16_unorm(const GLubyte src[4], void *dst) +{ + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 16); + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 16); + + uint32_t d = 0; + d |= PACK(g, 0, 16); + d |= PACK(r, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b10g10r10a2_unorm(const GLubyte src[4], void *dst) +{ + + + uint16_t b = + _mesa_unorm_to_unorm(src[2], 8, 10); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 10); + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 10); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 2); + + uint32_t d = 0; + d |= PACK(b, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(r, 20, 10); + d |= PACK(a, 30, 2); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b10g10r10x2_unorm(const GLubyte src[4], void *dst) +{ + + + uint16_t b = + _mesa_unorm_to_unorm(src[2], 8, 10); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 10); + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 10); + + + uint32_t d = 0; + d |= PACK(b, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(r, 20, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r10g10b10a2_unorm(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 10); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 10); + + + uint16_t b = + _mesa_unorm_to_unorm(src[2], 8, 10); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 2); + + uint32_t d = 0; + d |= PACK(r, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(b, 20, 10); + d |= PACK(a, 30, 2); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r10g10b10x2_unorm(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 10); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 10); + + + uint16_t b = + _mesa_unorm_to_unorm(src[2], 8, 10); + + + uint32_t d = 0; + d |= PACK(r, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(b, 20, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r3g3b2_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 3); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 3); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 2); + + uint8_t d = 0; + d |= PACK(r, 0, 3); + d |= PACK(g, 3, 3); + d |= PACK(b, 6, 2); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_ubyte_a4b4g4r4_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 4); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 4); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 4); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 4); + + uint16_t d = 0; + d |= PACK(a, 0, 4); + d |= PACK(b, 4, 4); + d |= PACK(g, 8, 4); + d |= PACK(r, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_r4g4b4a4_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 4); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 4); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 4); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 4); + + uint16_t d = 0; + d |= PACK(r, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(b, 8, 4); + d |= PACK(a, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_r5g5b5a1_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 5); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 5); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 5); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 1); + + uint16_t d = 0; + d |= PACK(r, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(b, 10, 5); + d |= PACK(a, 15, 1); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a2b10g10r10_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 2); + + + uint16_t b = + _mesa_unorm_to_unorm(src[2], 8, 10); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 10); + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 10); + + uint32_t d = 0; + d |= PACK(a, 0, 2); + d |= PACK(b, 2, 10); + d |= PACK(g, 12, 10); + d |= PACK(r, 22, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_a2r10g10b10_unorm(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 2); + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 10); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 10); + + + uint16_t b = + _mesa_unorm_to_unorm(src[2], 8, 10); + + uint32_t d = 0; + d |= PACK(a, 0, 2); + d |= PACK(r, 2, 10); + d |= PACK(g, 12, 10); + d |= PACK(b, 22, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_a_unorm8(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_a_unorm16(const GLubyte src[4], void *dst) +{ + + + uint16_t a = + _mesa_unorm_to_unorm(src[3], 8, 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_l_unorm8(const GLubyte src[4], void *dst) +{ + + + uint8_t l = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_l_unorm16(const GLubyte src[4], void *dst) +{ + + + uint16_t l = + _mesa_unorm_to_unorm(src[0], 8, 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_i_unorm8(const GLubyte src[4], void *dst) +{ + + + uint8_t i = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_i_unorm16(const GLubyte src[4], void *dst) +{ + + + uint16_t i = + _mesa_unorm_to_unorm(src[0], 8, 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_r_unorm8(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_r_unorm16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_bgr_unorm8(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = b; + d[1] = g; + d[2] = r; +} + +static inline void +pack_ubyte_rgb_unorm8(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t g = + _mesa_unorm_to_unorm(src[1], 8, 8); + + + uint8_t b = + _mesa_unorm_to_unorm(src[2], 8, 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgba_unorm16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 16); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 16); + + + uint16_t b = + _mesa_unorm_to_unorm(src[2], 8, 16); + + + uint16_t a = + _mesa_unorm_to_unorm(src[3], 8, 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgbx_unorm16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_unorm(src[0], 8, 16); + + + uint16_t g = + _mesa_unorm_to_unorm(src[1], 8, 16); + + + uint16_t b = + _mesa_unorm_to_unorm(src[2], 8, 16); + + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_a8b8g8r8_snorm(const GLubyte src[4], void *dst) +{ + + + int8_t a = + _mesa_unorm_to_snorm(src[3], 8, 8); + + + int8_t b = + _mesa_unorm_to_snorm(src[2], 8, 8); + + + int8_t g = + _mesa_unorm_to_snorm(src[1], 8, 8); + + + int8_t r = + _mesa_unorm_to_snorm(src[0], 8, 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_x8b8g8r8_snorm(const GLubyte src[4], void *dst) +{ + + + + int8_t b = + _mesa_unorm_to_snorm(src[2], 8, 8); + + + int8_t g = + _mesa_unorm_to_snorm(src[1], 8, 8); + + + int8_t r = + _mesa_unorm_to_snorm(src[0], 8, 8); + + uint32_t d = 0; + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8b8a8_snorm(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unorm_to_snorm(src[0], 8, 8); + + + int8_t g = + _mesa_unorm_to_snorm(src[1], 8, 8); + + + int8_t b = + _mesa_unorm_to_snorm(src[2], 8, 8); + + + int8_t a = + _mesa_unorm_to_snorm(src[3], 8, 8); + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8b8x8_snorm(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unorm_to_snorm(src[0], 8, 8); + + + int8_t g = + _mesa_unorm_to_snorm(src[1], 8, 8); + + + int8_t b = + _mesa_unorm_to_snorm(src[2], 8, 8); + + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r16g16_snorm(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unorm_to_snorm(src[0], 8, 16); + + + int16_t g = + _mesa_unorm_to_snorm(src[1], 8, 16); + + uint32_t d = 0; + d |= PACK(r, 0, 16); + d |= PACK(g, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_g16r16_snorm(const GLubyte src[4], void *dst) +{ + + + int16_t g = + _mesa_unorm_to_snorm(src[1], 8, 16); + + + int16_t r = + _mesa_unorm_to_snorm(src[0], 8, 16); + + uint32_t d = 0; + d |= PACK(g, 0, 16); + d |= PACK(r, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8_snorm(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unorm_to_snorm(src[0], 8, 8); + + + int8_t g = + _mesa_unorm_to_snorm(src[1], 8, 8); + + uint16_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_g8r8_snorm(const GLubyte src[4], void *dst) +{ + + + int8_t g = + _mesa_unorm_to_snorm(src[1], 8, 8); + + + int8_t r = + _mesa_unorm_to_snorm(src[0], 8, 8); + + uint16_t d = 0; + d |= PACK(g, 0, 8); + d |= PACK(r, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_l8a8_snorm(const GLubyte src[4], void *dst) +{ + + + int8_t l = + _mesa_unorm_to_snorm(src[0], 8, 8); + + + int8_t a = + _mesa_unorm_to_snorm(src[3], 8, 8); + + uint16_t d = 0; + d |= PACK(l, 0, 8); + d |= PACK(a, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a8l8_snorm(const GLubyte src[4], void *dst) +{ + + + int8_t a = + _mesa_unorm_to_snorm(src[3], 8, 8); + + + int8_t l = + _mesa_unorm_to_snorm(src[0], 8, 8); + + uint16_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(l, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a_snorm8(const GLubyte src[4], void *dst) +{ + + + int8_t a = + _mesa_unorm_to_snorm(src[3], 8, 8); + + int8_t *d = (int8_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_a_snorm16(const GLubyte src[4], void *dst) +{ + + + int16_t a = + _mesa_unorm_to_snorm(src[3], 8, 16); + + int16_t *d = (int16_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_l_snorm8(const GLubyte src[4], void *dst) +{ + + + int8_t l = + _mesa_unorm_to_snorm(src[0], 8, 8); + + int8_t *d = (int8_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_l_snorm16(const GLubyte src[4], void *dst) +{ + + + int16_t l = + _mesa_unorm_to_snorm(src[0], 8, 16); + + int16_t *d = (int16_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_i_snorm8(const GLubyte src[4], void *dst) +{ + + + int8_t i = + _mesa_unorm_to_snorm(src[0], 8, 8); + + int8_t *d = (int8_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_i_snorm16(const GLubyte src[4], void *dst) +{ + + + int16_t i = + _mesa_unorm_to_snorm(src[0], 8, 16); + + int16_t *d = (int16_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_r_snorm8(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unorm_to_snorm(src[0], 8, 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_r_snorm16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unorm_to_snorm(src[0], 8, 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_la_snorm16(const GLubyte src[4], void *dst) +{ + + + int16_t l = + _mesa_unorm_to_snorm(src[0], 8, 16); + + + int16_t a = + _mesa_unorm_to_snorm(src[3], 8, 16); + + int16_t *d = (int16_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_rgb_snorm16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unorm_to_snorm(src[0], 8, 16); + + + int16_t g = + _mesa_unorm_to_snorm(src[1], 8, 16); + + + int16_t b = + _mesa_unorm_to_snorm(src[2], 8, 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgba_snorm16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unorm_to_snorm(src[0], 8, 16); + + + int16_t g = + _mesa_unorm_to_snorm(src[1], 8, 16); + + + int16_t b = + _mesa_unorm_to_snorm(src[2], 8, 16); + + + int16_t a = + _mesa_unorm_to_snorm(src[3], 8, 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgbx_snorm16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unorm_to_snorm(src[0], 8, 16); + + + int16_t g = + _mesa_unorm_to_snorm(src[1], 8, 16); + + + int16_t b = + _mesa_unorm_to_snorm(src[2], 8, 16); + + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_a8b8g8r8_srgb(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b8g8r8a8_srgb(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_a8r8g8b8_srgb(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b8g8r8x8_srgb(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_x8r8g8b8_srgb(const GLubyte src[4], void *dst) +{ + + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + uint32_t d = 0; + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8b8a8_srgb(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8b8x8_srgb(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_x8b8g8r8_srgb(const GLubyte src[4], void *dst) +{ + + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + uint32_t d = 0; + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_l8a8_srgb(const GLubyte src[4], void *dst) +{ + + + uint8_t l = + _mesa_unorm_to_unorm(src[0], 8, 8); + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + uint16_t d = 0; + d |= PACK(l, 0, 8); + d |= PACK(a, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a8l8_srgb(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unorm_to_unorm(src[3], 8, 8); + + + uint8_t l = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint16_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(l, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_l_srgb8(const GLubyte src[4], void *dst) +{ + + + uint8_t l = + _mesa_unorm_to_unorm(src[0], 8, 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_bgr_srgb8(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + + util_format_linear_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + uint8_t *d = (uint8_t *)dst; + d[0] = b; + d[1] = g; + d[2] = r; +} + +static inline void +pack_ubyte_a_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t a = + _mesa_unorm_to_half(src[3], 8); + + uint16_t *d = (uint16_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_a_float32(const GLubyte src[4], void *dst) +{ + + + float a = + _mesa_unorm_to_float(src[3], 8); + + float *d = (float *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_l_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t l = + _mesa_unorm_to_half(src[0], 8); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_l_float32(const GLubyte src[4], void *dst) +{ + + + float l = + _mesa_unorm_to_float(src[0], 8); + + float *d = (float *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_la_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t l = + _mesa_unorm_to_half(src[0], 8); + + + uint16_t a = + _mesa_unorm_to_half(src[3], 8); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_la_float32(const GLubyte src[4], void *dst) +{ + + + float l = + _mesa_unorm_to_float(src[0], 8); + + + float a = + _mesa_unorm_to_float(src[3], 8); + + float *d = (float *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_i_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t i = + _mesa_unorm_to_half(src[0], 8); + + uint16_t *d = (uint16_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_i_float32(const GLubyte src[4], void *dst) +{ + + + float i = + _mesa_unorm_to_float(src[0], 8); + + float *d = (float *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_r_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_half(src[0], 8); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_r_float32(const GLubyte src[4], void *dst) +{ + + + float r = + _mesa_unorm_to_float(src[0], 8); + + float *d = (float *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_rg_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_half(src[0], 8); + + + uint16_t g = + _mesa_unorm_to_half(src[1], 8); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_ubyte_rg_float32(const GLubyte src[4], void *dst) +{ + + + float r = + _mesa_unorm_to_float(src[0], 8); + + + float g = + _mesa_unorm_to_float(src[1], 8); + + float *d = (float *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_ubyte_rgb_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_half(src[0], 8); + + + uint16_t g = + _mesa_unorm_to_half(src[1], 8); + + + uint16_t b = + _mesa_unorm_to_half(src[2], 8); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgb_float32(const GLubyte src[4], void *dst) +{ + + + float r = + _mesa_unorm_to_float(src[0], 8); + + + float g = + _mesa_unorm_to_float(src[1], 8); + + + float b = + _mesa_unorm_to_float(src[2], 8); + + float *d = (float *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgba_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_half(src[0], 8); + + + uint16_t g = + _mesa_unorm_to_half(src[1], 8); + + + uint16_t b = + _mesa_unorm_to_half(src[2], 8); + + + uint16_t a = + _mesa_unorm_to_half(src[3], 8); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgba_float32(const GLubyte src[4], void *dst) +{ + + + float r = + _mesa_unorm_to_float(src[0], 8); + + + float g = + _mesa_unorm_to_float(src[1], 8); + + + float b = + _mesa_unorm_to_float(src[2], 8); + + + float a = + _mesa_unorm_to_float(src[3], 8); + + float *d = (float *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgbx_float16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unorm_to_half(src[0], 8); + + + uint16_t g = + _mesa_unorm_to_half(src[1], 8); + + + uint16_t b = + _mesa_unorm_to_half(src[2], 8); + + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_rgbx_float32(const GLubyte src[4], void *dst) +{ + + + float r = + _mesa_unorm_to_float(src[0], 8); + + + float g = + _mesa_unorm_to_float(src[1], 8); + + + float b = + _mesa_unorm_to_float(src[2], 8); + + + float *d = (float *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_a8b8g8r8_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_a8r8g8b8_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r8g8b8a8_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b8g8r8a8_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b10g10r10a2_uint(const GLubyte src[4], void *dst) +{ + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 10); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 10); + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 10); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 2); + + uint32_t d = 0; + d |= PACK(b, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(r, 20, 10); + d |= PACK(a, 30, 2); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_r10g10b10a2_uint(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 10); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 10); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 10); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 2); + + uint32_t d = 0; + d |= PACK(r, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(b, 20, 10); + d |= PACK(a, 30, 2); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_a2b10g10r10_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 2); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 10); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 10); + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 10); + + uint32_t d = 0; + d |= PACK(a, 0, 2); + d |= PACK(b, 2, 10); + d |= PACK(g, 12, 10); + d |= PACK(r, 22, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_a2r10g10b10_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 2); + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 10); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 10); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 10); + + uint32_t d = 0; + d |= PACK(a, 0, 2); + d |= PACK(r, 2, 10); + d |= PACK(g, 12, 10); + d |= PACK(b, 22, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_ubyte_b5g6r5_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 6); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 6); + d |= PACK(r, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_r5g6b5_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 6); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + uint16_t d = 0; + d |= PACK(r, 0, 5); + d |= PACK(g, 5, 6); + d |= PACK(b, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_b2g3r3_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 2); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 3); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 3); + + uint8_t d = 0; + d |= PACK(b, 0, 2); + d |= PACK(g, 2, 3); + d |= PACK(r, 5, 3); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_ubyte_r3g3b2_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 3); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 3); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 2); + + uint8_t d = 0; + d |= PACK(r, 0, 3); + d |= PACK(g, 3, 3); + d |= PACK(b, 6, 2); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_ubyte_a4b4g4r4_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 4); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 4); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 4); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 4); + + uint16_t d = 0; + d |= PACK(a, 0, 4); + d |= PACK(b, 4, 4); + d |= PACK(g, 8, 4); + d |= PACK(r, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_r4g4b4a4_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 4); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 4); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 4); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 4); + + uint16_t d = 0; + d |= PACK(r, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(b, 8, 4); + d |= PACK(a, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_b4g4r4a4_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 4); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 4); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 4); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 4); + + uint16_t d = 0; + d |= PACK(b, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(r, 8, 4); + d |= PACK(a, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a4r4g4b4_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 4); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 4); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 4); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 4); + + uint16_t d = 0; + d |= PACK(a, 0, 4); + d |= PACK(r, 4, 4); + d |= PACK(g, 8, 4); + d |= PACK(b, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a1b5g5r5_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 1); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 5); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + uint16_t d = 0; + d |= PACK(a, 0, 1); + d |= PACK(b, 1, 5); + d |= PACK(g, 6, 5); + d |= PACK(r, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_b5g5r5a1_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 5); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 1); + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(r, 10, 5); + d |= PACK(a, 15, 1); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a1r5g5b5_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 1); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 5); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + uint16_t d = 0; + d |= PACK(a, 0, 1); + d |= PACK(r, 1, 5); + d |= PACK(g, 6, 5); + d |= PACK(b, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_r5g5b5a1_uint(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 5); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 1); + + uint16_t d = 0; + d |= PACK(r, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(b, 10, 5); + d |= PACK(a, 15, 1); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_ubyte_a_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_a_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t a = + _mesa_unsigned_to_unsigned(src[3], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_a_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t a = + _mesa_unsigned_to_unsigned(src[3], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_a_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t a = + _mesa_unsigned_to_signed(src[3], 8); + + int8_t *d = (int8_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_a_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t a = + _mesa_unsigned_to_signed(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_a_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t a = + _mesa_unsigned_to_signed(src[3], 32); + + int32_t *d = (int32_t *)dst; + d[0] = a; +} + +static inline void +pack_ubyte_i_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t i = + _mesa_unsigned_to_unsigned(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_i_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t i = + _mesa_unsigned_to_unsigned(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_i_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t i = + _mesa_unsigned_to_unsigned(src[0], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_i_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t i = + _mesa_unsigned_to_signed(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_i_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t i = + _mesa_unsigned_to_signed(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_i_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t i = + _mesa_unsigned_to_signed(src[0], 32); + + int32_t *d = (int32_t *)dst; + d[0] = i; +} + +static inline void +pack_ubyte_l_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t l = + _mesa_unsigned_to_unsigned(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_l_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t l = + _mesa_unsigned_to_unsigned(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_l_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t l = + _mesa_unsigned_to_unsigned(src[0], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_l_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t l = + _mesa_unsigned_to_signed(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_l_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t l = + _mesa_unsigned_to_signed(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_l_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t l = + _mesa_unsigned_to_signed(src[0], 32); + + int32_t *d = (int32_t *)dst; + d[0] = l; +} + +static inline void +pack_ubyte_la_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t l = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_la_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t l = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t a = + _mesa_unsigned_to_unsigned(src[3], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_la_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t l = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t a = + _mesa_unsigned_to_unsigned(src[3], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_la_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t l = + _mesa_unsigned_to_signed(src[0], 8); + + + int8_t a = + _mesa_unsigned_to_signed(src[3], 8); + + int8_t *d = (int8_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_la_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t l = + _mesa_unsigned_to_signed(src[0], 16); + + + int16_t a = + _mesa_unsigned_to_signed(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_la_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t l = + _mesa_unsigned_to_signed(src[0], 32); + + + int32_t a = + _mesa_unsigned_to_signed(src[3], 32); + + int32_t *d = (int32_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_ubyte_r_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_r_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_r_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_r_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unsigned_to_signed(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_r_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unsigned_to_signed(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_r_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t r = + _mesa_unsigned_to_signed(src[0], 32); + + int32_t *d = (int32_t *)dst; + d[0] = r; +} + +static inline void +pack_ubyte_rg_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_ubyte_rg_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_ubyte_rg_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t g = + _mesa_unsigned_to_unsigned(src[1], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_ubyte_rg_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unsigned_to_signed(src[0], 8); + + + int8_t g = + _mesa_unsigned_to_signed(src[1], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_ubyte_rg_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unsigned_to_signed(src[0], 16); + + + int16_t g = + _mesa_unsigned_to_signed(src[1], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_ubyte_rg_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t r = + _mesa_unsigned_to_signed(src[0], 32); + + + int32_t g = + _mesa_unsigned_to_signed(src[1], 32); + + int32_t *d = (int32_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_ubyte_rgb_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgb_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 16); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgb_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t g = + _mesa_unsigned_to_unsigned(src[1], 32); + + + uint32_t b = + _mesa_unsigned_to_unsigned(src[2], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgb_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unsigned_to_signed(src[0], 8); + + + int8_t g = + _mesa_unsigned_to_signed(src[1], 8); + + + int8_t b = + _mesa_unsigned_to_signed(src[2], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgb_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unsigned_to_signed(src[0], 16); + + + int16_t g = + _mesa_unsigned_to_signed(src[1], 16); + + + int16_t b = + _mesa_unsigned_to_signed(src[2], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgb_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t r = + _mesa_unsigned_to_signed(src[0], 32); + + + int32_t g = + _mesa_unsigned_to_signed(src[1], 32); + + + int32_t b = + _mesa_unsigned_to_signed(src[2], 32); + + int32_t *d = (int32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_ubyte_rgba_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgba_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 16); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 16); + + + uint16_t a = + _mesa_unsigned_to_unsigned(src[3], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgba_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t g = + _mesa_unsigned_to_unsigned(src[1], 32); + + + uint32_t b = + _mesa_unsigned_to_unsigned(src[2], 32); + + + uint32_t a = + _mesa_unsigned_to_unsigned(src[3], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgba_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unsigned_to_signed(src[0], 8); + + + int8_t g = + _mesa_unsigned_to_signed(src[1], 8); + + + int8_t b = + _mesa_unsigned_to_signed(src[2], 8); + + + int8_t a = + _mesa_unsigned_to_signed(src[3], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgba_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unsigned_to_signed(src[0], 16); + + + int16_t g = + _mesa_unsigned_to_signed(src[1], 16); + + + int16_t b = + _mesa_unsigned_to_signed(src[2], 16); + + + int16_t a = + _mesa_unsigned_to_signed(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgba_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t r = + _mesa_unsigned_to_signed(src[0], 32); + + + int32_t g = + _mesa_unsigned_to_signed(src[1], 32); + + + int32_t b = + _mesa_unsigned_to_signed(src[2], 32); + + + int32_t a = + _mesa_unsigned_to_signed(src[3], 32); + + int32_t *d = (int32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_ubyte_rgbx_uint8(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_rgbx_uint16(const GLubyte src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 16); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 16); + + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_rgbx_uint32(const GLubyte src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t g = + _mesa_unsigned_to_unsigned(src[1], 32); + + + uint32_t b = + _mesa_unsigned_to_unsigned(src[2], 32); + + + uint32_t *d = (uint32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_rgbx_sint8(const GLubyte src[4], void *dst) +{ + + + int8_t r = + _mesa_unsigned_to_signed(src[0], 8); + + + int8_t g = + _mesa_unsigned_to_signed(src[1], 8); + + + int8_t b = + _mesa_unsigned_to_signed(src[2], 8); + + + int8_t *d = (int8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_rgbx_sint16(const GLubyte src[4], void *dst) +{ + + + int16_t r = + _mesa_unsigned_to_signed(src[0], 16); + + + int16_t g = + _mesa_unsigned_to_signed(src[1], 16); + + + int16_t b = + _mesa_unsigned_to_signed(src[2], 16); + + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_rgbx_sint32(const GLubyte src[4], void *dst) +{ + + + int32_t r = + _mesa_unsigned_to_signed(src[0], 32); + + + int32_t g = + _mesa_unsigned_to_signed(src[1], 32); + + + int32_t b = + _mesa_unsigned_to_signed(src[2], 32); + + + int32_t *d = (int32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_ubyte_r9g9b9e5_float(const GLubyte src[4], void *dst) +{ + GLuint *d = (GLuint *) dst; + GLfloat rgb[3]; + rgb[0] = _mesa_unorm_to_float(src[RCOMP], 8); + rgb[1] = _mesa_unorm_to_float(src[GCOMP], 8); + rgb[2] = _mesa_unorm_to_float(src[BCOMP], 8); + *d = float3_to_rgb9e5(rgb); +} + +static inline void +pack_ubyte_r11g11b10_float(const GLubyte src[4], void *dst) +{ + GLuint *d = (GLuint *) dst; + GLfloat rgb[3]; + rgb[0] = _mesa_unorm_to_float(src[RCOMP], 8); + rgb[1] = _mesa_unorm_to_float(src[GCOMP], 8); + rgb[2] = _mesa_unorm_to_float(src[BCOMP], 8); + *d = float3_to_r11g11b10f(rgb); +} + +/* uint packing functions */ + + +static inline void +pack_uint_a8b8g8r8_uint(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_uint_a8r8g8b8_uint(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_uint_r8g8b8a8_uint(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_uint_b8g8r8a8_uint(const GLuint src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_uint_b10g10r10a2_uint(const GLuint src[4], void *dst) +{ + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 10); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 10); + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 10); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 2); + + uint32_t d = 0; + d |= PACK(b, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(r, 20, 10); + d |= PACK(a, 30, 2); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_uint_r10g10b10a2_uint(const GLuint src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 10); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 10); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 10); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 2); + + uint32_t d = 0; + d |= PACK(r, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(b, 20, 10); + d |= PACK(a, 30, 2); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_uint_a2b10g10r10_uint(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 2); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 10); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 10); + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 10); + + uint32_t d = 0; + d |= PACK(a, 0, 2); + d |= PACK(b, 2, 10); + d |= PACK(g, 12, 10); + d |= PACK(r, 22, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_uint_a2r10g10b10_uint(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 2); + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 10); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 10); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 10); + + uint32_t d = 0; + d |= PACK(a, 0, 2); + d |= PACK(r, 2, 10); + d |= PACK(g, 12, 10); + d |= PACK(b, 22, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_uint_b5g6r5_uint(const GLuint src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 6); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 6); + d |= PACK(r, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_r5g6b5_uint(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 6); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + uint16_t d = 0; + d |= PACK(r, 0, 5); + d |= PACK(g, 5, 6); + d |= PACK(b, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_b2g3r3_uint(const GLuint src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 2); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 3); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 3); + + uint8_t d = 0; + d |= PACK(b, 0, 2); + d |= PACK(g, 2, 3); + d |= PACK(r, 5, 3); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_uint_r3g3b2_uint(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 3); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 3); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 2); + + uint8_t d = 0; + d |= PACK(r, 0, 3); + d |= PACK(g, 3, 3); + d |= PACK(b, 6, 2); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_uint_a4b4g4r4_uint(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 4); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 4); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 4); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 4); + + uint16_t d = 0; + d |= PACK(a, 0, 4); + d |= PACK(b, 4, 4); + d |= PACK(g, 8, 4); + d |= PACK(r, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_r4g4b4a4_uint(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 4); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 4); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 4); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 4); + + uint16_t d = 0; + d |= PACK(r, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(b, 8, 4); + d |= PACK(a, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_b4g4r4a4_uint(const GLuint src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 4); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 4); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 4); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 4); + + uint16_t d = 0; + d |= PACK(b, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(r, 8, 4); + d |= PACK(a, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_a4r4g4b4_uint(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 4); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 4); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 4); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 4); + + uint16_t d = 0; + d |= PACK(a, 0, 4); + d |= PACK(r, 4, 4); + d |= PACK(g, 8, 4); + d |= PACK(b, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_a1b5g5r5_uint(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 1); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 5); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + uint16_t d = 0; + d |= PACK(a, 0, 1); + d |= PACK(b, 1, 5); + d |= PACK(g, 6, 5); + d |= PACK(r, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_b5g5r5a1_uint(const GLuint src[4], void *dst) +{ + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 5); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 1); + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(r, 10, 5); + d |= PACK(a, 15, 1); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_a1r5g5b5_uint(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 1); + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 5); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + uint16_t d = 0; + d |= PACK(a, 0, 1); + d |= PACK(r, 1, 5); + d |= PACK(g, 6, 5); + d |= PACK(b, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_r5g5b5a1_uint(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 5); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 5); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 5); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 1); + + uint16_t d = 0; + d |= PACK(r, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(b, 10, 5); + d |= PACK(a, 15, 1); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_uint_a_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = a; +} + +static inline void +pack_uint_a_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t a = + _mesa_unsigned_to_unsigned(src[3], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = a; +} + +static inline void +pack_uint_a_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t a = + _mesa_unsigned_to_unsigned(src[3], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = a; +} + +static inline void +pack_uint_a_sint8(const GLuint src[4], void *dst) +{ + + + int8_t a = + _mesa_signed_to_signed(src[3], 8); + + int8_t *d = (int8_t *)dst; + d[0] = a; +} + +static inline void +pack_uint_a_sint16(const GLuint src[4], void *dst) +{ + + + int16_t a = + _mesa_signed_to_signed(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = a; +} + +static inline void +pack_uint_a_sint32(const GLuint src[4], void *dst) +{ + + + int32_t a = + _mesa_signed_to_signed(src[3], 32); + + int32_t *d = (int32_t *)dst; + d[0] = a; +} + +static inline void +pack_uint_i_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t i = + _mesa_unsigned_to_unsigned(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = i; +} + +static inline void +pack_uint_i_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t i = + _mesa_unsigned_to_unsigned(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = i; +} + +static inline void +pack_uint_i_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t i = + _mesa_unsigned_to_unsigned(src[0], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = i; +} + +static inline void +pack_uint_i_sint8(const GLuint src[4], void *dst) +{ + + + int8_t i = + _mesa_signed_to_signed(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = i; +} + +static inline void +pack_uint_i_sint16(const GLuint src[4], void *dst) +{ + + + int16_t i = + _mesa_signed_to_signed(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = i; +} + +static inline void +pack_uint_i_sint32(const GLuint src[4], void *dst) +{ + + + int32_t i = + _mesa_signed_to_signed(src[0], 32); + + int32_t *d = (int32_t *)dst; + d[0] = i; +} + +static inline void +pack_uint_l_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t l = + _mesa_unsigned_to_unsigned(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = l; +} + +static inline void +pack_uint_l_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t l = + _mesa_unsigned_to_unsigned(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; +} + +static inline void +pack_uint_l_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t l = + _mesa_unsigned_to_unsigned(src[0], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = l; +} + +static inline void +pack_uint_l_sint8(const GLuint src[4], void *dst) +{ + + + int8_t l = + _mesa_signed_to_signed(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = l; +} + +static inline void +pack_uint_l_sint16(const GLuint src[4], void *dst) +{ + + + int16_t l = + _mesa_signed_to_signed(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = l; +} + +static inline void +pack_uint_l_sint32(const GLuint src[4], void *dst) +{ + + + int32_t l = + _mesa_signed_to_signed(src[0], 32); + + int32_t *d = (int32_t *)dst; + d[0] = l; +} + +static inline void +pack_uint_la_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t l = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_uint_la_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t l = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t a = + _mesa_unsigned_to_unsigned(src[3], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_uint_la_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t l = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t a = + _mesa_unsigned_to_unsigned(src[3], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_uint_la_sint8(const GLuint src[4], void *dst) +{ + + + int8_t l = + _mesa_signed_to_signed(src[0], 8); + + + int8_t a = + _mesa_signed_to_signed(src[3], 8); + + int8_t *d = (int8_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_uint_la_sint16(const GLuint src[4], void *dst) +{ + + + int16_t l = + _mesa_signed_to_signed(src[0], 16); + + + int16_t a = + _mesa_signed_to_signed(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_uint_la_sint32(const GLuint src[4], void *dst) +{ + + + int32_t l = + _mesa_signed_to_signed(src[0], 32); + + + int32_t a = + _mesa_signed_to_signed(src[3], 32); + + int32_t *d = (int32_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_uint_r_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; +} + +static inline void +pack_uint_r_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; +} + +static inline void +pack_uint_r_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = r; +} + +static inline void +pack_uint_r_sint8(const GLuint src[4], void *dst) +{ + + + int8_t r = + _mesa_signed_to_signed(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; +} + +static inline void +pack_uint_r_sint16(const GLuint src[4], void *dst) +{ + + + int16_t r = + _mesa_signed_to_signed(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; +} + +static inline void +pack_uint_r_sint32(const GLuint src[4], void *dst) +{ + + + int32_t r = + _mesa_signed_to_signed(src[0], 32); + + int32_t *d = (int32_t *)dst; + d[0] = r; +} + +static inline void +pack_uint_rg_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_uint_rg_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_uint_rg_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t g = + _mesa_unsigned_to_unsigned(src[1], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_uint_rg_sint8(const GLuint src[4], void *dst) +{ + + + int8_t r = + _mesa_signed_to_signed(src[0], 8); + + + int8_t g = + _mesa_signed_to_signed(src[1], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_uint_rg_sint16(const GLuint src[4], void *dst) +{ + + + int16_t r = + _mesa_signed_to_signed(src[0], 16); + + + int16_t g = + _mesa_signed_to_signed(src[1], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_uint_rg_sint32(const GLuint src[4], void *dst) +{ + + + int32_t r = + _mesa_signed_to_signed(src[0], 32); + + + int32_t g = + _mesa_signed_to_signed(src[1], 32); + + int32_t *d = (int32_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_uint_rgb_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_uint_rgb_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 16); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_uint_rgb_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t g = + _mesa_unsigned_to_unsigned(src[1], 32); + + + uint32_t b = + _mesa_unsigned_to_unsigned(src[2], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_uint_rgb_sint8(const GLuint src[4], void *dst) +{ + + + int8_t r = + _mesa_signed_to_signed(src[0], 8); + + + int8_t g = + _mesa_signed_to_signed(src[1], 8); + + + int8_t b = + _mesa_signed_to_signed(src[2], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_uint_rgb_sint16(const GLuint src[4], void *dst) +{ + + + int16_t r = + _mesa_signed_to_signed(src[0], 16); + + + int16_t g = + _mesa_signed_to_signed(src[1], 16); + + + int16_t b = + _mesa_signed_to_signed(src[2], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_uint_rgb_sint32(const GLuint src[4], void *dst) +{ + + + int32_t r = + _mesa_signed_to_signed(src[0], 32); + + + int32_t g = + _mesa_signed_to_signed(src[1], 32); + + + int32_t b = + _mesa_signed_to_signed(src[2], 32); + + int32_t *d = (int32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_uint_rgba_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t a = + _mesa_unsigned_to_unsigned(src[3], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_uint_rgba_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 16); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 16); + + + uint16_t a = + _mesa_unsigned_to_unsigned(src[3], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_uint_rgba_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t g = + _mesa_unsigned_to_unsigned(src[1], 32); + + + uint32_t b = + _mesa_unsigned_to_unsigned(src[2], 32); + + + uint32_t a = + _mesa_unsigned_to_unsigned(src[3], 32); + + uint32_t *d = (uint32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_uint_rgba_sint8(const GLuint src[4], void *dst) +{ + + + int8_t r = + _mesa_signed_to_signed(src[0], 8); + + + int8_t g = + _mesa_signed_to_signed(src[1], 8); + + + int8_t b = + _mesa_signed_to_signed(src[2], 8); + + + int8_t a = + _mesa_signed_to_signed(src[3], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_uint_rgba_sint16(const GLuint src[4], void *dst) +{ + + + int16_t r = + _mesa_signed_to_signed(src[0], 16); + + + int16_t g = + _mesa_signed_to_signed(src[1], 16); + + + int16_t b = + _mesa_signed_to_signed(src[2], 16); + + + int16_t a = + _mesa_signed_to_signed(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_uint_rgba_sint32(const GLuint src[4], void *dst) +{ + + + int32_t r = + _mesa_signed_to_signed(src[0], 32); + + + int32_t g = + _mesa_signed_to_signed(src[1], 32); + + + int32_t b = + _mesa_signed_to_signed(src[2], 32); + + + int32_t a = + _mesa_signed_to_signed(src[3], 32); + + int32_t *d = (int32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_uint_rgbx_uint8(const GLuint src[4], void *dst) +{ + + + uint8_t r = + _mesa_unsigned_to_unsigned(src[0], 8); + + + uint8_t g = + _mesa_unsigned_to_unsigned(src[1], 8); + + + uint8_t b = + _mesa_unsigned_to_unsigned(src[2], 8); + + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_uint_rgbx_uint16(const GLuint src[4], void *dst) +{ + + + uint16_t r = + _mesa_unsigned_to_unsigned(src[0], 16); + + + uint16_t g = + _mesa_unsigned_to_unsigned(src[1], 16); + + + uint16_t b = + _mesa_unsigned_to_unsigned(src[2], 16); + + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_uint_rgbx_uint32(const GLuint src[4], void *dst) +{ + + + uint32_t r = + _mesa_unsigned_to_unsigned(src[0], 32); + + + uint32_t g = + _mesa_unsigned_to_unsigned(src[1], 32); + + + uint32_t b = + _mesa_unsigned_to_unsigned(src[2], 32); + + + uint32_t *d = (uint32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_uint_rgbx_sint8(const GLuint src[4], void *dst) +{ + + + int8_t r = + _mesa_signed_to_signed(src[0], 8); + + + int8_t g = + _mesa_signed_to_signed(src[1], 8); + + + int8_t b = + _mesa_signed_to_signed(src[2], 8); + + + int8_t *d = (int8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_uint_rgbx_sint16(const GLuint src[4], void *dst) +{ + + + int16_t r = + _mesa_signed_to_signed(src[0], 16); + + + int16_t g = + _mesa_signed_to_signed(src[1], 16); + + + int16_t b = + _mesa_signed_to_signed(src[2], 16); + + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_uint_rgbx_sint32(const GLuint src[4], void *dst) +{ + + + int32_t r = + _mesa_signed_to_signed(src[0], 32); + + + int32_t g = + _mesa_signed_to_signed(src[1], 32); + + + int32_t b = + _mesa_signed_to_signed(src[2], 32); + + + int32_t *d = (int32_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +/* float packing functions */ + + +static inline void +pack_float_a8b8g8r8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_x8b8g8r8_unorm(const GLfloat src[4], void *dst) +{ + + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + uint32_t d = 0; + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r8g8b8a8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r8g8b8x8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_b8g8r8a8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_b8g8r8x8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_a8r8g8b8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_x8r8g8b8_unorm(const GLfloat src[4], void *dst) +{ + + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + uint32_t d = 0; + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_l16a16_unorm(const GLfloat src[4], void *dst) +{ + + + uint16_t l = + _mesa_float_to_unorm(src[0], 16); + + + uint16_t a = + _mesa_float_to_unorm(src[3], 16); + + uint32_t d = 0; + d |= PACK(l, 0, 16); + d |= PACK(a, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_a16l16_unorm(const GLfloat src[4], void *dst) +{ + + + uint16_t a = + _mesa_float_to_unorm(src[3], 16); + + + uint16_t l = + _mesa_float_to_unorm(src[0], 16); + + uint32_t d = 0; + d |= PACK(a, 0, 16); + d |= PACK(l, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_b5g6r5_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 5); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 6); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 5); + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 6); + d |= PACK(r, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_r5g6b5_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 5); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 6); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 5); + + uint16_t d = 0; + d |= PACK(r, 0, 5); + d |= PACK(g, 5, 6); + d |= PACK(b, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_b4g4r4a4_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 4); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 4); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 4); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 4); + + uint16_t d = 0; + d |= PACK(b, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(r, 8, 4); + d |= PACK(a, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_b4g4r4x4_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 4); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 4); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 4); + + + uint16_t d = 0; + d |= PACK(b, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(r, 8, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_a4r4g4b4_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 4); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 4); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 4); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 4); + + uint16_t d = 0; + d |= PACK(a, 0, 4); + d |= PACK(r, 4, 4); + d |= PACK(g, 8, 4); + d |= PACK(b, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_a1b5g5r5_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 1); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 5); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 5); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 5); + + uint16_t d = 0; + d |= PACK(a, 0, 1); + d |= PACK(b, 1, 5); + d |= PACK(g, 6, 5); + d |= PACK(r, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_b5g5r5a1_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 5); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 5); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 5); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 1); + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(r, 10, 5); + d |= PACK(a, 15, 1); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_b5g5r5x1_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 5); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 5); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 5); + + + uint16_t d = 0; + d |= PACK(b, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(r, 10, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_a1r5g5b5_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 1); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 5); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 5); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 5); + + uint16_t d = 0; + d |= PACK(a, 0, 1); + d |= PACK(r, 1, 5); + d |= PACK(g, 6, 5); + d |= PACK(b, 11, 5); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_l8a8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t l = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + uint16_t d = 0; + d |= PACK(l, 0, 8); + d |= PACK(a, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_a8l8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + + uint8_t l = + _mesa_float_to_unorm(src[0], 8); + + uint16_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(l, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_r8g8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + uint16_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_g8r8_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + uint16_t d = 0; + d |= PACK(g, 0, 8); + d |= PACK(r, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_l4a4_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t l = + _mesa_float_to_unorm(src[0], 4); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 4); + + uint8_t d = 0; + d |= PACK(l, 0, 4); + d |= PACK(a, 4, 4); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_float_b2g3r3_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 2); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 3); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 3); + + uint8_t d = 0; + d |= PACK(b, 0, 2); + d |= PACK(g, 2, 3); + d |= PACK(r, 5, 3); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_float_r16g16_unorm(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_unorm(src[0], 16); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 16); + + uint32_t d = 0; + d |= PACK(r, 0, 16); + d |= PACK(g, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_g16r16_unorm(const GLfloat src[4], void *dst) +{ + + + uint16_t g = + _mesa_float_to_unorm(src[1], 16); + + + uint16_t r = + _mesa_float_to_unorm(src[0], 16); + + uint32_t d = 0; + d |= PACK(g, 0, 16); + d |= PACK(r, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_b10g10r10a2_unorm(const GLfloat src[4], void *dst) +{ + + + uint16_t b = + _mesa_float_to_unorm(src[2], 10); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 10); + + + uint16_t r = + _mesa_float_to_unorm(src[0], 10); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 2); + + uint32_t d = 0; + d |= PACK(b, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(r, 20, 10); + d |= PACK(a, 30, 2); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_b10g10r10x2_unorm(const GLfloat src[4], void *dst) +{ + + + uint16_t b = + _mesa_float_to_unorm(src[2], 10); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 10); + + + uint16_t r = + _mesa_float_to_unorm(src[0], 10); + + + uint32_t d = 0; + d |= PACK(b, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(r, 20, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r10g10b10a2_unorm(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_unorm(src[0], 10); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 10); + + + uint16_t b = + _mesa_float_to_unorm(src[2], 10); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 2); + + uint32_t d = 0; + d |= PACK(r, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(b, 20, 10); + d |= PACK(a, 30, 2); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r10g10b10x2_unorm(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_unorm(src[0], 10); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 10); + + + uint16_t b = + _mesa_float_to_unorm(src[2], 10); + + + uint32_t d = 0; + d |= PACK(r, 0, 10); + d |= PACK(g, 10, 10); + d |= PACK(b, 20, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r3g3b2_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 3); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 3); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 2); + + uint8_t d = 0; + d |= PACK(r, 0, 3); + d |= PACK(g, 3, 3); + d |= PACK(b, 6, 2); + (*(uint8_t *)dst) = d; +} + +static inline void +pack_float_a4b4g4r4_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 4); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 4); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 4); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 4); + + uint16_t d = 0; + d |= PACK(a, 0, 4); + d |= PACK(b, 4, 4); + d |= PACK(g, 8, 4); + d |= PACK(r, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_r4g4b4a4_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 4); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 4); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 4); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 4); + + uint16_t d = 0; + d |= PACK(r, 0, 4); + d |= PACK(g, 4, 4); + d |= PACK(b, 8, 4); + d |= PACK(a, 12, 4); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_r5g5b5a1_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 5); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 5); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 5); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 1); + + uint16_t d = 0; + d |= PACK(r, 0, 5); + d |= PACK(g, 5, 5); + d |= PACK(b, 10, 5); + d |= PACK(a, 15, 1); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_a2b10g10r10_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 2); + + + uint16_t b = + _mesa_float_to_unorm(src[2], 10); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 10); + + + uint16_t r = + _mesa_float_to_unorm(src[0], 10); + + uint32_t d = 0; + d |= PACK(a, 0, 2); + d |= PACK(b, 2, 10); + d |= PACK(g, 12, 10); + d |= PACK(r, 22, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_a2r10g10b10_unorm(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 2); + + + uint16_t r = + _mesa_float_to_unorm(src[0], 10); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 10); + + + uint16_t b = + _mesa_float_to_unorm(src[2], 10); + + uint32_t d = 0; + d |= PACK(a, 0, 2); + d |= PACK(r, 2, 10); + d |= PACK(g, 12, 10); + d |= PACK(b, 22, 10); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_a_unorm8(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = a; +} + +static inline void +pack_float_a_unorm16(const GLfloat src[4], void *dst) +{ + + + uint16_t a = + _mesa_float_to_unorm(src[3], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = a; +} + +static inline void +pack_float_l_unorm8(const GLfloat src[4], void *dst) +{ + + + uint8_t l = + _mesa_float_to_unorm(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = l; +} + +static inline void +pack_float_l_unorm16(const GLfloat src[4], void *dst) +{ + + + uint16_t l = + _mesa_float_to_unorm(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; +} + +static inline void +pack_float_i_unorm8(const GLfloat src[4], void *dst) +{ + + + uint8_t i = + _mesa_float_to_unorm(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = i; +} + +static inline void +pack_float_i_unorm16(const GLfloat src[4], void *dst) +{ + + + uint16_t i = + _mesa_float_to_unorm(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = i; +} + +static inline void +pack_float_r_unorm8(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; +} + +static inline void +pack_float_r_unorm16(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_unorm(src[0], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; +} + +static inline void +pack_float_bgr_unorm8(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = b; + d[1] = g; + d[2] = r; +} + +static inline void +pack_float_rgb_unorm8(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t g = + _mesa_float_to_unorm(src[1], 8); + + + uint8_t b = + _mesa_float_to_unorm(src[2], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_float_rgba_unorm16(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_unorm(src[0], 16); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 16); + + + uint16_t b = + _mesa_float_to_unorm(src[2], 16); + + + uint16_t a = + _mesa_float_to_unorm(src[3], 16); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_float_rgbx_unorm16(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_unorm(src[0], 16); + + + uint16_t g = + _mesa_float_to_unorm(src[1], 16); + + + uint16_t b = + _mesa_float_to_unorm(src[2], 16); + + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_float_a8b8g8r8_snorm(const GLfloat src[4], void *dst) +{ + + + int8_t a = + _mesa_float_to_snorm(src[3], 8); + + + int8_t b = + _mesa_float_to_snorm(src[2], 8); + + + int8_t g = + _mesa_float_to_snorm(src[1], 8); + + + int8_t r = + _mesa_float_to_snorm(src[0], 8); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_x8b8g8r8_snorm(const GLfloat src[4], void *dst) +{ + + + + int8_t b = + _mesa_float_to_snorm(src[2], 8); + + + int8_t g = + _mesa_float_to_snorm(src[1], 8); + + + int8_t r = + _mesa_float_to_snorm(src[0], 8); + + uint32_t d = 0; + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r8g8b8a8_snorm(const GLfloat src[4], void *dst) +{ + + + int8_t r = + _mesa_float_to_snorm(src[0], 8); + + + int8_t g = + _mesa_float_to_snorm(src[1], 8); + + + int8_t b = + _mesa_float_to_snorm(src[2], 8); + + + int8_t a = + _mesa_float_to_snorm(src[3], 8); + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r8g8b8x8_snorm(const GLfloat src[4], void *dst) +{ + + + int8_t r = + _mesa_float_to_snorm(src[0], 8); + + + int8_t g = + _mesa_float_to_snorm(src[1], 8); + + + int8_t b = + _mesa_float_to_snorm(src[2], 8); + + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r16g16_snorm(const GLfloat src[4], void *dst) +{ + + + int16_t r = + _mesa_float_to_snorm(src[0], 16); + + + int16_t g = + _mesa_float_to_snorm(src[1], 16); + + uint32_t d = 0; + d |= PACK(r, 0, 16); + d |= PACK(g, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_g16r16_snorm(const GLfloat src[4], void *dst) +{ + + + int16_t g = + _mesa_float_to_snorm(src[1], 16); + + + int16_t r = + _mesa_float_to_snorm(src[0], 16); + + uint32_t d = 0; + d |= PACK(g, 0, 16); + d |= PACK(r, 16, 16); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r8g8_snorm(const GLfloat src[4], void *dst) +{ + + + int8_t r = + _mesa_float_to_snorm(src[0], 8); + + + int8_t g = + _mesa_float_to_snorm(src[1], 8); + + uint16_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_g8r8_snorm(const GLfloat src[4], void *dst) +{ + + + int8_t g = + _mesa_float_to_snorm(src[1], 8); + + + int8_t r = + _mesa_float_to_snorm(src[0], 8); + + uint16_t d = 0; + d |= PACK(g, 0, 8); + d |= PACK(r, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_l8a8_snorm(const GLfloat src[4], void *dst) +{ + + + int8_t l = + _mesa_float_to_snorm(src[0], 8); + + + int8_t a = + _mesa_float_to_snorm(src[3], 8); + + uint16_t d = 0; + d |= PACK(l, 0, 8); + d |= PACK(a, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_a8l8_snorm(const GLfloat src[4], void *dst) +{ + + + int8_t a = + _mesa_float_to_snorm(src[3], 8); + + + int8_t l = + _mesa_float_to_snorm(src[0], 8); + + uint16_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(l, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_a_snorm8(const GLfloat src[4], void *dst) +{ + + + int8_t a = + _mesa_float_to_snorm(src[3], 8); + + int8_t *d = (int8_t *)dst; + d[0] = a; +} + +static inline void +pack_float_a_snorm16(const GLfloat src[4], void *dst) +{ + + + int16_t a = + _mesa_float_to_snorm(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = a; +} + +static inline void +pack_float_l_snorm8(const GLfloat src[4], void *dst) +{ + + + int8_t l = + _mesa_float_to_snorm(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = l; +} + +static inline void +pack_float_l_snorm16(const GLfloat src[4], void *dst) +{ + + + int16_t l = + _mesa_float_to_snorm(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = l; +} + +static inline void +pack_float_i_snorm8(const GLfloat src[4], void *dst) +{ + + + int8_t i = + _mesa_float_to_snorm(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = i; +} + +static inline void +pack_float_i_snorm16(const GLfloat src[4], void *dst) +{ + + + int16_t i = + _mesa_float_to_snorm(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = i; +} + +static inline void +pack_float_r_snorm8(const GLfloat src[4], void *dst) +{ + + + int8_t r = + _mesa_float_to_snorm(src[0], 8); + + int8_t *d = (int8_t *)dst; + d[0] = r; +} + +static inline void +pack_float_r_snorm16(const GLfloat src[4], void *dst) +{ + + + int16_t r = + _mesa_float_to_snorm(src[0], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; +} + +static inline void +pack_float_la_snorm16(const GLfloat src[4], void *dst) +{ + + + int16_t l = + _mesa_float_to_snorm(src[0], 16); + + + int16_t a = + _mesa_float_to_snorm(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_float_rgb_snorm16(const GLfloat src[4], void *dst) +{ + + + int16_t r = + _mesa_float_to_snorm(src[0], 16); + + + int16_t g = + _mesa_float_to_snorm(src[1], 16); + + + int16_t b = + _mesa_float_to_snorm(src[2], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_float_rgba_snorm16(const GLfloat src[4], void *dst) +{ + + + int16_t r = + _mesa_float_to_snorm(src[0], 16); + + + int16_t g = + _mesa_float_to_snorm(src[1], 16); + + + int16_t b = + _mesa_float_to_snorm(src[2], 16); + + + int16_t a = + _mesa_float_to_snorm(src[3], 16); + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_float_rgbx_snorm16(const GLfloat src[4], void *dst) +{ + + + int16_t r = + _mesa_float_to_snorm(src[0], 16); + + + int16_t g = + _mesa_float_to_snorm(src[1], 16); + + + int16_t b = + _mesa_float_to_snorm(src[2], 16); + + + int16_t *d = (int16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_float_a8b8g8r8_srgb(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_b8g8r8a8_srgb(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_a8r8g8b8_srgb(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + uint32_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_b8g8r8x8_srgb(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + + uint32_t d = 0; + d |= PACK(b, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(r, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_x8r8g8b8_srgb(const GLfloat src[4], void *dst) +{ + + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + uint32_t d = 0; + d |= PACK(r, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(b, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r8g8b8a8_srgb(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + d |= PACK(a, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_r8g8b8x8_srgb(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + + uint32_t d = 0; + d |= PACK(r, 0, 8); + d |= PACK(g, 8, 8); + d |= PACK(b, 16, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_x8b8g8r8_srgb(const GLfloat src[4], void *dst) +{ + + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + uint32_t d = 0; + d |= PACK(b, 8, 8); + d |= PACK(g, 16, 8); + d |= PACK(r, 24, 8); + (*(uint32_t *)dst) = d; +} + +static inline void +pack_float_l8a8_srgb(const GLfloat src[4], void *dst) +{ + + + uint8_t l = + _mesa_float_to_unorm(src[0], 8); + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + uint16_t d = 0; + d |= PACK(l, 0, 8); + d |= PACK(a, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_a8l8_srgb(const GLfloat src[4], void *dst) +{ + + + uint8_t a = + _mesa_float_to_unorm(src[3], 8); + + + uint8_t l = + _mesa_float_to_unorm(src[0], 8); + + uint16_t d = 0; + d |= PACK(a, 0, 8); + d |= PACK(l, 8, 8); + (*(uint16_t *)dst) = d; +} + +static inline void +pack_float_l_srgb8(const GLfloat src[4], void *dst) +{ + + + uint8_t l = + _mesa_float_to_unorm(src[0], 8); + + uint8_t *d = (uint8_t *)dst; + d[0] = l; +} + +static inline void +pack_float_bgr_srgb8(const GLfloat src[4], void *dst) +{ + + + uint8_t b = + + util_format_linear_float_to_srgb_8unorm(src[2]); + + + uint8_t g = + + util_format_linear_float_to_srgb_8unorm(src[1]); + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + uint8_t *d = (uint8_t *)dst; + d[0] = b; + d[1] = g; + d[2] = r; +} + +static inline void +pack_float_a_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t a = + _mesa_float_to_half(src[3]); + + uint16_t *d = (uint16_t *)dst; + d[0] = a; +} + +static inline void +pack_float_a_float32(const GLfloat src[4], void *dst) +{ + + + float a = + src[3]; + + float *d = (float *)dst; + d[0] = a; +} + +static inline void +pack_float_l_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t l = + _mesa_float_to_half(src[0]); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; +} + +static inline void +pack_float_l_float32(const GLfloat src[4], void *dst) +{ + + + float l = + src[0]; + + float *d = (float *)dst; + d[0] = l; +} + +static inline void +pack_float_la_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t l = + _mesa_float_to_half(src[0]); + + + uint16_t a = + _mesa_float_to_half(src[3]); + + uint16_t *d = (uint16_t *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_float_la_float32(const GLfloat src[4], void *dst) +{ + + + float l = + src[0]; + + + float a = + src[3]; + + float *d = (float *)dst; + d[0] = l; + d[1] = a; +} + +static inline void +pack_float_i_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t i = + _mesa_float_to_half(src[0]); + + uint16_t *d = (uint16_t *)dst; + d[0] = i; +} + +static inline void +pack_float_i_float32(const GLfloat src[4], void *dst) +{ + + + float i = + src[0]; + + float *d = (float *)dst; + d[0] = i; +} + +static inline void +pack_float_r_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_half(src[0]); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; +} + +static inline void +pack_float_r_float32(const GLfloat src[4], void *dst) +{ + + + float r = + src[0]; + + float *d = (float *)dst; + d[0] = r; +} + +static inline void +pack_float_rg_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_half(src[0]); + + + uint16_t g = + _mesa_float_to_half(src[1]); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_float_rg_float32(const GLfloat src[4], void *dst) +{ + + + float r = + src[0]; + + + float g = + src[1]; + + float *d = (float *)dst; + d[0] = r; + d[1] = g; +} + +static inline void +pack_float_rgb_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_half(src[0]); + + + uint16_t g = + _mesa_float_to_half(src[1]); + + + uint16_t b = + _mesa_float_to_half(src[2]); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_float_rgb_float32(const GLfloat src[4], void *dst) +{ + + + float r = + src[0]; + + + float g = + src[1]; + + + float b = + src[2]; + + float *d = (float *)dst; + d[0] = r; + d[1] = g; + d[2] = b; +} + +static inline void +pack_float_rgba_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_half(src[0]); + + + uint16_t g = + _mesa_float_to_half(src[1]); + + + uint16_t b = + _mesa_float_to_half(src[2]); + + + uint16_t a = + _mesa_float_to_half(src[3]); + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_float_rgba_float32(const GLfloat src[4], void *dst) +{ + + + float r = + src[0]; + + + float g = + src[1]; + + + float b = + src[2]; + + + float a = + src[3]; + + float *d = (float *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + d[3] = a; +} + +static inline void +pack_float_rgbx_float16(const GLfloat src[4], void *dst) +{ + + + uint16_t r = + _mesa_float_to_half(src[0]); + + + uint16_t g = + _mesa_float_to_half(src[1]); + + + uint16_t b = + _mesa_float_to_half(src[2]); + + + uint16_t *d = (uint16_t *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_float_rgbx_float32(const GLfloat src[4], void *dst) +{ + + + float r = + src[0]; + + + float g = + src[1]; + + + float b = + src[2]; + + + float *d = (float *)dst; + d[0] = r; + d[1] = g; + d[2] = b; + } + +static inline void +pack_float_r9g9b9e5_float(const GLfloat src[4], void *dst) +{ + GLuint *d = (GLuint *) dst; + *d = float3_to_rgb9e5(src); +} + +static inline void +pack_float_r11g11b10_float(const GLfloat src[4], void *dst) +{ + GLuint *d = (GLuint *) dst; + *d = float3_to_r11g11b10f(src); +} + +/** + * Return a function that can pack a GLubyte rgba[4] color. + */ +gl_pack_ubyte_rgba_func +_mesa_get_pack_ubyte_rgba_function(mesa_format format) +{ + switch (format) { + + case MESA_FORMAT_A8B8G8R8_UNORM: + return pack_ubyte_a8b8g8r8_unorm; + + case MESA_FORMAT_X8B8G8R8_UNORM: + return pack_ubyte_x8b8g8r8_unorm; + + case MESA_FORMAT_R8G8B8A8_UNORM: + return pack_ubyte_r8g8b8a8_unorm; + + case MESA_FORMAT_R8G8B8X8_UNORM: + return pack_ubyte_r8g8b8x8_unorm; + + case MESA_FORMAT_B8G8R8A8_UNORM: + return pack_ubyte_b8g8r8a8_unorm; + + case MESA_FORMAT_B8G8R8X8_UNORM: + return pack_ubyte_b8g8r8x8_unorm; + + case MESA_FORMAT_A8R8G8B8_UNORM: + return pack_ubyte_a8r8g8b8_unorm; + + case MESA_FORMAT_X8R8G8B8_UNORM: + return pack_ubyte_x8r8g8b8_unorm; + + case MESA_FORMAT_L16A16_UNORM: + return pack_ubyte_l16a16_unorm; + + case MESA_FORMAT_A16L16_UNORM: + return pack_ubyte_a16l16_unorm; + + case MESA_FORMAT_B5G6R5_UNORM: + return pack_ubyte_b5g6r5_unorm; + + case MESA_FORMAT_R5G6B5_UNORM: + return pack_ubyte_r5g6b5_unorm; + + case MESA_FORMAT_B4G4R4A4_UNORM: + return pack_ubyte_b4g4r4a4_unorm; + + case MESA_FORMAT_B4G4R4X4_UNORM: + return pack_ubyte_b4g4r4x4_unorm; + + case MESA_FORMAT_A4R4G4B4_UNORM: + return pack_ubyte_a4r4g4b4_unorm; + + case MESA_FORMAT_A1B5G5R5_UNORM: + return pack_ubyte_a1b5g5r5_unorm; + + case MESA_FORMAT_B5G5R5A1_UNORM: + return pack_ubyte_b5g5r5a1_unorm; + + case MESA_FORMAT_B5G5R5X1_UNORM: + return pack_ubyte_b5g5r5x1_unorm; + + case MESA_FORMAT_A1R5G5B5_UNORM: + return pack_ubyte_a1r5g5b5_unorm; + + case MESA_FORMAT_L8A8_UNORM: + return pack_ubyte_l8a8_unorm; + + case MESA_FORMAT_A8L8_UNORM: + return pack_ubyte_a8l8_unorm; + + case MESA_FORMAT_R8G8_UNORM: + return pack_ubyte_r8g8_unorm; + + case MESA_FORMAT_G8R8_UNORM: + return pack_ubyte_g8r8_unorm; + + case MESA_FORMAT_L4A4_UNORM: + return pack_ubyte_l4a4_unorm; + + case MESA_FORMAT_B2G3R3_UNORM: + return pack_ubyte_b2g3r3_unorm; + + case MESA_FORMAT_R16G16_UNORM: + return pack_ubyte_r16g16_unorm; + + case MESA_FORMAT_G16R16_UNORM: + return pack_ubyte_g16r16_unorm; + + case MESA_FORMAT_B10G10R10A2_UNORM: + return pack_ubyte_b10g10r10a2_unorm; + + case MESA_FORMAT_B10G10R10X2_UNORM: + return pack_ubyte_b10g10r10x2_unorm; + + case MESA_FORMAT_R10G10B10A2_UNORM: + return pack_ubyte_r10g10b10a2_unorm; + + case MESA_FORMAT_R10G10B10X2_UNORM: + return pack_ubyte_r10g10b10x2_unorm; + + case MESA_FORMAT_R3G3B2_UNORM: + return pack_ubyte_r3g3b2_unorm; + + case MESA_FORMAT_A4B4G4R4_UNORM: + return pack_ubyte_a4b4g4r4_unorm; + + case MESA_FORMAT_R4G4B4A4_UNORM: + return pack_ubyte_r4g4b4a4_unorm; + + case MESA_FORMAT_R5G5B5A1_UNORM: + return pack_ubyte_r5g5b5a1_unorm; + + case MESA_FORMAT_A2B10G10R10_UNORM: + return pack_ubyte_a2b10g10r10_unorm; + + case MESA_FORMAT_A2R10G10B10_UNORM: + return pack_ubyte_a2r10g10b10_unorm; + + case MESA_FORMAT_A_UNORM8: + return pack_ubyte_a_unorm8; + + case MESA_FORMAT_A_UNORM16: + return pack_ubyte_a_unorm16; + + case MESA_FORMAT_L_UNORM8: + return pack_ubyte_l_unorm8; + + case MESA_FORMAT_L_UNORM16: + return pack_ubyte_l_unorm16; + + case MESA_FORMAT_I_UNORM8: + return pack_ubyte_i_unorm8; + + case MESA_FORMAT_I_UNORM16: + return pack_ubyte_i_unorm16; + + case MESA_FORMAT_R_UNORM8: + return pack_ubyte_r_unorm8; + + case MESA_FORMAT_R_UNORM16: + return pack_ubyte_r_unorm16; + + case MESA_FORMAT_BGR_UNORM8: + return pack_ubyte_bgr_unorm8; + + case MESA_FORMAT_RGB_UNORM8: + return pack_ubyte_rgb_unorm8; + + case MESA_FORMAT_RGBA_UNORM16: + return pack_ubyte_rgba_unorm16; + + case MESA_FORMAT_RGBX_UNORM16: + return pack_ubyte_rgbx_unorm16; + + case MESA_FORMAT_A8B8G8R8_SNORM: + return pack_ubyte_a8b8g8r8_snorm; + + case MESA_FORMAT_X8B8G8R8_SNORM: + return pack_ubyte_x8b8g8r8_snorm; + + case MESA_FORMAT_R8G8B8A8_SNORM: + return pack_ubyte_r8g8b8a8_snorm; + + case MESA_FORMAT_R8G8B8X8_SNORM: + return pack_ubyte_r8g8b8x8_snorm; + + case MESA_FORMAT_R16G16_SNORM: + return pack_ubyte_r16g16_snorm; + + case MESA_FORMAT_G16R16_SNORM: + return pack_ubyte_g16r16_snorm; + + case MESA_FORMAT_R8G8_SNORM: + return pack_ubyte_r8g8_snorm; + + case MESA_FORMAT_G8R8_SNORM: + return pack_ubyte_g8r8_snorm; + + case MESA_FORMAT_L8A8_SNORM: + return pack_ubyte_l8a8_snorm; + + case MESA_FORMAT_A8L8_SNORM: + return pack_ubyte_a8l8_snorm; + + case MESA_FORMAT_A_SNORM8: + return pack_ubyte_a_snorm8; + + case MESA_FORMAT_A_SNORM16: + return pack_ubyte_a_snorm16; + + case MESA_FORMAT_L_SNORM8: + return pack_ubyte_l_snorm8; + + case MESA_FORMAT_L_SNORM16: + return pack_ubyte_l_snorm16; + + case MESA_FORMAT_I_SNORM8: + return pack_ubyte_i_snorm8; + + case MESA_FORMAT_I_SNORM16: + return pack_ubyte_i_snorm16; + + case MESA_FORMAT_R_SNORM8: + return pack_ubyte_r_snorm8; + + case MESA_FORMAT_R_SNORM16: + return pack_ubyte_r_snorm16; + + case MESA_FORMAT_LA_SNORM16: + return pack_ubyte_la_snorm16; + + case MESA_FORMAT_RGB_SNORM16: + return pack_ubyte_rgb_snorm16; + + case MESA_FORMAT_RGBA_SNORM16: + return pack_ubyte_rgba_snorm16; + + case MESA_FORMAT_RGBX_SNORM16: + return pack_ubyte_rgbx_snorm16; + + case MESA_FORMAT_A8B8G8R8_SRGB: + return pack_ubyte_a8b8g8r8_srgb; + + case MESA_FORMAT_B8G8R8A8_SRGB: + return pack_ubyte_b8g8r8a8_srgb; + + case MESA_FORMAT_A8R8G8B8_SRGB: + return pack_ubyte_a8r8g8b8_srgb; + + case MESA_FORMAT_B8G8R8X8_SRGB: + return pack_ubyte_b8g8r8x8_srgb; + + case MESA_FORMAT_X8R8G8B8_SRGB: + return pack_ubyte_x8r8g8b8_srgb; + + case MESA_FORMAT_R8G8B8A8_SRGB: + return pack_ubyte_r8g8b8a8_srgb; + + case MESA_FORMAT_R8G8B8X8_SRGB: + return pack_ubyte_r8g8b8x8_srgb; + + case MESA_FORMAT_X8B8G8R8_SRGB: + return pack_ubyte_x8b8g8r8_srgb; + + case MESA_FORMAT_L8A8_SRGB: + return pack_ubyte_l8a8_srgb; + + case MESA_FORMAT_A8L8_SRGB: + return pack_ubyte_a8l8_srgb; + + case MESA_FORMAT_L_SRGB8: + return pack_ubyte_l_srgb8; + + case MESA_FORMAT_BGR_SRGB8: + return pack_ubyte_bgr_srgb8; + + case MESA_FORMAT_R9G9B9E5_FLOAT: + return pack_ubyte_r9g9b9e5_float; + + case MESA_FORMAT_R11G11B10_FLOAT: + return pack_ubyte_r11g11b10_float; + + case MESA_FORMAT_A_FLOAT16: + return pack_ubyte_a_float16; + + case MESA_FORMAT_A_FLOAT32: + return pack_ubyte_a_float32; + + case MESA_FORMAT_L_FLOAT16: + return pack_ubyte_l_float16; + + case MESA_FORMAT_L_FLOAT32: + return pack_ubyte_l_float32; + + case MESA_FORMAT_LA_FLOAT16: + return pack_ubyte_la_float16; + + case MESA_FORMAT_LA_FLOAT32: + return pack_ubyte_la_float32; + + case MESA_FORMAT_I_FLOAT16: + return pack_ubyte_i_float16; + + case MESA_FORMAT_I_FLOAT32: + return pack_ubyte_i_float32; + + case MESA_FORMAT_R_FLOAT16: + return pack_ubyte_r_float16; + + case MESA_FORMAT_R_FLOAT32: + return pack_ubyte_r_float32; + + case MESA_FORMAT_RG_FLOAT16: + return pack_ubyte_rg_float16; + + case MESA_FORMAT_RG_FLOAT32: + return pack_ubyte_rg_float32; + + case MESA_FORMAT_RGB_FLOAT16: + return pack_ubyte_rgb_float16; + + case MESA_FORMAT_RGB_FLOAT32: + return pack_ubyte_rgb_float32; + + case MESA_FORMAT_RGBA_FLOAT16: + return pack_ubyte_rgba_float16; + + case MESA_FORMAT_RGBA_FLOAT32: + return pack_ubyte_rgba_float32; + + case MESA_FORMAT_RGBX_FLOAT16: + return pack_ubyte_rgbx_float16; + + case MESA_FORMAT_RGBX_FLOAT32: + return pack_ubyte_rgbx_float32; + + case MESA_FORMAT_A8B8G8R8_UINT: + return pack_ubyte_a8b8g8r8_uint; + + case MESA_FORMAT_A8R8G8B8_UINT: + return pack_ubyte_a8r8g8b8_uint; + + case MESA_FORMAT_R8G8B8A8_UINT: + return pack_ubyte_r8g8b8a8_uint; + + case MESA_FORMAT_B8G8R8A8_UINT: + return pack_ubyte_b8g8r8a8_uint; + + case MESA_FORMAT_B10G10R10A2_UINT: + return pack_ubyte_b10g10r10a2_uint; + + case MESA_FORMAT_R10G10B10A2_UINT: + return pack_ubyte_r10g10b10a2_uint; + + case MESA_FORMAT_A2B10G10R10_UINT: + return pack_ubyte_a2b10g10r10_uint; + + case MESA_FORMAT_A2R10G10B10_UINT: + return pack_ubyte_a2r10g10b10_uint; + + case MESA_FORMAT_B5G6R5_UINT: + return pack_ubyte_b5g6r5_uint; + + case MESA_FORMAT_R5G6B5_UINT: + return pack_ubyte_r5g6b5_uint; + + case MESA_FORMAT_B2G3R3_UINT: + return pack_ubyte_b2g3r3_uint; + + case MESA_FORMAT_R3G3B2_UINT: + return pack_ubyte_r3g3b2_uint; + + case MESA_FORMAT_A4B4G4R4_UINT: + return pack_ubyte_a4b4g4r4_uint; + + case MESA_FORMAT_R4G4B4A4_UINT: + return pack_ubyte_r4g4b4a4_uint; + + case MESA_FORMAT_B4G4R4A4_UINT: + return pack_ubyte_b4g4r4a4_uint; + + case MESA_FORMAT_A4R4G4B4_UINT: + return pack_ubyte_a4r4g4b4_uint; + + case MESA_FORMAT_A1B5G5R5_UINT: + return pack_ubyte_a1b5g5r5_uint; + + case MESA_FORMAT_B5G5R5A1_UINT: + return pack_ubyte_b5g5r5a1_uint; + + case MESA_FORMAT_A1R5G5B5_UINT: + return pack_ubyte_a1r5g5b5_uint; + + case MESA_FORMAT_R5G5B5A1_UINT: + return pack_ubyte_r5g5b5a1_uint; + + case MESA_FORMAT_A_UINT8: + return pack_ubyte_a_uint8; + + case MESA_FORMAT_A_UINT16: + return pack_ubyte_a_uint16; + + case MESA_FORMAT_A_UINT32: + return pack_ubyte_a_uint32; + + case MESA_FORMAT_A_SINT8: + return pack_ubyte_a_sint8; + + case MESA_FORMAT_A_SINT16: + return pack_ubyte_a_sint16; + + case MESA_FORMAT_A_SINT32: + return pack_ubyte_a_sint32; + + case MESA_FORMAT_I_UINT8: + return pack_ubyte_i_uint8; + + case MESA_FORMAT_I_UINT16: + return pack_ubyte_i_uint16; + + case MESA_FORMAT_I_UINT32: + return pack_ubyte_i_uint32; + + case MESA_FORMAT_I_SINT8: + return pack_ubyte_i_sint8; + + case MESA_FORMAT_I_SINT16: + return pack_ubyte_i_sint16; + + case MESA_FORMAT_I_SINT32: + return pack_ubyte_i_sint32; + + case MESA_FORMAT_L_UINT8: + return pack_ubyte_l_uint8; + + case MESA_FORMAT_L_UINT16: + return pack_ubyte_l_uint16; + + case MESA_FORMAT_L_UINT32: + return pack_ubyte_l_uint32; + + case MESA_FORMAT_L_SINT8: + return pack_ubyte_l_sint8; + + case MESA_FORMAT_L_SINT16: + return pack_ubyte_l_sint16; + + case MESA_FORMAT_L_SINT32: + return pack_ubyte_l_sint32; + + case MESA_FORMAT_LA_UINT8: + return pack_ubyte_la_uint8; + + case MESA_FORMAT_LA_UINT16: + return pack_ubyte_la_uint16; + + case MESA_FORMAT_LA_UINT32: + return pack_ubyte_la_uint32; + + case MESA_FORMAT_LA_SINT8: + return pack_ubyte_la_sint8; + + case MESA_FORMAT_LA_SINT16: + return pack_ubyte_la_sint16; + + case MESA_FORMAT_LA_SINT32: + return pack_ubyte_la_sint32; + + case MESA_FORMAT_R_UINT8: + return pack_ubyte_r_uint8; + + case MESA_FORMAT_R_UINT16: + return pack_ubyte_r_uint16; + + case MESA_FORMAT_R_UINT32: + return pack_ubyte_r_uint32; + + case MESA_FORMAT_R_SINT8: + return pack_ubyte_r_sint8; + + case MESA_FORMAT_R_SINT16: + return pack_ubyte_r_sint16; + + case MESA_FORMAT_R_SINT32: + return pack_ubyte_r_sint32; + + case MESA_FORMAT_RG_UINT8: + return pack_ubyte_rg_uint8; + + case MESA_FORMAT_RG_UINT16: + return pack_ubyte_rg_uint16; + + case MESA_FORMAT_RG_UINT32: + return pack_ubyte_rg_uint32; + + case MESA_FORMAT_RG_SINT8: + return pack_ubyte_rg_sint8; + + case MESA_FORMAT_RG_SINT16: + return pack_ubyte_rg_sint16; + + case MESA_FORMAT_RG_SINT32: + return pack_ubyte_rg_sint32; + + case MESA_FORMAT_RGB_UINT8: + return pack_ubyte_rgb_uint8; + + case MESA_FORMAT_RGB_UINT16: + return pack_ubyte_rgb_uint16; + + case MESA_FORMAT_RGB_UINT32: + return pack_ubyte_rgb_uint32; + + case MESA_FORMAT_RGB_SINT8: + return pack_ubyte_rgb_sint8; + + case MESA_FORMAT_RGB_SINT16: + return pack_ubyte_rgb_sint16; + + case MESA_FORMAT_RGB_SINT32: + return pack_ubyte_rgb_sint32; + + case MESA_FORMAT_RGBA_UINT8: + return pack_ubyte_rgba_uint8; + + case MESA_FORMAT_RGBA_UINT16: + return pack_ubyte_rgba_uint16; + + case MESA_FORMAT_RGBA_UINT32: + return pack_ubyte_rgba_uint32; + + case MESA_FORMAT_RGBA_SINT8: + return pack_ubyte_rgba_sint8; + + case MESA_FORMAT_RGBA_SINT16: + return pack_ubyte_rgba_sint16; + + case MESA_FORMAT_RGBA_SINT32: + return pack_ubyte_rgba_sint32; + + case MESA_FORMAT_RGBX_UINT8: + return pack_ubyte_rgbx_uint8; + + case MESA_FORMAT_RGBX_UINT16: + return pack_ubyte_rgbx_uint16; + + case MESA_FORMAT_RGBX_UINT32: + return pack_ubyte_rgbx_uint32; + + case MESA_FORMAT_RGBX_SINT8: + return pack_ubyte_rgbx_sint8; + + case MESA_FORMAT_RGBX_SINT16: + return pack_ubyte_rgbx_sint16; + + case MESA_FORMAT_RGBX_SINT32: + return pack_ubyte_rgbx_sint32; + default: + return NULL; + } +} + +/** + * Return a function that can pack a GLfloat rgba[4] color. + */ +gl_pack_float_rgba_func +_mesa_get_pack_float_rgba_function(mesa_format format) +{ + switch (format) { + + case MESA_FORMAT_A8B8G8R8_UNORM: + return pack_float_a8b8g8r8_unorm; + + case MESA_FORMAT_X8B8G8R8_UNORM: + return pack_float_x8b8g8r8_unorm; + + case MESA_FORMAT_R8G8B8A8_UNORM: + return pack_float_r8g8b8a8_unorm; + + case MESA_FORMAT_R8G8B8X8_UNORM: + return pack_float_r8g8b8x8_unorm; + + case MESA_FORMAT_B8G8R8A8_UNORM: + return pack_float_b8g8r8a8_unorm; + + case MESA_FORMAT_B8G8R8X8_UNORM: + return pack_float_b8g8r8x8_unorm; + + case MESA_FORMAT_A8R8G8B8_UNORM: + return pack_float_a8r8g8b8_unorm; + + case MESA_FORMAT_X8R8G8B8_UNORM: + return pack_float_x8r8g8b8_unorm; + + case MESA_FORMAT_L16A16_UNORM: + return pack_float_l16a16_unorm; + + case MESA_FORMAT_A16L16_UNORM: + return pack_float_a16l16_unorm; + + case MESA_FORMAT_B5G6R5_UNORM: + return pack_float_b5g6r5_unorm; + + case MESA_FORMAT_R5G6B5_UNORM: + return pack_float_r5g6b5_unorm; + + case MESA_FORMAT_B4G4R4A4_UNORM: + return pack_float_b4g4r4a4_unorm; + + case MESA_FORMAT_B4G4R4X4_UNORM: + return pack_float_b4g4r4x4_unorm; + + case MESA_FORMAT_A4R4G4B4_UNORM: + return pack_float_a4r4g4b4_unorm; + + case MESA_FORMAT_A1B5G5R5_UNORM: + return pack_float_a1b5g5r5_unorm; + + case MESA_FORMAT_B5G5R5A1_UNORM: + return pack_float_b5g5r5a1_unorm; + + case MESA_FORMAT_B5G5R5X1_UNORM: + return pack_float_b5g5r5x1_unorm; + + case MESA_FORMAT_A1R5G5B5_UNORM: + return pack_float_a1r5g5b5_unorm; + + case MESA_FORMAT_L8A8_UNORM: + return pack_float_l8a8_unorm; + + case MESA_FORMAT_A8L8_UNORM: + return pack_float_a8l8_unorm; + + case MESA_FORMAT_R8G8_UNORM: + return pack_float_r8g8_unorm; + + case MESA_FORMAT_G8R8_UNORM: + return pack_float_g8r8_unorm; + + case MESA_FORMAT_L4A4_UNORM: + return pack_float_l4a4_unorm; + + case MESA_FORMAT_B2G3R3_UNORM: + return pack_float_b2g3r3_unorm; + + case MESA_FORMAT_R16G16_UNORM: + return pack_float_r16g16_unorm; + + case MESA_FORMAT_G16R16_UNORM: + return pack_float_g16r16_unorm; + + case MESA_FORMAT_B10G10R10A2_UNORM: + return pack_float_b10g10r10a2_unorm; + + case MESA_FORMAT_B10G10R10X2_UNORM: + return pack_float_b10g10r10x2_unorm; + + case MESA_FORMAT_R10G10B10A2_UNORM: + return pack_float_r10g10b10a2_unorm; + + case MESA_FORMAT_R10G10B10X2_UNORM: + return pack_float_r10g10b10x2_unorm; + + case MESA_FORMAT_R3G3B2_UNORM: + return pack_float_r3g3b2_unorm; + + case MESA_FORMAT_A4B4G4R4_UNORM: + return pack_float_a4b4g4r4_unorm; + + case MESA_FORMAT_R4G4B4A4_UNORM: + return pack_float_r4g4b4a4_unorm; + + case MESA_FORMAT_R5G5B5A1_UNORM: + return pack_float_r5g5b5a1_unorm; + + case MESA_FORMAT_A2B10G10R10_UNORM: + return pack_float_a2b10g10r10_unorm; + + case MESA_FORMAT_A2R10G10B10_UNORM: + return pack_float_a2r10g10b10_unorm; + + case MESA_FORMAT_A_UNORM8: + return pack_float_a_unorm8; + + case MESA_FORMAT_A_UNORM16: + return pack_float_a_unorm16; + + case MESA_FORMAT_L_UNORM8: + return pack_float_l_unorm8; + + case MESA_FORMAT_L_UNORM16: + return pack_float_l_unorm16; + + case MESA_FORMAT_I_UNORM8: + return pack_float_i_unorm8; + + case MESA_FORMAT_I_UNORM16: + return pack_float_i_unorm16; + + case MESA_FORMAT_R_UNORM8: + return pack_float_r_unorm8; + + case MESA_FORMAT_R_UNORM16: + return pack_float_r_unorm16; + + case MESA_FORMAT_BGR_UNORM8: + return pack_float_bgr_unorm8; + + case MESA_FORMAT_RGB_UNORM8: + return pack_float_rgb_unorm8; + + case MESA_FORMAT_RGBA_UNORM16: + return pack_float_rgba_unorm16; + + case MESA_FORMAT_RGBX_UNORM16: + return pack_float_rgbx_unorm16; + + case MESA_FORMAT_A8B8G8R8_SNORM: + return pack_float_a8b8g8r8_snorm; + + case MESA_FORMAT_X8B8G8R8_SNORM: + return pack_float_x8b8g8r8_snorm; + + case MESA_FORMAT_R8G8B8A8_SNORM: + return pack_float_r8g8b8a8_snorm; + + case MESA_FORMAT_R8G8B8X8_SNORM: + return pack_float_r8g8b8x8_snorm; + + case MESA_FORMAT_R16G16_SNORM: + return pack_float_r16g16_snorm; + + case MESA_FORMAT_G16R16_SNORM: + return pack_float_g16r16_snorm; + + case MESA_FORMAT_R8G8_SNORM: + return pack_float_r8g8_snorm; + + case MESA_FORMAT_G8R8_SNORM: + return pack_float_g8r8_snorm; + + case MESA_FORMAT_L8A8_SNORM: + return pack_float_l8a8_snorm; + + case MESA_FORMAT_A8L8_SNORM: + return pack_float_a8l8_snorm; + + case MESA_FORMAT_A_SNORM8: + return pack_float_a_snorm8; + + case MESA_FORMAT_A_SNORM16: + return pack_float_a_snorm16; + + case MESA_FORMAT_L_SNORM8: + return pack_float_l_snorm8; + + case MESA_FORMAT_L_SNORM16: + return pack_float_l_snorm16; + + case MESA_FORMAT_I_SNORM8: + return pack_float_i_snorm8; + + case MESA_FORMAT_I_SNORM16: + return pack_float_i_snorm16; + + case MESA_FORMAT_R_SNORM8: + return pack_float_r_snorm8; + + case MESA_FORMAT_R_SNORM16: + return pack_float_r_snorm16; + + case MESA_FORMAT_LA_SNORM16: + return pack_float_la_snorm16; + + case MESA_FORMAT_RGB_SNORM16: + return pack_float_rgb_snorm16; + + case MESA_FORMAT_RGBA_SNORM16: + return pack_float_rgba_snorm16; + + case MESA_FORMAT_RGBX_SNORM16: + return pack_float_rgbx_snorm16; + + case MESA_FORMAT_A8B8G8R8_SRGB: + return pack_float_a8b8g8r8_srgb; + + case MESA_FORMAT_B8G8R8A8_SRGB: + return pack_float_b8g8r8a8_srgb; + + case MESA_FORMAT_A8R8G8B8_SRGB: + return pack_float_a8r8g8b8_srgb; + + case MESA_FORMAT_B8G8R8X8_SRGB: + return pack_float_b8g8r8x8_srgb; + + case MESA_FORMAT_X8R8G8B8_SRGB: + return pack_float_x8r8g8b8_srgb; + + case MESA_FORMAT_R8G8B8A8_SRGB: + return pack_float_r8g8b8a8_srgb; + + case MESA_FORMAT_R8G8B8X8_SRGB: + return pack_float_r8g8b8x8_srgb; + + case MESA_FORMAT_X8B8G8R8_SRGB: + return pack_float_x8b8g8r8_srgb; + + case MESA_FORMAT_L8A8_SRGB: + return pack_float_l8a8_srgb; + + case MESA_FORMAT_A8L8_SRGB: + return pack_float_a8l8_srgb; + + case MESA_FORMAT_L_SRGB8: + return pack_float_l_srgb8; + + case MESA_FORMAT_BGR_SRGB8: + return pack_float_bgr_srgb8; + + case MESA_FORMAT_R9G9B9E5_FLOAT: + return pack_float_r9g9b9e5_float; + + case MESA_FORMAT_R11G11B10_FLOAT: + return pack_float_r11g11b10_float; + + case MESA_FORMAT_A_FLOAT16: + return pack_float_a_float16; + + case MESA_FORMAT_A_FLOAT32: + return pack_float_a_float32; + + case MESA_FORMAT_L_FLOAT16: + return pack_float_l_float16; + + case MESA_FORMAT_L_FLOAT32: + return pack_float_l_float32; + + case MESA_FORMAT_LA_FLOAT16: + return pack_float_la_float16; + + case MESA_FORMAT_LA_FLOAT32: + return pack_float_la_float32; + + case MESA_FORMAT_I_FLOAT16: + return pack_float_i_float16; + + case MESA_FORMAT_I_FLOAT32: + return pack_float_i_float32; + + case MESA_FORMAT_R_FLOAT16: + return pack_float_r_float16; + + case MESA_FORMAT_R_FLOAT32: + return pack_float_r_float32; + + case MESA_FORMAT_RG_FLOAT16: + return pack_float_rg_float16; + + case MESA_FORMAT_RG_FLOAT32: + return pack_float_rg_float32; + + case MESA_FORMAT_RGB_FLOAT16: + return pack_float_rgb_float16; + + case MESA_FORMAT_RGB_FLOAT32: + return pack_float_rgb_float32; + + case MESA_FORMAT_RGBA_FLOAT16: + return pack_float_rgba_float16; + + case MESA_FORMAT_RGBA_FLOAT32: + return pack_float_rgba_float32; + + case MESA_FORMAT_RGBX_FLOAT16: + return pack_float_rgbx_float16; + + case MESA_FORMAT_RGBX_FLOAT32: + return pack_float_rgbx_float32; + default: + return NULL; + } +} + +/** + * Pack a row of GLubyte rgba[4] values to the destination. + */ +void +_mesa_pack_ubyte_rgba_row(mesa_format format, GLuint n, + const GLubyte src[][4], void *dst) +{ + GLuint i; + GLubyte *d = dst; + + switch (format) { + + case MESA_FORMAT_A8B8G8R8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a8b8g8r8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_x8b8g8r8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8b8a8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8b8x8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b8g8r8a8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8X8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b8g8r8x8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a8r8g8b8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8R8G8B8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_x8r8g8b8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L16A16_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_l16a16_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A16L16_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a16l16_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B5G6R5_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b5g6r5_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R5G6B5_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r5g6b5_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B4G4R4A4_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b4g4r4a4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B4G4R4X4_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b4g4r4x4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A4R4G4B4_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a4r4g4b4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A1B5G5R5_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a1b5g5r5_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B5G5R5A1_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b5g5r5a1_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B5G5R5X1_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b5g5r5x1_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A1R5G5B5_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a1r5g5b5_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L8A8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_l8a8_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A8L8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a8l8_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R8G8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_G8R8_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_g8r8_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L4A4_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_l4a4_unorm(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_B2G3R3_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b2g3r3_unorm(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R16G16_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r16g16_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_G16R16_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_g16r16_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B10G10R10A2_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b10g10r10a2_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B10G10R10X2_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_b10g10r10x2_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R10G10B10A2_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r10g10b10a2_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R10G10B10X2_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r10g10b10x2_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R3G3B2_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r3g3b2_unorm(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A4B4G4R4_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a4b4g4r4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R4G4B4A4_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r4g4b4a4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R5G5B5A1_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r5g5b5a1_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A2B10G10R10_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a2b10g10r10_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A2R10G10B10_UNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a2r10g10b10_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A_UNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_a_unorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A_UNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_a_unorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_UNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_l_unorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_L_UNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_l_unorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_UNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_i_unorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_I_UNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_i_unorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_UNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_r_unorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R_UNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_r_unorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_BGR_UNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_bgr_unorm8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_RGB_UNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_unorm8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_RGBA_UNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_unorm16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_UNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_unorm16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_A8B8G8R8_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a8b8g8r8_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_x8b8g8r8_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8b8a8_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8b8x8_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R16G16_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r16g16_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_G16R16_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_g16r16_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8_snorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_G8R8_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_g8r8_snorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L8A8_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_l8a8_snorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A8L8_SNORM: + for (i = 0; i < n; ++i) { + pack_ubyte_a8l8_snorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_SNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_a_snorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A_SNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_a_snorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_SNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_l_snorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_L_SNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_l_snorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_SNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_i_snorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_I_SNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_i_snorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_SNORM8: + for (i = 0; i < n; ++i) { + pack_ubyte_r_snorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R_SNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_r_snorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_LA_SNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_la_snorm16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGB_SNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_snorm16(src[i], d); + d += 6; + } + break; + + case MESA_FORMAT_RGBA_SNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_snorm16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_SNORM16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_snorm16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_A8B8G8R8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_a8b8g8r8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_b8g8r8a8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_a8r8g8b8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8X8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_b8g8r8x8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8R8G8B8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_x8r8g8b8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8b8a8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8b8x8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_x8b8g8r8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L8A8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_l8a8_srgb(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A8L8_SRGB: + for (i = 0; i < n; ++i) { + pack_ubyte_a8l8_srgb(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_SRGB8: + for (i = 0; i < n; ++i) { + pack_ubyte_l_srgb8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_BGR_SRGB8: + for (i = 0; i < n; ++i) { + pack_ubyte_bgr_srgb8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_R9G9B9E5_FLOAT: + for (i = 0; i < n; ++i) { + pack_ubyte_r9g9b9e5_float(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R11G11B10_FLOAT: + for (i = 0; i < n; ++i) { + pack_ubyte_r11g11b10_float(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_a_float16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_a_float32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_l_float16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_l_float32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_la_float16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_la_float32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_I_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_i_float16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_i_float32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_r_float16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_r_float32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rg_float16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rg_float32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGB_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_float16(src[i], d); + d += 6; + } + break; + + case MESA_FORMAT_RGB_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_float32(src[i], d); + d += 12; + } + break; + + case MESA_FORMAT_RGBA_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_float16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBA_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_float32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_RGBX_FLOAT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_float16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_FLOAT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_float32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_A8B8G8R8_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_a8b8g8r8_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_a8r8g8b8_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_r8g8b8a8_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_b8g8r8a8_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B10G10R10A2_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_b10g10r10a2_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R10G10B10A2_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_r10g10b10a2_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A2B10G10R10_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_a2b10g10r10_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A2R10G10B10_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_a2r10g10b10_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B5G6R5_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_b5g6r5_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R5G6B5_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_r5g6b5_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B2G3R3_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_b2g3r3_uint(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R3G3B2_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_r3g3b2_uint(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A4B4G4R4_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_a4b4g4r4_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R4G4B4A4_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_r4g4b4a4_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B4G4R4A4_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_b4g4r4a4_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A4R4G4B4_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_a4r4g4b4_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A1B5G5R5_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_a1b5g5r5_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B5G5R5A1_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_b5g5r5a1_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A1R5G5B5_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_a1r5g5b5_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R5G5B5A1_UINT: + for (i = 0; i < n; ++i) { + pack_ubyte_r5g5b5a1_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_a_uint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_a_uint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_a_uint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_a_sint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_a_sint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_a_sint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_I_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_i_uint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_I_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_i_uint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_i_uint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_I_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_i_sint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_I_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_i_sint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_i_sint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_l_uint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_L_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_l_uint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_l_uint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_l_sint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_L_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_l_sint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_l_sint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_la_uint8(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_LA_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_la_uint16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_la_uint32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_LA_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_la_sint8(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_LA_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_la_sint16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_la_sint32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_R_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_r_uint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_r_uint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_r_uint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_r_sint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_r_sint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_r_sint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_rg_uint8(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_RG_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rg_uint16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rg_uint32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RG_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_rg_sint8(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_RG_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rg_sint16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rg_sint32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGB_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_uint8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_RGB_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_uint16(src[i], d); + d += 6; + } + break; + + case MESA_FORMAT_RGB_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_uint32(src[i], d); + d += 12; + } + break; + + case MESA_FORMAT_RGB_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_sint8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_RGB_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_sint16(src[i], d); + d += 6; + } + break; + + case MESA_FORMAT_RGB_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgb_sint32(src[i], d); + d += 12; + } + break; + + case MESA_FORMAT_RGBA_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_uint8(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGBA_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_uint16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBA_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_uint32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_RGBA_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_sint8(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGBA_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_sint16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBA_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgba_sint32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_RGBX_UINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_uint8(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGBX_UINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_uint16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_UINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_uint32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_RGBX_SINT8: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_sint8(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGBX_SINT16: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_sint16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_SINT32: + for (i = 0; i < n; ++i) { + pack_ubyte_rgbx_sint32(src[i], d); + d += 16; + } + break; + default: + assert(!"Invalid format"); + } +} + +/** + * Pack a row of GLuint rgba[4] values to the destination. + */ +void +_mesa_pack_uint_rgba_row(mesa_format format, GLuint n, + const GLuint src[][4], void *dst) +{ + GLuint i; + GLubyte *d = dst; + + switch (format) { + + case MESA_FORMAT_A8B8G8R8_UINT: + for (i = 0; i < n; ++i) { + pack_uint_a8b8g8r8_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_UINT: + for (i = 0; i < n; ++i) { + pack_uint_a8r8g8b8_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_UINT: + for (i = 0; i < n; ++i) { + pack_uint_r8g8b8a8_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_UINT: + for (i = 0; i < n; ++i) { + pack_uint_b8g8r8a8_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B10G10R10A2_UINT: + for (i = 0; i < n; ++i) { + pack_uint_b10g10r10a2_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R10G10B10A2_UINT: + for (i = 0; i < n; ++i) { + pack_uint_r10g10b10a2_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A2B10G10R10_UINT: + for (i = 0; i < n; ++i) { + pack_uint_a2b10g10r10_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A2R10G10B10_UINT: + for (i = 0; i < n; ++i) { + pack_uint_a2r10g10b10_uint(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B5G6R5_UINT: + for (i = 0; i < n; ++i) { + pack_uint_b5g6r5_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R5G6B5_UINT: + for (i = 0; i < n; ++i) { + pack_uint_r5g6b5_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B2G3R3_UINT: + for (i = 0; i < n; ++i) { + pack_uint_b2g3r3_uint(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R3G3B2_UINT: + for (i = 0; i < n; ++i) { + pack_uint_r3g3b2_uint(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A4B4G4R4_UINT: + for (i = 0; i < n; ++i) { + pack_uint_a4b4g4r4_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R4G4B4A4_UINT: + for (i = 0; i < n; ++i) { + pack_uint_r4g4b4a4_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B4G4R4A4_UINT: + for (i = 0; i < n; ++i) { + pack_uint_b4g4r4a4_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A4R4G4B4_UINT: + for (i = 0; i < n; ++i) { + pack_uint_a4r4g4b4_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A1B5G5R5_UINT: + for (i = 0; i < n; ++i) { + pack_uint_a1b5g5r5_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B5G5R5A1_UINT: + for (i = 0; i < n; ++i) { + pack_uint_b5g5r5a1_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A1R5G5B5_UINT: + for (i = 0; i < n; ++i) { + pack_uint_a1r5g5b5_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R5G5B5A1_UINT: + for (i = 0; i < n; ++i) { + pack_uint_r5g5b5a1_uint(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_a_uint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_a_uint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_a_uint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_a_sint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_a_sint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_a_sint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_I_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_i_uint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_I_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_i_uint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_i_uint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_I_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_i_sint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_I_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_i_sint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_i_sint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_l_uint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_L_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_l_uint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_l_uint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_l_sint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_L_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_l_sint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_l_sint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_la_uint8(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_LA_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_la_uint16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_la_uint32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_LA_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_la_sint8(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_LA_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_la_sint16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_la_sint32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_R_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_r_uint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_r_uint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_r_uint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_r_sint8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_r_sint16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_r_sint32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_rg_uint8(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_RG_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_rg_uint16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_rg_uint32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RG_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_rg_sint8(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_RG_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_rg_sint16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_rg_sint32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGB_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_rgb_uint8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_RGB_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_rgb_uint16(src[i], d); + d += 6; + } + break; + + case MESA_FORMAT_RGB_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_rgb_uint32(src[i], d); + d += 12; + } + break; + + case MESA_FORMAT_RGB_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_rgb_sint8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_RGB_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_rgb_sint16(src[i], d); + d += 6; + } + break; + + case MESA_FORMAT_RGB_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_rgb_sint32(src[i], d); + d += 12; + } + break; + + case MESA_FORMAT_RGBA_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_rgba_uint8(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGBA_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_rgba_uint16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBA_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_rgba_uint32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_RGBA_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_rgba_sint8(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGBA_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_rgba_sint16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBA_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_rgba_sint32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_RGBX_UINT8: + for (i = 0; i < n; ++i) { + pack_uint_rgbx_uint8(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGBX_UINT16: + for (i = 0; i < n; ++i) { + pack_uint_rgbx_uint16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_UINT32: + for (i = 0; i < n; ++i) { + pack_uint_rgbx_uint32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_RGBX_SINT8: + for (i = 0; i < n; ++i) { + pack_uint_rgbx_sint8(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGBX_SINT16: + for (i = 0; i < n; ++i) { + pack_uint_rgbx_sint16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_SINT32: + for (i = 0; i < n; ++i) { + pack_uint_rgbx_sint32(src[i], d); + d += 16; + } + break; + default: + assert(!"Invalid format"); + } +} + +/** + * Pack a row of GLfloat rgba[4] values to the destination. + */ +void +_mesa_pack_float_rgba_row(mesa_format format, GLuint n, + const GLfloat src[][4], void *dst) +{ + GLuint i; + GLubyte *d = dst; + + switch (format) { + + case MESA_FORMAT_A8B8G8R8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a8b8g8r8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_x8b8g8r8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r8g8b8a8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r8g8b8x8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b8g8r8a8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8X8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b8g8r8x8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a8r8g8b8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8R8G8B8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_x8r8g8b8_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L16A16_UNORM: + for (i = 0; i < n; ++i) { + pack_float_l16a16_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A16L16_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a16l16_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B5G6R5_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b5g6r5_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R5G6B5_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r5g6b5_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B4G4R4A4_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b4g4r4a4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B4G4R4X4_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b4g4r4x4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A4R4G4B4_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a4r4g4b4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A1B5G5R5_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a1b5g5r5_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B5G5R5A1_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b5g5r5a1_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_B5G5R5X1_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b5g5r5x1_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A1R5G5B5_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a1r5g5b5_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L8A8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_l8a8_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A8L8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a8l8_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R8G8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r8g8_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_G8R8_UNORM: + for (i = 0; i < n; ++i) { + pack_float_g8r8_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L4A4_UNORM: + for (i = 0; i < n; ++i) { + pack_float_l4a4_unorm(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_B2G3R3_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b2g3r3_unorm(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R16G16_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r16g16_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_G16R16_UNORM: + for (i = 0; i < n; ++i) { + pack_float_g16r16_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B10G10R10A2_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b10g10r10a2_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B10G10R10X2_UNORM: + for (i = 0; i < n; ++i) { + pack_float_b10g10r10x2_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R10G10B10A2_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r10g10b10a2_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R10G10B10X2_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r10g10b10x2_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R3G3B2_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r3g3b2_unorm(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A4B4G4R4_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a4b4g4r4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R4G4B4A4_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r4g4b4a4_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R5G5B5A1_UNORM: + for (i = 0; i < n; ++i) { + pack_float_r5g5b5a1_unorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A2B10G10R10_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a2b10g10r10_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A2R10G10B10_UNORM: + for (i = 0; i < n; ++i) { + pack_float_a2r10g10b10_unorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A_UNORM8: + for (i = 0; i < n; ++i) { + pack_float_a_unorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A_UNORM16: + for (i = 0; i < n; ++i) { + pack_float_a_unorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_UNORM8: + for (i = 0; i < n; ++i) { + pack_float_l_unorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_L_UNORM16: + for (i = 0; i < n; ++i) { + pack_float_l_unorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_UNORM8: + for (i = 0; i < n; ++i) { + pack_float_i_unorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_I_UNORM16: + for (i = 0; i < n; ++i) { + pack_float_i_unorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_UNORM8: + for (i = 0; i < n; ++i) { + pack_float_r_unorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R_UNORM16: + for (i = 0; i < n; ++i) { + pack_float_r_unorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_BGR_UNORM8: + for (i = 0; i < n; ++i) { + pack_float_bgr_unorm8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_RGB_UNORM8: + for (i = 0; i < n; ++i) { + pack_float_rgb_unorm8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_RGBA_UNORM16: + for (i = 0; i < n; ++i) { + pack_float_rgba_unorm16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_UNORM16: + for (i = 0; i < n; ++i) { + pack_float_rgbx_unorm16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_A8B8G8R8_SNORM: + for (i = 0; i < n; ++i) { + pack_float_a8b8g8r8_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_SNORM: + for (i = 0; i < n; ++i) { + pack_float_x8b8g8r8_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_SNORM: + for (i = 0; i < n; ++i) { + pack_float_r8g8b8a8_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_SNORM: + for (i = 0; i < n; ++i) { + pack_float_r8g8b8x8_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R16G16_SNORM: + for (i = 0; i < n; ++i) { + pack_float_r16g16_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_G16R16_SNORM: + for (i = 0; i < n; ++i) { + pack_float_g16r16_snorm(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8_SNORM: + for (i = 0; i < n; ++i) { + pack_float_r8g8_snorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_G8R8_SNORM: + for (i = 0; i < n; ++i) { + pack_float_g8r8_snorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L8A8_SNORM: + for (i = 0; i < n; ++i) { + pack_float_l8a8_snorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A8L8_SNORM: + for (i = 0; i < n; ++i) { + pack_float_a8l8_snorm(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_SNORM8: + for (i = 0; i < n; ++i) { + pack_float_a_snorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_A_SNORM16: + for (i = 0; i < n; ++i) { + pack_float_a_snorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_SNORM8: + for (i = 0; i < n; ++i) { + pack_float_l_snorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_L_SNORM16: + for (i = 0; i < n; ++i) { + pack_float_l_snorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_SNORM8: + for (i = 0; i < n; ++i) { + pack_float_i_snorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_I_SNORM16: + for (i = 0; i < n; ++i) { + pack_float_i_snorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_SNORM8: + for (i = 0; i < n; ++i) { + pack_float_r_snorm8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_R_SNORM16: + for (i = 0; i < n; ++i) { + pack_float_r_snorm16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_LA_SNORM16: + for (i = 0; i < n; ++i) { + pack_float_la_snorm16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RGB_SNORM16: + for (i = 0; i < n; ++i) { + pack_float_rgb_snorm16(src[i], d); + d += 6; + } + break; + + case MESA_FORMAT_RGBA_SNORM16: + for (i = 0; i < n; ++i) { + pack_float_rgba_snorm16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_SNORM16: + for (i = 0; i < n; ++i) { + pack_float_rgbx_snorm16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_A8B8G8R8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_a8b8g8r8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_b8g8r8a8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_a8r8g8b8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_B8G8R8X8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_b8g8r8x8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8R8G8B8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_x8r8g8b8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_r8g8b8a8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_r8g8b8x8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_x8b8g8r8_srgb(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L8A8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_l8a8_srgb(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A8L8_SRGB: + for (i = 0; i < n; ++i) { + pack_float_a8l8_srgb(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_SRGB8: + for (i = 0; i < n; ++i) { + pack_float_l_srgb8(src[i], d); + d += 1; + } + break; + + case MESA_FORMAT_BGR_SRGB8: + for (i = 0; i < n; ++i) { + pack_float_bgr_srgb8(src[i], d); + d += 3; + } + break; + + case MESA_FORMAT_R9G9B9E5_FLOAT: + for (i = 0; i < n; ++i) { + pack_float_r9g9b9e5_float(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R11G11B10_FLOAT: + for (i = 0; i < n; ++i) { + pack_float_r11g11b10_float(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_A_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_a_float16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_A_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_a_float32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_L_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_l_float16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_L_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_l_float32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_la_float16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_LA_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_la_float32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_I_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_i_float16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_I_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_i_float32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_R_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_r_float16(src[i], d); + d += 2; + } + break; + + case MESA_FORMAT_R_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_r_float32(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_rg_float16(src[i], d); + d += 4; + } + break; + + case MESA_FORMAT_RG_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_rg_float32(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGB_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_rgb_float16(src[i], d); + d += 6; + } + break; + + case MESA_FORMAT_RGB_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_rgb_float32(src[i], d); + d += 12; + } + break; + + case MESA_FORMAT_RGBA_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_rgba_float16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBA_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_rgba_float32(src[i], d); + d += 16; + } + break; + + case MESA_FORMAT_RGBX_FLOAT16: + for (i = 0; i < n; ++i) { + pack_float_rgbx_float16(src[i], d); + d += 8; + } + break; + + case MESA_FORMAT_RGBX_FLOAT32: + for (i = 0; i < n; ++i) { + pack_float_rgbx_float32(src[i], d); + d += 16; + } + break; + default: + assert(!"Invalid format"); + } +} + +/** + * Pack a 2D image of ubyte RGBA pixels in the given format. + * \param srcRowStride source image row stride in bytes + * \param dstRowStride destination image row stride in bytes + */ +void +_mesa_pack_ubyte_rgba_rect(mesa_format format, GLuint width, GLuint height, + const GLubyte *src, GLint srcRowStride, + void *dst, GLint dstRowStride) +{ + GLubyte *dstUB = dst; + GLuint i; + + if (srcRowStride == width * 4 * sizeof(GLubyte) && + dstRowStride == _mesa_format_row_stride(format, width)) { + /* do whole image at once */ + _mesa_pack_ubyte_rgba_row(format, width * height, + (const GLubyte (*)[4]) src, dst); + } + else { + /* row by row */ + for (i = 0; i < height; i++) { + _mesa_pack_ubyte_rgba_row(format, width, + (const GLubyte (*)[4]) src, dstUB); + src += srcRowStride; + dstUB += dstRowStride; + } + } +} + + +/** Helper struct for MESA_FORMAT_Z32_FLOAT_S8X24_UINT */ +struct z32f_x24s8 +{ + float z; + uint32_t x24s8; +}; + + +/** + ** Pack float Z pixels + **/ + +static void +pack_float_S8_UINT_Z24_UNORM(const GLfloat *src, void *dst) +{ + /* don't disturb the stencil values */ + GLuint *d = ((GLuint *) dst); + const GLdouble scale = (GLdouble) 0xffffff; + GLuint s = *d & 0xff; + GLuint z = (GLuint) (*src * scale); + assert(z <= 0xffffff); + *d = (z << 8) | s; +} + +static void +pack_float_Z24_UNORM_S8_UINT(const GLfloat *src, void *dst) +{ + /* don't disturb the stencil values */ + GLuint *d = ((GLuint *) dst); + const GLdouble scale = (GLdouble) 0xffffff; + GLuint s = *d & 0xff000000; + GLuint z = (GLuint) (*src * scale); + assert(z <= 0xffffff); + *d = s | z; +} + +static void +pack_float_Z_UNORM16(const GLfloat *src, void *dst) +{ + GLushort *d = ((GLushort *) dst); + const GLfloat scale = (GLfloat) 0xffff; + *d = (GLushort) (*src * scale); +} + +static void +pack_float_Z_UNORM32(const GLfloat *src, void *dst) +{ + GLuint *d = ((GLuint *) dst); + const GLdouble scale = (GLdouble) 0xffffffff; + *d = (GLuint) (*src * scale); +} + +static void +pack_float_Z_FLOAT32(const GLfloat *src, void *dst) +{ + GLfloat *d = (GLfloat *) dst; + *d = *src; +} + +gl_pack_float_z_func +_mesa_get_pack_float_z_func(mesa_format format) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: + return pack_float_S8_UINT_Z24_UNORM; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + return pack_float_Z24_UNORM_S8_UINT; + case MESA_FORMAT_Z_UNORM16: + return pack_float_Z_UNORM16; + case MESA_FORMAT_Z_UNORM32: + return pack_float_Z_UNORM32; + case MESA_FORMAT_Z_FLOAT32: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + return pack_float_Z_FLOAT32; + default: + _mesa_problem(NULL, + "unexpected format in _mesa_get_pack_float_z_func()"); + return NULL; + } +} + + + +/** + ** Pack uint Z pixels. The incoming src value is always in + ** the range [0, 2^32-1]. + **/ + +static void +pack_uint_S8_UINT_Z24_UNORM(const GLuint *src, void *dst) +{ + /* don't disturb the stencil values */ + GLuint *d = ((GLuint *) dst); + GLuint s = *d & 0xff; + GLuint z = *src & 0xffffff00; + *d = z | s; +} + +static void +pack_uint_Z24_UNORM_S8_UINT(const GLuint *src, void *dst) +{ + /* don't disturb the stencil values */ + GLuint *d = ((GLuint *) dst); + GLuint s = *d & 0xff000000; + GLuint z = *src >> 8; + *d = s | z; +} + +static void +pack_uint_Z_UNORM16(const GLuint *src, void *dst) +{ + GLushort *d = ((GLushort *) dst); + *d = *src >> 16; +} + +static void +pack_uint_Z_UNORM32(const GLuint *src, void *dst) +{ + GLuint *d = ((GLuint *) dst); + *d = *src; +} + +static void +pack_uint_Z_FLOAT32(const GLuint *src, void *dst) +{ + GLuint *d = ((GLuint *) dst); + const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; + *d = (GLuint) (*src * scale); + assert(*d >= 0.0f); + assert(*d <= 1.0f); +} + +static void +pack_uint_Z_FLOAT32_X24S8(const GLuint *src, void *dst) +{ + GLfloat *d = ((GLfloat *) dst); + const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; + *d = (GLfloat) (*src * scale); + assert(*d >= 0.0f); + assert(*d <= 1.0f); +} + +gl_pack_uint_z_func +_mesa_get_pack_uint_z_func(mesa_format format) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: + return pack_uint_S8_UINT_Z24_UNORM; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + return pack_uint_Z24_UNORM_S8_UINT; + case MESA_FORMAT_Z_UNORM16: + return pack_uint_Z_UNORM16; + case MESA_FORMAT_Z_UNORM32: + return pack_uint_Z_UNORM32; + case MESA_FORMAT_Z_FLOAT32: + return pack_uint_Z_FLOAT32; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + return pack_uint_Z_FLOAT32_X24S8; + default: + _mesa_problem(NULL, "unexpected format in _mesa_get_pack_uint_z_func()"); + return NULL; + } +} + + +/** + ** Pack ubyte stencil pixels + **/ + +static void +pack_ubyte_stencil_Z24_S8(const GLubyte *src, void *dst) +{ + /* don't disturb the Z values */ + GLuint *d = ((GLuint *) dst); + GLuint s = *src; + GLuint z = *d & 0xffffff00; + *d = z | s; +} + +static void +pack_ubyte_stencil_S8_Z24(const GLubyte *src, void *dst) +{ + /* don't disturb the Z values */ + GLuint *d = ((GLuint *) dst); + GLuint s = *src << 24; + GLuint z = *d & 0xffffff; + *d = s | z; +} + +static void +pack_ubyte_stencil_S8(const GLubyte *src, void *dst) +{ + GLubyte *d = (GLubyte *) dst; + *d = *src; +} + +static void +pack_ubyte_stencil_Z32_FLOAT_X24S8(const GLubyte *src, void *dst) +{ + GLfloat *d = ((GLfloat *) dst); + d[1] = *src; +} + + +gl_pack_ubyte_stencil_func +_mesa_get_pack_ubyte_stencil_func(mesa_format format) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + return pack_ubyte_stencil_Z24_S8; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + return pack_ubyte_stencil_S8_Z24; + case MESA_FORMAT_S_UINT8: + return pack_ubyte_stencil_S8; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + return pack_ubyte_stencil_Z32_FLOAT_X24S8; + default: + _mesa_problem(NULL, + "unexpected format in _mesa_pack_ubyte_stencil_func()"); + return NULL; + } +} + + + +void +_mesa_pack_float_z_row(mesa_format format, GLuint n, + const GLfloat *src, void *dst) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: + { + /* don't disturb the stencil values */ + GLuint *d = ((GLuint *) dst); + const GLdouble scale = (GLdouble) 0xffffff; + GLuint i; + for (i = 0; i < n; i++) { + GLuint s = d[i] & 0xff; + GLuint z = (GLuint) (src[i] * scale); + assert(z <= 0xffffff); + d[i] = (z << 8) | s; + } + } + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + { + /* don't disturb the stencil values */ + GLuint *d = ((GLuint *) dst); + const GLdouble scale = (GLdouble) 0xffffff; + GLuint i; + for (i = 0; i < n; i++) { + GLuint s = d[i] & 0xff000000; + GLuint z = (GLuint) (src[i] * scale); + assert(z <= 0xffffff); + d[i] = s | z; + } + } + break; + case MESA_FORMAT_Z_UNORM16: + { + GLushort *d = ((GLushort *) dst); + const GLfloat scale = (GLfloat) 0xffff; + GLuint i; + for (i = 0; i < n; i++) { + d[i] = (GLushort) (src[i] * scale); + } + } + break; + case MESA_FORMAT_Z_UNORM32: + { + GLuint *d = ((GLuint *) dst); + const GLdouble scale = (GLdouble) 0xffffffff; + GLuint i; + for (i = 0; i < n; i++) { + d[i] = (GLuint) (src[i] * scale); + } + } + break; + case MESA_FORMAT_Z_FLOAT32: + memcpy(dst, src, n * sizeof(GLfloat)); + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + { + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + GLuint i; + for (i = 0; i < n; i++) { + d[i].z = src[i]; + } + } + break; + default: + _mesa_problem(NULL, "unexpected format in _mesa_pack_float_z_row()"); + } +} + + +/** + * The incoming Z values are always in the range [0, 0xffffffff]. + */ +void +_mesa_pack_uint_z_row(mesa_format format, GLuint n, + const GLuint *src, void *dst) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: + { + /* don't disturb the stencil values */ + GLuint *d = ((GLuint *) dst); + GLuint i; + for (i = 0; i < n; i++) { + GLuint s = d[i] & 0xff; + GLuint z = src[i] & 0xffffff00; + d[i] = z | s; + } + } + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + { + /* don't disturb the stencil values */ + GLuint *d = ((GLuint *) dst); + GLuint i; + for (i = 0; i < n; i++) { + GLuint s = d[i] & 0xff000000; + GLuint z = src[i] >> 8; + d[i] = s | z; + } + } + break; + case MESA_FORMAT_Z_UNORM16: + { + GLushort *d = ((GLushort *) dst); + GLuint i; + for (i = 0; i < n; i++) { + d[i] = src[i] >> 16; + } + } + break; + case MESA_FORMAT_Z_UNORM32: + memcpy(dst, src, n * sizeof(GLfloat)); + break; + case MESA_FORMAT_Z_FLOAT32: + { + GLuint *d = ((GLuint *) dst); + const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; + GLuint i; + for (i = 0; i < n; i++) { + d[i] = (GLuint) (src[i] * scale); + assert(d[i] >= 0.0f); + assert(d[i] <= 1.0f); + } + } + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + { + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; + GLuint i; + for (i = 0; i < n; i++) { + d[i].z = (GLfloat) (src[i] * scale); + assert(d[i].z >= 0.0f); + assert(d[i].z <= 1.0f); + } + } + break; + default: + _mesa_problem(NULL, "unexpected format in _mesa_pack_uint_z_row()"); + } +} + + +void +_mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, + const GLubyte *src, void *dst) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + { + /* don't disturb the Z values */ + GLuint *d = ((GLuint *) dst); + GLuint i; + for (i = 0; i < n; i++) { + GLuint s = src[i]; + GLuint z = d[i] & 0xffffff00; + d[i] = z | s; + } + } + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + { + /* don't disturb the Z values */ + GLuint *d = ((GLuint *) dst); + GLuint i; + for (i = 0; i < n; i++) { + GLuint s = src[i] << 24; + GLuint z = d[i] & 0xffffff; + d[i] = s | z; + } + } + break; + case MESA_FORMAT_S_UINT8: + memcpy(dst, src, n * sizeof(GLubyte)); + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + { + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + GLuint i; + for (i = 0; i < n; i++) { + d[i].x24s8 = src[i]; + } + } + break; + default: + _mesa_problem(NULL, "unexpected format in _mesa_pack_ubyte_stencil_row()"); + } +} + + +/** + * Incoming Z/stencil values are always in uint_24_8 format. + */ +void +_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, + const GLuint *src, void *dst) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + memcpy(dst, src, n * sizeof(GLuint)); + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + { + GLuint *d = ((GLuint *) dst); + GLuint i; + for (i = 0; i < n; i++) { + GLuint s = src[i] << 24; + GLuint z = src[i] >> 8; + d[i] = s | z; + } + } + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + { + const GLdouble scale = 1.0 / (GLdouble) 0xffffff; + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + GLuint i; + for (i = 0; i < n; i++) { + GLfloat z = (GLfloat) ((src[i] >> 8) * scale); + d[i].z = z; + d[i].x24s8 = src[i]; + } + } + break; + default: + _mesa_problem(NULL, "bad format %s in _mesa_pack_ubyte_s_row", + _mesa_get_format_name(format)); + return; + } +} + + + +/** + * Convert a boolean color mask to a packed color where each channel of + * the packed value at dst will be 0 or ~0 depending on the colorMask. + */ +void +_mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst) +{ + GLfloat maskColor[4]; + + switch (_mesa_get_format_datatype(format)) { + case GL_UNSIGNED_NORMALIZED: + /* simple: 1.0 will convert to ~0 in the right bit positions */ + maskColor[0] = colorMask[0] ? 1.0f : 0.0f; + maskColor[1] = colorMask[1] ? 1.0f : 0.0f; + maskColor[2] = colorMask[2] ? 1.0f : 0.0f; + maskColor[3] = colorMask[3] ? 1.0f : 0.0f; + _mesa_pack_float_rgba_row(format, 1, + (const GLfloat (*)[4]) maskColor, dst); + break; + case GL_SIGNED_NORMALIZED: + case GL_FLOAT: + /* These formats are harder because it's hard to know the floating + * point values that will convert to ~0 for each color channel's bits. + * This solution just generates a non-zero value for each color channel + * then fixes up the non-zero values to be ~0. + * Note: we'll need to add special case code if we ever have to deal + * with formats with unequal color channel sizes, like R11_G11_B10. + * We issue a warning below for channel sizes other than 8,16,32. + */ + { + GLuint bits = _mesa_get_format_max_bits(format); /* bits per chan */ + GLuint bytes = _mesa_get_format_bytes(format); + GLuint i; + + /* this should put non-zero values into the channels of dst */ + maskColor[0] = colorMask[0] ? -1.0f : 0.0f; + maskColor[1] = colorMask[1] ? -1.0f : 0.0f; + maskColor[2] = colorMask[2] ? -1.0f : 0.0f; + maskColor[3] = colorMask[3] ? -1.0f : 0.0f; + _mesa_pack_float_rgba_row(format, 1, + (const GLfloat (*)[4]) maskColor, dst); + + /* fix-up the dst channels by converting non-zero values to ~0 */ + if (bits == 8) { + GLubyte *d = (GLubyte *) dst; + for (i = 0; i < bytes; i++) { + d[i] = d[i] ? 0xff : 0x0; + } + } + else if (bits == 16) { + GLushort *d = (GLushort *) dst; + for (i = 0; i < bytes / 2; i++) { + d[i] = d[i] ? 0xffff : 0x0; + } + } + else if (bits == 32) { + GLuint *d = (GLuint *) dst; + for (i = 0; i < bytes / 4; i++) { + d[i] = d[i] ? 0xffffffffU : 0x0; + } + } + else { + _mesa_problem(NULL, "unexpected size in _mesa_pack_colormask()"); + return; + } + } + break; + default: + _mesa_problem(NULL, "unexpected format data type in gen_color_mask()"); + return; + } +} + diff --git a/prebuilt-intermediates/main/format_unpack.c b/prebuilt-intermediates/main/format_unpack.c new file mode 100644 index 00000000000..760cbc267c5 --- /dev/null +++ b/prebuilt-intermediates/main/format_unpack.c @@ -0,0 +1,7549 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (c) 2011 VMware, Inc. + * Copyright (c) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Color, depth, stencil packing functions. + * Used to pack basic color, depth and stencil formats to specific + * hardware formats. + * + * There are both per-pixel and per-row packing functions: + * - The former will be used by swrast to write values to the color, depth, + * stencil buffers when drawing points, lines and masked spans. + * - The later will be used for image-oriented functions like glDrawPixels, + * glAccum, and glTexImage. + */ + +#include <stdint.h> + +#include "format_unpack.h" +#include "format_utils.h" +#include "macros.h" +#include "util/format_rgb9e5.h" +#include "util/format_r11g11b10f.h" +#include "util/format_srgb.h" + +#define UNPACK(SRC, OFFSET, BITS) (((SRC) >> (OFFSET)) & MAX_UINT(BITS)) + + + +/* float unpacking functions */ + + +static inline void +unpack_float_a8b8g8r8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_x8b8g8r8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r8g8b8a8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_r8g8b8x8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_b8g8r8a8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_b8g8r8x8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_a8r8g8b8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_x8r8g8b8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_l16a16_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t l = UNPACK(*src, 0, 16); + uint16_t a = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_unorm_to_float(l, 16); + + + dst[1] = _mesa_unorm_to_float(l, 16); + + + dst[2] = _mesa_unorm_to_float(l, 16); + + + dst[3] = _mesa_unorm_to_float(a, 16); +} + +static inline void +unpack_float_a16l16_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t a = UNPACK(*src, 0, 16); + uint16_t l = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_unorm_to_float(l, 16); + + + dst[1] = _mesa_unorm_to_float(l, 16); + + + dst[2] = _mesa_unorm_to_float(l, 16); + + + dst[3] = _mesa_unorm_to_float(a, 16); +} + +static inline void +unpack_float_b5g6r5_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 6); + uint8_t r = UNPACK(*src, 11, 5); + + + + dst[0] = _mesa_unorm_to_float(r, 5); + + + dst[1] = _mesa_unorm_to_float(g, 6); + + + dst[2] = _mesa_unorm_to_float(b, 5); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r5g6b5_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 6); + uint8_t b = UNPACK(*src, 11, 5); + + + + dst[0] = _mesa_unorm_to_float(r, 5); + + + dst[1] = _mesa_unorm_to_float(g, 6); + + + dst[2] = _mesa_unorm_to_float(b, 5); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_b4g4r4a4_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 4); + uint8_t g = UNPACK(*src, 4, 4); + uint8_t r = UNPACK(*src, 8, 4); + uint8_t a = UNPACK(*src, 12, 4); + + + + dst[0] = _mesa_unorm_to_float(r, 4); + + + dst[1] = _mesa_unorm_to_float(g, 4); + + + dst[2] = _mesa_unorm_to_float(b, 4); + + + dst[3] = _mesa_unorm_to_float(a, 4); +} + +static inline void +unpack_float_b4g4r4x4_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 4); + uint8_t g = UNPACK(*src, 4, 4); + uint8_t r = UNPACK(*src, 8, 4); + + + + dst[0] = _mesa_unorm_to_float(r, 4); + + + dst[1] = _mesa_unorm_to_float(g, 4); + + + dst[2] = _mesa_unorm_to_float(b, 4); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_a4r4g4b4_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 4); + uint8_t r = UNPACK(*src, 4, 4); + uint8_t g = UNPACK(*src, 8, 4); + uint8_t b = UNPACK(*src, 12, 4); + + + + dst[0] = _mesa_unorm_to_float(r, 4); + + + dst[1] = _mesa_unorm_to_float(g, 4); + + + dst[2] = _mesa_unorm_to_float(b, 4); + + + dst[3] = _mesa_unorm_to_float(a, 4); +} + +static inline void +unpack_float_a1b5g5r5_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 1); + uint8_t b = UNPACK(*src, 1, 5); + uint8_t g = UNPACK(*src, 6, 5); + uint8_t r = UNPACK(*src, 11, 5); + + + + dst[0] = _mesa_unorm_to_float(r, 5); + + + dst[1] = _mesa_unorm_to_float(g, 5); + + + dst[2] = _mesa_unorm_to_float(b, 5); + + + dst[3] = _mesa_unorm_to_float(a, 1); +} + +static inline void +unpack_float_b5g5r5a1_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 5); + uint8_t r = UNPACK(*src, 10, 5); + uint8_t a = UNPACK(*src, 15, 1); + + + + dst[0] = _mesa_unorm_to_float(r, 5); + + + dst[1] = _mesa_unorm_to_float(g, 5); + + + dst[2] = _mesa_unorm_to_float(b, 5); + + + dst[3] = _mesa_unorm_to_float(a, 1); +} + +static inline void +unpack_float_b5g5r5x1_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 5); + uint8_t r = UNPACK(*src, 10, 5); + + + + dst[0] = _mesa_unorm_to_float(r, 5); + + + dst[1] = _mesa_unorm_to_float(g, 5); + + + dst[2] = _mesa_unorm_to_float(b, 5); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_a1r5g5b5_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 1); + uint8_t r = UNPACK(*src, 1, 5); + uint8_t g = UNPACK(*src, 6, 5); + uint8_t b = UNPACK(*src, 11, 5); + + + + dst[0] = _mesa_unorm_to_float(r, 5); + + + dst[1] = _mesa_unorm_to_float(g, 5); + + + dst[2] = _mesa_unorm_to_float(b, 5); + + + dst[3] = _mesa_unorm_to_float(a, 1); +} + +static inline void +unpack_float_l8a8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t l = UNPACK(*src, 0, 8); + uint8_t a = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_float(l, 8); + + + dst[1] = _mesa_unorm_to_float(l, 8); + + + dst[2] = _mesa_unorm_to_float(l, 8); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_a8l8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t l = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_float(l, 8); + + + dst[1] = _mesa_unorm_to_float(l, 8); + + + dst[2] = _mesa_unorm_to_float(l, 8); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_r8g8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_g8r8_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t g = UNPACK(*src, 0, 8); + uint8_t r = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_l4a4_unorm(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t l = UNPACK(*src, 0, 4); + uint8_t a = UNPACK(*src, 4, 4); + + + + dst[0] = _mesa_unorm_to_float(l, 4); + + + dst[1] = _mesa_unorm_to_float(l, 4); + + + dst[2] = _mesa_unorm_to_float(l, 4); + + + dst[3] = _mesa_unorm_to_float(a, 4); +} + +static inline void +unpack_float_b2g3r3_unorm(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t b = UNPACK(*src, 0, 2); + uint8_t g = UNPACK(*src, 2, 3); + uint8_t r = UNPACK(*src, 5, 3); + + + + dst[0] = _mesa_unorm_to_float(r, 3); + + + dst[1] = _mesa_unorm_to_float(g, 3); + + + dst[2] = _mesa_unorm_to_float(b, 2); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r16g16_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t r = UNPACK(*src, 0, 16); + uint16_t g = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_unorm_to_float(r, 16); + + + dst[1] = _mesa_unorm_to_float(g, 16); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_g16r16_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t g = UNPACK(*src, 0, 16); + uint16_t r = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_unorm_to_float(r, 16); + + + dst[1] = _mesa_unorm_to_float(g, 16); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_b10g10r10a2_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t b = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t r = UNPACK(*src, 20, 10); + uint8_t a = UNPACK(*src, 30, 2); + + + + dst[0] = _mesa_unorm_to_float(r, 10); + + + dst[1] = _mesa_unorm_to_float(g, 10); + + + dst[2] = _mesa_unorm_to_float(b, 10); + + + dst[3] = _mesa_unorm_to_float(a, 2); +} + +static inline void +unpack_float_b10g10r10x2_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t b = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t r = UNPACK(*src, 20, 10); + + + + dst[0] = _mesa_unorm_to_float(r, 10); + + + dst[1] = _mesa_unorm_to_float(g, 10); + + + dst[2] = _mesa_unorm_to_float(b, 10); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r10g10b10a2_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t r = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t b = UNPACK(*src, 20, 10); + uint8_t a = UNPACK(*src, 30, 2); + + + + dst[0] = _mesa_unorm_to_float(r, 10); + + + dst[1] = _mesa_unorm_to_float(g, 10); + + + dst[2] = _mesa_unorm_to_float(b, 10); + + + dst[3] = _mesa_unorm_to_float(a, 2); +} + +static inline void +unpack_float_r10g10b10x2_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t r = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t b = UNPACK(*src, 20, 10); + + + + dst[0] = _mesa_unorm_to_float(r, 10); + + + dst[1] = _mesa_unorm_to_float(g, 10); + + + dst[2] = _mesa_unorm_to_float(b, 10); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r3g3b2_unorm(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = UNPACK(*src, 0, 3); + uint8_t g = UNPACK(*src, 3, 3); + uint8_t b = UNPACK(*src, 6, 2); + + + + dst[0] = _mesa_unorm_to_float(r, 3); + + + dst[1] = _mesa_unorm_to_float(g, 3); + + + dst[2] = _mesa_unorm_to_float(b, 2); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_a4b4g4r4_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 4); + uint8_t b = UNPACK(*src, 4, 4); + uint8_t g = UNPACK(*src, 8, 4); + uint8_t r = UNPACK(*src, 12, 4); + + + + dst[0] = _mesa_unorm_to_float(r, 4); + + + dst[1] = _mesa_unorm_to_float(g, 4); + + + dst[2] = _mesa_unorm_to_float(b, 4); + + + dst[3] = _mesa_unorm_to_float(a, 4); +} + +static inline void +unpack_float_r4g4b4a4_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 4); + uint8_t g = UNPACK(*src, 4, 4); + uint8_t b = UNPACK(*src, 8, 4); + uint8_t a = UNPACK(*src, 12, 4); + + + + dst[0] = _mesa_unorm_to_float(r, 4); + + + dst[1] = _mesa_unorm_to_float(g, 4); + + + dst[2] = _mesa_unorm_to_float(b, 4); + + + dst[3] = _mesa_unorm_to_float(a, 4); +} + +static inline void +unpack_float_r5g5b5a1_unorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 5); + uint8_t b = UNPACK(*src, 10, 5); + uint8_t a = UNPACK(*src, 15, 1); + + + + dst[0] = _mesa_unorm_to_float(r, 5); + + + dst[1] = _mesa_unorm_to_float(g, 5); + + + dst[2] = _mesa_unorm_to_float(b, 5); + + + dst[3] = _mesa_unorm_to_float(a, 1); +} + +static inline void +unpack_float_a2b10g10r10_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 2); + uint16_t b = UNPACK(*src, 2, 10); + uint16_t g = UNPACK(*src, 12, 10); + uint16_t r = UNPACK(*src, 22, 10); + + + + dst[0] = _mesa_unorm_to_float(r, 10); + + + dst[1] = _mesa_unorm_to_float(g, 10); + + + dst[2] = _mesa_unorm_to_float(b, 10); + + + dst[3] = _mesa_unorm_to_float(a, 2); +} + +static inline void +unpack_float_a2r10g10b10_unorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 2); + uint16_t r = UNPACK(*src, 2, 10); + uint16_t g = UNPACK(*src, 12, 10); + uint16_t b = UNPACK(*src, 22, 10); + + + + dst[0] = _mesa_unorm_to_float(r, 10); + + + dst[1] = _mesa_unorm_to_float(g, 10); + + + dst[2] = _mesa_unorm_to_float(b, 10); + + + dst[3] = _mesa_unorm_to_float(a, 2); +} + +static inline void +unpack_float_a_unorm8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t a = src[0]; + + + dst[0] = 0.0f; + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_a_unorm16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t a = src[0]; + + + dst[0] = 0.0f; + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + + dst[3] = _mesa_unorm_to_float(a, 16); +} + +static inline void +unpack_float_l_unorm8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t l = src[0]; + + + + dst[0] = _mesa_unorm_to_float(l, 8); + + + dst[1] = _mesa_unorm_to_float(l, 8); + + + dst[2] = _mesa_unorm_to_float(l, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_l_unorm16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t l = src[0]; + + + + dst[0] = _mesa_unorm_to_float(l, 16); + + + dst[1] = _mesa_unorm_to_float(l, 16); + + + dst[2] = _mesa_unorm_to_float(l, 16); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_i_unorm8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t i = src[0]; + + + + dst[0] = _mesa_unorm_to_float(i, 8); + + + dst[1] = _mesa_unorm_to_float(i, 8); + + + dst[2] = _mesa_unorm_to_float(i, 8); + + + dst[3] = _mesa_unorm_to_float(i, 8); +} + +static inline void +unpack_float_i_unorm16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t i = src[0]; + + + + dst[0] = _mesa_unorm_to_float(i, 16); + + + dst[1] = _mesa_unorm_to_float(i, 16); + + + dst[2] = _mesa_unorm_to_float(i, 16); + + + dst[3] = _mesa_unorm_to_float(i, 16); +} + +static inline void +unpack_float_r_unorm8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r_unorm16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + + + + dst[0] = _mesa_unorm_to_float(r, 16); + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_bgr_unorm8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t b = src[0]; + uint8_t g = src[1]; + uint8_t r = src[2]; + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rgb_unorm8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + uint8_t g = src[1]; + uint8_t b = src[2]; + + + + dst[0] = _mesa_unorm_to_float(r, 8); + + + dst[1] = _mesa_unorm_to_float(g, 8); + + + dst[2] = _mesa_unorm_to_float(b, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rgba_unorm16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + uint16_t a = src[3]; + + + + dst[0] = _mesa_unorm_to_float(r, 16); + + + dst[1] = _mesa_unorm_to_float(g, 16); + + + dst[2] = _mesa_unorm_to_float(b, 16); + + + dst[3] = _mesa_unorm_to_float(a, 16); +} + +static inline void +unpack_float_rgbx_unorm16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + + + + dst[0] = _mesa_unorm_to_float(r, 16); + + + dst[1] = _mesa_unorm_to_float(g, 16); + + + dst[2] = _mesa_unorm_to_float(b, 16); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_a8b8g8r8_snorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int8_t a = UNPACK(*src, 0, 8); + int8_t b = UNPACK(*src, 8, 8); + int8_t g = UNPACK(*src, 16, 8); + int8_t r = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_snorm_to_float(r, 8); + + + dst[1] = _mesa_snorm_to_float(g, 8); + + + dst[2] = _mesa_snorm_to_float(b, 8); + + + dst[3] = _mesa_snorm_to_float(a, 8); +} + +static inline void +unpack_float_x8b8g8r8_snorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int8_t b = UNPACK(*src, 8, 8); + int8_t g = UNPACK(*src, 16, 8); + int8_t r = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_snorm_to_float(r, 8); + + + dst[1] = _mesa_snorm_to_float(g, 8); + + + dst[2] = _mesa_snorm_to_float(b, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r8g8b8a8_snorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int8_t r = UNPACK(*src, 0, 8); + int8_t g = UNPACK(*src, 8, 8); + int8_t b = UNPACK(*src, 16, 8); + int8_t a = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_snorm_to_float(r, 8); + + + dst[1] = _mesa_snorm_to_float(g, 8); + + + dst[2] = _mesa_snorm_to_float(b, 8); + + + dst[3] = _mesa_snorm_to_float(a, 8); +} + +static inline void +unpack_float_r8g8b8x8_snorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int8_t r = UNPACK(*src, 0, 8); + int8_t g = UNPACK(*src, 8, 8); + int8_t b = UNPACK(*src, 16, 8); + + + + dst[0] = _mesa_snorm_to_float(r, 8); + + + dst[1] = _mesa_snorm_to_float(g, 8); + + + dst[2] = _mesa_snorm_to_float(b, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r16g16_snorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int16_t r = UNPACK(*src, 0, 16); + int16_t g = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_snorm_to_float(r, 16); + + + dst[1] = _mesa_snorm_to_float(g, 16); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_g16r16_snorm(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int16_t g = UNPACK(*src, 0, 16); + int16_t r = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_snorm_to_float(r, 16); + + + dst[1] = _mesa_snorm_to_float(g, 16); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r8g8_snorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + int8_t r = UNPACK(*src, 0, 8); + int8_t g = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_snorm_to_float(r, 8); + + + dst[1] = _mesa_snorm_to_float(g, 8); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_g8r8_snorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + int8_t g = UNPACK(*src, 0, 8); + int8_t r = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_snorm_to_float(r, 8); + + + dst[1] = _mesa_snorm_to_float(g, 8); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_l8a8_snorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + int8_t l = UNPACK(*src, 0, 8); + int8_t a = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_snorm_to_float(l, 8); + + + dst[1] = _mesa_snorm_to_float(l, 8); + + + dst[2] = _mesa_snorm_to_float(l, 8); + + + dst[3] = _mesa_snorm_to_float(a, 8); +} + +static inline void +unpack_float_a8l8_snorm(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + int8_t a = UNPACK(*src, 0, 8); + int8_t l = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_snorm_to_float(l, 8); + + + dst[1] = _mesa_snorm_to_float(l, 8); + + + dst[2] = _mesa_snorm_to_float(l, 8); + + + dst[3] = _mesa_snorm_to_float(a, 8); +} + +static inline void +unpack_float_a_snorm8(const void *void_src, GLfloat dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t a = src[0]; + + + dst[0] = 0.0f; + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + + dst[3] = _mesa_snorm_to_float(a, 8); +} + +static inline void +unpack_float_a_snorm16(const void *void_src, GLfloat dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t a = src[0]; + + + dst[0] = 0.0f; + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + + dst[3] = _mesa_snorm_to_float(a, 16); +} + +static inline void +unpack_float_l_snorm8(const void *void_src, GLfloat dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t l = src[0]; + + + + dst[0] = _mesa_snorm_to_float(l, 8); + + + dst[1] = _mesa_snorm_to_float(l, 8); + + + dst[2] = _mesa_snorm_to_float(l, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_l_snorm16(const void *void_src, GLfloat dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t l = src[0]; + + + + dst[0] = _mesa_snorm_to_float(l, 16); + + + dst[1] = _mesa_snorm_to_float(l, 16); + + + dst[2] = _mesa_snorm_to_float(l, 16); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_i_snorm8(const void *void_src, GLfloat dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t i = src[0]; + + + + dst[0] = _mesa_snorm_to_float(i, 8); + + + dst[1] = _mesa_snorm_to_float(i, 8); + + + dst[2] = _mesa_snorm_to_float(i, 8); + + + dst[3] = _mesa_snorm_to_float(i, 8); +} + +static inline void +unpack_float_i_snorm16(const void *void_src, GLfloat dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t i = src[0]; + + + + dst[0] = _mesa_snorm_to_float(i, 16); + + + dst[1] = _mesa_snorm_to_float(i, 16); + + + dst[2] = _mesa_snorm_to_float(i, 16); + + + dst[3] = _mesa_snorm_to_float(i, 16); +} + +static inline void +unpack_float_r_snorm8(const void *void_src, GLfloat dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t r = src[0]; + + + + dst[0] = _mesa_snorm_to_float(r, 8); + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r_snorm16(const void *void_src, GLfloat dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + + + + dst[0] = _mesa_snorm_to_float(r, 16); + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_la_snorm16(const void *void_src, GLfloat dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t l = src[0]; + int16_t a = src[1]; + + + + dst[0] = _mesa_snorm_to_float(l, 16); + + + dst[1] = _mesa_snorm_to_float(l, 16); + + + dst[2] = _mesa_snorm_to_float(l, 16); + + + dst[3] = _mesa_snorm_to_float(a, 16); +} + +static inline void +unpack_float_rgb_snorm16(const void *void_src, GLfloat dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + + + + dst[0] = _mesa_snorm_to_float(r, 16); + + + dst[1] = _mesa_snorm_to_float(g, 16); + + + dst[2] = _mesa_snorm_to_float(b, 16); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rgba_snorm16(const void *void_src, GLfloat dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + int16_t a = src[3]; + + + + dst[0] = _mesa_snorm_to_float(r, 16); + + + dst[1] = _mesa_snorm_to_float(g, 16); + + + dst[2] = _mesa_snorm_to_float(b, 16); + + + dst[3] = _mesa_snorm_to_float(a, 16); +} + +static inline void +unpack_float_rgbx_snorm16(const void *void_src, GLfloat dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + + + + dst[0] = _mesa_snorm_to_float(r, 16); + + + dst[1] = _mesa_snorm_to_float(g, 16); + + + dst[2] = _mesa_snorm_to_float(b, 16); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_a8b8g8r8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_b8g8r8a8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_a8r8g8b8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_b8g8r8x8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_x8r8g8b8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r8g8b8a8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_r8g8b8x8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_x8b8g8r8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_l8a8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t l = UNPACK(*src, 0, 8); + uint8_t a = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_float(l, 8); + + + dst[1] = _mesa_unorm_to_float(l, 8); + + + dst[2] = _mesa_unorm_to_float(l, 8); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_a8l8_srgb(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t l = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_float(l, 8); + + + dst[1] = _mesa_unorm_to_float(l, 8); + + + dst[2] = _mesa_unorm_to_float(l, 8); + + + dst[3] = _mesa_unorm_to_float(a, 8); +} + +static inline void +unpack_float_l_srgb8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t l = src[0]; + + + + dst[0] = _mesa_unorm_to_float(l, 8); + + + dst[1] = _mesa_unorm_to_float(l, 8); + + + dst[2] = _mesa_unorm_to_float(l, 8); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_bgr_srgb8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t b = src[0]; + uint8_t g = src[1]; + uint8_t r = src[2]; + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + + + dst[1] = util_format_srgb_8unorm_to_linear_float(g); + + + + dst[2] = util_format_srgb_8unorm_to_linear_float(b); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_a_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t a = src[0]; + + + dst[0] = 0.0f; + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + + dst[3] = _mesa_half_to_float(a); +} + +static inline void +unpack_float_a_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float a = src[0]; + + + dst[0] = 0.0f; + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + + dst[3] = a; +} + +static inline void +unpack_float_l_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t l = src[0]; + + + + dst[0] = _mesa_half_to_float(l); + + + dst[1] = _mesa_half_to_float(l); + + + dst[2] = _mesa_half_to_float(l); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_l_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float l = src[0]; + + + + dst[0] = l; + + + dst[1] = l; + + + dst[2] = l; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_la_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t l = src[0]; + uint16_t a = src[1]; + + + + dst[0] = _mesa_half_to_float(l); + + + dst[1] = _mesa_half_to_float(l); + + + dst[2] = _mesa_half_to_float(l); + + + dst[3] = _mesa_half_to_float(a); +} + +static inline void +unpack_float_la_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float l = src[0]; + float a = src[1]; + + + + dst[0] = l; + + + dst[1] = l; + + + dst[2] = l; + + + dst[3] = a; +} + +static inline void +unpack_float_i_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t i = src[0]; + + + + dst[0] = _mesa_half_to_float(i); + + + dst[1] = _mesa_half_to_float(i); + + + dst[2] = _mesa_half_to_float(i); + + + dst[3] = _mesa_half_to_float(i); +} + +static inline void +unpack_float_i_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float i = src[0]; + + + + dst[0] = i; + + + dst[1] = i; + + + dst[2] = i; + + + dst[3] = i; +} + +static inline void +unpack_float_r_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + + + + dst[0] = _mesa_half_to_float(r); + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_r_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float r = src[0]; + + + + dst[0] = r; + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rg_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + + + + dst[0] = _mesa_half_to_float(r); + + + dst[1] = _mesa_half_to_float(g); + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rg_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float r = src[0]; + float g = src[1]; + + + + dst[0] = r; + + + dst[1] = g; + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rgb_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + + + + dst[0] = _mesa_half_to_float(r); + + + dst[1] = _mesa_half_to_float(g); + + + dst[2] = _mesa_half_to_float(b); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rgb_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float r = src[0]; + float g = src[1]; + float b = src[2]; + + + + dst[0] = r; + + + dst[1] = g; + + + dst[2] = b; + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rgba_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + uint16_t a = src[3]; + + + + dst[0] = _mesa_half_to_float(r); + + + dst[1] = _mesa_half_to_float(g); + + + dst[2] = _mesa_half_to_float(b); + + + dst[3] = _mesa_half_to_float(a); +} + +static inline void +unpack_float_rgba_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float r = src[0]; + float g = src[1]; + float b = src[2]; + float a = src[3]; + + + + dst[0] = r; + + + dst[1] = g; + + + dst[2] = b; + + + dst[3] = a; +} + +static inline void +unpack_float_rgbx_float16(const void *void_src, GLfloat dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + + + + dst[0] = _mesa_half_to_float(r); + + + dst[1] = _mesa_half_to_float(g); + + + dst[2] = _mesa_half_to_float(b); + + dst[3] = 1.0f; +} + +static inline void +unpack_float_rgbx_float32(const void *void_src, GLfloat dst[4]) +{ + float *src = (float *)void_src; + float r = src[0]; + float g = src[1]; + float b = src[2]; + + + + dst[0] = r; + + + dst[1] = g; + + + dst[2] = b; + + dst[3] = 1.0f; +} + +static void +unpack_float_r9g9b9e5_float(const void *src, GLfloat dst[4]) +{ + rgb9e5_to_float3(*(const GLuint *)src, dst); + dst[3] = 1.0f; +} + +static void +unpack_float_r11g11b10_float(const void *src, GLfloat dst[4]) +{ + r11g11b10f_to_float3(*(const GLuint *)src, dst); + dst[3] = 1.0f; +} + +static void +unpack_float_ycbcr(const void *src, GLfloat dst[][4], GLuint n) +{ + GLuint i; + for (i = 0; i < n; i++) { + const GLushort *src0 = ((const GLushort *) src) + i * 2; /* even */ + const GLushort *src1 = src0 + 1; /* odd */ + const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ + const GLubyte cb = *src0 & 0xff; /* chroma U */ + const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ + const GLubyte cr = *src1 & 0xff; /* chroma V */ + const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); + GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); + GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); + r *= (1.0F / 255.0F); + g *= (1.0F / 255.0F); + b *= (1.0F / 255.0F); + dst[i][0] = CLAMP(r, 0.0F, 1.0F); + dst[i][1] = CLAMP(g, 0.0F, 1.0F); + dst[i][2] = CLAMP(b, 0.0F, 1.0F); + dst[i][3] = 1.0F; + } +} + +static void +unpack_float_ycbcr_rev(const void *src, GLfloat dst[][4], GLuint n) +{ + GLuint i; + for (i = 0; i < n; i++) { + const GLushort *src0 = ((const GLushort *) src) + i * 2; /* even */ + const GLushort *src1 = src0 + 1; /* odd */ + const GLubyte y0 = *src0 & 0xff; /* luminance */ + const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ + const GLubyte y1 = *src1 & 0xff; /* luminance */ + const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */ + const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); + GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); + GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); + r *= (1.0F / 255.0F); + g *= (1.0F / 255.0F); + b *= (1.0F / 255.0F); + dst[i][0] = CLAMP(r, 0.0F, 1.0F); + dst[i][1] = CLAMP(g, 0.0F, 1.0F); + dst[i][2] = CLAMP(b, 0.0F, 1.0F); + dst[i][3] = 1.0F; + } +} + +/* ubyte packing functions */ + + +static inline void +unpack_ubyte_a8b8g8r8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_x8b8g8r8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r8g8b8a8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_r8g8b8x8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_b8g8r8a8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_b8g8r8x8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_a8r8g8b8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_x8r8g8b8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_l16a16_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t l = UNPACK(*src, 0, 16); + uint16_t a = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_unorm_to_unorm(l, 16, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 16, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 16, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 16, 8); +} + +static inline void +unpack_ubyte_a16l16_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t a = UNPACK(*src, 0, 16); + uint16_t l = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_unorm_to_unorm(l, 16, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 16, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 16, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 16, 8); +} + +static inline void +unpack_ubyte_b5g6r5_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 6); + uint8_t r = UNPACK(*src, 11, 5); + + + + dst[0] = _mesa_unorm_to_unorm(r, 5, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 6, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 5, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r5g6b5_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 6); + uint8_t b = UNPACK(*src, 11, 5); + + + + dst[0] = _mesa_unorm_to_unorm(r, 5, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 6, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 5, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_b4g4r4a4_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 4); + uint8_t g = UNPACK(*src, 4, 4); + uint8_t r = UNPACK(*src, 8, 4); + uint8_t a = UNPACK(*src, 12, 4); + + + + dst[0] = _mesa_unorm_to_unorm(r, 4, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 4, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 4, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 4, 8); +} + +static inline void +unpack_ubyte_b4g4r4x4_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 4); + uint8_t g = UNPACK(*src, 4, 4); + uint8_t r = UNPACK(*src, 8, 4); + + + + dst[0] = _mesa_unorm_to_unorm(r, 4, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 4, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 4, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_a4r4g4b4_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 4); + uint8_t r = UNPACK(*src, 4, 4); + uint8_t g = UNPACK(*src, 8, 4); + uint8_t b = UNPACK(*src, 12, 4); + + + + dst[0] = _mesa_unorm_to_unorm(r, 4, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 4, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 4, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 4, 8); +} + +static inline void +unpack_ubyte_a1b5g5r5_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 1); + uint8_t b = UNPACK(*src, 1, 5); + uint8_t g = UNPACK(*src, 6, 5); + uint8_t r = UNPACK(*src, 11, 5); + + + + dst[0] = _mesa_unorm_to_unorm(r, 5, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 5, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 5, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 1, 8); +} + +static inline void +unpack_ubyte_b5g5r5a1_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 5); + uint8_t r = UNPACK(*src, 10, 5); + uint8_t a = UNPACK(*src, 15, 1); + + + + dst[0] = _mesa_unorm_to_unorm(r, 5, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 5, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 5, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 1, 8); +} + +static inline void +unpack_ubyte_b5g5r5x1_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 5); + uint8_t r = UNPACK(*src, 10, 5); + + + + dst[0] = _mesa_unorm_to_unorm(r, 5, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 5, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 5, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_a1r5g5b5_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 1); + uint8_t r = UNPACK(*src, 1, 5); + uint8_t g = UNPACK(*src, 6, 5); + uint8_t b = UNPACK(*src, 11, 5); + + + + dst[0] = _mesa_unorm_to_unorm(r, 5, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 5, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 5, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 1, 8); +} + +static inline void +unpack_ubyte_l8a8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t l = UNPACK(*src, 0, 8); + uint8_t a = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_a8l8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t l = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_r8g8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_g8r8_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t g = UNPACK(*src, 0, 8); + uint8_t r = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_l4a4_unorm(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t l = UNPACK(*src, 0, 4); + uint8_t a = UNPACK(*src, 4, 4); + + + + dst[0] = _mesa_unorm_to_unorm(l, 4, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 4, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 4, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 4, 8); +} + +static inline void +unpack_ubyte_b2g3r3_unorm(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t b = UNPACK(*src, 0, 2); + uint8_t g = UNPACK(*src, 2, 3); + uint8_t r = UNPACK(*src, 5, 3); + + + + dst[0] = _mesa_unorm_to_unorm(r, 3, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 3, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 2, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r16g16_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t r = UNPACK(*src, 0, 16); + uint16_t g = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_unorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 16, 8); + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_g16r16_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t g = UNPACK(*src, 0, 16); + uint16_t r = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_unorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 16, 8); + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_b10g10r10a2_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t b = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t r = UNPACK(*src, 20, 10); + uint8_t a = UNPACK(*src, 30, 2); + + + + dst[0] = _mesa_unorm_to_unorm(r, 10, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 10, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 10, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 2, 8); +} + +static inline void +unpack_ubyte_b10g10r10x2_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t b = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t r = UNPACK(*src, 20, 10); + + + + dst[0] = _mesa_unorm_to_unorm(r, 10, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 10, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 10, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r10g10b10a2_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t r = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t b = UNPACK(*src, 20, 10); + uint8_t a = UNPACK(*src, 30, 2); + + + + dst[0] = _mesa_unorm_to_unorm(r, 10, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 10, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 10, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 2, 8); +} + +static inline void +unpack_ubyte_r10g10b10x2_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t r = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t b = UNPACK(*src, 20, 10); + + + + dst[0] = _mesa_unorm_to_unorm(r, 10, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 10, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 10, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r3g3b2_unorm(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = UNPACK(*src, 0, 3); + uint8_t g = UNPACK(*src, 3, 3); + uint8_t b = UNPACK(*src, 6, 2); + + + + dst[0] = _mesa_unorm_to_unorm(r, 3, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 3, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 2, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_a4b4g4r4_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 4); + uint8_t b = UNPACK(*src, 4, 4); + uint8_t g = UNPACK(*src, 8, 4); + uint8_t r = UNPACK(*src, 12, 4); + + + + dst[0] = _mesa_unorm_to_unorm(r, 4, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 4, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 4, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 4, 8); +} + +static inline void +unpack_ubyte_r4g4b4a4_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 4); + uint8_t g = UNPACK(*src, 4, 4); + uint8_t b = UNPACK(*src, 8, 4); + uint8_t a = UNPACK(*src, 12, 4); + + + + dst[0] = _mesa_unorm_to_unorm(r, 4, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 4, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 4, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 4, 8); +} + +static inline void +unpack_ubyte_r5g5b5a1_unorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 5); + uint8_t b = UNPACK(*src, 10, 5); + uint8_t a = UNPACK(*src, 15, 1); + + + + dst[0] = _mesa_unorm_to_unorm(r, 5, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 5, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 5, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 1, 8); +} + +static inline void +unpack_ubyte_a2b10g10r10_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 2); + uint16_t b = UNPACK(*src, 2, 10); + uint16_t g = UNPACK(*src, 12, 10); + uint16_t r = UNPACK(*src, 22, 10); + + + + dst[0] = _mesa_unorm_to_unorm(r, 10, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 10, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 10, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 2, 8); +} + +static inline void +unpack_ubyte_a2r10g10b10_unorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 2); + uint16_t r = UNPACK(*src, 2, 10); + uint16_t g = UNPACK(*src, 12, 10); + uint16_t b = UNPACK(*src, 22, 10); + + + + dst[0] = _mesa_unorm_to_unorm(r, 10, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 10, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 10, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 2, 8); +} + +static inline void +unpack_ubyte_a_unorm8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_a_unorm16(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + + dst[3] = _mesa_unorm_to_unorm(a, 16, 8); +} + +static inline void +unpack_ubyte_l_unorm8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t l = src[0]; + + + + dst[0] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_l_unorm16(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t l = src[0]; + + + + dst[0] = _mesa_unorm_to_unorm(l, 16, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 16, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 16, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_i_unorm8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t i = src[0]; + + + + dst[0] = _mesa_unorm_to_unorm(i, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(i, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(i, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(i, 8, 8); +} + +static inline void +unpack_ubyte_i_unorm16(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t i = src[0]; + + + + dst[0] = _mesa_unorm_to_unorm(i, 16, 8); + + + dst[1] = _mesa_unorm_to_unorm(i, 16, 8); + + + dst[2] = _mesa_unorm_to_unorm(i, 16, 8); + + + dst[3] = _mesa_unorm_to_unorm(i, 16, 8); +} + +static inline void +unpack_ubyte_r_unorm8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r_unorm16(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + + + + dst[0] = _mesa_unorm_to_unorm(r, 16, 8); + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_bgr_unorm8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t b = src[0]; + uint8_t g = src[1]; + uint8_t r = src[2]; + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_rgb_unorm8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + uint8_t g = src[1]; + uint8_t b = src[2]; + + + + dst[0] = _mesa_unorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_rgba_unorm16(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + uint16_t a = src[3]; + + + + dst[0] = _mesa_unorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 16, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 16, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 16, 8); +} + +static inline void +unpack_ubyte_rgbx_unorm16(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + + + + dst[0] = _mesa_unorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_unorm_to_unorm(g, 16, 8); + + + dst[2] = _mesa_unorm_to_unorm(b, 16, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_a8b8g8r8_snorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int8_t a = UNPACK(*src, 0, 8); + int8_t b = UNPACK(*src, 8, 8); + int8_t g = UNPACK(*src, 16, 8); + int8_t r = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_snorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_snorm_to_unorm(b, 8, 8); + + + dst[3] = _mesa_snorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_x8b8g8r8_snorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int8_t b = UNPACK(*src, 8, 8); + int8_t g = UNPACK(*src, 16, 8); + int8_t r = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_snorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_snorm_to_unorm(b, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r8g8b8a8_snorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int8_t r = UNPACK(*src, 0, 8); + int8_t g = UNPACK(*src, 8, 8); + int8_t b = UNPACK(*src, 16, 8); + int8_t a = UNPACK(*src, 24, 8); + + + + dst[0] = _mesa_snorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_snorm_to_unorm(b, 8, 8); + + + dst[3] = _mesa_snorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_r8g8b8x8_snorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int8_t r = UNPACK(*src, 0, 8); + int8_t g = UNPACK(*src, 8, 8); + int8_t b = UNPACK(*src, 16, 8); + + + + dst[0] = _mesa_snorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 8, 8); + + + dst[2] = _mesa_snorm_to_unorm(b, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r16g16_snorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int16_t r = UNPACK(*src, 0, 16); + int16_t g = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_snorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 16, 8); + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_g16r16_snorm(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + int16_t g = UNPACK(*src, 0, 16); + int16_t r = UNPACK(*src, 16, 16); + + + + dst[0] = _mesa_snorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 16, 8); + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r8g8_snorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + int8_t r = UNPACK(*src, 0, 8); + int8_t g = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_snorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 8, 8); + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_g8r8_snorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + int8_t g = UNPACK(*src, 0, 8); + int8_t r = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_snorm_to_unorm(r, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 8, 8); + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_l8a8_snorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + int8_t l = UNPACK(*src, 0, 8); + int8_t a = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_snorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_snorm_to_unorm(l, 8, 8); + + + dst[3] = _mesa_snorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_a8l8_snorm(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + int8_t a = UNPACK(*src, 0, 8); + int8_t l = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_snorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_snorm_to_unorm(l, 8, 8); + + + dst[3] = _mesa_snorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_a_snorm8(const void *void_src, GLubyte dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + + dst[3] = _mesa_snorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_a_snorm16(const void *void_src, GLubyte dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + + dst[3] = _mesa_snorm_to_unorm(a, 16, 8); +} + +static inline void +unpack_ubyte_l_snorm8(const void *void_src, GLubyte dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t l = src[0]; + + + + dst[0] = _mesa_snorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_snorm_to_unorm(l, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_l_snorm16(const void *void_src, GLubyte dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t l = src[0]; + + + + dst[0] = _mesa_snorm_to_unorm(l, 16, 8); + + + dst[1] = _mesa_snorm_to_unorm(l, 16, 8); + + + dst[2] = _mesa_snorm_to_unorm(l, 16, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_i_snorm8(const void *void_src, GLubyte dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t i = src[0]; + + + + dst[0] = _mesa_snorm_to_unorm(i, 8, 8); + + + dst[1] = _mesa_snorm_to_unorm(i, 8, 8); + + + dst[2] = _mesa_snorm_to_unorm(i, 8, 8); + + + dst[3] = _mesa_snorm_to_unorm(i, 8, 8); +} + +static inline void +unpack_ubyte_i_snorm16(const void *void_src, GLubyte dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t i = src[0]; + + + + dst[0] = _mesa_snorm_to_unorm(i, 16, 8); + + + dst[1] = _mesa_snorm_to_unorm(i, 16, 8); + + + dst[2] = _mesa_snorm_to_unorm(i, 16, 8); + + + dst[3] = _mesa_snorm_to_unorm(i, 16, 8); +} + +static inline void +unpack_ubyte_r_snorm8(const void *void_src, GLubyte dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t r = src[0]; + + + + dst[0] = _mesa_snorm_to_unorm(r, 8, 8); + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r_snorm16(const void *void_src, GLubyte dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + + + + dst[0] = _mesa_snorm_to_unorm(r, 16, 8); + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void +unpack_ubyte_la_snorm16(const void *void_src, GLubyte dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t l = src[0]; + int16_t a = src[1]; + + + + dst[0] = _mesa_snorm_to_unorm(l, 16, 8); + + + dst[1] = _mesa_snorm_to_unorm(l, 16, 8); + + + dst[2] = _mesa_snorm_to_unorm(l, 16, 8); + + + dst[3] = _mesa_snorm_to_unorm(a, 16, 8); +} + +static inline void +unpack_ubyte_rgb_snorm16(const void *void_src, GLubyte dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + + + + dst[0] = _mesa_snorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 16, 8); + + + dst[2] = _mesa_snorm_to_unorm(b, 16, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_rgba_snorm16(const void *void_src, GLubyte dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + int16_t a = src[3]; + + + + dst[0] = _mesa_snorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 16, 8); + + + dst[2] = _mesa_snorm_to_unorm(b, 16, 8); + + + dst[3] = _mesa_snorm_to_unorm(a, 16, 8); +} + +static inline void +unpack_ubyte_rgbx_snorm16(const void *void_src, GLubyte dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + + + + dst[0] = _mesa_snorm_to_unorm(r, 16, 8); + + + dst[1] = _mesa_snorm_to_unorm(g, 16, 8); + + + dst[2] = _mesa_snorm_to_unorm(b, 16, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_a8b8g8r8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_b8g8r8a8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_a8r8g8b8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_b8g8r8x8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_x8r8g8b8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_r8g8b8a8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_r8g8b8x8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_x8b8g8r8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_l8a8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t l = UNPACK(*src, 0, 8); + uint8_t a = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_a8l8_srgb(const void *void_src, GLubyte dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t l = UNPACK(*src, 8, 8); + + + + dst[0] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[3] = _mesa_unorm_to_unorm(a, 8, 8); +} + +static inline void +unpack_ubyte_l_srgb8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t l = src[0]; + + + + dst[0] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[1] = _mesa_unorm_to_unorm(l, 8, 8); + + + dst[2] = _mesa_unorm_to_unorm(l, 8, 8); + + dst[3] = 255; +} + +static inline void +unpack_ubyte_bgr_srgb8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t b = src[0]; + uint8_t g = src[1]; + uint8_t r = src[2]; + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + + + dst[1] = util_format_srgb_to_linear_8unorm(g); + + + + dst[2] = util_format_srgb_to_linear_8unorm(b); + + dst[3] = 255; +} + +/* integer packing functions */ + + +static inline void +unpack_int_a8b8g8r8_uint(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t b = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t r = UNPACK(*src, 24, 8); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_a8r8g8b8_uint(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 8); + uint8_t r = UNPACK(*src, 8, 8); + uint8_t g = UNPACK(*src, 16, 8); + uint8_t b = UNPACK(*src, 24, 8); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_r8g8b8a8_uint(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t r = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t b = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_b8g8r8a8_uint(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t b = UNPACK(*src, 0, 8); + uint8_t g = UNPACK(*src, 8, 8); + uint8_t r = UNPACK(*src, 16, 8); + uint8_t a = UNPACK(*src, 24, 8); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_b10g10r10a2_uint(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t b = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t r = UNPACK(*src, 20, 10); + uint8_t a = UNPACK(*src, 30, 2); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_r10g10b10a2_uint(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint16_t r = UNPACK(*src, 0, 10); + uint16_t g = UNPACK(*src, 10, 10); + uint16_t b = UNPACK(*src, 20, 10); + uint8_t a = UNPACK(*src, 30, 2); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_a2b10g10r10_uint(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 2); + uint16_t b = UNPACK(*src, 2, 10); + uint16_t g = UNPACK(*src, 12, 10); + uint16_t r = UNPACK(*src, 22, 10); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_a2r10g10b10_uint(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint8_t a = UNPACK(*src, 0, 2); + uint16_t r = UNPACK(*src, 2, 10); + uint16_t g = UNPACK(*src, 12, 10); + uint16_t b = UNPACK(*src, 22, 10); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_b5g6r5_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 6); + uint8_t r = UNPACK(*src, 11, 5); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_r5g6b5_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 6); + uint8_t b = UNPACK(*src, 11, 5); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_b2g3r3_uint(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t b = UNPACK(*src, 0, 2); + uint8_t g = UNPACK(*src, 2, 3); + uint8_t r = UNPACK(*src, 5, 3); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_r3g3b2_uint(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = UNPACK(*src, 0, 3); + uint8_t g = UNPACK(*src, 3, 3); + uint8_t b = UNPACK(*src, 6, 2); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_a4b4g4r4_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 4); + uint8_t b = UNPACK(*src, 4, 4); + uint8_t g = UNPACK(*src, 8, 4); + uint8_t r = UNPACK(*src, 12, 4); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_r4g4b4a4_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 4); + uint8_t g = UNPACK(*src, 4, 4); + uint8_t b = UNPACK(*src, 8, 4); + uint8_t a = UNPACK(*src, 12, 4); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_b4g4r4a4_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 4); + uint8_t g = UNPACK(*src, 4, 4); + uint8_t r = UNPACK(*src, 8, 4); + uint8_t a = UNPACK(*src, 12, 4); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_a4r4g4b4_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 4); + uint8_t r = UNPACK(*src, 4, 4); + uint8_t g = UNPACK(*src, 8, 4); + uint8_t b = UNPACK(*src, 12, 4); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_a1b5g5r5_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 1); + uint8_t b = UNPACK(*src, 1, 5); + uint8_t g = UNPACK(*src, 6, 5); + uint8_t r = UNPACK(*src, 11, 5); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_b5g5r5a1_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t b = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 5); + uint8_t r = UNPACK(*src, 10, 5); + uint8_t a = UNPACK(*src, 15, 1); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_a1r5g5b5_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t a = UNPACK(*src, 0, 1); + uint8_t r = UNPACK(*src, 1, 5); + uint8_t g = UNPACK(*src, 6, 5); + uint8_t b = UNPACK(*src, 11, 5); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_r5g5b5a1_uint(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint8_t r = UNPACK(*src, 0, 5); + uint8_t g = UNPACK(*src, 5, 5); + uint8_t b = UNPACK(*src, 10, 5); + uint8_t a = UNPACK(*src, 15, 1); + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_a_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = a; +} + +static inline void +unpack_int_a_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = a; +} + +static inline void +unpack_int_a_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = a; +} + +static inline void +unpack_int_a_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = a; +} + +static inline void +unpack_int_a_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = a; +} + +static inline void +unpack_int_a_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t a = src[0]; + + + dst[0] = 0; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = a; +} + +static inline void +unpack_int_i_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t i = src[0]; + + + dst[0] = i; + + dst[1] = i; + + dst[2] = i; + + dst[3] = i; +} + +static inline void +unpack_int_i_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t i = src[0]; + + + dst[0] = i; + + dst[1] = i; + + dst[2] = i; + + dst[3] = i; +} + +static inline void +unpack_int_i_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t i = src[0]; + + + dst[0] = i; + + dst[1] = i; + + dst[2] = i; + + dst[3] = i; +} + +static inline void +unpack_int_i_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t i = src[0]; + + + dst[0] = i; + + dst[1] = i; + + dst[2] = i; + + dst[3] = i; +} + +static inline void +unpack_int_i_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t i = src[0]; + + + dst[0] = i; + + dst[1] = i; + + dst[2] = i; + + dst[3] = i; +} + +static inline void +unpack_int_i_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t i = src[0]; + + + dst[0] = i; + + dst[1] = i; + + dst[2] = i; + + dst[3] = i; +} + +static inline void +unpack_int_l_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t l = src[0]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = 1; +} + +static inline void +unpack_int_l_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t l = src[0]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = 1; +} + +static inline void +unpack_int_l_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t l = src[0]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = 1; +} + +static inline void +unpack_int_l_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t l = src[0]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = 1; +} + +static inline void +unpack_int_l_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t l = src[0]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = 1; +} + +static inline void +unpack_int_l_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t l = src[0]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = 1; +} + +static inline void +unpack_int_la_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t l = src[0]; + uint8_t a = src[1]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = a; +} + +static inline void +unpack_int_la_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t l = src[0]; + uint16_t a = src[1]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = a; +} + +static inline void +unpack_int_la_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t l = src[0]; + uint32_t a = src[1]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = a; +} + +static inline void +unpack_int_la_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t l = src[0]; + int8_t a = src[1]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = a; +} + +static inline void +unpack_int_la_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t l = src[0]; + int16_t a = src[1]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = a; +} + +static inline void +unpack_int_la_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t l = src[0]; + int32_t a = src[1]; + + + dst[0] = l; + + dst[1] = l; + + dst[2] = l; + + dst[3] = a; +} + +static inline void +unpack_int_r_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + + + dst[0] = r; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_r_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + + + dst[0] = r; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_r_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t r = src[0]; + + + dst[0] = r; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_r_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t r = src[0]; + + + dst[0] = r; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_r_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + + + dst[0] = r; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_r_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t r = src[0]; + + + dst[0] = r; + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_rg_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + uint8_t g = src[1]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_rg_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_rg_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t r = src[0]; + uint32_t g = src[1]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_rg_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t r = src[0]; + int8_t g = src[1]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_rg_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_rg_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t r = src[0]; + int32_t g = src[1]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = 0; + + dst[3] = 1; +} + +static inline void +unpack_int_rgb_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + uint8_t g = src[1]; + uint8_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgb_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgb_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t r = src[0]; + uint32_t g = src[1]; + uint32_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgb_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t r = src[0]; + int8_t g = src[1]; + int8_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgb_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgb_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t r = src[0]; + int32_t g = src[1]; + int32_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgba_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + uint8_t g = src[1]; + uint8_t b = src[2]; + uint8_t a = src[3]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_rgba_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + uint16_t a = src[3]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_rgba_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t r = src[0]; + uint32_t g = src[1]; + uint32_t b = src[2]; + uint32_t a = src[3]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_rgba_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t r = src[0]; + int8_t g = src[1]; + int8_t b = src[2]; + int8_t a = src[3]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_rgba_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + int16_t a = src[3]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_rgba_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t r = src[0]; + int32_t g = src[1]; + int32_t b = src[2]; + int32_t a = src[3]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = a; +} + +static inline void +unpack_int_rgbx_uint8(const void *void_src, GLuint dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + uint8_t g = src[1]; + uint8_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgbx_uint16(const void *void_src, GLuint dst[4]) +{ + uint16_t *src = (uint16_t *)void_src; + uint16_t r = src[0]; + uint16_t g = src[1]; + uint16_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgbx_uint32(const void *void_src, GLuint dst[4]) +{ + uint32_t *src = (uint32_t *)void_src; + uint32_t r = src[0]; + uint32_t g = src[1]; + uint32_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgbx_sint8(const void *void_src, GLuint dst[4]) +{ + int8_t *src = (int8_t *)void_src; + int8_t r = src[0]; + int8_t g = src[1]; + int8_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgbx_sint16(const void *void_src, GLuint dst[4]) +{ + int16_t *src = (int16_t *)void_src; + int16_t r = src[0]; + int16_t g = src[1]; + int16_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + +static inline void +unpack_int_rgbx_sint32(const void *void_src, GLuint dst[4]) +{ + int32_t *src = (int32_t *)void_src; + int32_t r = src[0]; + int32_t g = src[1]; + int32_t b = src[2]; + + + dst[0] = r; + + dst[1] = g; + + dst[2] = b; + + dst[3] = 1; +} + + +void +_mesa_unpack_rgba_row(mesa_format format, GLuint n, + const void *src, GLfloat dst[][4]) +{ + GLubyte *s = (GLubyte *)src; + GLuint i; + + switch (format) { + case MESA_FORMAT_A8B8G8R8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a8b8g8r8_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_X8B8G8R8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_x8b8g8r8_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R8G8B8A8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r8g8b8a8_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R8G8B8X8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r8g8b8x8_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_B8G8R8A8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b8g8r8a8_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_B8G8R8X8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b8g8r8x8_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_A8R8G8B8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a8r8g8b8_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_X8R8G8B8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_x8r8g8b8_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_L16A16_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_l16a16_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_A16L16_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a16l16_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_B5G6R5_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b5g6r5_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_R5G6B5_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r5g6b5_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_B4G4R4A4_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b4g4r4a4_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_B4G4R4X4_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b4g4r4x4_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A4R4G4B4_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a4r4g4b4_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A1B5G5R5_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a1b5g5r5_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_B5G5R5A1_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b5g5r5a1_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_B5G5R5X1_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b5g5r5x1_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A1R5G5B5_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a1r5g5b5_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_L8A8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_l8a8_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A8L8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a8l8_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_R8G8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r8g8_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_G8R8_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_g8r8_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_L4A4_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_l4a4_unorm(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_B2G3R3_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b2g3r3_unorm(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_R16G16_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r16g16_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_G16R16_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_g16r16_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_B10G10R10A2_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b10g10r10a2_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_B10G10R10X2_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_b10g10r10x2_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R10G10B10A2_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r10g10b10a2_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R10G10B10X2_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r10g10b10x2_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R3G3B2_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r3g3b2_unorm(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_A4B4G4R4_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a4b4g4r4_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_R4G4B4A4_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r4g4b4a4_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_R5G5B5A1_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_r5g5b5a1_unorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A2B10G10R10_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a2b10g10r10_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_A2R10G10B10_UNORM: + for (i = 0; i < n; ++i) { + unpack_float_a2r10g10b10_unorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_A_UNORM8: + for (i = 0; i < n; ++i) { + unpack_float_a_unorm8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_A_UNORM16: + for (i = 0; i < n; ++i) { + unpack_float_a_unorm16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_L_UNORM8: + for (i = 0; i < n; ++i) { + unpack_float_l_unorm8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_L_UNORM16: + for (i = 0; i < n; ++i) { + unpack_float_l_unorm16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_I_UNORM8: + for (i = 0; i < n; ++i) { + unpack_float_i_unorm8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_I_UNORM16: + for (i = 0; i < n; ++i) { + unpack_float_i_unorm16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_R_UNORM8: + for (i = 0; i < n; ++i) { + unpack_float_r_unorm8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_R_UNORM16: + for (i = 0; i < n; ++i) { + unpack_float_r_unorm16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_BGR_UNORM8: + for (i = 0; i < n; ++i) { + unpack_float_bgr_unorm8(s, dst[i]); + s += 3; + } + break; + case MESA_FORMAT_RGB_UNORM8: + for (i = 0; i < n; ++i) { + unpack_float_rgb_unorm8(s, dst[i]); + s += 3; + } + break; + case MESA_FORMAT_RGBA_UNORM16: + for (i = 0; i < n; ++i) { + unpack_float_rgba_unorm16(s, dst[i]); + s += 8; + } + break; + case MESA_FORMAT_RGBX_UNORM16: + for (i = 0; i < n; ++i) { + unpack_float_rgbx_unorm16(s, dst[i]); + s += 8; + } + break; + case MESA_FORMAT_A8B8G8R8_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_a8b8g8r8_snorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_X8B8G8R8_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_x8b8g8r8_snorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R8G8B8A8_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_r8g8b8a8_snorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R8G8B8X8_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_r8g8b8x8_snorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R16G16_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_r16g16_snorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_G16R16_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_g16r16_snorm(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R8G8_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_r8g8_snorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_G8R8_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_g8r8_snorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_L8A8_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_l8a8_snorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A8L8_SNORM: + for (i = 0; i < n; ++i) { + unpack_float_a8l8_snorm(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A_SNORM8: + for (i = 0; i < n; ++i) { + unpack_float_a_snorm8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_A_SNORM16: + for (i = 0; i < n; ++i) { + unpack_float_a_snorm16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_L_SNORM8: + for (i = 0; i < n; ++i) { + unpack_float_l_snorm8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_L_SNORM16: + for (i = 0; i < n; ++i) { + unpack_float_l_snorm16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_I_SNORM8: + for (i = 0; i < n; ++i) { + unpack_float_i_snorm8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_I_SNORM16: + for (i = 0; i < n; ++i) { + unpack_float_i_snorm16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_R_SNORM8: + for (i = 0; i < n; ++i) { + unpack_float_r_snorm8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_R_SNORM16: + for (i = 0; i < n; ++i) { + unpack_float_r_snorm16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_LA_SNORM16: + for (i = 0; i < n; ++i) { + unpack_float_la_snorm16(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_RGB_SNORM16: + for (i = 0; i < n; ++i) { + unpack_float_rgb_snorm16(s, dst[i]); + s += 6; + } + break; + case MESA_FORMAT_RGBA_SNORM16: + for (i = 0; i < n; ++i) { + unpack_float_rgba_snorm16(s, dst[i]); + s += 8; + } + break; + case MESA_FORMAT_RGBX_SNORM16: + for (i = 0; i < n; ++i) { + unpack_float_rgbx_snorm16(s, dst[i]); + s += 8; + } + break; + case MESA_FORMAT_A8B8G8R8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_a8b8g8r8_srgb(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_B8G8R8A8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_b8g8r8a8_srgb(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_A8R8G8B8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_a8r8g8b8_srgb(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_B8G8R8X8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_b8g8r8x8_srgb(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_X8R8G8B8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_x8r8g8b8_srgb(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R8G8B8A8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_r8g8b8a8_srgb(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R8G8B8X8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_r8g8b8x8_srgb(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_X8B8G8R8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_x8b8g8r8_srgb(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_L8A8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_l8a8_srgb(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A8L8_SRGB: + for (i = 0; i < n; ++i) { + unpack_float_a8l8_srgb(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_L_SRGB8: + for (i = 0; i < n; ++i) { + unpack_float_l_srgb8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_BGR_SRGB8: + for (i = 0; i < n; ++i) { + unpack_float_bgr_srgb8(s, dst[i]); + s += 3; + } + break; + case MESA_FORMAT_R9G9B9E5_FLOAT: + for (i = 0; i < n; ++i) { + unpack_float_r9g9b9e5_float(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R11G11B10_FLOAT: + for (i = 0; i < n; ++i) { + unpack_float_r11g11b10_float(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_A_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_a_float16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_A_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_a_float32(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_L_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_l_float16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_L_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_l_float32(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_LA_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_la_float16(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_LA_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_la_float32(s, dst[i]); + s += 8; + } + break; + case MESA_FORMAT_I_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_i_float16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_I_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_i_float32(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_R_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_r_float16(s, dst[i]); + s += 2; + } + break; + case MESA_FORMAT_R_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_r_float32(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_RG_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_rg_float16(s, dst[i]); + s += 4; + } + break; + case MESA_FORMAT_RG_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_rg_float32(s, dst[i]); + s += 8; + } + break; + case MESA_FORMAT_RGB_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_rgb_float16(s, dst[i]); + s += 6; + } + break; + case MESA_FORMAT_RGB_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_rgb_float32(s, dst[i]); + s += 12; + } + break; + case MESA_FORMAT_RGBA_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_rgba_float16(s, dst[i]); + s += 8; + } + break; + case MESA_FORMAT_RGBA_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_rgba_float32(s, dst[i]); + s += 16; + } + break; + case MESA_FORMAT_RGBX_FLOAT16: + for (i = 0; i < n; ++i) { + unpack_float_rgbx_float16(s, dst[i]); + s += 8; + } + break; + case MESA_FORMAT_RGBX_FLOAT32: + for (i = 0; i < n; ++i) { + unpack_float_rgbx_float32(s, dst[i]); + s += 16; + } + break; + case MESA_FORMAT_YCBCR: + unpack_float_ycbcr(src, dst, n); + break; + case MESA_FORMAT_YCBCR_REV: + unpack_float_ycbcr_rev(src, dst, n); + break; + default: + _mesa_problem(NULL, "%s: bad format %s", __func__, + _mesa_get_format_name(format)); + return; + } +} + +void +_mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, + const void *src, GLubyte dst[][4]) +{ + GLubyte *s = (GLubyte *)src; + GLuint i; + + switch (format) { + + case MESA_FORMAT_A8B8G8R8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a8b8g8r8_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_x8b8g8r8_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r8g8b8a8_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r8g8b8x8_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b8g8r8a8_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B8G8R8X8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b8g8r8x8_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a8r8g8b8_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_X8R8G8B8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_x8r8g8b8_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_L16A16_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_l16a16_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A16L16_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a16l16_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B5G6R5_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b5g6r5_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R5G6B5_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r5g6b5_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_B4G4R4A4_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b4g4r4a4_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_B4G4R4X4_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b4g4r4x4_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A4R4G4B4_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a4r4g4b4_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A1B5G5R5_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a1b5g5r5_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_B5G5R5A1_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b5g5r5a1_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_B5G5R5X1_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b5g5r5x1_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A1R5G5B5_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a1r5g5b5_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_L8A8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_l8a8_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A8L8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a8l8_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R8G8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r8g8_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_G8R8_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_g8r8_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_L4A4_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_l4a4_unorm(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_B2G3R3_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b2g3r3_unorm(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_R16G16_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r16g16_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_G16R16_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_g16r16_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B10G10R10A2_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b10g10r10a2_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B10G10R10X2_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_b10g10r10x2_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R10G10B10A2_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r10g10b10a2_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R10G10B10X2_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r10g10b10x2_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R3G3B2_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r3g3b2_unorm(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_A4B4G4R4_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a4b4g4r4_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R4G4B4A4_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r4g4b4a4_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R5G5B5A1_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r5g5b5a1_unorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A2B10G10R10_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a2b10g10r10_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A2R10G10B10_UNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a2r10g10b10_unorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A_UNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_a_unorm8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_A_UNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_a_unorm16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_L_UNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_l_unorm8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_L_UNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_l_unorm16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_I_UNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_i_unorm8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_I_UNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_i_unorm16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R_UNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_r_unorm8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_R_UNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_r_unorm16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_BGR_UNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_bgr_unorm8(s, dst[i]); + s += 3; + } + break; + + case MESA_FORMAT_RGB_UNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_rgb_unorm8(s, dst[i]); + s += 3; + } + break; + + case MESA_FORMAT_RGBA_UNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_rgba_unorm16(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_RGBX_UNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_rgbx_unorm16(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_A8B8G8R8_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a8b8g8r8_snorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_x8b8g8r8_snorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r8g8b8a8_snorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r8g8b8x8_snorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R16G16_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r16g16_snorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_G16R16_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_g16r16_snorm(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R8G8_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_r8g8_snorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_G8R8_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_g8r8_snorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_L8A8_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_l8a8_snorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A8L8_SNORM: + for (i = 0; i < n; ++i) { + unpack_ubyte_a8l8_snorm(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A_SNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_a_snorm8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_A_SNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_a_snorm16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_L_SNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_l_snorm8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_L_SNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_l_snorm16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_I_SNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_i_snorm8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_I_SNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_i_snorm16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R_SNORM8: + for (i = 0; i < n; ++i) { + unpack_ubyte_r_snorm8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_R_SNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_r_snorm16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_LA_SNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_la_snorm16(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_RGB_SNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_rgb_snorm16(s, dst[i]); + s += 6; + } + break; + + case MESA_FORMAT_RGBA_SNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_rgba_snorm16(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_RGBX_SNORM16: + for (i = 0; i < n; ++i) { + unpack_ubyte_rgbx_snorm16(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_A8B8G8R8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_a8b8g8r8_srgb(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_b8g8r8a8_srgb(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_a8r8g8b8_srgb(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B8G8R8X8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_b8g8r8x8_srgb(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_X8R8G8B8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_x8r8g8b8_srgb(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_r8g8b8a8_srgb(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R8G8B8X8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_r8g8b8x8_srgb(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_X8B8G8R8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_x8b8g8r8_srgb(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_L8A8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_l8a8_srgb(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A8L8_SRGB: + for (i = 0; i < n; ++i) { + unpack_ubyte_a8l8_srgb(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_L_SRGB8: + for (i = 0; i < n; ++i) { + unpack_ubyte_l_srgb8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_BGR_SRGB8: + for (i = 0; i < n; ++i) { + unpack_ubyte_bgr_srgb8(s, dst[i]); + s += 3; + } + break; + default: + /* get float values, convert to ubyte */ + { + GLfloat *tmp = malloc(n * 4 * sizeof(GLfloat)); + if (tmp) { + GLuint i; + _mesa_unpack_rgba_row(format, n, src, (GLfloat (*)[4]) tmp); + for (i = 0; i < n; i++) { + dst[i][0] = _mesa_float_to_unorm(tmp[i*4+0], 8); + dst[i][1] = _mesa_float_to_unorm(tmp[i*4+1], 8); + dst[i][2] = _mesa_float_to_unorm(tmp[i*4+2], 8); + dst[i][3] = _mesa_float_to_unorm(tmp[i*4+3], 8); + } + free(tmp); + } + } + break; + } +} + +void +_mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, + const void *src, GLuint dst[][4]) +{ + GLubyte *s = (GLubyte *)src; + GLuint i; + + switch (format) { + + case MESA_FORMAT_A8B8G8R8_UINT: + for (i = 0; i < n; ++i) { + unpack_int_a8b8g8r8_uint(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A8R8G8B8_UINT: + for (i = 0; i < n; ++i) { + unpack_int_a8r8g8b8_uint(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R8G8B8A8_UINT: + for (i = 0; i < n; ++i) { + unpack_int_r8g8b8a8_uint(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B8G8R8A8_UINT: + for (i = 0; i < n; ++i) { + unpack_int_b8g8r8a8_uint(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B10G10R10A2_UINT: + for (i = 0; i < n; ++i) { + unpack_int_b10g10r10a2_uint(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R10G10B10A2_UINT: + for (i = 0; i < n; ++i) { + unpack_int_r10g10b10a2_uint(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A2B10G10R10_UINT: + for (i = 0; i < n; ++i) { + unpack_int_a2b10g10r10_uint(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A2R10G10B10_UINT: + for (i = 0; i < n; ++i) { + unpack_int_a2r10g10b10_uint(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_B5G6R5_UINT: + for (i = 0; i < n; ++i) { + unpack_int_b5g6r5_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R5G6B5_UINT: + for (i = 0; i < n; ++i) { + unpack_int_r5g6b5_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_B2G3R3_UINT: + for (i = 0; i < n; ++i) { + unpack_int_b2g3r3_uint(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_R3G3B2_UINT: + for (i = 0; i < n; ++i) { + unpack_int_r3g3b2_uint(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_A4B4G4R4_UINT: + for (i = 0; i < n; ++i) { + unpack_int_a4b4g4r4_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R4G4B4A4_UINT: + for (i = 0; i < n; ++i) { + unpack_int_r4g4b4a4_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_B4G4R4A4_UINT: + for (i = 0; i < n; ++i) { + unpack_int_b4g4r4a4_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A4R4G4B4_UINT: + for (i = 0; i < n; ++i) { + unpack_int_a4r4g4b4_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A1B5G5R5_UINT: + for (i = 0; i < n; ++i) { + unpack_int_a1b5g5r5_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_B5G5R5A1_UINT: + for (i = 0; i < n; ++i) { + unpack_int_b5g5r5a1_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A1R5G5B5_UINT: + for (i = 0; i < n; ++i) { + unpack_int_a1r5g5b5_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R5G5B5A1_UINT: + for (i = 0; i < n; ++i) { + unpack_int_r5g5b5a1_uint(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_a_uint8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_A_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_a_uint16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_a_uint32(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_A_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_a_sint8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_A_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_a_sint16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_A_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_a_sint32(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_I_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_i_uint8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_I_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_i_uint16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_I_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_i_uint32(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_I_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_i_sint8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_I_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_i_sint16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_I_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_i_sint32(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_L_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_l_uint8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_L_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_l_uint16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_L_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_l_uint32(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_L_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_l_sint8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_L_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_l_sint16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_L_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_l_sint32(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_LA_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_la_uint8(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_LA_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_la_uint16(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_LA_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_la_uint32(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_LA_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_la_sint8(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_LA_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_la_sint16(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_LA_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_la_sint32(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_R_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_r_uint8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_R_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_r_uint16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_r_uint32(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_R_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_r_sint8(s, dst[i]); + s += 1; + } + break; + + case MESA_FORMAT_R_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_r_sint16(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_R_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_r_sint32(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_RG_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_rg_uint8(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_RG_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_rg_uint16(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_RG_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_rg_uint32(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_RG_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_rg_sint8(s, dst[i]); + s += 2; + } + break; + + case MESA_FORMAT_RG_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_rg_sint16(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_RG_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_rg_sint32(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_RGB_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_rgb_uint8(s, dst[i]); + s += 3; + } + break; + + case MESA_FORMAT_RGB_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_rgb_uint16(s, dst[i]); + s += 6; + } + break; + + case MESA_FORMAT_RGB_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_rgb_uint32(s, dst[i]); + s += 12; + } + break; + + case MESA_FORMAT_RGB_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_rgb_sint8(s, dst[i]); + s += 3; + } + break; + + case MESA_FORMAT_RGB_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_rgb_sint16(s, dst[i]); + s += 6; + } + break; + + case MESA_FORMAT_RGB_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_rgb_sint32(s, dst[i]); + s += 12; + } + break; + + case MESA_FORMAT_RGBA_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_rgba_uint8(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_RGBA_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_rgba_uint16(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_RGBA_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_rgba_uint32(s, dst[i]); + s += 16; + } + break; + + case MESA_FORMAT_RGBA_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_rgba_sint8(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_RGBA_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_rgba_sint16(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_RGBA_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_rgba_sint32(s, dst[i]); + s += 16; + } + break; + + case MESA_FORMAT_RGBX_UINT8: + for (i = 0; i < n; ++i) { + unpack_int_rgbx_uint8(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_RGBX_UINT16: + for (i = 0; i < n; ++i) { + unpack_int_rgbx_uint16(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_RGBX_UINT32: + for (i = 0; i < n; ++i) { + unpack_int_rgbx_uint32(s, dst[i]); + s += 16; + } + break; + + case MESA_FORMAT_RGBX_SINT8: + for (i = 0; i < n; ++i) { + unpack_int_rgbx_sint8(s, dst[i]); + s += 4; + } + break; + + case MESA_FORMAT_RGBX_SINT16: + for (i = 0; i < n; ++i) { + unpack_int_rgbx_sint16(s, dst[i]); + s += 8; + } + break; + + case MESA_FORMAT_RGBX_SINT32: + for (i = 0; i < n; ++i) { + unpack_int_rgbx_sint32(s, dst[i]); + s += 16; + } + break; + default: + _mesa_problem(NULL, "%s: bad format %s", __func__, + _mesa_get_format_name(format)); + return; + } +} + +/** + * Unpack a 2D rect of pixels returning float RGBA colors. + * \param format the source image format + * \param src start address of the source image + * \param srcRowStride source image row stride in bytes + * \param dst start address of the dest image + * \param dstRowStride dest image row stride in bytes + * \param x source image start X pos + * \param y source image start Y pos + * \param width width of rect region to convert + * \param height height of rect region to convert + */ +void +_mesa_unpack_rgba_block(mesa_format format, + const void *src, GLint srcRowStride, + GLfloat dst[][4], GLint dstRowStride, + GLuint x, GLuint y, GLuint width, GLuint height) +{ + const GLuint srcPixStride = _mesa_get_format_bytes(format); + const GLuint dstPixStride = 4 * sizeof(GLfloat); + const GLubyte *srcRow; + GLubyte *dstRow; + GLuint i; + + /* XXX needs to be fixed for compressed formats */ + + srcRow = ((const GLubyte *) src) + srcRowStride * y + srcPixStride * x; + dstRow = ((GLubyte *) dst) + dstRowStride * y + dstPixStride * x; + + for (i = 0; i < height; i++) { + _mesa_unpack_rgba_row(format, width, srcRow, (GLfloat (*)[4]) dstRow); + + dstRow += dstRowStride; + srcRow += srcRowStride; + } +} + +/** Helper struct for MESA_FORMAT_Z32_FLOAT_S8X24_UINT */ +struct z32f_x24s8 +{ + float z; + uint32_t x24s8; +}; + +typedef void (*unpack_float_z_func)(GLuint n, const void *src, GLfloat *dst); + +static void +unpack_float_z_X8_UINT_Z24_UNORM(GLuint n, const void *src, GLfloat *dst) +{ + /* only return Z, not stencil data */ + const GLuint *s = ((const GLuint *) src); + const GLdouble scale = 1.0 / (GLdouble) 0xffffff; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = (GLfloat) ((s[i] >> 8) * scale); + assert(dst[i] >= 0.0F); + assert(dst[i] <= 1.0F); + } +} + +static void +unpack_float_z_Z24_UNORM_X8_UINT(GLuint n, const void *src, GLfloat *dst) +{ + /* only return Z, not stencil data */ + const GLuint *s = ((const GLuint *) src); + const GLdouble scale = 1.0 / (GLdouble) 0xffffff; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = (GLfloat) ((s[i] & 0x00ffffff) * scale); + assert(dst[i] >= 0.0F); + assert(dst[i] <= 1.0F); + } +} + +static void +unpack_float_Z_UNORM16(GLuint n, const void *src, GLfloat *dst) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = s[i] * (1.0F / 65535.0F); + } +} + +static void +unpack_float_Z_UNORM32(GLuint n, const void *src, GLfloat *dst) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = s[i] * (1.0F / 0xffffffff); + } +} + +static void +unpack_float_Z_FLOAT32(GLuint n, const void *src, GLfloat *dst) +{ + memcpy(dst, src, n * sizeof(float)); +} + +static void +unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst) +{ + const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = s[i].z; + } +} + + + +/** + * Unpack Z values. + * The returned values will always be in the range [0.0, 1.0]. + */ +void +_mesa_unpack_float_z_row(mesa_format format, GLuint n, + const void *src, GLfloat *dst) +{ + unpack_float_z_func unpack; + + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: + unpack = unpack_float_z_X8_UINT_Z24_UNORM; + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + unpack = unpack_float_z_Z24_UNORM_X8_UINT; + break; + case MESA_FORMAT_Z_UNORM16: + unpack = unpack_float_Z_UNORM16; + break; + case MESA_FORMAT_Z_UNORM32: + unpack = unpack_float_Z_UNORM32; + break; + case MESA_FORMAT_Z_FLOAT32: + unpack = unpack_float_Z_FLOAT32; + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + unpack = unpack_float_z_Z32X24S8; + break; + default: + _mesa_problem(NULL, "bad format %s in _mesa_unpack_float_z_row", + _mesa_get_format_name(format)); + return; + } + + unpack(n, src, dst); +} + + + +typedef void (*unpack_uint_z_func)(const void *src, GLuint *dst, GLuint n); + +static void +unpack_uint_z_X8_UINT_Z24_UNORM(const void *src, GLuint *dst, GLuint n) +{ + /* only return Z, not stencil data */ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = (s[i] & 0xffffff00) | (s[i] >> 24); + } +} + +static void +unpack_uint_z_Z24_UNORM_X8_UINT(const void *src, GLuint *dst, GLuint n) +{ + /* only return Z, not stencil data */ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = (s[i] << 8) | ((s[i] >> 16) & 0xff); + } +} + +static void +unpack_uint_Z_UNORM16(const void *src, GLuint *dst, GLuint n) +{ + const GLushort *s = ((const GLushort *)src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = (s[i] << 16) | s[i]; + } +} + +static void +unpack_uint_Z_UNORM32(const void *src, GLuint *dst, GLuint n) +{ + memcpy(dst, src, n * sizeof(GLuint)); +} + +static void +unpack_uint_Z_FLOAT32(const void *src, GLuint *dst, GLuint n) +{ + const float *s = (const float *)src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = FLOAT_TO_UINT(CLAMP(s[i], 0.0F, 1.0F)); + } +} + +static void +unpack_uint_Z_FLOAT32_X24S8(const void *src, GLuint *dst, GLuint n) +{ + const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; + GLuint i; + + for (i = 0; i < n; i++) { + dst[i] = FLOAT_TO_UINT(CLAMP(s[i].z, 0.0F, 1.0F)); + } +} + + +/** + * Unpack Z values. + * The returned values will always be in the range [0, 0xffffffff]. + */ +void +_mesa_unpack_uint_z_row(mesa_format format, GLuint n, + const void *src, GLuint *dst) +{ + unpack_uint_z_func unpack; + const GLubyte *srcPtr = (GLubyte *) src; + + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: + unpack = unpack_uint_z_X8_UINT_Z24_UNORM; + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + unpack = unpack_uint_z_Z24_UNORM_X8_UINT; + break; + case MESA_FORMAT_Z_UNORM16: + unpack = unpack_uint_Z_UNORM16; + break; + case MESA_FORMAT_Z_UNORM32: + unpack = unpack_uint_Z_UNORM32; + break; + case MESA_FORMAT_Z_FLOAT32: + unpack = unpack_uint_Z_FLOAT32; + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + unpack = unpack_uint_Z_FLOAT32_X24S8; + break; + default: + _mesa_problem(NULL, "bad format %s in _mesa_unpack_uint_z_row", + _mesa_get_format_name(format)); + return; + } + + unpack(srcPtr, dst, n); +} + + +static void +unpack_ubyte_s_S_UINT8(const void *src, GLubyte *dst, GLuint n) +{ + memcpy(dst, src, n); +} + +static void +unpack_ubyte_s_S8_UINT_Z24_UNORM(const void *src, GLubyte *dst, GLuint n) +{ + GLuint i; + const GLuint *src32 = src; + + for (i = 0; i < n; i++) + dst[i] = src32[i] & 0xff; +} + +static void +unpack_ubyte_s_Z24_UNORM_S8_UINT(const void *src, GLubyte *dst, GLuint n) +{ + GLuint i; + const GLuint *src32 = src; + + for (i = 0; i < n; i++) + dst[i] = src32[i] >> 24; +} + +static void +unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(const void *src, GLubyte *dst, GLuint n) +{ + GLuint i; + const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; + + for (i = 0; i < n; i++) + dst[i] = s[i].x24s8 & 0xff; +} + +void +_mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, + const void *src, GLubyte *dst) +{ + switch (format) { + case MESA_FORMAT_S_UINT8: + unpack_ubyte_s_S_UINT8(src, dst, n); + break; + case MESA_FORMAT_S8_UINT_Z24_UNORM: + unpack_ubyte_s_S8_UINT_Z24_UNORM(src, dst, n); + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + unpack_ubyte_s_Z24_UNORM_S8_UINT(src, dst, n); + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(src, dst, n); + break; + default: + _mesa_problem(NULL, "bad format %s in _mesa_unpack_ubyte_s_row", + _mesa_get_format_name(format)); + return; + } +} + +static void +unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(const GLuint *src, GLuint *dst, GLuint n) +{ + GLuint i; + + for (i = 0; i < n; i++) { + GLuint val = src[i]; + dst[i] = val >> 24 | val << 8; + } +} + +static void +unpack_uint_24_8_depth_stencil_Z32_S8X24(const GLuint *src, + GLuint *dst, GLuint n) +{ + GLuint i; + + for (i = 0; i < n; i++) { + /* 8 bytes per pixel (float + uint32) */ + GLfloat zf = ((GLfloat *) src)[i * 2 + 0]; + GLuint z24 = (GLuint) (zf * (GLfloat) 0xffffff); + GLuint s = src[i * 2 + 1] & 0xff; + dst[i] = (z24 << 8) | s; + } +} + +static void +unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(const GLuint *src, GLuint *dst, GLuint n) +{ + memcpy(dst, src, n * 4); +} + +/** + * Unpack depth/stencil returning as GL_UNSIGNED_INT_24_8. + * \param format the source data format + */ +void +_mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, + const void *src, GLuint *dst) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(src, dst, n); + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(src, dst, n); + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + unpack_uint_24_8_depth_stencil_Z32_S8X24(src, dst, n); + break; + default: + _mesa_problem(NULL, + "bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row", + _mesa_get_format_name(format)); + return; + } +} + +static void +unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(const GLuint *src, + GLuint *dst, GLuint n) +{ + GLuint i; + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + const GLdouble scale = 1.0 / (GLdouble) 0xffffff; + + for (i = 0; i < n; i++) { + const GLuint z24 = src[i] & 0xffffff; + d[i].z = z24 * scale; + d[i].x24s8 = src[i] >> 24; + assert(d[i].z >= 0.0f); + assert(d[i].z <= 1.0f); + } +} + +static void +unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(const GLuint *src, + GLuint *dst, GLuint n) +{ + memcpy(dst, src, n * sizeof(struct z32f_x24s8)); +} + +static void +unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(const GLuint *src, + GLuint *dst, GLuint n) +{ + GLuint i; + struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; + const GLdouble scale = 1.0 / (GLdouble) 0xffffff; + + for (i = 0; i < n; i++) { + const GLuint z24 = src[i] >> 8; + d[i].z = z24 * scale; + d[i].x24s8 = src[i] & 0xff; + assert(d[i].z >= 0.0f); + assert(d[i].z <= 1.0f); + } +} + +/** + * Unpack depth/stencil returning as GL_FLOAT_32_UNSIGNED_INT_24_8_REV. + * \param format the source data format + * + * In GL_FLOAT_32_UNSIGNED_INT_24_8_REV lower 4 bytes contain float + * component and higher 4 bytes contain packed 24-bit and 8-bit + * components. + * + * 31 30 29 28 ... 4 3 2 1 0 31 30 29 ... 9 8 7 6 5 ... 2 1 0 + * +-------------------------+ +--------------------------------+ + * | Float Component | | Unused | 8 bit stencil | + * +-------------------------+ +--------------------------------+ + * lower 4 bytes higher 4 bytes + */ +void +_mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, + const void *src, GLuint *dst) +{ + switch (format) { + case MESA_FORMAT_S8_UINT_Z24_UNORM: + unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(src, dst, n); + break; + case MESA_FORMAT_Z24_UNORM_S8_UINT: + unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(src, dst, n); + break; + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: + unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(src, dst, n); + break; + default: + _mesa_problem(NULL, + "bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row", + _mesa_get_format_name(format)); + return; + } +} + +/** + * Unpack depth/stencil + * \param format the source data format + * \param type the destination data type + */ +void +_mesa_unpack_depth_stencil_row(mesa_format format, GLuint n, + const void *src, GLenum type, + GLuint *dst) +{ + assert(type == GL_UNSIGNED_INT_24_8 || + type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); + + switch (type) { + case GL_UNSIGNED_INT_24_8: + _mesa_unpack_uint_24_8_depth_stencil_row(format, n, src, dst); + break; + case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + _mesa_unpack_float_32_uint_24_8_depth_stencil_row(format, n, src, dst); + break; + default: + _mesa_problem(NULL, + "bad type 0x%x in _mesa_unpack_depth_stencil_row", + type); + return; + } +} + diff --git a/prebuilt-intermediates/nir/nir_builder_opcodes.h b/prebuilt-intermediates/nir/nir_builder_opcodes.h new file mode 100644 index 00000000000..194a202079a --- /dev/null +++ b/prebuilt-intermediates/nir/nir_builder_opcodes.h @@ -0,0 +1,949 @@ +/* Copyright (C) 2015 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _NIR_BUILDER_OPCODES_ +#define _NIR_BUILDER_OPCODES_ + + + +static inline nir_ssa_def * +nir_b2f(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_b2f, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_b2i(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_b2i, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_ball_fequal2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ball_fequal2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ball_fequal3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ball_fequal3, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ball_fequal4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ball_fequal4, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ball_iequal2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ball_iequal2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ball_iequal3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ball_iequal3, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ball_iequal4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ball_iequal4, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_bany_fnequal2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_bany_fnequal2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_bany_fnequal3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_bany_fnequal3, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_bany_fnequal4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_bany_fnequal4, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_bany_inequal2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_bany_inequal2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_bany_inequal3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_bany_inequal3, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_bany_inequal4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_bany_inequal4, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_bcsel(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_bcsel, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_bfi(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_bfi, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_bfm(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_bfm, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_bit_count(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_bit_count, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_bitfield_insert(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2, nir_ssa_def *src3) +{ + return nir_build_alu(build, nir_op_bitfield_insert, src0, src1, src2, src3); +} +static inline nir_ssa_def * +nir_bitfield_reverse(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_bitfield_reverse, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_d2b(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_d2b, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_d2f(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_d2f, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_d2i(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_d2i, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_d2u(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_d2u, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_extract_i16(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_extract_i16, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_extract_i8(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_extract_i8, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_extract_u16(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_extract_u16, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_extract_u8(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_extract_u8, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_f2b(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_f2b, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_f2d(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_f2d, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_f2i(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_f2i, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_f2u(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_f2u, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fabs(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fabs, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fadd(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fadd, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fall_equal2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fall_equal2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fall_equal3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fall_equal3, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fall_equal4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fall_equal4, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fand(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fand, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fany_nequal2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fany_nequal2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fany_nequal3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fany_nequal3, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fany_nequal4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fany_nequal4, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fceil(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fceil, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fcos(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fcos, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fcsel(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_fcsel, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_fddx(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fddx, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fddx_coarse(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fddx_coarse, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fddx_fine(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fddx_fine, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fddy(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fddy, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fddy_coarse(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fddy_coarse, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fddy_fine(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fddy_fine, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdiv(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdiv, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdot2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdot2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdot3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdot3, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdot4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdot4, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdot_replicated2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdot_replicated2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdot_replicated3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdot_replicated3, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdot_replicated4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdot_replicated4, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdph(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdph, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fdph_replicated(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fdph_replicated, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_feq(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_feq, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fexp2(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fexp2, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_ffloor(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_ffloor, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_ffma(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_ffma, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_ffract(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_ffract, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fge(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fge, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_find_lsb(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_find_lsb, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_flog2(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_flog2, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_flrp(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_flrp, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_flt(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_flt, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fmax(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fmax, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fmin(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fmin, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fmod(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fmod, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fmov(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fmov, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fmul(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fmul, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fne(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fne, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fneg(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fneg, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise1_1(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise1_1, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise1_2(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise1_2, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise1_3(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise1_3, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise1_4(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise1_4, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise2_1(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise2_1, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise2_2(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise2_2, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise2_3(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise2_3, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise2_4(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise2_4, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise3_1(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise3_1, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise3_2(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise3_2, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise3_3(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise3_3, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise3_4(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise3_4, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise4_1(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise4_1, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise4_2(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise4_2, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise4_3(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise4_3, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnoise4_4(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnoise4_4, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fnot(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fnot, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_for(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_for, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fpow(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fpow, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fquantize2f16(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fquantize2f16, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_frcp(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_frcp, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_frem(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_frem, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_fround_even(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fround_even, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_frsq(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_frsq, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fsat(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fsat, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fsign(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fsign, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fsin(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fsin, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fsqrt(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_fsqrt, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fsub(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fsub, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ftrunc(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_ftrunc, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_fxor(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_fxor, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_i2b(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_i2b, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_i2d(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_i2d, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_i2f(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_i2f, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_iabs(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_iabs, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_iadd(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_iadd, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_iand(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_iand, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ibfe(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_ibfe, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_ibitfield_extract(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_ibitfield_extract, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_idiv(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_idiv, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ieq(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ieq, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ifind_msb(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_ifind_msb, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_ige(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ige, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ilt(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ilt, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_imax(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_imax, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_imin(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_imin, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_imod(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_imod, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_imov(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_imov, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_imul(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_imul, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_imul_high(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_imul_high, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ine(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ine, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ineg(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_ineg, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_inot(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_inot, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_ior(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ior, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_irem(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_irem, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ishl(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ishl, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ishr(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ishr, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_isign(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_isign, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_isub(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_isub, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ixor(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ixor, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ldexp(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ldexp, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_double_2x32(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_pack_double_2x32, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_double_2x32_split(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_pack_double_2x32_split, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_half_2x16(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_pack_half_2x16, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_half_2x16_split(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_pack_half_2x16_split, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_snorm_2x16(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_pack_snorm_2x16, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_snorm_4x8(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_pack_snorm_4x8, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_unorm_2x16(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_pack_unorm_2x16, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_unorm_4x8(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_pack_unorm_4x8, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_uvec2_to_uint(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_pack_uvec2_to_uint, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_pack_uvec4_to_uint(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_pack_uvec4_to_uint, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_seq(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_seq, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_sge(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_sge, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_slt(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_slt, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_sne(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_sne, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_u2d(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_u2d, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_u2f(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_u2f, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_uadd_carry(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_uadd_carry, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ubfe(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_ubfe, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_ubitfield_extract(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_ubitfield_extract, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_udiv(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_udiv, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ufind_msb(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_ufind_msb, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_uge(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_uge, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ult(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ult, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_umax(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_umax, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_umax_4x8(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_umax_4x8, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_umin(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_umin, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_umin_4x8(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_umin_4x8, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_umod(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_umod, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_umul_high(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_umul_high, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_umul_unorm_4x8(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_umul_unorm_4x8, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_double_2x32(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_double_2x32, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_double_2x32_split_x(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_double_2x32_split_x, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_double_2x32_split_y(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_double_2x32_split_y, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_half_2x16(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_half_2x16, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_half_2x16_split_x(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_half_2x16_split_x, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_half_2x16_split_y(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_half_2x16_split_y, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_snorm_2x16(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_snorm_2x16, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_snorm_4x8(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_snorm_4x8, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_unorm_2x16(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_unorm_2x16, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_unpack_unorm_4x8(nir_builder *build, nir_ssa_def *src0) +{ + return nir_build_alu(build, nir_op_unpack_unorm_4x8, src0, NULL, NULL, NULL); +} +static inline nir_ssa_def * +nir_usadd_4x8(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_usadd_4x8, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ushr(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ushr, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_ussub_4x8(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_ussub_4x8, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_usub_borrow(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_usub_borrow, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_vec2(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1) +{ + return nir_build_alu(build, nir_op_vec2, src0, src1, NULL, NULL); +} +static inline nir_ssa_def * +nir_vec3(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2) +{ + return nir_build_alu(build, nir_op_vec3, src0, src1, src2, NULL); +} +static inline nir_ssa_def * +nir_vec4(nir_builder *build, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2, nir_ssa_def *src3) +{ + return nir_build_alu(build, nir_op_vec4, src0, src1, src2, src3); +} + +#endif /* _NIR_BUILDER_OPCODES_ */ diff --git a/prebuilt-intermediates/nir/nir_constant_expressions.c b/prebuilt-intermediates/nir/nir_constant_expressions.c new file mode 100644 index 00000000000..d26a5e94509 --- /dev/null +++ b/prebuilt-intermediates/nir/nir_constant_expressions.c @@ -0,0 +1,10338 @@ +/* + * Copyright (C) 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Jason Ekstrand (jason@jlekstrand.net) + */ + +#include <math.h> +#include "main/core.h" +#include "util/rounding.h" /* for _mesa_roundeven */ +#include "util/half_float.h" +#include "nir_constant_expressions.h" + +/** + * Evaluate one component of packSnorm4x8. + */ +static uint8_t +pack_snorm_1x8(float x) +{ + /* From section 8.4 of the GLSL 4.30 spec: + * + * packSnorm4x8 + * ------------ + * The conversion for component c of v to fixed point is done as + * follows: + * + * packSnorm4x8: round(clamp(c, -1, +1) * 127.0) + * + * We must first cast the float to an int, because casting a negative + * float to a uint is undefined. + */ + return (uint8_t) (int) + _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 127.0f); +} + +/** + * Evaluate one component of packSnorm2x16. + */ +static uint16_t +pack_snorm_1x16(float x) +{ + /* From section 8.4 of the GLSL ES 3.00 spec: + * + * packSnorm2x16 + * ------------- + * The conversion for component c of v to fixed point is done as + * follows: + * + * packSnorm2x16: round(clamp(c, -1, +1) * 32767.0) + * + * We must first cast the float to an int, because casting a negative + * float to a uint is undefined. + */ + return (uint16_t) (int) + _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 32767.0f); +} + +/** + * Evaluate one component of unpackSnorm4x8. + */ +static float +unpack_snorm_1x8(uint8_t u) +{ + /* From section 8.4 of the GLSL 4.30 spec: + * + * unpackSnorm4x8 + * -------------- + * The conversion for unpacked fixed-point value f to floating point is + * done as follows: + * + * unpackSnorm4x8: clamp(f / 127.0, -1, +1) + */ + return CLAMP((int8_t) u / 127.0f, -1.0f, +1.0f); +} + +/** + * Evaluate one component of unpackSnorm2x16. + */ +static float +unpack_snorm_1x16(uint16_t u) +{ + /* From section 8.4 of the GLSL ES 3.00 spec: + * + * unpackSnorm2x16 + * --------------- + * The conversion for unpacked fixed-point value f to floating point is + * done as follows: + * + * unpackSnorm2x16: clamp(f / 32767.0, -1, +1) + */ + return CLAMP((int16_t) u / 32767.0f, -1.0f, +1.0f); +} + +/** + * Evaluate one component packUnorm4x8. + */ +static uint8_t +pack_unorm_1x8(float x) +{ + /* From section 8.4 of the GLSL 4.30 spec: + * + * packUnorm4x8 + * ------------ + * The conversion for component c of v to fixed point is done as + * follows: + * + * packUnorm4x8: round(clamp(c, 0, +1) * 255.0) + */ + return (uint8_t) (int) + _mesa_roundevenf(CLAMP(x, 0.0f, 1.0f) * 255.0f); +} + +/** + * Evaluate one component packUnorm2x16. + */ +static uint16_t +pack_unorm_1x16(float x) +{ + /* From section 8.4 of the GLSL ES 3.00 spec: + * + * packUnorm2x16 + * ------------- + * The conversion for component c of v to fixed point is done as + * follows: + * + * packUnorm2x16: round(clamp(c, 0, +1) * 65535.0) + */ + return (uint16_t) (int) + _mesa_roundevenf(CLAMP(x, 0.0f, 1.0f) * 65535.0f); +} + +/** + * Evaluate one component of unpackUnorm4x8. + */ +static float +unpack_unorm_1x8(uint8_t u) +{ + /* From section 8.4 of the GLSL 4.30 spec: + * + * unpackUnorm4x8 + * -------------- + * The conversion for unpacked fixed-point value f to floating point is + * done as follows: + * + * unpackUnorm4x8: f / 255.0 + */ + return (float) u / 255.0f; +} + +/** + * Evaluate one component of unpackUnorm2x16. + */ +static float +unpack_unorm_1x16(uint16_t u) +{ + /* From section 8.4 of the GLSL ES 3.00 spec: + * + * unpackUnorm2x16 + * --------------- + * The conversion for unpacked fixed-point value f to floating point is + * done as follows: + * + * unpackUnorm2x16: f / 65535.0 + */ + return (float) u / 65535.0f; +} + +/** + * Evaluate one component of packHalf2x16. + */ +static uint16_t +pack_half_1x16(float x) +{ + return _mesa_float_to_half(x); +} + +/** + * Evaluate one component of unpackHalf2x16. + */ +static float +unpack_half_1x16(uint16_t u) +{ + return _mesa_half_to_float(u); +} + +/* Some typed vector structures to make things like src0.y work */ +typedef float float32_t; +typedef double float64_t; +typedef bool bool32_t; +struct float32_vec { + float32_t x; + float32_t y; + float32_t z; + float32_t w; +}; +struct float64_vec { + float64_t x; + float64_t y; + float64_t z; + float64_t w; +}; +struct int32_vec { + int32_t x; + int32_t y; + int32_t z; + int32_t w; +}; +struct int64_vec { + int64_t x; + int64_t y; + int64_t z; + int64_t w; +}; +struct uint32_vec { + uint32_t x; + uint32_t y; + uint32_t z; + uint32_t w; +}; +struct uint64_vec { + uint64_t x; + uint64_t y; + uint64_t z; + uint64_t w; +}; + +struct bool32_vec { + bool x; + bool y; + bool z; + bool w; +}; + +static nir_const_value +evaluate_b2f(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const bool src0 = _src[0].u32[_i] != 0; + + float32_t dst = src0 ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const bool src0 = _src[0].u32[_i] != 0; + + float32_t dst = src0 ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_b2i(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const bool src0 = _src[0].u32[_i] != 0; + + int32_t dst = src0 ? 1 : 0; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const bool src0 = _src[0].u32[_i] != 0; + + int32_t dst = src0 ? 1 : 0; + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ball_fequal2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + 0, + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + 0, + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + 0, + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ball_fequal3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ball_fequal4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z) && (src0.w == src1.w)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + _src[0].f64[3], + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + _src[1].f64[3], + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z) && (src0.w == src1.w)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ball_iequal2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct int32_vec src0 = { + _src[0].i32[0], + _src[0].i32[1], + 0, + 0, + }; + + const struct int32_vec src1 = { + _src[1].i32[0], + _src[1].i32[1], + 0, + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct int64_vec src0 = { + _src[0].i64[0], + _src[0].i64[1], + 0, + 0, + }; + + const struct int64_vec src1 = { + _src[1].i64[0], + _src[1].i64[1], + 0, + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ball_iequal3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct int32_vec src0 = { + _src[0].i32[0], + _src[0].i32[1], + _src[0].i32[2], + 0, + }; + + const struct int32_vec src1 = { + _src[1].i32[0], + _src[1].i32[1], + _src[1].i32[2], + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct int64_vec src0 = { + _src[0].i64[0], + _src[0].i64[1], + _src[0].i64[2], + 0, + }; + + const struct int64_vec src1 = { + _src[1].i64[0], + _src[1].i64[1], + _src[1].i64[2], + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ball_iequal4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct int32_vec src0 = { + _src[0].i32[0], + _src[0].i32[1], + _src[0].i32[2], + _src[0].i32[3], + }; + + const struct int32_vec src1 = { + _src[1].i32[0], + _src[1].i32[1], + _src[1].i32[2], + _src[1].i32[3], + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z) && (src0.w == src1.w)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct int64_vec src0 = { + _src[0].i64[0], + _src[0].i64[1], + _src[0].i64[2], + _src[0].i64[3], + }; + + const struct int64_vec src1 = { + _src[1].i64[0], + _src[1].i64[1], + _src[1].i64[2], + _src[1].i64[3], + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z) && (src0.w == src1.w)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bany_fnequal2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + 0, + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + 0, + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + 0, + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bany_fnequal3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bany_fnequal4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z) || (src0.w != src1.w)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + _src[0].f64[3], + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + _src[1].f64[3], + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z) || (src0.w != src1.w)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bany_inequal2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct int32_vec src0 = { + _src[0].i32[0], + _src[0].i32[1], + 0, + 0, + }; + + const struct int32_vec src1 = { + _src[1].i32[0], + _src[1].i32[1], + 0, + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct int64_vec src0 = { + _src[0].i64[0], + _src[0].i64[1], + 0, + 0, + }; + + const struct int64_vec src1 = { + _src[1].i64[0], + _src[1].i64[1], + 0, + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bany_inequal3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct int32_vec src0 = { + _src[0].i32[0], + _src[0].i32[1], + _src[0].i32[2], + 0, + }; + + const struct int32_vec src1 = { + _src[1].i32[0], + _src[1].i32[1], + _src[1].i32[2], + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct int64_vec src0 = { + _src[0].i64[0], + _src[0].i64[1], + _src[0].i64[2], + 0, + }; + + const struct int64_vec src1 = { + _src[1].i64[0], + _src[1].i64[1], + _src[1].i64[2], + 0, + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bany_inequal4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct int32_vec src0 = { + _src[0].i32[0], + _src[0].i32[1], + _src[0].i32[2], + _src[0].i32[3], + }; + + const struct int32_vec src1 = { + _src[1].i32[0], + _src[1].i32[1], + _src[1].i32[2], + _src[1].i32[3], + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z) || (src0.w != src1.w)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + case 64: { + + + + const struct int64_vec src0 = { + _src[0].i64[0], + _src[0].i64[1], + _src[0].i64[2], + _src[0].i64[3], + }; + + const struct int64_vec src1 = { + _src[1].i64[0], + _src[1].i64[1], + _src[1].i64[2], + _src[1].i64[3], + }; + + struct bool32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z) || (src0.w != src1.w)); + + _dst_val.u32[0] = dst.x ? NIR_TRUE : NIR_FALSE; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bcsel(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const bool src0 = _src[0].u32[_i] != 0; + const uint32_t src1 = + _src[1].u32[_i]; + const uint32_t src2 = + _src[2].u32[_i]; + + uint32_t dst = src0 ? src1 : src2; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const bool src0 = _src[0].u32[_i] != 0; + const uint64_t src1 = + _src[1].u64[_i]; + const uint64_t src2 = + _src[2].u64[_i]; + + uint64_t dst = src0 ? src1 : src2; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bfi(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + const uint32_t src2 = + _src[2].u32[_i]; + + uint32_t dst; + + +unsigned mask = src0, insert = src1, base = src2; +if (mask == 0) { + dst = base; +} else { + unsigned tmp = mask; + while (!(tmp & 1)) { + tmp >>= 1; + insert <<= 1; + } + dst = (base & ~mask) | (insert & mask); +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + const uint32_t src2 = + _src[2].u32[_i]; + + uint32_t dst; + + +unsigned mask = src0, insert = src1, base = src2; +if (mask == 0) { + dst = base; +} else { + unsigned tmp = mask; + while (!(tmp & 1)) { + tmp >>= 1; + insert <<= 1; + } + dst = (base & ~mask) | (insert & mask); +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bfm(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + uint32_t dst; + + +int bits = src0, offset = src1; +if (offset < 0 || bits < 0 || offset > 31 || bits > 31 || offset + bits > 32) + dst = 0; /* undefined */ +else + dst = ((1u << bits) - 1) << offset; + + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + uint32_t dst; + + +int bits = src0, offset = src1; +if (offset < 0 || bits < 0 || offset > 31 || bits > 31 || offset + bits > 32) + dst = 0; /* undefined */ +else + dst = ((1u << bits) - 1) << offset; + + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bit_count(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + uint32_t dst; + + +dst = 0; +for (unsigned bit = 0; bit < 32; bit++) { + if ((src0 >> bit) & 1) + dst++; +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + uint32_t dst; + + +dst = 0; +for (unsigned bit = 0; bit < 32; bit++) { + if ((src0 >> bit) & 1) + dst++; +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bitfield_insert(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + const int32_t src3 = + _src[3].i32[_i]; + + uint32_t dst; + + +unsigned base = src0, insert = src1; +int offset = src2, bits = src3; +if (bits == 0) { + dst = 0; +} else if (offset < 0 || bits < 0 || bits + offset > 32) { + dst = 0; +} else { + unsigned mask = ((1ull << bits) - 1) << offset; + dst = (base & ~mask) | ((insert << bits) & mask); +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + const int32_t src3 = + _src[3].i32[_i]; + + uint32_t dst; + + +unsigned base = src0, insert = src1; +int offset = src2, bits = src3; +if (bits == 0) { + dst = 0; +} else if (offset < 0 || bits < 0 || bits + offset > 32) { + dst = 0; +} else { + unsigned mask = ((1ull << bits) - 1) << offset; + dst = (base & ~mask) | ((insert << bits) & mask); +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_bitfield_reverse(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + uint32_t dst; + + +/* we're not winning any awards for speed here, but that's ok */ +dst = 0; +for (unsigned bit = 0; bit < 32; bit++) + dst |= ((src0 >> bit) & 1) << (31 - bit); + + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + uint32_t dst; + + +/* we're not winning any awards for speed here, but that's ok */ +dst = 0; +for (unsigned bit = 0; bit < 32; bit++) + dst |= ((src0 >> bit) & 1) << (31 - bit); + + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_d2b(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + bool32_t dst = src0 != 0.0; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + bool32_t dst = src0 != 0.0; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_d2f(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float32_t dst = src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float32_t dst = src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_d2i(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + int32_t dst = src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + int32_t dst = src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_d2u(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + uint32_t dst = src0; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + uint32_t dst = src0; + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_extract_i16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = (int16_t)(src0 >> (src1 * 16)); + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = (int16_t)(src0 >> (src1 * 16)); + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_extract_i8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = (int8_t)(src0 >> (src1 * 8)); + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = (int8_t)(src0 >> (src1 * 8)); + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_extract_u16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = (uint16_t)(src0 >> (src1 * 16)); + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = (uint16_t)(src0 >> (src1 * 16)); + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_extract_u8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = (uint8_t)(src0 >> (src1 * 8)); + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = (uint8_t)(src0 >> (src1 * 8)); + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_f2b(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + bool32_t dst = src0 != 0.0f; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + bool32_t dst = src0 != 0.0f; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_f2d(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float64_t dst = src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float64_t dst = src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_f2i(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + int32_t dst = src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + int32_t dst = src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_f2u(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + uint32_t dst = src0; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + uint32_t dst = src0; + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fabs(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? fabs(src0) : fabsf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? fabs(src0) : fabsf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fadd(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = src0 + src1; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = src0 + src1; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fall_equal2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fall_equal3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fall_equal4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z) && (src0.w == src1.w)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x == src1.x) && (src0.y == src1.y) && (src0.z == src1.z) && (src0.w == src1.w)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fand(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = ((src0 != 0.0f) && (src1 != 0.0f)) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = ((src0 != 0.0f) && (src1 != 0.0f)) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fany_nequal2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fany_nequal3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fany_nequal4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z) || (src0.w != src1.w)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x != src1.x) || (src0.y != src1.y) || (src0.z != src1.z) || (src0.w != src1.w)) ? 1.0f : 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fceil(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? ceil(src0) : ceilf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? ceil(src0) : ceilf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fcos(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? cos(src0) : cosf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? cos(src0) : cosf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fcsel(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + const float32_t src2 = + _src[2].f32[_i]; + + float32_t dst = (src0 != 0.0f) ? src1 : src2; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + const float32_t src2 = + _src[2].f32[_i]; + + float32_t dst = (src0 != 0.0f) ? src1 : src2; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fddx(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float32_t dst = 0.0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float64_t dst = 0.0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fddx_coarse(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float32_t dst = 0.0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float64_t dst = 0.0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fddx_fine(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float32_t dst = 0.0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float64_t dst = 0.0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fddy(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float32_t dst = 0.0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float64_t dst = 0.0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fddy_coarse(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float32_t dst = 0.0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float64_t dst = 0.0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fddy_fine(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float32_t dst = 0.0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + + float64_t dst = 0.0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdiv(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = src0 / src1; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = src0 / src1; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdot2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y)); + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + 0, + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + 0, + 0, + }; + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y)); + + _dst_val.f64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdot3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y) + (src0.z * src1.z)); + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + 0, + }; + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y) + (src0.z * src1.z)); + + _dst_val.f64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdot4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y) + (src0.z * src1.z) + (src0.w * src1.w)); + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + _src[0].f64[3], + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + _src[1].f64[3], + }; + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y) + (src0.z * src1.z) + (src0.w * src1.w)); + + _dst_val.f64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdot_replicated2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y)); + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + 0, + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + 0, + 0, + }; + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y)); + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + _dst_val.f64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdot_replicated3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y) + (src0.z * src1.z)); + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + 0, + }; + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y) + (src0.z * src1.z)); + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + _dst_val.f64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdot_replicated4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y) + (src0.z * src1.z) + (src0.w * src1.w)); + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + _src[0].f64[3], + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + _src[1].f64[3], + }; + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = ((src0.x * src1.x) + (src0.y * src1.y) + (src0.z * src1.z) + (src0.w * src1.w)); + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + _dst_val.f64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdph(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + _src[1].f64[3], + }; + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w; + + _dst_val.f64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fdph_replicated(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + _src[1].f32[1], + _src[1].f32[2], + _src[1].f32[3], + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + const struct float64_vec src0 = { + _src[0].f64[0], + _src[0].f64[1], + _src[0].f64[2], + 0, + }; + + const struct float64_vec src1 = { + _src[1].f64[0], + _src[1].f64[1], + _src[1].f64[2], + _src[1].f64[3], + }; + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + _dst_val.f64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_feq(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + bool32_t dst = src0 == src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + bool32_t dst = src0 == src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fexp2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = exp2f(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = exp2f(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ffloor(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? floor(src0) : floorf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? floor(src0) : floorf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ffma(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + const float32_t src2 = + _src[2].f32[_i]; + + float32_t dst = src0 * src1 + src2; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + const float64_t src2 = + _src[2].f64[_i]; + + float64_t dst = src0 * src1 + src2; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ffract(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = src0 - (bit_size == 64 ? floor(src0) : floorf(src0)); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = src0 - (bit_size == 64 ? floor(src0) : floorf(src0)); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fge(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + bool32_t dst = src0 >= src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + bool32_t dst = src0 >= src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_find_lsb(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst; + + +dst = -1; +for (unsigned bit = 0; bit < 32; bit++) { + if ((src0 >> bit) & 1) { + dst = bit; + break; + } +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst; + + +dst = -1; +for (unsigned bit = 0; bit < 32; bit++) { + if ((src0 >> bit) & 1) { + dst = bit; + break; + } +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_flog2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = log2f(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = log2f(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_flrp(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + const float32_t src2 = + _src[2].f32[_i]; + + float32_t dst = src0 * (1 - src2) + src1 * src2; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + const float64_t src2 = + _src[2].f64[_i]; + + float64_t dst = src0 * (1 - src2) + src1 * src2; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_flt(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + bool32_t dst = src0 < src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + bool32_t dst = src0 < src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fmax(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = fmaxf(src0, src1); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = fmaxf(src0, src1); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fmin(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = fminf(src0, src1); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = fminf(src0, src1); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fmod(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = src0 - src1 * floorf(src0 / src1); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = src0 - src1 * floorf(src0 / src1); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fmov(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fmul(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = src0 * src1; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = src0 * src1; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fne(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + bool32_t dst = src0 != src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + bool32_t dst = src0 != src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fneg(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = -src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = -src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise1_1(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise1_2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise1_3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise1_4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise2_1(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise2_2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise2_3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise2_4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise3_1(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise3_2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise3_3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise3_4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise4_1(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + _dst_val.f64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise4_2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + _dst_val.f64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise4_3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + _dst_val.f64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnoise4_4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + struct float64_vec dst; + + dst.x = dst.y = dst.z = dst.w = 0.0f; + + _dst_val.f64[0] = dst.x; + _dst_val.f64[1] = dst.y; + _dst_val.f64[2] = dst.z; + _dst_val.f64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fnot(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? ((src0 == 0.0) ? 1.0 : 0.0f) : ((src0 == 0.0f) ? 1.0f : 0.0f); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? ((src0 == 0.0) ? 1.0 : 0.0f) : ((src0 == 0.0f) ? 1.0f : 0.0f); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_for(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = ((src0 != 0.0f) || (src1 != 0.0f)) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = ((src0 != 0.0f) || (src1 != 0.0f)) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fpow(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = bit_size == 64 ? powf(src0, src1) : pow(src0, src1); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = bit_size == 64 ? powf(src0, src1) : pow(src0, src1); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fquantize2f16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = (fabs(src0) < ldexpf(1.0, -14)) ? copysignf(0.0f, src0) : _mesa_half_to_float(_mesa_float_to_half(src0)); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = (fabs(src0) < ldexpf(1.0, -14)) ? copysignf(0.0f, src0) : _mesa_half_to_float(_mesa_float_to_half(src0)); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_frcp(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? 1.0 / src0 : 1.0f / src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? 1.0 / src0 : 1.0f / src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_frem(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = src0 - src1 * truncf(src0 / src1); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = src0 - src1 * truncf(src0 / src1); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fround_even(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? _mesa_roundeven(src0) : _mesa_roundevenf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? _mesa_roundeven(src0) : _mesa_roundevenf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_frsq(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? 1.0 / sqrt(src0) : 1.0f / sqrtf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? 1.0 / sqrt(src0) : 1.0f / sqrtf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fsat(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? ((src0 > 1.0) ? 1.0 : ((src0 <= 0.0) ? 0.0 : src0)) : ((src0 > 1.0f) ? 1.0f : ((src0 <= 0.0f) ? 0.0f : src0)); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? ((src0 > 1.0) ? 1.0 : ((src0 <= 0.0) ? 0.0 : src0)) : ((src0 > 1.0f) ? 1.0f : ((src0 <= 0.0f) ? 0.0f : src0)); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fsign(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? ((src0 == 0.0) ? 0.0 : ((src0 > 0.0) ? 1.0 : -1.0)) : ((src0 == 0.0f) ? 0.0f : ((src0 > 0.0f) ? 1.0f : -1.0f)); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? ((src0 == 0.0) ? 0.0 : ((src0 > 0.0) ? 1.0 : -1.0)) : ((src0 == 0.0f) ? 0.0f : ((src0 > 0.0f) ? 1.0f : -1.0f)); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fsin(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? sin(src0) : sinf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? sin(src0) : sinf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fsqrt(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? sqrt(src0) : sqrtf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? sqrt(src0) : sqrtf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fsub(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = src0 - src1; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const float64_t src1 = + _src[1].f64[_i]; + + float64_t dst = src0 - src1; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ftrunc(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + + float32_t dst = bit_size == 64 ? trunc(src0) : truncf(src0); + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + + float64_t dst = bit_size == 64 ? trunc(src0) : truncf(src0); + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_fxor(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 != 0.0f && src1 == 0.0f) || (src0 == 0.0f && src1 != 0.0f) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 != 0.0f && src1 == 0.0f) || (src0 == 0.0f && src1 != 0.0f) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_i2b(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + bool32_t dst = src0 != 0; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + bool32_t dst = src0 != 0; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_i2d(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + float64_t dst = src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + float64_t dst = src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_i2f(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + float32_t dst = src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + float32_t dst = src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_iabs(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst = (src0 < 0) ? -src0 : src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + + int64_t dst = (src0 < 0) ? -src0 : src0; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_iadd(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src0 + src1; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src0 + src1; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_iand(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src0 & src1; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src0 & src1; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ibfe(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + + int32_t dst; + + +int base = src0; +int offset = src1, bits = src2; +if (bits == 0) { + dst = 0; +} else if (bits < 0 || offset < 0) { + dst = 0; /* undefined */ +} else if (offset + bits < 32) { + dst = (base << (32 - bits - offset)) >> (32 - bits); +} else { + dst = base >> offset; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + + int32_t dst; + + +int base = src0; +int offset = src1, bits = src2; +if (bits == 0) { + dst = 0; +} else if (bits < 0 || offset < 0) { + dst = 0; /* undefined */ +} else if (offset + bits < 32) { + dst = (base << (32 - bits - offset)) >> (32 - bits); +} else { + dst = base >> offset; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ibitfield_extract(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + + int32_t dst; + + +int base = src0; +int offset = src1, bits = src2; +if (bits == 0) { + dst = 0; +} else if (offset < 0 || bits < 0 || offset + bits > 32) { + dst = 0; +} else { + dst = (base << (32 - offset - bits)) >> offset; /* use sign-extending shift */ +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + + int32_t dst; + + +int base = src0; +int offset = src1, bits = src2; +if (bits == 0) { + dst = 0; +} else if (offset < 0 || bits < 0 || offset + bits > 32) { + dst = 0; +} else { + dst = (base << (32 - offset - bits)) >> offset; /* use sign-extending shift */ +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_idiv(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src0 / src1; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src0 / src1; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ieq(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + bool32_t dst = src0 == src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + bool32_t dst = src0 == src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ifind_msb(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst; + + +dst = -1; +for (int bit = 31; bit >= 0; bit--) { + /* If src0 < 0, we're looking for the first 0 bit. + * if src0 >= 0, we're looking for the first 1 bit. + */ + if ((((src0 >> bit) & 1) && (src0 >= 0)) || + (!((src0 >> bit) & 1) && (src0 < 0))) { + dst = bit; + break; + } +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst; + + +dst = -1; +for (int bit = 31; bit >= 0; bit--) { + /* If src0 < 0, we're looking for the first 0 bit. + * if src0 >= 0, we're looking for the first 1 bit. + */ + if ((((src0 >> bit) & 1) && (src0 >= 0)) || + (!((src0 >> bit) & 1) && (src0 < 0))) { + dst = bit; + break; + } +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ige(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + bool32_t dst = src0 >= src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + bool32_t dst = src0 >= src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ilt(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + bool32_t dst = src0 < src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + bool32_t dst = src0 < src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_imax(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src1 > src0 ? src1 : src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src1 > src0 ? src1 : src0; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_imin(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src1 > src0 ? src0 : src1; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src1 > src0 ? src0 : src1; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_imod(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src1 == 0 ? 0 : ((src0 % src1 == 0 || (src0 >= 0) == (src1 >= 0)) ? src0 % src1 : src0 % src1 + src1); + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src1 == 0 ? 0 : ((src0 % src1 == 0 || (src0 >= 0) == (src1 >= 0)) ? src0 % src1 : src0 % src1 + src1); + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_imov(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst = src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + + int64_t dst = src0; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_imul(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src0 * src1; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src0 * src1; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_imul_high(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = (int32_t)(((int64_t) src0 * (int64_t) src1) >> 32); + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = (int32_t)(((int64_t) src0 * (int64_t) src1) >> 32); + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ine(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + bool32_t dst = src0 != src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + bool32_t dst = src0 != src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ineg(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst = -src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + + int64_t dst = -src0; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_inot(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst = ~src0; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + + int64_t dst = ~src0; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ior(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src0 | src1; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src0 | src1; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_irem(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src1 == 0 ? 0 : src0 % src1; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src1 == 0 ? 0 : src0 % src1; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ishl(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src0 << src1; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src0 << src1; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ishr(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src0 >> src1; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src0 >> src1; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_isign(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + + int32_t dst = (src0 == 0) ? 0 : ((src0 > 0) ? 1 : -1); + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + + int64_t dst = (src0 == 0) ? 0 : ((src0 > 0) ? 1 : -1); + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_isub(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst = src0 - src1; + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int64_t src0 = + _src[0].i64[_i]; + const int64_t src1 = + _src[1].i64[_i]; + + int64_t dst = src0 - src1; + + _dst_val.i64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ixor(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src0 ^ src1; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src0 ^ src1; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ldexp(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + float32_t dst; + + +dst = (bit_size == 64) ? ldexp(src0, src1) : ldexpf(src0, src1); +/* flush denormals to zero. */ +if (!isnormal(dst)) + dst = copysignf(0.0f, src0); + + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float64_t src0 = + _src[0].f64[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + float64_t dst; + + +dst = (bit_size == 64) ? ldexp(src0, src1) : ldexpf(src0, src1); +/* flush denormals to zero. */ +if (!isnormal(dst)) + dst = copysignf(0.0f, src0); + + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_double_2x32(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + _src[0].u32[1], + 0, + 0, + }; + + struct uint64_vec dst; + + dst.x = src0.x | ((uint64_t)src0.y << 32); + + _dst_val.u64[0] = dst.x; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + _src[0].u32[1], + 0, + 0, + }; + + struct uint64_vec dst; + + dst.x = src0.x | ((uint64_t)src0.y << 32); + + _dst_val.u64[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_double_2x32_split(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint64_t dst = src0 | ((uint64_t)src1 << 32); + + _dst_val.u64[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint64_t dst = src0 | ((uint64_t)src1 << 32); + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_half_2x16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_half_1x16(src0.x); +dst.x |= ((uint32_t) pack_half_1x16(src0.y)) << 16; + + + _dst_val.u32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_half_1x16(src0.x); +dst.x |= ((uint32_t) pack_half_1x16(src0.y)) << 16; + + + _dst_val.u32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_half_2x16_split(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + 0, + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + 0, + 0, + 0, + }; + + struct uint32_vec dst; + + dst.x = dst.y = dst.z = dst.w = pack_half_1x16(src0.x) | (pack_half_1x16(src1.x) << 16); + + _dst_val.u32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + 0, + 0, + 0, + }; + + const struct float32_vec src1 = { + _src[1].f32[0], + 0, + 0, + 0, + }; + + struct uint32_vec dst; + + dst.x = dst.y = dst.z = dst.w = pack_half_1x16(src0.x) | (pack_half_1x16(src1.x) << 16); + + _dst_val.u32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_snorm_2x16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_snorm_1x16(src0.x); +dst.x |= ((uint32_t) pack_snorm_1x16(src0.y)) << 16; + + + _dst_val.u32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_snorm_1x16(src0.x); +dst.x |= ((uint32_t) pack_snorm_1x16(src0.y)) << 16; + + + _dst_val.u32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_snorm_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_snorm_1x8(src0.x); +dst.x |= ((uint32_t) pack_snorm_1x8(src0.y)) << 8; +dst.x |= ((uint32_t) pack_snorm_1x8(src0.z)) << 16; +dst.x |= ((uint32_t) pack_snorm_1x8(src0.w)) << 24; + + + _dst_val.u32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_snorm_1x8(src0.x); +dst.x |= ((uint32_t) pack_snorm_1x8(src0.y)) << 8; +dst.x |= ((uint32_t) pack_snorm_1x8(src0.z)) << 16; +dst.x |= ((uint32_t) pack_snorm_1x8(src0.w)) << 24; + + + _dst_val.u32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_unorm_2x16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_unorm_1x16(src0.x); +dst.x |= ((uint32_t) pack_unorm_1x16(src0.y)) << 16; + + + _dst_val.u32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_unorm_1x16(src0.x); +dst.x |= ((uint32_t) pack_unorm_1x16(src0.y)) << 16; + + + _dst_val.u32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_unorm_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_unorm_1x8(src0.x); +dst.x |= ((uint32_t) pack_unorm_1x8(src0.y)) << 8; +dst.x |= ((uint32_t) pack_unorm_1x8(src0.z)) << 16; +dst.x |= ((uint32_t) pack_unorm_1x8(src0.w)) << 24; + + + _dst_val.u32[0] = dst.x; + + break; + } + case 64: { + + + + const struct float32_vec src0 = { + _src[0].f32[0], + _src[0].f32[1], + _src[0].f32[2], + _src[0].f32[3], + }; + + struct uint32_vec dst; + + +dst.x = (uint32_t) pack_unorm_1x8(src0.x); +dst.x |= ((uint32_t) pack_unorm_1x8(src0.y)) << 8; +dst.x |= ((uint32_t) pack_unorm_1x8(src0.z)) << 16; +dst.x |= ((uint32_t) pack_unorm_1x8(src0.w)) << 24; + + + _dst_val.u32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_uvec2_to_uint(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + _src[0].u32[1], + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = (src0.x & 0xffff) | (src0.y << 16); + + + _dst_val.u32[0] = dst.x; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + _src[0].u32[1], + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = (src0.x & 0xffff) | (src0.y << 16); + + + _dst_val.u32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_pack_uvec4_to_uint(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + _src[0].u32[1], + _src[0].u32[2], + _src[0].u32[3], + }; + + struct uint32_vec dst; + + +dst.x = (src0.x << 0) | + (src0.y << 8) | + (src0.z << 16) | + (src0.w << 24); + + + _dst_val.u32[0] = dst.x; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + _src[0].u32[1], + _src[0].u32[2], + _src[0].u32[3], + }; + + struct uint32_vec dst; + + +dst.x = (src0.x << 0) | + (src0.y << 8) | + (src0.z << 16) | + (src0.w << 24); + + + _dst_val.u32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_seq(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 == src1) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 == src1) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_sge(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 >= src1) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 >= src1) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_slt(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 < src1) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 < src1) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_sne(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 != src1) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const float32_t src0 = + _src[0].f32[_i]; + const float32_t src1 = + _src[1].f32[_i]; + + float32_t dst = (src0 != src1) ? 1.0f : 0.0f; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_u2d(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + float64_t dst = src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + float64_t dst = src0; + + _dst_val.f64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_u2f(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + float32_t dst = src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + float32_t dst = src0; + + _dst_val.f32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_uadd_carry(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src0 + src1 < src0; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src0 + src1 < src0; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ubfe(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + + uint32_t dst; + + +unsigned base = src0; +int offset = src1, bits = src2; +if (bits == 0) { + dst = 0; +} else if (bits < 0 || offset < 0) { + dst = 0; /* undefined */ +} else if (offset + bits < 32) { + dst = (base << (32 - bits - offset)) >> (32 - bits); +} else { + dst = base >> offset; +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + + uint32_t dst; + + +unsigned base = src0; +int offset = src1, bits = src2; +if (bits == 0) { + dst = 0; +} else if (bits < 0 || offset < 0) { + dst = 0; /* undefined */ +} else if (offset + bits < 32) { + dst = (base << (32 - bits - offset)) >> (32 - bits); +} else { + dst = base >> offset; +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ubitfield_extract(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + + uint32_t dst; + + +unsigned base = src0; +int offset = src1, bits = src2; +if (bits == 0) { + dst = 0; +} else if (bits < 0 || offset < 0 || offset + bits > 32) { + dst = 0; /* undefined per the spec */ +} else { + dst = (base >> offset) & ((1ull << bits) - 1); +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + const int32_t src2 = + _src[2].i32[_i]; + + uint32_t dst; + + +unsigned base = src0; +int offset = src1, bits = src2; +if (bits == 0) { + dst = 0; +} else if (bits < 0 || offset < 0 || offset + bits > 32) { + dst = 0; /* undefined per the spec */ +} else { + dst = (base >> offset) & ((1ull << bits) - 1); +} + + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_udiv(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src0 / src1; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src0 / src1; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ufind_msb(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + int32_t dst; + + +dst = -1; +for (int bit = 31; bit > 0; bit--) { + if ((src0 >> bit) & 1) { + dst = bit; + break; + } +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + + int32_t dst; + + +dst = -1; +for (int bit = 31; bit > 0; bit--) { + if ((src0 >> bit) & 1) { + dst = bit; + break; + } +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_uge(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + bool32_t dst = src0 >= src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + bool32_t dst = src0 >= src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ult(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + bool32_t dst = src0 < src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + bool32_t dst = src0 < src1; + + _dst_val.u32[_i] = dst ? NIR_TRUE : NIR_FALSE; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_umax(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src1 > src0 ? src1 : src0; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src1 > src0 ? src1 : src0; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_umax_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + dst |= MAX2((src0 >> i) & 0xff, (src1 >> i) & 0xff) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + dst |= MAX2((src0 >> i) & 0xff, (src1 >> i) & 0xff) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_umin(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src1 > src0 ? src0 : src1; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src1 > src0 ? src0 : src1; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_umin_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + dst |= MIN2((src0 >> i) & 0xff, (src1 >> i) & 0xff) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + dst |= MIN2((src0 >> i) & 0xff, (src1 >> i) & 0xff) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_umod(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src1 == 0 ? 0 : src0 % src1; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src1 == 0 ? 0 : src0 % src1; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_umul_high(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = (uint32_t)(((uint64_t) src0 * (uint64_t) src1) >> 32); + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = (uint32_t)(((uint64_t) src0 * (uint64_t) src1) >> 32); + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_umul_unorm_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + int src0_chan = (src0 >> i) & 0xff; + int src1_chan = (src1 >> i) & 0xff; + dst |= ((src0_chan * src1_chan) / 255) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + int src0_chan = (src0 >> i) & 0xff; + int src1_chan = (src1 >> i) & 0xff; + dst |= ((src0_chan * src1_chan) / 255) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_double_2x32(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint64_vec src0 = { + _src[0].u64[0], + 0, + 0, + 0, + }; + + struct uint32_vec dst; + + dst.x = src0.x; dst.y = src0.x >> 32; + + _dst_val.u32[0] = dst.x; + _dst_val.u32[1] = dst.y; + + break; + } + case 64: { + + + + const struct uint64_vec src0 = { + _src[0].u64[0], + 0, + 0, + 0, + }; + + struct uint32_vec dst; + + dst.x = src0.x; dst.y = src0.x >> 32; + + _dst_val.u32[0] = dst.x; + _dst_val.u32[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_double_2x32_split_x(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + + uint32_t dst = src0; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + + uint32_t dst = src0; + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_double_2x32_split_y(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + + uint32_t dst = src0 >> 32; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + + uint32_t dst = src0 >> 32; + + _dst_val.u32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_half_2x16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_half_1x16((uint16_t)(src0.x & 0xffff)); +dst.y = unpack_half_1x16((uint16_t)(src0.x << 16)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_half_1x16((uint16_t)(src0.x & 0xffff)); +dst.y = unpack_half_1x16((uint16_t)(src0.x << 16)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_half_2x16_split_x(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = unpack_half_1x16((uint16_t)(src0.x & 0xffff)); + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = unpack_half_1x16((uint16_t)(src0.x & 0xffff)); + + _dst_val.f32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_half_2x16_split_y(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = unpack_half_1x16((uint16_t)(src0.x >> 16)); + + _dst_val.f32[0] = dst.x; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + dst.x = dst.y = dst.z = dst.w = unpack_half_1x16((uint16_t)(src0.x >> 16)); + + _dst_val.f32[0] = dst.x; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_snorm_2x16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_snorm_1x16((uint16_t)(src0.x & 0xffff)); +dst.y = unpack_snorm_1x16((uint16_t)(src0.x << 16)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_snorm_1x16((uint16_t)(src0.x & 0xffff)); +dst.y = unpack_snorm_1x16((uint16_t)(src0.x << 16)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_snorm_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_snorm_1x8((uint8_t)(src0.x & 0xff)); +dst.y = unpack_snorm_1x8((uint8_t)((src0.x >> 8) & 0xff)); +dst.z = unpack_snorm_1x8((uint8_t)((src0.x >> 16) & 0xff)); +dst.w = unpack_snorm_1x8((uint8_t)(src0.x >> 24)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_snorm_1x8((uint8_t)(src0.x & 0xff)); +dst.y = unpack_snorm_1x8((uint8_t)((src0.x >> 8) & 0xff)); +dst.z = unpack_snorm_1x8((uint8_t)((src0.x >> 16) & 0xff)); +dst.w = unpack_snorm_1x8((uint8_t)(src0.x >> 24)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_unorm_2x16(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_unorm_1x16((uint16_t)(src0.x & 0xffff)); +dst.y = unpack_unorm_1x16((uint16_t)(src0.x << 16)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_unorm_1x16((uint16_t)(src0.x & 0xffff)); +dst.y = unpack_unorm_1x16((uint16_t)(src0.x << 16)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_unpack_unorm_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_unorm_1x8((uint8_t)(src0.x & 0xff)); +dst.y = unpack_unorm_1x8((uint8_t)((src0.x >> 8) & 0xff)); +dst.z = unpack_unorm_1x8((uint8_t)((src0.x >> 16) & 0xff)); +dst.w = unpack_unorm_1x8((uint8_t)(src0.x >> 24)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + case 64: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + struct float32_vec dst; + + +dst.x = unpack_unorm_1x8((uint8_t)(src0.x & 0xff)); +dst.y = unpack_unorm_1x8((uint8_t)((src0.x >> 8) & 0xff)); +dst.z = unpack_unorm_1x8((uint8_t)((src0.x >> 16) & 0xff)); +dst.w = unpack_unorm_1x8((uint8_t)(src0.x >> 24)); + + + _dst_val.f32[0] = dst.x; + _dst_val.f32[1] = dst.y; + _dst_val.f32[2] = dst.z; + _dst_val.f32[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_usadd_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + dst |= MIN2(((src0 >> i) & 0xff) + ((src1 >> i) & 0xff), 0xff) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + dst |= MIN2(((src0 >> i) & 0xff) + ((src1 >> i) & 0xff), 0xff) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ushr(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src0 >> src1; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src0 >> src1; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_ussub_4x8(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + int src0_chan = (src0 >> i) & 0xff; + int src1_chan = (src1 >> i) & 0xff; + if (src0_chan > src1_chan) + dst |= (src0_chan - src1_chan) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const int32_t src0 = + _src[0].i32[_i]; + const int32_t src1 = + _src[1].i32[_i]; + + int32_t dst; + + +dst = 0; +for (int i = 0; i < 32; i += 8) { + int src0_chan = (src0 >> i) & 0xff; + int src1_chan = (src1 >> i) & 0xff; + if (src0_chan > src1_chan) + dst |= (src0_chan - src1_chan) << i; +} + + + _dst_val.i32[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_usub_borrow(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint32_t src0 = + _src[0].u32[_i]; + const uint32_t src1 = + _src[1].u32[_i]; + + uint32_t dst = src0 < src1; + + _dst_val.u32[_i] = dst; + } + + break; + } + case 64: { + + + + for (unsigned _i = 0; _i < num_components; _i++) { + const uint64_t src0 = + _src[0].u64[_i]; + const uint64_t src1 = + _src[1].u64[_i]; + + uint64_t dst = src0 < src1; + + _dst_val.u64[_i] = dst; + } + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_vec2(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + const struct uint32_vec src1 = { + _src[1].u32[0], + 0, + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = src0.x; +dst.y = src1.x; + + + _dst_val.u32[0] = dst.x; + _dst_val.u32[1] = dst.y; + + break; + } + case 64: { + + + + const struct uint64_vec src0 = { + _src[0].u64[0], + 0, + 0, + 0, + }; + + const struct uint64_vec src1 = { + _src[1].u64[0], + 0, + 0, + 0, + }; + + struct uint64_vec dst; + + +dst.x = src0.x; +dst.y = src1.x; + + + _dst_val.u64[0] = dst.x; + _dst_val.u64[1] = dst.y; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_vec3(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + const struct uint32_vec src1 = { + _src[1].u32[0], + 0, + 0, + 0, + }; + + const struct uint32_vec src2 = { + _src[2].u32[0], + 0, + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = src0.x; +dst.y = src1.x; +dst.z = src2.x; + + + _dst_val.u32[0] = dst.x; + _dst_val.u32[1] = dst.y; + _dst_val.u32[2] = dst.z; + + break; + } + case 64: { + + + + const struct uint64_vec src0 = { + _src[0].u64[0], + 0, + 0, + 0, + }; + + const struct uint64_vec src1 = { + _src[1].u64[0], + 0, + 0, + 0, + }; + + const struct uint64_vec src2 = { + _src[2].u64[0], + 0, + 0, + 0, + }; + + struct uint64_vec dst; + + +dst.x = src0.x; +dst.y = src1.x; +dst.z = src2.x; + + + _dst_val.u64[0] = dst.x; + _dst_val.u64[1] = dst.y; + _dst_val.u64[2] = dst.z; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} +static nir_const_value +evaluate_vec4(MAYBE_UNUSED unsigned num_components, unsigned bit_size, + MAYBE_UNUSED nir_const_value *_src) +{ + nir_const_value _dst_val = { {0, } }; + + switch (bit_size) { + case 32: { + + + + const struct uint32_vec src0 = { + _src[0].u32[0], + 0, + 0, + 0, + }; + + const struct uint32_vec src1 = { + _src[1].u32[0], + 0, + 0, + 0, + }; + + const struct uint32_vec src2 = { + _src[2].u32[0], + 0, + 0, + 0, + }; + + const struct uint32_vec src3 = { + _src[3].u32[0], + 0, + 0, + 0, + }; + + struct uint32_vec dst; + + +dst.x = src0.x; +dst.y = src1.x; +dst.z = src2.x; +dst.w = src3.x; + + + _dst_val.u32[0] = dst.x; + _dst_val.u32[1] = dst.y; + _dst_val.u32[2] = dst.z; + _dst_val.u32[3] = dst.w; + + break; + } + case 64: { + + + + const struct uint64_vec src0 = { + _src[0].u64[0], + 0, + 0, + 0, + }; + + const struct uint64_vec src1 = { + _src[1].u64[0], + 0, + 0, + 0, + }; + + const struct uint64_vec src2 = { + _src[2].u64[0], + 0, + 0, + 0, + }; + + const struct uint64_vec src3 = { + _src[3].u64[0], + 0, + 0, + 0, + }; + + struct uint64_vec dst; + + +dst.x = src0.x; +dst.y = src1.x; +dst.z = src2.x; +dst.w = src3.x; + + + _dst_val.u64[0] = dst.x; + _dst_val.u64[1] = dst.y; + _dst_val.u64[2] = dst.z; + _dst_val.u64[3] = dst.w; + + break; + } + + default: + unreachable("unknown bit width"); + } + + return _dst_val; +} + +nir_const_value +nir_eval_const_opcode(nir_op op, unsigned num_components, + unsigned bit_width, nir_const_value *src) +{ + switch (op) { + case nir_op_b2f: + return evaluate_b2f(num_components, bit_width, src); + case nir_op_b2i: + return evaluate_b2i(num_components, bit_width, src); + case nir_op_ball_fequal2: + return evaluate_ball_fequal2(num_components, bit_width, src); + case nir_op_ball_fequal3: + return evaluate_ball_fequal3(num_components, bit_width, src); + case nir_op_ball_fequal4: + return evaluate_ball_fequal4(num_components, bit_width, src); + case nir_op_ball_iequal2: + return evaluate_ball_iequal2(num_components, bit_width, src); + case nir_op_ball_iequal3: + return evaluate_ball_iequal3(num_components, bit_width, src); + case nir_op_ball_iequal4: + return evaluate_ball_iequal4(num_components, bit_width, src); + case nir_op_bany_fnequal2: + return evaluate_bany_fnequal2(num_components, bit_width, src); + case nir_op_bany_fnequal3: + return evaluate_bany_fnequal3(num_components, bit_width, src); + case nir_op_bany_fnequal4: + return evaluate_bany_fnequal4(num_components, bit_width, src); + case nir_op_bany_inequal2: + return evaluate_bany_inequal2(num_components, bit_width, src); + case nir_op_bany_inequal3: + return evaluate_bany_inequal3(num_components, bit_width, src); + case nir_op_bany_inequal4: + return evaluate_bany_inequal4(num_components, bit_width, src); + case nir_op_bcsel: + return evaluate_bcsel(num_components, bit_width, src); + case nir_op_bfi: + return evaluate_bfi(num_components, bit_width, src); + case nir_op_bfm: + return evaluate_bfm(num_components, bit_width, src); + case nir_op_bit_count: + return evaluate_bit_count(num_components, bit_width, src); + case nir_op_bitfield_insert: + return evaluate_bitfield_insert(num_components, bit_width, src); + case nir_op_bitfield_reverse: + return evaluate_bitfield_reverse(num_components, bit_width, src); + case nir_op_d2b: + return evaluate_d2b(num_components, bit_width, src); + case nir_op_d2f: + return evaluate_d2f(num_components, bit_width, src); + case nir_op_d2i: + return evaluate_d2i(num_components, bit_width, src); + case nir_op_d2u: + return evaluate_d2u(num_components, bit_width, src); + case nir_op_extract_i16: + return evaluate_extract_i16(num_components, bit_width, src); + case nir_op_extract_i8: + return evaluate_extract_i8(num_components, bit_width, src); + case nir_op_extract_u16: + return evaluate_extract_u16(num_components, bit_width, src); + case nir_op_extract_u8: + return evaluate_extract_u8(num_components, bit_width, src); + case nir_op_f2b: + return evaluate_f2b(num_components, bit_width, src); + case nir_op_f2d: + return evaluate_f2d(num_components, bit_width, src); + case nir_op_f2i: + return evaluate_f2i(num_components, bit_width, src); + case nir_op_f2u: + return evaluate_f2u(num_components, bit_width, src); + case nir_op_fabs: + return evaluate_fabs(num_components, bit_width, src); + case nir_op_fadd: + return evaluate_fadd(num_components, bit_width, src); + case nir_op_fall_equal2: + return evaluate_fall_equal2(num_components, bit_width, src); + case nir_op_fall_equal3: + return evaluate_fall_equal3(num_components, bit_width, src); + case nir_op_fall_equal4: + return evaluate_fall_equal4(num_components, bit_width, src); + case nir_op_fand: + return evaluate_fand(num_components, bit_width, src); + case nir_op_fany_nequal2: + return evaluate_fany_nequal2(num_components, bit_width, src); + case nir_op_fany_nequal3: + return evaluate_fany_nequal3(num_components, bit_width, src); + case nir_op_fany_nequal4: + return evaluate_fany_nequal4(num_components, bit_width, src); + case nir_op_fceil: + return evaluate_fceil(num_components, bit_width, src); + case nir_op_fcos: + return evaluate_fcos(num_components, bit_width, src); + case nir_op_fcsel: + return evaluate_fcsel(num_components, bit_width, src); + case nir_op_fddx: + return evaluate_fddx(num_components, bit_width, src); + case nir_op_fddx_coarse: + return evaluate_fddx_coarse(num_components, bit_width, src); + case nir_op_fddx_fine: + return evaluate_fddx_fine(num_components, bit_width, src); + case nir_op_fddy: + return evaluate_fddy(num_components, bit_width, src); + case nir_op_fddy_coarse: + return evaluate_fddy_coarse(num_components, bit_width, src); + case nir_op_fddy_fine: + return evaluate_fddy_fine(num_components, bit_width, src); + case nir_op_fdiv: + return evaluate_fdiv(num_components, bit_width, src); + case nir_op_fdot2: + return evaluate_fdot2(num_components, bit_width, src); + case nir_op_fdot3: + return evaluate_fdot3(num_components, bit_width, src); + case nir_op_fdot4: + return evaluate_fdot4(num_components, bit_width, src); + case nir_op_fdot_replicated2: + return evaluate_fdot_replicated2(num_components, bit_width, src); + case nir_op_fdot_replicated3: + return evaluate_fdot_replicated3(num_components, bit_width, src); + case nir_op_fdot_replicated4: + return evaluate_fdot_replicated4(num_components, bit_width, src); + case nir_op_fdph: + return evaluate_fdph(num_components, bit_width, src); + case nir_op_fdph_replicated: + return evaluate_fdph_replicated(num_components, bit_width, src); + case nir_op_feq: + return evaluate_feq(num_components, bit_width, src); + case nir_op_fexp2: + return evaluate_fexp2(num_components, bit_width, src); + case nir_op_ffloor: + return evaluate_ffloor(num_components, bit_width, src); + case nir_op_ffma: + return evaluate_ffma(num_components, bit_width, src); + case nir_op_ffract: + return evaluate_ffract(num_components, bit_width, src); + case nir_op_fge: + return evaluate_fge(num_components, bit_width, src); + case nir_op_find_lsb: + return evaluate_find_lsb(num_components, bit_width, src); + case nir_op_flog2: + return evaluate_flog2(num_components, bit_width, src); + case nir_op_flrp: + return evaluate_flrp(num_components, bit_width, src); + case nir_op_flt: + return evaluate_flt(num_components, bit_width, src); + case nir_op_fmax: + return evaluate_fmax(num_components, bit_width, src); + case nir_op_fmin: + return evaluate_fmin(num_components, bit_width, src); + case nir_op_fmod: + return evaluate_fmod(num_components, bit_width, src); + case nir_op_fmov: + return evaluate_fmov(num_components, bit_width, src); + case nir_op_fmul: + return evaluate_fmul(num_components, bit_width, src); + case nir_op_fne: + return evaluate_fne(num_components, bit_width, src); + case nir_op_fneg: + return evaluate_fneg(num_components, bit_width, src); + case nir_op_fnoise1_1: + return evaluate_fnoise1_1(num_components, bit_width, src); + case nir_op_fnoise1_2: + return evaluate_fnoise1_2(num_components, bit_width, src); + case nir_op_fnoise1_3: + return evaluate_fnoise1_3(num_components, bit_width, src); + case nir_op_fnoise1_4: + return evaluate_fnoise1_4(num_components, bit_width, src); + case nir_op_fnoise2_1: + return evaluate_fnoise2_1(num_components, bit_width, src); + case nir_op_fnoise2_2: + return evaluate_fnoise2_2(num_components, bit_width, src); + case nir_op_fnoise2_3: + return evaluate_fnoise2_3(num_components, bit_width, src); + case nir_op_fnoise2_4: + return evaluate_fnoise2_4(num_components, bit_width, src); + case nir_op_fnoise3_1: + return evaluate_fnoise3_1(num_components, bit_width, src); + case nir_op_fnoise3_2: + return evaluate_fnoise3_2(num_components, bit_width, src); + case nir_op_fnoise3_3: + return evaluate_fnoise3_3(num_components, bit_width, src); + case nir_op_fnoise3_4: + return evaluate_fnoise3_4(num_components, bit_width, src); + case nir_op_fnoise4_1: + return evaluate_fnoise4_1(num_components, bit_width, src); + case nir_op_fnoise4_2: + return evaluate_fnoise4_2(num_components, bit_width, src); + case nir_op_fnoise4_3: + return evaluate_fnoise4_3(num_components, bit_width, src); + case nir_op_fnoise4_4: + return evaluate_fnoise4_4(num_components, bit_width, src); + case nir_op_fnot: + return evaluate_fnot(num_components, bit_width, src); + case nir_op_for: + return evaluate_for(num_components, bit_width, src); + case nir_op_fpow: + return evaluate_fpow(num_components, bit_width, src); + case nir_op_fquantize2f16: + return evaluate_fquantize2f16(num_components, bit_width, src); + case nir_op_frcp: + return evaluate_frcp(num_components, bit_width, src); + case nir_op_frem: + return evaluate_frem(num_components, bit_width, src); + case nir_op_fround_even: + return evaluate_fround_even(num_components, bit_width, src); + case nir_op_frsq: + return evaluate_frsq(num_components, bit_width, src); + case nir_op_fsat: + return evaluate_fsat(num_components, bit_width, src); + case nir_op_fsign: + return evaluate_fsign(num_components, bit_width, src); + case nir_op_fsin: + return evaluate_fsin(num_components, bit_width, src); + case nir_op_fsqrt: + return evaluate_fsqrt(num_components, bit_width, src); + case nir_op_fsub: + return evaluate_fsub(num_components, bit_width, src); + case nir_op_ftrunc: + return evaluate_ftrunc(num_components, bit_width, src); + case nir_op_fxor: + return evaluate_fxor(num_components, bit_width, src); + case nir_op_i2b: + return evaluate_i2b(num_components, bit_width, src); + case nir_op_i2d: + return evaluate_i2d(num_components, bit_width, src); + case nir_op_i2f: + return evaluate_i2f(num_components, bit_width, src); + case nir_op_iabs: + return evaluate_iabs(num_components, bit_width, src); + case nir_op_iadd: + return evaluate_iadd(num_components, bit_width, src); + case nir_op_iand: + return evaluate_iand(num_components, bit_width, src); + case nir_op_ibfe: + return evaluate_ibfe(num_components, bit_width, src); + case nir_op_ibitfield_extract: + return evaluate_ibitfield_extract(num_components, bit_width, src); + case nir_op_idiv: + return evaluate_idiv(num_components, bit_width, src); + case nir_op_ieq: + return evaluate_ieq(num_components, bit_width, src); + case nir_op_ifind_msb: + return evaluate_ifind_msb(num_components, bit_width, src); + case nir_op_ige: + return evaluate_ige(num_components, bit_width, src); + case nir_op_ilt: + return evaluate_ilt(num_components, bit_width, src); + case nir_op_imax: + return evaluate_imax(num_components, bit_width, src); + case nir_op_imin: + return evaluate_imin(num_components, bit_width, src); + case nir_op_imod: + return evaluate_imod(num_components, bit_width, src); + case nir_op_imov: + return evaluate_imov(num_components, bit_width, src); + case nir_op_imul: + return evaluate_imul(num_components, bit_width, src); + case nir_op_imul_high: + return evaluate_imul_high(num_components, bit_width, src); + case nir_op_ine: + return evaluate_ine(num_components, bit_width, src); + case nir_op_ineg: + return evaluate_ineg(num_components, bit_width, src); + case nir_op_inot: + return evaluate_inot(num_components, bit_width, src); + case nir_op_ior: + return evaluate_ior(num_components, bit_width, src); + case nir_op_irem: + return evaluate_irem(num_components, bit_width, src); + case nir_op_ishl: + return evaluate_ishl(num_components, bit_width, src); + case nir_op_ishr: + return evaluate_ishr(num_components, bit_width, src); + case nir_op_isign: + return evaluate_isign(num_components, bit_width, src); + case nir_op_isub: + return evaluate_isub(num_components, bit_width, src); + case nir_op_ixor: + return evaluate_ixor(num_components, bit_width, src); + case nir_op_ldexp: + return evaluate_ldexp(num_components, bit_width, src); + case nir_op_pack_double_2x32: + return evaluate_pack_double_2x32(num_components, bit_width, src); + case nir_op_pack_double_2x32_split: + return evaluate_pack_double_2x32_split(num_components, bit_width, src); + case nir_op_pack_half_2x16: + return evaluate_pack_half_2x16(num_components, bit_width, src); + case nir_op_pack_half_2x16_split: + return evaluate_pack_half_2x16_split(num_components, bit_width, src); + case nir_op_pack_snorm_2x16: + return evaluate_pack_snorm_2x16(num_components, bit_width, src); + case nir_op_pack_snorm_4x8: + return evaluate_pack_snorm_4x8(num_components, bit_width, src); + case nir_op_pack_unorm_2x16: + return evaluate_pack_unorm_2x16(num_components, bit_width, src); + case nir_op_pack_unorm_4x8: + return evaluate_pack_unorm_4x8(num_components, bit_width, src); + case nir_op_pack_uvec2_to_uint: + return evaluate_pack_uvec2_to_uint(num_components, bit_width, src); + case nir_op_pack_uvec4_to_uint: + return evaluate_pack_uvec4_to_uint(num_components, bit_width, src); + case nir_op_seq: + return evaluate_seq(num_components, bit_width, src); + case nir_op_sge: + return evaluate_sge(num_components, bit_width, src); + case nir_op_slt: + return evaluate_slt(num_components, bit_width, src); + case nir_op_sne: + return evaluate_sne(num_components, bit_width, src); + case nir_op_u2d: + return evaluate_u2d(num_components, bit_width, src); + case nir_op_u2f: + return evaluate_u2f(num_components, bit_width, src); + case nir_op_uadd_carry: + return evaluate_uadd_carry(num_components, bit_width, src); + case nir_op_ubfe: + return evaluate_ubfe(num_components, bit_width, src); + case nir_op_ubitfield_extract: + return evaluate_ubitfield_extract(num_components, bit_width, src); + case nir_op_udiv: + return evaluate_udiv(num_components, bit_width, src); + case nir_op_ufind_msb: + return evaluate_ufind_msb(num_components, bit_width, src); + case nir_op_uge: + return evaluate_uge(num_components, bit_width, src); + case nir_op_ult: + return evaluate_ult(num_components, bit_width, src); + case nir_op_umax: + return evaluate_umax(num_components, bit_width, src); + case nir_op_umax_4x8: + return evaluate_umax_4x8(num_components, bit_width, src); + case nir_op_umin: + return evaluate_umin(num_components, bit_width, src); + case nir_op_umin_4x8: + return evaluate_umin_4x8(num_components, bit_width, src); + case nir_op_umod: + return evaluate_umod(num_components, bit_width, src); + case nir_op_umul_high: + return evaluate_umul_high(num_components, bit_width, src); + case nir_op_umul_unorm_4x8: + return evaluate_umul_unorm_4x8(num_components, bit_width, src); + case nir_op_unpack_double_2x32: + return evaluate_unpack_double_2x32(num_components, bit_width, src); + case nir_op_unpack_double_2x32_split_x: + return evaluate_unpack_double_2x32_split_x(num_components, bit_width, src); + case nir_op_unpack_double_2x32_split_y: + return evaluate_unpack_double_2x32_split_y(num_components, bit_width, src); + case nir_op_unpack_half_2x16: + return evaluate_unpack_half_2x16(num_components, bit_width, src); + case nir_op_unpack_half_2x16_split_x: + return evaluate_unpack_half_2x16_split_x(num_components, bit_width, src); + case nir_op_unpack_half_2x16_split_y: + return evaluate_unpack_half_2x16_split_y(num_components, bit_width, src); + case nir_op_unpack_snorm_2x16: + return evaluate_unpack_snorm_2x16(num_components, bit_width, src); + case nir_op_unpack_snorm_4x8: + return evaluate_unpack_snorm_4x8(num_components, bit_width, src); + case nir_op_unpack_unorm_2x16: + return evaluate_unpack_unorm_2x16(num_components, bit_width, src); + case nir_op_unpack_unorm_4x8: + return evaluate_unpack_unorm_4x8(num_components, bit_width, src); + case nir_op_usadd_4x8: + return evaluate_usadd_4x8(num_components, bit_width, src); + case nir_op_ushr: + return evaluate_ushr(num_components, bit_width, src); + case nir_op_ussub_4x8: + return evaluate_ussub_4x8(num_components, bit_width, src); + case nir_op_usub_borrow: + return evaluate_usub_borrow(num_components, bit_width, src); + case nir_op_vec2: + return evaluate_vec2(num_components, bit_width, src); + case nir_op_vec3: + return evaluate_vec3(num_components, bit_width, src); + case nir_op_vec4: + return evaluate_vec4(num_components, bit_width, src); + default: + unreachable("shouldn't get here"); + } +} diff --git a/prebuilt-intermediates/nir/nir_opcodes.c b/prebuilt-intermediates/nir/nir_opcodes.c new file mode 100644 index 00000000000..176a414523a --- /dev/null +++ b/prebuilt-intermediates/nir/nir_opcodes.c @@ -0,0 +1,2582 @@ + +#include "nir.h" + +const nir_op_info nir_op_infos[nir_num_opcodes] = { +{ + .name = "b2f", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_bool32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "b2i", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_bool32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "ball_fequal2", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 2, 2 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ball_fequal3", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 3, 3 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ball_fequal4", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 4, 4 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ball_iequal2", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 2, 2 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ball_iequal3", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 3, 3 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ball_iequal4", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 4, 4 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "bany_fnequal2", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 2, 2 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "bany_fnequal3", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 3, 3 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "bany_fnequal4", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 4, 4 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "bany_inequal2", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 2, 2 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "bany_inequal3", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 3, 3 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "bany_inequal4", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_bool32, + .input_sizes = { + 4, 4 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "bcsel", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_bool32, nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "bfi", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_uint32, nir_type_uint32, nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "bfm", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "bit_count", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "bitfield_insert", + .num_inputs = 4, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0, 0, 0, 0 + }, + .input_types = { + nir_type_uint32, nir_type_uint32, nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "bitfield_reverse", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "d2b", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float64 + }, + .algebraic_properties = + 0 +}, +{ + .name = "d2f", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float64 + }, + .algebraic_properties = + 0 +}, +{ + .name = "d2i", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float64 + }, + .algebraic_properties = + 0 +}, +{ + .name = "d2u", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float64 + }, + .algebraic_properties = + 0 +}, +{ + .name = "extract_i16", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "extract_i8", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "extract_u16", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "extract_u8", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "f2b", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "f2d", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float64, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "f2i", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "f2u", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "fabs", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fadd", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "fall_equal2", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float32, + .input_sizes = { + 2, 2 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fall_equal3", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float32, + .input_sizes = { + 3, 3 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fall_equal4", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float32, + .input_sizes = { + 4, 4 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fand", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fany_nequal2", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float32, + .input_sizes = { + 2, 2 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fany_nequal3", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float32, + .input_sizes = { + 3, 3 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fany_nequal4", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float32, + .input_sizes = { + 4, 4 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fceil", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fcos", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fcsel", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_float32, nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "fddx", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fddx_coarse", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fddx_fine", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fddy", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fddy_coarse", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fddy_fine", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fdiv", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fdot2", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float, + .input_sizes = { + 2, 2 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fdot3", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float, + .input_sizes = { + 3, 3 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fdot4", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float, + .input_sizes = { + 4, 4 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fdot_replicated2", + .num_inputs = 2, + .output_size = 4, + .output_type = nir_type_float, + .input_sizes = { + 2, 2 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fdot_replicated3", + .num_inputs = 2, + .output_size = 4, + .output_type = nir_type_float, + .input_sizes = { + 3, 3 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fdot_replicated4", + .num_inputs = 2, + .output_size = 4, + .output_type = nir_type_float, + .input_sizes = { + 4, 4 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fdph", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_float, + .input_sizes = { + 3, 4 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fdph_replicated", + .num_inputs = 2, + .output_size = 4, + .output_type = nir_type_float, + .input_sizes = { + 3, 4 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "feq", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fexp2", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "ffloor", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "ffma", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "ffract", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fge", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "find_lsb", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "flog2", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "flrp", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "flt", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fmax", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fmin", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fmod", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fmov", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fmul", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "fne", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fneg", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise1_1", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_float, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise1_2", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_float, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise1_3", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_float, + .input_sizes = { + 3 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise1_4", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_float, + .input_sizes = { + 4 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise2_1", + .num_inputs = 1, + .output_size = 2, + .output_type = nir_type_float, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise2_2", + .num_inputs = 1, + .output_size = 2, + .output_type = nir_type_float, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise2_3", + .num_inputs = 1, + .output_size = 2, + .output_type = nir_type_float, + .input_sizes = { + 3 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise2_4", + .num_inputs = 1, + .output_size = 2, + .output_type = nir_type_float, + .input_sizes = { + 4 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise3_1", + .num_inputs = 1, + .output_size = 3, + .output_type = nir_type_float, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise3_2", + .num_inputs = 1, + .output_size = 3, + .output_type = nir_type_float, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise3_3", + .num_inputs = 1, + .output_size = 3, + .output_type = nir_type_float, + .input_sizes = { + 3 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise3_4", + .num_inputs = 1, + .output_size = 3, + .output_type = nir_type_float, + .input_sizes = { + 4 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise4_1", + .num_inputs = 1, + .output_size = 4, + .output_type = nir_type_float, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise4_2", + .num_inputs = 1, + .output_size = 4, + .output_type = nir_type_float, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise4_3", + .num_inputs = 1, + .output_size = 4, + .output_type = nir_type_float, + .input_sizes = { + 3 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnoise4_4", + .num_inputs = 1, + .output_size = 4, + .output_type = nir_type_float, + .input_sizes = { + 4 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fnot", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "for", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "fpow", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fquantize2f16", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "frcp", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "frem", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fround_even", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "frsq", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fsat", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fsign", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fsin", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fsqrt", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fsub", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "ftrunc", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_float + }, + .algebraic_properties = + 0 +}, +{ + .name = "fxor", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "i2b", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "i2d", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float64, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "i2f", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "iabs", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "iadd", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "iand", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "ibfe", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "ibitfield_extract", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "idiv", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "ieq", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ifind_msb", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "ige", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "ilt", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "imax", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "imin", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "imod", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "imov", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "imul", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "imul_high", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ine", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ineg", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "inot", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "ior", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "irem", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "ishl", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "ishr", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "isign", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "isub", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int, nir_type_int + }, + .algebraic_properties = + 0 +}, +{ + .name = "ixor", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "ldexp", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float, nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_double_2x32", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_uint64, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_double_2x32_split", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint64, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint32, nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_half_2x16", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_uint32, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_half_2x16_split", + .num_inputs = 2, + .output_size = 1, + .output_type = nir_type_uint32, + .input_sizes = { + 1, 1 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_snorm_2x16", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_uint32, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_snorm_4x8", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_uint32, + .input_sizes = { + 4 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_unorm_2x16", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_uint32, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_unorm_4x8", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_uint32, + .input_sizes = { + 4 + }, + .input_types = { + nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_uvec2_to_uint", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_uint32, + .input_sizes = { + 2 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "pack_uvec4_to_uint", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_uint32, + .input_sizes = { + 4 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "seq", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "sge", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "slt", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "sne", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_float32, nir_type_float32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "u2d", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float64, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "u2f", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_float32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "uadd_carry", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "ubfe", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_uint32, nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "ubitfield_extract", + .num_inputs = 3, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0, 0, 0 + }, + .input_types = { + nir_type_uint32, nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "udiv", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "ufind_msb", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "uge", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "ult", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_bool32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "umax", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "umax_4x8", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "umin", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "umin_4x8", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "umod", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "umul_high", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint32, nir_type_uint32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE +}, +{ + .name = "umul_unorm_4x8", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "unpack_double_2x32", + .num_inputs = 1, + .output_size = 2, + .output_type = nir_type_uint32, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_uint64 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_double_2x32_split_x", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_uint64 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_double_2x32_split_y", + .num_inputs = 1, + .output_size = 0, + .output_type = nir_type_uint32, + .input_sizes = { + 0 + }, + .input_types = { + nir_type_uint64 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_half_2x16", + .num_inputs = 1, + .output_size = 2, + .output_type = nir_type_float32, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_half_2x16_split_x", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_float32, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_half_2x16_split_y", + .num_inputs = 1, + .output_size = 1, + .output_type = nir_type_float32, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_snorm_2x16", + .num_inputs = 1, + .output_size = 2, + .output_type = nir_type_float32, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_snorm_4x8", + .num_inputs = 1, + .output_size = 4, + .output_type = nir_type_float32, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_unorm_2x16", + .num_inputs = 1, + .output_size = 2, + .output_type = nir_type_float32, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "unpack_unorm_4x8", + .num_inputs = 1, + .output_size = 4, + .output_type = nir_type_float32, + .input_sizes = { + 1 + }, + .input_types = { + nir_type_uint32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "usadd_4x8", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + NIR_OP_IS_COMMUTATIVE | NIR_OP_IS_ASSOCIATIVE +}, +{ + .name = "ushr", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "ussub_4x8", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_int32, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_int32, nir_type_int32 + }, + .algebraic_properties = + 0 +}, +{ + .name = "usub_borrow", + .num_inputs = 2, + .output_size = 0, + .output_type = nir_type_uint, + .input_sizes = { + 0, 0 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "vec2", + .num_inputs = 2, + .output_size = 2, + .output_type = nir_type_uint, + .input_sizes = { + 1, 1 + }, + .input_types = { + nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "vec3", + .num_inputs = 3, + .output_size = 3, + .output_type = nir_type_uint, + .input_sizes = { + 1, 1, 1 + }, + .input_types = { + nir_type_uint, nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +{ + .name = "vec4", + .num_inputs = 4, + .output_size = 4, + .output_type = nir_type_uint, + .input_sizes = { + 1, 1, 1, 1 + }, + .input_types = { + nir_type_uint, nir_type_uint, nir_type_uint, nir_type_uint + }, + .algebraic_properties = + 0 +}, +}; + diff --git a/prebuilt-intermediates/nir/nir_opcodes.h b/prebuilt-intermediates/nir/nir_opcodes.h new file mode 100644 index 00000000000..c838c1a4aea --- /dev/null +++ b/prebuilt-intermediates/nir/nir_opcodes.h @@ -0,0 +1,220 @@ +/* Copyright (C) 2014 Connor Abbott + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Connor Abbott (cwabbott0@gmail.com) + */ + +#ifndef _NIR_OPCODES_ +#define _NIR_OPCODES_ + + + +typedef enum { + nir_op_b2f, + nir_op_b2i, + nir_op_ball_fequal2, + nir_op_ball_fequal3, + nir_op_ball_fequal4, + nir_op_ball_iequal2, + nir_op_ball_iequal3, + nir_op_ball_iequal4, + nir_op_bany_fnequal2, + nir_op_bany_fnequal3, + nir_op_bany_fnequal4, + nir_op_bany_inequal2, + nir_op_bany_inequal3, + nir_op_bany_inequal4, + nir_op_bcsel, + nir_op_bfi, + nir_op_bfm, + nir_op_bit_count, + nir_op_bitfield_insert, + nir_op_bitfield_reverse, + nir_op_d2b, + nir_op_d2f, + nir_op_d2i, + nir_op_d2u, + nir_op_extract_i16, + nir_op_extract_i8, + nir_op_extract_u16, + nir_op_extract_u8, + nir_op_f2b, + nir_op_f2d, + nir_op_f2i, + nir_op_f2u, + nir_op_fabs, + nir_op_fadd, + nir_op_fall_equal2, + nir_op_fall_equal3, + nir_op_fall_equal4, + nir_op_fand, + nir_op_fany_nequal2, + nir_op_fany_nequal3, + nir_op_fany_nequal4, + nir_op_fceil, + nir_op_fcos, + nir_op_fcsel, + nir_op_fddx, + nir_op_fddx_coarse, + nir_op_fddx_fine, + nir_op_fddy, + nir_op_fddy_coarse, + nir_op_fddy_fine, + nir_op_fdiv, + nir_op_fdot2, + nir_op_fdot3, + nir_op_fdot4, + nir_op_fdot_replicated2, + nir_op_fdot_replicated3, + nir_op_fdot_replicated4, + nir_op_fdph, + nir_op_fdph_replicated, + nir_op_feq, + nir_op_fexp2, + nir_op_ffloor, + nir_op_ffma, + nir_op_ffract, + nir_op_fge, + nir_op_find_lsb, + nir_op_flog2, + nir_op_flrp, + nir_op_flt, + nir_op_fmax, + nir_op_fmin, + nir_op_fmod, + nir_op_fmov, + nir_op_fmul, + nir_op_fne, + nir_op_fneg, + nir_op_fnoise1_1, + nir_op_fnoise1_2, + nir_op_fnoise1_3, + nir_op_fnoise1_4, + nir_op_fnoise2_1, + nir_op_fnoise2_2, + nir_op_fnoise2_3, + nir_op_fnoise2_4, + nir_op_fnoise3_1, + nir_op_fnoise3_2, + nir_op_fnoise3_3, + nir_op_fnoise3_4, + nir_op_fnoise4_1, + nir_op_fnoise4_2, + nir_op_fnoise4_3, + nir_op_fnoise4_4, + nir_op_fnot, + nir_op_for, + nir_op_fpow, + nir_op_fquantize2f16, + nir_op_frcp, + nir_op_frem, + nir_op_fround_even, + nir_op_frsq, + nir_op_fsat, + nir_op_fsign, + nir_op_fsin, + nir_op_fsqrt, + nir_op_fsub, + nir_op_ftrunc, + nir_op_fxor, + nir_op_i2b, + nir_op_i2d, + nir_op_i2f, + nir_op_iabs, + nir_op_iadd, + nir_op_iand, + nir_op_ibfe, + nir_op_ibitfield_extract, + nir_op_idiv, + nir_op_ieq, + nir_op_ifind_msb, + nir_op_ige, + nir_op_ilt, + nir_op_imax, + nir_op_imin, + nir_op_imod, + nir_op_imov, + nir_op_imul, + nir_op_imul_high, + nir_op_ine, + nir_op_ineg, + nir_op_inot, + nir_op_ior, + nir_op_irem, + nir_op_ishl, + nir_op_ishr, + nir_op_isign, + nir_op_isub, + nir_op_ixor, + nir_op_ldexp, + nir_op_pack_double_2x32, + nir_op_pack_double_2x32_split, + nir_op_pack_half_2x16, + nir_op_pack_half_2x16_split, + nir_op_pack_snorm_2x16, + nir_op_pack_snorm_4x8, + nir_op_pack_unorm_2x16, + nir_op_pack_unorm_4x8, + nir_op_pack_uvec2_to_uint, + nir_op_pack_uvec4_to_uint, + nir_op_seq, + nir_op_sge, + nir_op_slt, + nir_op_sne, + nir_op_u2d, + nir_op_u2f, + nir_op_uadd_carry, + nir_op_ubfe, + nir_op_ubitfield_extract, + nir_op_udiv, + nir_op_ufind_msb, + nir_op_uge, + nir_op_ult, + nir_op_umax, + nir_op_umax_4x8, + nir_op_umin, + nir_op_umin_4x8, + nir_op_umod, + nir_op_umul_high, + nir_op_umul_unorm_4x8, + nir_op_unpack_double_2x32, + nir_op_unpack_double_2x32_split_x, + nir_op_unpack_double_2x32_split_y, + nir_op_unpack_half_2x16, + nir_op_unpack_half_2x16_split_x, + nir_op_unpack_half_2x16_split_y, + nir_op_unpack_snorm_2x16, + nir_op_unpack_snorm_4x8, + nir_op_unpack_unorm_2x16, + nir_op_unpack_unorm_4x8, + nir_op_usadd_4x8, + nir_op_ushr, + nir_op_ussub_4x8, + nir_op_usub_borrow, + nir_op_vec2, + nir_op_vec3, + nir_op_vec4, + nir_last_opcode = nir_op_vec4, + nir_num_opcodes = nir_last_opcode + 1 +} nir_op; + +#endif /* _NIR_OPCODES_ */ diff --git a/prebuilt-intermediates/nir/nir_opt_algebraic.c b/prebuilt-intermediates/nir/nir_opt_algebraic.c new file mode 100644 index 00000000000..d155be45f3e --- /dev/null +++ b/prebuilt-intermediates/nir/nir_opt_algebraic.c @@ -0,0 +1,21885 @@ + +#include "nir.h" +#include "nir_search.h" + +#ifndef NIR_OPT_ALGEBRAIC_STRUCT_DEFS +#define NIR_OPT_ALGEBRAIC_STRUCT_DEFS + +struct transform { + const nir_search_expression *search; + const nir_search_value *replace; + unsigned condition_offset; +}; + +#endif + + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search111_0 = { + { nir_search_value_variable, 32 }, + 0, /* a */ + false, + nir_type_bool32, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search111_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search111 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search111_0.value, &search111_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace111_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace111 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace111_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search122_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search122_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search122 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search122_0.value, &search122_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace122 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search123_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search123_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x1 /* -1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search123 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search123_0.value, &search123_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace123 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search124_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search124_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search124 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search124_0.value, &search124_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace124 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search132_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search132_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search132_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search132_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search132_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search132_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search132 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search132_0.value, &search132_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace132_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace132_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace132_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &replace132_0_0.value, &replace132_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace132 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace132_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search140_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff /* 255 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search140_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search140_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x18 /* 24 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search140_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search140_1_0.value, &search140_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search140 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search140_0.value, &search140_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace140_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace140_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x18 /* 24 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace140 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &replace140_0.value, &replace140_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search141_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xffff /* 65535 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search141_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search141_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search141_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search141_1_0.value, &search141_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search141 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search141_0.value, &search141_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace141_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace141_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace141 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &replace141_0.value, &replace141_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search190_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff /* 255 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search190_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search190_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search190_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search190_1_0.value, &search190_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search190 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search190_0.value, &search190_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace190_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace190_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x2 /* 2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace190 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &replace190_0.value, &replace190_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search191_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff /* 255 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search191_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search191_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search191_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search191_1_0.value, &search191_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search191 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search191_0.value, &search191_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace191_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace191_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace191 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &replace191_0.value, &replace191_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search192_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff /* 255 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search192_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search192 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search192_0.value, &search192_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace192_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace192_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace192 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &replace192_0.value, &replace192_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search194_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xffff /* 65535 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search194_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search194 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search194_0.value, &search194_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace194_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace194_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace194 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u16, + { &replace194_0.value, &replace194_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search236_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search236_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search236_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search236_0_0.value, &search236_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search236_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search236_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search236_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search236_1_0.value, &search236_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search236 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search236_0.value, &search236_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace236_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace236_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace236 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace236_0.value, &replace236_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search237_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search237_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search237_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search237_0_0.value, &search237_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search237_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search237_1_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search237_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search237_1_0.value, &search237_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search237 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search237_0.value, &search237_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace237_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace237_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace237 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace237_0.value, &replace237_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search238_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search238_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search238_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search238_0_0.value, &search238_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search238_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search238_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search238_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search238_1_0.value, &search238_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search238 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search238_0.value, &search238_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace238_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace238_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace238 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace238_0.value, &replace238_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search239_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search239_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search239_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search239_0_0.value, &search239_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search239_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search239_1_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search239_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search239_1_0.value, &search239_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search239 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search239_0.value, &search239_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace239_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace239_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace239 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace239_0.value, &replace239_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search240_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search240_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search240_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search240_0_0.value, &search240_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search240_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search240_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search240_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search240_1_0.value, &search240_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search240 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search240_0.value, &search240_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace240_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace240_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace240 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace240_0.value, &replace240_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search241_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search241_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search241_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search241_0_0.value, &search241_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search241_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search241_1_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search241_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search241_1_0.value, &search241_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search241 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search241_0.value, &search241_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace241_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace241_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace241 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace241_0.value, &replace241_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_iand_xforms[] = { + { &search111, &replace111.value, 0 }, + { &search122, &replace122.value, 0 }, + { &search123, &replace123.value, 0 }, + { &search124, &replace124.value, 0 }, + { &search132, &replace132.value, 0 }, + { &search140, &replace140.value, 0 }, + { &search141, &replace141.value, 0 }, + { &search190, &replace190.value, 17 }, + { &search191, &replace191.value, 17 }, + { &search192, &replace192.value, 17 }, + { &search194, &replace194.value, 18 }, + { &search236, &replace236.value, 0 }, + { &search237, &replace237.value, 0 }, + { &search238, &replace238.value, 0 }, + { &search239, &replace239.value, 0 }, + { &search240, &replace240.value, 0 }, + { &search241, &replace241.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search182_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search182_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &search182_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search182 = { + { nir_search_value_expression, 0 }, + false, + nir_op_i2b, + { &search182_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace182 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search185_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search185_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search185_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search185 = { + { nir_search_value_expression, 0 }, + false, + nir_op_i2b, + { &search185_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace185_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace185 = { + { nir_search_value_expression, 0 }, + false, + nir_op_i2b, + { &replace185_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search186_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search186_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &search186_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search186 = { + { nir_search_value_expression, 0 }, + false, + nir_op_i2b, + { &search186_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace186_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace186 = { + { nir_search_value_expression, 0 }, + false, + nir_op_i2b, + { &replace186_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_i2b_xforms[] = { + { &search182, &replace182.value, 0 }, + { &search185, &replace185.value, 0 }, + { &search186, &replace186.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search129_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search129_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search129 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ixor, + { &search129_0.value, &search129_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace129 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search130_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search130_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search130 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ixor, + { &search130_0.value, &search130_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace130 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_ixor_xforms[] = { + { &search129, &replace129.value, 0 }, + { &search130, &replace130.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search104_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search104_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search104 = { + { nir_search_value_expression, 0 }, + false, + nir_op_seq, + { &search104_0.value, &search104_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace104_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace104_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace104_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace104_0_0.value, &replace104_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace104 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace104_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_seq_xforms[] = { + { &search104, &replace104.value, 11 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search115_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search115_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search115 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &search115_0.value, &search115_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace115 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_FALSE /* False */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search250_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search250_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search250_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search250_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search250_0_0.value, &search250_0_1.value, &search250_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search250_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search250 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &search250_0.value, &search250_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace250_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace250_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace250_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace250_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &replace250_1_0.value, &replace250_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace250_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace250_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace250_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &replace250_2_0.value, &replace250_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace250 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace250_0.value, &replace250_1.value, &replace250_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search251_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search251_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search251_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search251_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search251_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search251_1_0.value, &search251_1_1.value, &search251_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search251 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &search251_0.value, &search251_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace251_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace251_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace251_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace251_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &replace251_1_0.value, &replace251_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace251_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace251_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace251_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &replace251_2_0.value, &replace251_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace251 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace251_0.value, &replace251_1.value, &replace251_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ilt_xforms[] = { + { &search115, &replace115.value, 0 }, + { &search250, &replace250.value, 0 }, + { &search251, &replace251.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search4_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search4_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search4 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umod, + { &search4_0.value, &search4_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace4 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search9_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search9_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + (is_pos_power_of_two), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search9 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umod, + { &search9_0.value, &search9_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace9_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace9_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace9_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace9_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &replace9_1_0.value, &replace9_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace9 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &replace9_0.value, &replace9_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_umod_xforms[] = { + { &search4, &replace4.value, 0 }, + { &search9, &replace9.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search0_1 = { + { nir_search_value_variable, 32 }, + 1, /* b */ + true, + nir_type_invalid, + (is_pos_power_of_two), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search0_0.value, &search0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace0_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_find_lsb, + { &replace0_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace0_0.value, &replace0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search1_1 = { + { nir_search_value_variable, 32 }, + 1, /* b */ + true, + nir_type_invalid, + (is_neg_power_of_two), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search1_0.value, &search1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace1_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace1_0_1_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace1_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &replace1_0_1_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace1_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_find_lsb, + { &replace1_0_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace1_0_0.value, &replace1_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &replace1_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search30_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search30_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search30 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search30_0.value, &search30_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace30 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search34_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search34_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search34 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search34_0.value, &search34_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace34 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search36_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search36_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x1 /* -1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search36 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search36_0.value, &search36_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace36_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace36 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &replace36_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search108_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search108_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &search108_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search108_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search108_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &search108_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search108 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search108_0.value, &search108_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace108_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace108_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace108_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &replace108_0_0.value, &replace108_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace108 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &replace108_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search208_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search208_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search208_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search208_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search208 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search208_0.value, &search208_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace208_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace208_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace208_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace208_0_0.value, &replace208_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace208 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &replace208_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search210_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search210_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search210_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search210_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search210_1_0.value, &search210_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search210 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search210_0.value, &search210_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace210_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace210_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace210_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace210_0_0.value, &replace210_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace210_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace210 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace210_0.value, &replace210_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_imul_xforms[] = { + { &search0, &replace0.value, 0 }, + { &search1, &replace1.value, 0 }, + { &search30, &replace30.value, 0 }, + { &search34, &replace34.value, 0 }, + { &search36, &replace36.value, 0 }, + { &search108, &replace108.value, 0 }, + { &search208, &replace208.value, 0 }, + { &search210, &replace210.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search120_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search120_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search120 = { + { nir_search_value_expression, 0 }, + false, + nir_op_uge, + { &search120_0.value, &search120_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace120 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search260_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search260_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search260_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search260_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search260_0_0.value, &search260_0_1.value, &search260_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search260_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search260 = { + { nir_search_value_expression, 0 }, + false, + nir_op_uge, + { &search260_0.value, &search260_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace260_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace260_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace260_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace260_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_uge, + { &replace260_1_0.value, &replace260_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace260_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace260_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace260_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_uge, + { &replace260_2_0.value, &replace260_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace260 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace260_0.value, &replace260_1.value, &replace260_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search261_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search261_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search261_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search261_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search261_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search261_1_0.value, &search261_1_1.value, &search261_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search261 = { + { nir_search_value_expression, 0 }, + false, + nir_op_uge, + { &search261_0.value, &search261_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace261_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace261_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace261_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace261_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_uge, + { &replace261_1_0.value, &replace261_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace261_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace261_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace261_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_uge, + { &replace261_2_0.value, &replace261_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace261 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace261_0.value, &replace261_1.value, &replace261_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_uge_xforms[] = { + { &search120, &replace120.value, 0 }, + { &search260, &replace260.value, 0 }, + { &search261, &replace261.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search11_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search11_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search11_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search11 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search11_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace11 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search112_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search112_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &search112_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search112 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search112_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace112 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search202_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search202 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search202_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace202_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace202_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace202 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &replace202_0.value, &replace202_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ineg_xforms[] = { + { &search11, &replace11.value, 0 }, + { &search112, &replace112.value, 0 }, + { &search202, &replace202.value, 20 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search29_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search29_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search29 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fmul, + { &search29_0.value, &search29_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace29 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search33_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search33_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search33 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search33_0.value, &search33_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace33 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search35_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search35_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbff0000000000000L /* -1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search35 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search35_0.value, &search35_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace35_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace35 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace35_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search109_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search109_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search109_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search109_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search109_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search109_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search109 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search109_0.value, &search109_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace109_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace109_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace109_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &replace109_0_0.value, &replace109_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace109 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace109_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search160_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search160_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &search160_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search160_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search160_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &search160_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search160 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fmul, + { &search160_0.value, &search160_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace160_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace160_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace160_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace160_0_0.value, &replace160_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace160 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &replace160_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search207_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search207_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search207_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search207_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search207 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search207_0.value, &search207_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace207_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace207_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace207_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace207_0_0.value, &replace207_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace207 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace207_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search209_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search209_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search209_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search209_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search209_1_0.value, &search209_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search209 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fmul, + { &search209_0.value, &search209_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace209_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace209_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace209_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace209_0_0.value, &replace209_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace209_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace209 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace209_0.value, &replace209_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fmul_xforms[] = { + { &search29, &replace29.value, 0 }, + { &search33, &replace33.value, 0 }, + { &search35, &replace35.value, 0 }, + { &search109, &replace109.value, 0 }, + { &search160, &replace160.value, 0 }, + { &search207, &replace207.value, 0 }, + { &search209, &replace209.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search220_0 = { + { nir_search_value_variable, 0 }, + 0, /* value */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search220_1 = { + { nir_search_value_variable, 0 }, + 1, /* offset */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search220_2 = { + { nir_search_value_variable, 0 }, + 2, /* bits */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search220 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ubitfield_extract, + { &search220_0.value, &search220_1.value, &search220_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace220_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1f /* 31 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace220_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* bits */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace220_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &replace220_0_0.value, &replace220_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace220_1 = { + { nir_search_value_variable, 0 }, + 0, /* value */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace220_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* value */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace220_2_1 = { + { nir_search_value_variable, 0 }, + 1, /* offset */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace220_2_2 = { + { nir_search_value_variable, 0 }, + 2, /* bits */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace220_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ubfe, + { &replace220_2_0.value, &replace220_2_1.value, &replace220_2_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace220 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace220_0.value, &replace220_1.value, &replace220_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ubitfield_extract_xforms[] = { + { &search220, &replace220.value, 26 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search37_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search37_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search37_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search37 = { + { nir_search_value_expression, 0 }, + true, + nir_op_ffma, + { &search37_0.value, &search37_1.value, &search37_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace37 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search38_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search38_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search38_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search38 = { + { nir_search_value_expression, 0 }, + true, + nir_op_ffma, + { &search38_0.value, &search38_1.value, &search38_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace38 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search39_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search39_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search39_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search39 = { + { nir_search_value_expression, 0 }, + true, + nir_op_ffma, + { &search39_0.value, &search39_1.value, &search39_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace39_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace39_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace39 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace39_0.value, &replace39_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search40_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search40_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search40_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search40 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ffma, + { &search40_0.value, &search40_1.value, &search40_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace40_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace40_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace40 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace40_0.value, &replace40_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search41_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search41_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search41_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search41 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ffma, + { &search41_0.value, &search41_1.value, &search41_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace41_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace41_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace41 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace41_0.value, &replace41_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search57_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search57_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search57_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search57 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ffma, + { &search57_0.value, &search57_1.value, &search57_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace57_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace57_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace57_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace57_0_0.value, &replace57_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace57_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace57 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace57_0.value, &replace57_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ffma_xforms[] = { + { &search37, &replace37.value, 0 }, + { &search38, &replace38.value, 0 }, + { &search39, &replace39.value, 0 }, + { &search40, &replace40.value, 0 }, + { &search41, &replace41.value, 0 }, + { &search57, &replace57.value, 7 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search82_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search82_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search82 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umin, + { &search82_0.value, &search82_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace82 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search90_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search90_0_0_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search90_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umax, + { &search90_0_0_0_0.value, &search90_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search90_0_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search90_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umin, + { &search90_0_0_0.value, &search90_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search90_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search90_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umax, + { &search90_0_0.value, &search90_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search90_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search90 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umin, + { &search90_0.value, &search90_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace90_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace90_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace90_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umax, + { &replace90_0_0.value, &replace90_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace90_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace90 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umin, + { &replace90_0.value, &replace90_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_umin_xforms[] = { + { &search82, &replace82.value, 0 }, + { &search90, &replace90.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search83_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search83_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search83 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umax, + { &search83_0.value, &search83_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace83 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_umax_xforms[] = { + { &search83, &replace83.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search73_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search73_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search73_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search73_0_0.value, &search73_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search73_1 = { + { nir_search_value_variable, 0 }, + 0, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search73_2 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search73 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search73_0.value, &search73_1.value, &search73_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace73_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace73_1 = { + { nir_search_value_variable, 0 }, + 0, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace73 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace73_0.value, &replace73_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search74_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search74_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search74_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search74_0_0.value, &search74_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search74_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search74_2 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search74 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search74_0.value, &search74_1.value, &search74_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace74_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace74_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace74 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace74_0.value, &replace74_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search75_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search75_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search75_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search75_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search75_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search75 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search75_0.value, &search75_1.value, &search75_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace75_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace75_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace75_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace75 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace75_0.value, &replace75_1.value, &replace75_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search76_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search76_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search76_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search76_1_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search76_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search76_1_0.value, &search76_1_1.value, &search76_1_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search76_2 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search76 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search76_0.value, &search76_1.value, &search76_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace76_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace76_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace76_2 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace76 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace76_0.value, &replace76_1.value, &replace76_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search77_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search77_1 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search77_2 = { + { nir_search_value_variable, 32 }, + 1, /* b */ + false, + nir_type_bool32, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search77 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search77_0.value, &search77_1.value, &search77_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace77_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace77_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace77 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &replace77_0.value, &replace77_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search171_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search171_1 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search171_2 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_FALSE /* False */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search171 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search171_0.value, &search171_1.value, &search171_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace171 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search172_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search172_1 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_FALSE /* False */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search172_2 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search172 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search172_0.value, &search172_1.value, &search172_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace172_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace172 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace172_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search173_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search173_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search173_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search173 = { + { nir_search_value_expression, 32 }, + false, + nir_op_bcsel, + { &search173_0.value, &search173_1.value, &search173_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace173_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace173 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace173_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search174_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search174_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search174_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search174 = { + { nir_search_value_expression, 32 }, + false, + nir_op_bcsel, + { &search174_0.value, &search174_1.value, &search174_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace174_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace174_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace174_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace174 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace174_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search175_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search175_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbff0000000000000L /* -1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search175_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x8000000000000000L /* -0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search175 = { + { nir_search_value_expression, 32 }, + false, + nir_op_bcsel, + { &search175_0.value, &search175_1.value, &search175_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace175_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace175_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace175_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace175 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace175_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search176_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search176_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x8000000000000000L /* -0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search176_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbff0000000000000L /* -1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search176 = { + { nir_search_value_expression, 32 }, + false, + nir_op_bcsel, + { &search176_0.value, &search176_1.value, &search176_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace176_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace176_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace176_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace176_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace176_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace176 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace176_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search177_0 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search177_1 = { + { nir_search_value_variable, 0 }, + 0, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search177_2 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search177 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search177_0.value, &search177_1.value, &search177_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace177 = { + { nir_search_value_variable, 0 }, + 0, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search178_0 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_FALSE /* False */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search178_1 = { + { nir_search_value_variable, 0 }, + 0, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search178_2 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search178 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search178_0.value, &search178_1.value, &search178_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace178 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search179_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search179_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search179_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search179 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search179_0.value, &search179_1.value, &search179_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace179_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace179_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace179_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &replace179_0_0.value, &replace179_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace179_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace179_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace179 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace179_0.value, &replace179_1.value, &replace179_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search180_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search180_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search180_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search180 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search180_0.value, &search180_1.value, &search180_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace180 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_bcsel_xforms[] = { + { &search73, &replace73.value, 0 }, + { &search74, &replace74.value, 0 }, + { &search75, &replace75.value, 0 }, + { &search76, &replace76.value, 0 }, + { &search77, &replace77.value, 0 }, + { &search171, &replace171.value, 0 }, + { &search172, &replace172.value, 0 }, + { &search173, &replace173.value, 0 }, + { &search174, &replace174.value, 0 }, + { &search175, &replace175.value, 0 }, + { &search176, &replace176.value, 0 }, + { &search177, &replace177.value, 0 }, + { &search178, &replace178.value, 0 }, + { &search179, &replace179.value, 0 }, + { &search180, &replace180.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search103_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search103_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search103 = { + { nir_search_value_expression, 0 }, + false, + nir_op_sge, + { &search103_0.value, &search103_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace103_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace103_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace103_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace103_0_0.value, &replace103_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace103 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace103_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_sge_xforms[] = { + { &search103, &replace103.value, 11 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search153_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search153_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &search153_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search153 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fsqrt, + { &search153_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace153_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3fe0000000000000 /* 0.5 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace153_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace153_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace153_0_0.value, &replace153_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace153 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &replace153_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search165_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search165 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsqrt, + { &search165_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace165_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace165_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frsq, + { &replace165_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace165 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frcp, + { &replace165_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fsqrt_xforms[] = { + { &search153, &replace153.value, 0 }, + { &search165, &replace165.value, 15 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search18_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search18_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search18 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search18_0.value, &search18_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace18 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search22_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search22_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search22_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search22_0_0.value, &search22_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search22_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search22_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search22_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search22_1_0.value, &search22_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search22 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search22_0.value, &search22_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace22_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace22_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace22_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace22_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace22_1_0.value, &replace22_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace22 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace22_0.value, &replace22_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search24_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search24_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search24_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search24_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search24 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search24_0.value, &search24_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace24 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search25_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search25_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search25_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search25_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search25_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search25_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search25_1_0.value, &search25_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search25 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search25_0.value, &search25_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace25 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search26_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search26_1_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search26_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search26_1_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search26_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search26_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search26_1_0.value, &search26_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search26 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search26_0.value, &search26_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace26 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search204_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search204_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search204_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search204_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &search204_1_0.value, &search204_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search204 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search204_0.value, &search204_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace204_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace204_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace204 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &replace204_0.value, &replace204_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search212_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search212_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search212_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search212_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search212_1_0.value, &search212_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search212 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search212_0.value, &search212_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace212_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace212_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace212_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace212_0_0.value, &replace212_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace212_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace212 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace212_0.value, &replace212_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_iadd_xforms[] = { + { &search18, &replace18.value, 0 }, + { &search22, &replace22.value, 0 }, + { &search24, &replace24.value, 0 }, + { &search25, &replace25.value, 0 }, + { &search26, &replace26.value, 0 }, + { &search204, &replace204.value, 0 }, + { &search212, &replace212.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search225_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search225 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_unorm_2x16, + { &search225_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace225_0_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace225_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &replace225_0_0_0_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace225_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x40efffe000000000 /* 65535.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace225_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace225_0_0_0_0.value, &replace225_0_0_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace225_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fround_even, + { &replace225_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace225_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_f2u, + { &replace225_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace225 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_uvec2_to_uint, + { &replace225_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_pack_unorm_2x16_xforms[] = { + { &search225, &replace225.value, 29 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search226_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search226 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_unorm_4x8, + { &search226_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace226_0_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace226_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &replace226_0_0_0_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace226_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x406fe00000000000 /* 255.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace226_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace226_0_0_0_0.value, &replace226_0_0_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace226_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fround_even, + { &replace226_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace226_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_f2u, + { &replace226_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace226 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_uvec4_to_uint, + { &replace226_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_pack_unorm_4x8_xforms[] = { + { &search226, &replace226.value, 30 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search228_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search228 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_snorm_4x8, + { &search228_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace228_0_0_0_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace228_0_0_0_0_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbff0000000000000L /* -1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace228_0_0_0_0_1_1 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace228_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace228_0_0_0_0_1_0.value, &replace228_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace228_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace228_0_0_0_0_0.value, &replace228_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace228_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x405fc00000000000 /* 127.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace228_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace228_0_0_0_0.value, &replace228_0_0_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace228_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fround_even, + { &replace228_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace228_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_f2i, + { &replace228_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace228 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_uvec4_to_uint, + { &replace228_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_pack_snorm_4x8_xforms[] = { + { &search228, &replace228.value, 32 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search121_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search121_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search121 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fand, + { &search121_0.value, &search121_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace121 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +static const struct transform nir_opt_algebraic_fand_xforms[] = { + { &search121, &replace121.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search12_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search12_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search12_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search12 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search12_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace12_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace12 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &replace12_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search13_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search13_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search13_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search13 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search13_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace13_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace13 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &replace13_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search14_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search14_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_u2f, + { &search14_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search14 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search14_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace14_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace14 = { + { nir_search_value_expression, 0 }, + false, + nir_op_u2f, + { &replace14_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search98_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search98_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search98_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_slt, + { &search98_0_0.value, &search98_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search98 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search98_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace98_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace98_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace98 = { + { nir_search_value_expression, 0 }, + false, + nir_op_slt, + { &replace98_0.value, &replace98_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search99_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search99_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search99_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_sge, + { &search99_0_0.value, &search99_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search99 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search99_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace99_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace99_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace99 = { + { nir_search_value_expression, 0 }, + false, + nir_op_sge, + { &replace99_0.value, &replace99_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search100_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search100_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search100_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_seq, + { &search100_0_0.value, &search100_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search100 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search100_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace100_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace100_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace100 = { + { nir_search_value_expression, 0 }, + false, + nir_op_seq, + { &replace100_0.value, &replace100_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search101_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search101_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search101_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_sne, + { &search101_0_0.value, &search101_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search101 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search101_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace101_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace101_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace101 = { + { nir_search_value_expression, 0 }, + false, + nir_op_sne, + { &replace101_0.value, &replace101_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search187_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search187_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search187_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search187 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search187_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace187_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace187 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace187_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search205_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search205_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search205_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &search205_0_0.value, &search205_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search205 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search205_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace205_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace205 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &replace205_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fabs_xforms[] = { + { &search12, &replace12.value, 0 }, + { &search13, &replace13.value, 0 }, + { &search14, &replace14.value, 0 }, + { &search98, &replace98.value, 0 }, + { &search99, &replace99.value, 0 }, + { &search100, &replace100.value, 0 }, + { &search101, &replace101.value, 0 }, + { &search187, &replace187.value, 0 }, + { &search205, &replace205.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search5_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search5_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search5 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imod, + { &search5_0.value, &search5_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace5 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +static const struct transform nir_opt_algebraic_imod_xforms[] = { + { &search5, &replace5.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search117_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search117_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search117 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &search117_0.value, &search117_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace117 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search167_0 = { + { nir_search_value_variable, 32 }, + 0, /* a */ + false, + nir_type_bool32, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search167_1 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search167 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &search167_0.value, &search167_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace167 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search170_0 = { + { nir_search_value_variable, 32 }, + 0, /* a */ + false, + nir_type_bool32, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search170_1 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_FALSE /* False */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search170 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &search170_0.value, &search170_1.value }, + (is_not_used_by_if), +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace170_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace170 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace170_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search254_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search254_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search254_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search254_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search254_0_0.value, &search254_0_1.value, &search254_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search254_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search254 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &search254_0.value, &search254_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace254_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace254_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace254_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace254_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &replace254_1_0.value, &replace254_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace254_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace254_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace254_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &replace254_2_0.value, &replace254_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace254 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace254_0.value, &replace254_1.value, &replace254_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search255_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search255_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search255_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search255_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search255_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search255_1_0.value, &search255_1_1.value, &search255_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search255 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &search255_0.value, &search255_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace255_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace255_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace255_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace255_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &replace255_1_0.value, &replace255_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace255_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace255_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace255_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &replace255_2_0.value, &replace255_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace255 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace255_0.value, &replace255_1.value, &replace255_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ieq_xforms[] = { + { &search117, &replace117.value, 0 }, + { &search167, &replace167.value, 0 }, + { &search170, &replace170.value, 0 }, + { &search254, &replace254.value, 0 }, + { &search255, &replace255.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search80_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search80_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search80 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &search80_0.value, &search80_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace80 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search89_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search89_0_0_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search89_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &search89_0_0_0_0.value, &search89_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search89_0_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search89_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &search89_0_0_0.value, &search89_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search89_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search89_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &search89_0_0.value, &search89_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search89_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search89 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &search89_0.value, &search89_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace89_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace89_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace89_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &replace89_0_0.value, &replace89_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace89_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace89 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &replace89_0.value, &replace89_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_imin_xforms[] = { + { &search80, &replace80.value, 0 }, + { &search89, &replace89.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search155_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search155_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &search155_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search155 = { + { nir_search_value_expression, 0 }, + true, + nir_op_frsq, + { &search155_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace155_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbfe0000000000000L /* -0.5 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace155_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace155_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace155_0_0.value, &replace155_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace155 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &replace155_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_frsq_xforms[] = { + { &search155, &replace155.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search19_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search19_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search19 = { + { nir_search_value_expression, 0 }, + false, + nir_op_usadd_4x8, + { &search19_0.value, &search19_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace19 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search20_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search20_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x1 /* -1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search20 = { + { nir_search_value_expression, 0 }, + false, + nir_op_usadd_4x8, + { &search20_0.value, &search20_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace20 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x1 /* -1 */ }, +}; + +static const struct transform nir_opt_algebraic_usadd_4x8_xforms[] = { + { &search19, &replace19.value, 0 }, + { &search20, &replace20.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search3_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search3_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search3 = { + { nir_search_value_expression, 0 }, + false, + nir_op_idiv, + { &search3_0.value, &search3_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace3 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search7_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search7_1 = { + { nir_search_value_variable, 32 }, + 1, /* b */ + true, + nir_type_invalid, + (is_pos_power_of_two), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search7 = { + { nir_search_value_expression, 0 }, + false, + nir_op_idiv, + { &search7_0.value, &search7_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace7_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace7_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isign, + { &replace7_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace7_1_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace7_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &replace7_1_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace7_1_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace7_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_find_lsb, + { &replace7_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace7_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &replace7_1_0.value, &replace7_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace7 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace7_0.value, &replace7_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search8_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search8_1 = { + { nir_search_value_variable, 32 }, + 1, /* b */ + true, + nir_type_invalid, + (is_neg_power_of_two), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search8 = { + { nir_search_value_expression, 0 }, + false, + nir_op_idiv, + { &search8_0.value, &search8_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace8_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace8_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isign, + { &replace8_0_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace8_0_1_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace8_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &replace8_0_1_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace8_0_1_1_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace8_0_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &replace8_0_1_1_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace8_0_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_find_lsb, + { &replace8_0_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace8_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &replace8_0_1_0.value, &replace8_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace8_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace8_0_0.value, &replace8_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace8 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &replace8_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_idiv_xforms[] = { + { &search3, &replace3.value, 0 }, + { &search7, &replace7.value, 1 }, + { &search8, &replace8.value, 1 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search93_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search93_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search93_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &search93_0_0_0.value, &search93_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search93_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff /* 255 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search93_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &search93_0_0.value, &search93_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search93_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search93 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &search93_0.value, &search93_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace93_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace93_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace93_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &replace93_0_0.value, &replace93_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace93_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff /* 255 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace93 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &replace93_0.value, &replace93_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search222_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search222_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search222 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &search222_0.value, &search222_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace222_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace222_0_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace222_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace222_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace222_0_1_0.value, &replace222_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace222_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &replace222_0_0.value, &replace222_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace222_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff /* 255 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace222 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &replace222_0.value, &replace222_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_extract_u8_xforms[] = { + { &search93, &replace93.value, 0 }, + { &search222, &replace222.value, 27 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search227_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search227 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_snorm_2x16, + { &search227_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace227_0_0_0_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace227_0_0_0_0_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbff0000000000000L /* -1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace227_0_0_0_0_1_1 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace227_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace227_0_0_0_0_1_0.value, &replace227_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace227_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace227_0_0_0_0_0.value, &replace227_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace227_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x40dfffc000000000 /* 32767.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace227_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace227_0_0_0_0.value, &replace227_0_0_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace227_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fround_even, + { &replace227_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace227_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_f2i, + { &replace227_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace227 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_uvec2_to_uint, + { &replace227_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_pack_snorm_2x16_xforms[] = { + { &search227, &replace227.value, 31 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search144_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search144_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search144 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fpow, + { &search144_0.value, &search144_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace144_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace144_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &replace144_0_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace144_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace144_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace144_0_0.value, &replace144_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace144 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &replace144_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search147_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search147_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search147 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fpow, + { &search147_0.value, &search147_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace147 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search148_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search148_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x4000000000000000 /* 2.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search148 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fpow, + { &search148_0.value, &search148_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace148_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace148_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace148 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace148_0.value, &replace148_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search149_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search149_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x4010000000000000 /* 4.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search149 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fpow, + { &search149_0.value, &search149_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace149_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace149_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace149_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace149_0_0.value, &replace149_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace149_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace149_1_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace149_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace149_1_0.value, &replace149_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace149 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace149_0.value, &replace149_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search150_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x4000000000000000 /* 2.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search150_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search150 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fpow, + { &search150_0.value, &search150_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace150_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace150 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &replace150_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search151_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search151_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x400199999999999a /* 2.2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search151_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fpow, + { &search151_0_0.value, &search151_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search151_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3fdd1743e963dc48 /* 0.454545 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search151 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fpow, + { &search151_0.value, &search151_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace151 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search152_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search152_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x400199999999999a /* 2.2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search152_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fpow, + { &search152_0_0_0.value, &search152_0_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search152_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search152_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search152_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3fdd1743e963dc48 /* 0.454545 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search152 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fpow, + { &search152_0.value, &search152_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace152_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace152 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &replace152_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fpow_xforms[] = { + { &search144, &replace144.value, 12 }, + { &search147, &replace147.value, 0 }, + { &search148, &replace148.value, 0 }, + { &search149, &replace149.value, 0 }, + { &search150, &replace150.value, 0 }, + { &search151, &replace151.value, 0 }, + { &search152, &replace152.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search116_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search116_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search116 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &search116_0.value, &search116_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace116 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search252_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search252_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search252_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search252_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search252_0_0.value, &search252_0_1.value, &search252_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search252_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search252 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &search252_0.value, &search252_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace252_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace252_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace252_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace252_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &replace252_1_0.value, &replace252_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace252_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace252_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace252_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &replace252_2_0.value, &replace252_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace252 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace252_0.value, &replace252_1.value, &replace252_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search253_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search253_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search253_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search253_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search253_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search253_1_0.value, &search253_1_1.value, &search253_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search253 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &search253_0.value, &search253_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace253_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace253_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace253_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace253_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &replace253_1_0.value, &replace253_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace253_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace253_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace253_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &replace253_2_0.value, &replace253_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace253 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace253_0.value, &replace253_1.value, &replace253_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ige_xforms[] = { + { &search116, &replace116.value, 0 }, + { &search252, &replace252.value, 0 }, + { &search253, &replace253.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search161_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search161_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search161 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fdiv, + { &search161_0.value, &search161_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace161_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace161 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frcp, + { &replace161_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search162_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search162_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search162 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdiv, + { &search162_0.value, &search162_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace162_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace162_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace162_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frcp, + { &replace162_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace162 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace162_0.value, &replace162_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fdiv_xforms[] = { + { &search161, &replace161.value, 0 }, + { &search162, &replace162.value, 14 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search50_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search50 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ffract, + { &search50_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace50_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace50_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace50_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ffloor, + { &replace50_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace50 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &replace50_0.value, &replace50_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ffract_xforms[] = { + { &search50, &replace50.value, 4 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search17_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search17_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search17 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search17_0.value, &search17_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace17 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search21_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search21_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search21_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search21_0_0.value, &search21_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search21_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search21_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search21_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search21_1_0.value, &search21_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search21 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search21_0.value, &search21_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace21_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace21_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace21_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace21_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace21_1_0.value, &replace21_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace21 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace21_0.value, &replace21_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search23_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search23_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search23_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search23_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search23 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search23_0.value, &search23_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace23 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search27_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search27_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search27_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search27_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search27_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search27_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search27_1_0.value, &search27_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search27 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search27_0.value, &search27_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace27 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search28_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search28_1_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search28_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search28_1_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search28_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search28_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search28_1_0.value, &search28_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search28 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search28_0.value, &search28_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace28 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search51_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search51_0_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search51_0_1_1_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search51_0_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search51_0_1_1_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search51_0_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search51_0_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search51_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search51_0_1_0.value, &search51_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search51_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search51_0_0.value, &search51_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search51_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search51_1_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search51_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search51_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search51_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search51_1_0.value, &search51_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search51 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search51_0.value, &search51_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace51_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace51_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace51_2 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace51 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace51_0.value, &replace51_1.value, &replace51_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search52_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search52_0_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search52_0_1_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search52_0_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search52_0_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search52_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search52_0_1_0.value, &search52_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search52_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search52_0_0.value, &search52_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search52_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search52_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search52_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search52_1_0.value, &search52_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search52 = { + { nir_search_value_expression, 32 }, + true, + nir_op_fadd, + { &search52_0.value, &search52_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace52_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace52_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace52_2 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace52 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flrp, + { &replace52_0.value, &replace52_1.value, &replace52_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search53_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search53_0_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search53_0_1_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search53_0_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search53_0_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search53_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search53_0_1_0.value, &search53_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search53_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search53_0_0.value, &search53_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search53_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search53_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search53_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search53_1_0.value, &search53_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search53 = { + { nir_search_value_expression, 64 }, + true, + nir_op_fadd, + { &search53_0.value, &search53_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace53_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace53_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace53_2 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace53 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flrp, + { &replace53_0.value, &replace53_1.value, &replace53_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search54_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search54_1_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search54_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search54_1_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search54_1_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search54_1_1_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search54_1_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search54_1_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search54_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search54_1_1_0.value, &search54_1_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search54_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search54_1_0.value, &search54_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search54 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search54_0.value, &search54_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace54_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace54_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace54_2 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace54 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace54_0.value, &replace54_1.value, &replace54_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search55_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search55_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search55_1_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search55_1_1_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search55_1_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search55_1_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search55_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search55_1_1_0.value, &search55_1_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search55_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search55_1_0.value, &search55_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search55 = { + { nir_search_value_expression, 32 }, + true, + nir_op_fadd, + { &search55_0.value, &search55_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace55_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace55_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace55_2 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace55 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flrp, + { &replace55_0.value, &replace55_1.value, &replace55_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search56_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search56_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search56_1_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search56_1_1_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search56_1_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search56_1_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search56_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search56_1_1_0.value, &search56_1_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search56_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search56_1_0.value, &search56_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search56 = { + { nir_search_value_expression, 64 }, + true, + nir_op_fadd, + { &search56_0.value, &search56_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace56_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace56_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace56_2 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace56 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flrp, + { &replace56_0.value, &replace56_1.value, &replace56_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search58_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search58_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search58_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search58_0_0.value, &search58_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search58_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search58 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search58_0.value, &search58_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace58_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace58_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace58_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace58 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ffma, + { &replace58_0.value, &replace58_1.value, &replace58_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search203_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search203_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search203_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search203_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &search203_1_0.value, &search203_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search203 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search203_0.value, &search203_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace203_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace203_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace203 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &replace203_0.value, &replace203_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search211_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search211_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search211_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search211_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search211_1_0.value, &search211_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search211 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fadd, + { &search211_0.value, &search211_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace211_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace211_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace211_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace211_0_0.value, &replace211_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace211_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace211 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace211_0.value, &replace211_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fadd_xforms[] = { + { &search17, &replace17.value, 0 }, + { &search21, &replace21.value, 0 }, + { &search23, &replace23.value, 0 }, + { &search27, &replace27.value, 0 }, + { &search28, &replace28.value, 0 }, + { &search51, &replace51.value, 2 }, + { &search52, &replace52.value, 5 }, + { &search53, &replace53.value, 6 }, + { &search54, &replace54.value, 2 }, + { &search55, &replace55.value, 5 }, + { &search56, &replace56.value, 6 }, + { &search58, &replace58.value, 8 }, + { &search203, &replace203.value, 0 }, + { &search211, &replace211.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search59_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search59_0_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search59_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search59_0_0_0.value, &search59_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search59_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search59_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &search59_0_0.value, &search59_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search59_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search59 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search59_0.value, &search59_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace59_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace59_0_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace59_0_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace59_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace59_0_1_0.value, &replace59_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace59_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace59_0_0.value, &replace59_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace59_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace59_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace59_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace59_1_0.value, &replace59_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace59 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace59_0.value, &replace59_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search60_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search60_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search60_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &search60_0_0.value, &search60_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search60_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search60 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search60_0.value, &search60_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace60_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace60_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace60_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace60_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace60_1_0.value, &replace60_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace60 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace60_0.value, &replace60_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search134_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search134_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search134 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search134_0.value, &search134_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace134 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search135_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search135_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search135 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search135_0.value, &search135_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace135 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_ishl_xforms[] = { + { &search59, &replace59.value, 0 }, + { &search60, &replace60.value, 0 }, + { &search134, &replace134.value, 0 }, + { &search135, &replace135.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search217_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search217_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search217 = { + { nir_search_value_expression, 32 }, + false, + nir_op_usub_borrow, + { &search217_0.value, &search217_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace217_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace217_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace217_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &replace217_0_0.value, &replace217_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace217 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &replace217_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_usub_borrow_xforms[] = { + { &search217, &replace217.value, 24 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search143_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search143_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &search143_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search143 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flog2, + { &search143_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace143 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search156_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search156_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsqrt, + { &search156_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search156 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flog2, + { &search156_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace156_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3fe0000000000000 /* 0.5 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace156_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace156_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &replace156_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace156 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace156_0.value, &replace156_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search157_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search157_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frcp, + { &search157_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search157 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flog2, + { &search157_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace157_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace157_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &replace157_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace157 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace157_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search158_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search158_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frsq, + { &search158_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search158 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flog2, + { &search158_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace158_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbfe0000000000000L /* -0.5 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace158_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace158_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &replace158_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace158 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace158_0.value, &replace158_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search159_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search159_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search159_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fpow, + { &search159_0_0.value, &search159_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search159 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flog2, + { &search159_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace159_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace159_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace159_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &replace159_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace159 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace159_0.value, &replace159_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_flog2_xforms[] = { + { &search143, &replace143.value, 0 }, + { &search156, &replace156.value, 0 }, + { &search157, &replace157.value, 0 }, + { &search158, &replace158.value, 0 }, + { &search159, &replace159.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search61_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search61_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search61_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search61_0_0.value, &search61_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search61 = { + { nir_search_value_expression, 0 }, + true, + nir_op_inot, + { &search61_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace61_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace61_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace61 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace61_0.value, &replace61_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search62_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search62_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search62_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search62_0_0.value, &search62_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search62 = { + { nir_search_value_expression, 0 }, + true, + nir_op_inot, + { &search62_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace62_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace62_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace62 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace62_0.value, &replace62_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search63_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search63_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search63_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search63_0_0.value, &search63_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search63 = { + { nir_search_value_expression, 0 }, + true, + nir_op_inot, + { &search63_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace63_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace63_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace63 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace63_0.value, &replace63_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search64_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search64_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search64_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &search64_0_0.value, &search64_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search64 = { + { nir_search_value_expression, 0 }, + true, + nir_op_inot, + { &search64_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace64_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace64_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace64 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace64_0.value, &replace64_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search65_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search65_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search65_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &search65_0_0.value, &search65_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search65 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search65_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace65_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace65_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace65 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &replace65_0.value, &replace65_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search66_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search66_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search66_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ige, + { &search66_0_0.value, &search66_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search66 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search66_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace66_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace66_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace66 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &replace66_0.value, &replace66_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search67_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search67_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search67_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &search67_0_0.value, &search67_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search67 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search67_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace67_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace67_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace67 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &replace67_0.value, &replace67_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search68_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search68_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search68_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &search68_0_0.value, &search68_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search68 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search68_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace68_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace68_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace68 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ieq, + { &replace68_0.value, &replace68_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search131_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search131_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search131_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search131 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search131_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace131 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_inot_xforms[] = { + { &search61, &replace61.value, 0 }, + { &search62, &replace62.value, 0 }, + { &search63, &replace63.value, 0 }, + { &search64, &replace64.value, 0 }, + { &search65, &replace65.value, 0 }, + { &search66, &replace66.value, 0 }, + { &search67, &replace67.value, 0 }, + { &search68, &replace68.value, 0 }, + { &search131, &replace131.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search105_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search105_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search105 = { + { nir_search_value_expression, 0 }, + false, + nir_op_sne, + { &search105_0.value, &search105_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace105_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace105_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace105_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace105_0_0.value, &replace105_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace105 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace105_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_sne_xforms[] = { + { &search105, &replace105.value, 11 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search213_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search213_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search213 = { + { nir_search_value_expression, 32 }, + false, + nir_op_fmod, + { &search213_0.value, &search213_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace213_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace213_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace213_1_1_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace213_1_1_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace213_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdiv, + { &replace213_1_1_0_0.value, &replace213_1_1_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace213_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ffloor, + { &replace213_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace213_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace213_1_0.value, &replace213_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace213 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &replace213_0.value, &replace213_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search214_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search214_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search214 = { + { nir_search_value_expression, 64 }, + false, + nir_op_fmod, + { &search214_0.value, &search214_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace214_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace214_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace214_1_1_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace214_1_1_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace214_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdiv, + { &replace214_1_1_0_0.value, &replace214_1_1_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace214_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ffloor, + { &replace214_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace214_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace214_1_0.value, &replace214_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace214 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &replace214_0.value, &replace214_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fmod_xforms[] = { + { &search213, &replace213.value, 21 }, + { &search214, &replace214.value, 22 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search184_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search184_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ftrunc, + { &search184_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search184 = { + { nir_search_value_expression, 0 }, + false, + nir_op_f2u, + { &search184_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace184_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace184 = { + { nir_search_value_expression, 0 }, + false, + nir_op_f2u, + { &replace184_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_f2u_xforms[] = { + { &search184, &replace184.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search181_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search181_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search181_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search181 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fcsel, + { &search181_0.value, &search181_1.value, &search181_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace181 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_fcsel_xforms[] = { + { &search181, &replace181.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search196_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search196_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search196_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search196_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &search196_1_0.value, &search196_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search196 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &search196_0.value, &search196_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace196_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace196_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace196 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace196_0.value, &replace196_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search200_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search200_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search200 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &search200_0.value, &search200_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace200_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace200_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace200_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &replace200_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace200 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace200_0.value, &replace200_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_isub_xforms[] = { + { &search196, &replace196.value, 0 }, + { &search200, &replace200.value, 19 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search79_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search79_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search79 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &search79_0.value, &search79_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace79 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search85_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search85_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search85_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &search85_0_0.value, &search85_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search85_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search85 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fmax, + { &search85_0.value, &search85_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace85_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace85 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &replace85_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search91_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search91_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &search91_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search91_1 = { + { nir_search_value_variable, 32 }, + 1, /* b */ + true, + nir_type_invalid, + (is_zero_to_one), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search91 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &search91_0.value, &search91_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace91_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace91_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace91_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace91_0_0.value, &replace91_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace91 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &replace91_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fmax_xforms[] = { + { &search79, &replace79.value, 0 }, + { &search85, &replace85.value, 9 }, + { &search91, &replace91.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search31_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search31_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search31 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umul_unorm_4x8, + { &search31_0.value, &search31_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace31 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search32_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search32_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x1 /* -1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search32 = { + { nir_search_value_expression, 0 }, + false, + nir_op_umul_unorm_4x8, + { &search32_0.value, &search32_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace32 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_umul_unorm_4x8_xforms[] = { + { &search31, &replace31.value, 0 }, + { &search32, &replace32.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search218_0 = { + { nir_search_value_variable, 0 }, + 0, /* base */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search218_1 = { + { nir_search_value_variable, 0 }, + 1, /* insert */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search218_2 = { + { nir_search_value_variable, 0 }, + 2, /* offset */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search218_3 = { + { nir_search_value_variable, 0 }, + 3, /* bits */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search218 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bitfield_insert, + { &search218_0.value, &search218_1.value, &search218_2.value, &search218_3.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace218_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1f /* 31 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace218_0_1 = { + { nir_search_value_variable, 0 }, + 3, /* bits */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace218_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &replace218_0_0.value, &replace218_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace218_1 = { + { nir_search_value_variable, 0 }, + 1, /* insert */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace218_2_0_0 = { + { nir_search_value_variable, 0 }, + 3, /* bits */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace218_2_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* offset */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace218_2_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bfm, + { &replace218_2_0_0.value, &replace218_2_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace218_2_1 = { + { nir_search_value_variable, 0 }, + 1, /* insert */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace218_2_2 = { + { nir_search_value_variable, 0 }, + 0, /* base */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace218_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bfi, + { &replace218_2_0.value, &replace218_2_1.value, &replace218_2_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace218 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace218_0.value, &replace218_1.value, &replace218_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_bitfield_insert_xforms[] = { + { &search218, &replace218.value, 25 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search107_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search107_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search107_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search107_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search107 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search107_0.value, &search107_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace107_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace107_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace107 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace107_0.value, &replace107_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search246_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search246_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search246_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search246_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search246_0_0.value, &search246_0_1.value, &search246_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search246_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search246 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search246_0.value, &search246_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace246_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace246_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace246_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace246_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace246_1_0.value, &replace246_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace246_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace246_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace246_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace246_2_0.value, &replace246_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace246 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace246_0.value, &replace246_1.value, &replace246_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search247_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search247_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search247_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search247_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search247_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search247_1_0.value, &search247_1_1.value, &search247_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search247 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &search247_0.value, &search247_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace247_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace247_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace247_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace247_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace247_1_0.value, &replace247_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace247_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace247_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace247_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace247_2_0.value, &replace247_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace247 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace247_0.value, &replace247_1.value, &replace247_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_feq_xforms[] = { + { &search107, &replace107.value, 0 }, + { &search246, &replace246.value, 0 }, + { &search247, &replace247.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search42_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search42_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search42_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search42 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flrp, + { &search42_0.value, &search42_1.value, &search42_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace42 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search43_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search43_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search43_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search43 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flrp, + { &search43_0.value, &search43_1.value, &search43_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace43 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search44_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search44_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search44_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search44 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flrp, + { &search44_0.value, &search44_1.value, &search44_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace44 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search45_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search45_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search45_2 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search45 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flrp, + { &search45_0.value, &search45_1.value, &search45_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace45_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace45_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace45 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace45_0.value, &replace45_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search46_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search46_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search46_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search46_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search46_2_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search46 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flrp, + { &search46_0.value, &search46_1.value, &search46_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace46_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace46_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace46_2 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace46 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace46_0.value, &replace46_1.value, &replace46_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search47_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search47_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search47_2 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search47 = { + { nir_search_value_expression, 0 }, + true, + nir_op_flrp, + { &search47_0.value, &search47_1.value, &search47_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace47_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace47_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace47_0_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace47_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace47_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace47_0_0.value, &replace47_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace47_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace47 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace47_0.value, &replace47_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search48_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search48_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search48_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search48 = { + { nir_search_value_expression, 32 }, + false, + nir_op_flrp, + { &search48_0.value, &search48_1.value, &search48_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace48_0_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace48_0_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace48_0_1_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace48_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &replace48_0_1_0.value, &replace48_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace48_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace48_0_0.value, &replace48_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace48_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace48 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace48_0.value, &replace48_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search49_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search49_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search49_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search49 = { + { nir_search_value_expression, 64 }, + false, + nir_op_flrp, + { &search49_0.value, &search49_1.value, &search49_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace49_0_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace49_0_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace49_0_1_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace49_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &replace49_0_1_0.value, &replace49_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace49_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace49_0_0.value, &replace49_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace49_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace49 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace49_0.value, &replace49_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_flrp_xforms[] = { + { &search42, &replace42.value, 0 }, + { &search43, &replace43.value, 0 }, + { &search44, &replace44.value, 0 }, + { &search45, &replace45.value, 0 }, + { &search46, &replace46.value, 2 }, + { &search47, &replace47.value, 0 }, + { &search48, &replace48.value, 2 }, + { &search49, &replace49.value, 3 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search94_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search94_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search94_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search94_0_0.value, &search94_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search94_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search94_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search94_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search94_1_0.value, &search94_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search94 = { + { nir_search_value_expression, 0 }, + true, + nir_op_ior, + { &search94_0.value, &search94_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace94_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace94_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace94_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace94_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace94_1_0.value, &replace94_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace94 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace94_0.value, &replace94_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search95_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search95_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search95_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search95_0_0.value, &search95_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search95_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search95_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search95_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search95_1_0.value, &search95_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search95 = { + { nir_search_value_expression, 0 }, + true, + nir_op_ior, + { &search95_0.value, &search95_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace95_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace95_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace95_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace95_0_0.value, &replace95_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace95_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace95 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace95_0.value, &replace95_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search96_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search96_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search96_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search96_0_0.value, &search96_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search96_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search96_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search96_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search96_1_0.value, &search96_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search96 = { + { nir_search_value_expression, 0 }, + true, + nir_op_ior, + { &search96_0.value, &search96_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace96_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace96_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace96_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace96_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace96_1_0.value, &replace96_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace96 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace96_0.value, &replace96_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search97_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search97_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search97_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search97_0_0.value, &search97_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search97_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search97_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search97_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search97_1_0.value, &search97_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search97 = { + { nir_search_value_expression, 0 }, + true, + nir_op_ior, + { &search97_0.value, &search97_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace97_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace97_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace97_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace97_0_0.value, &replace97_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace97_1 = { + { nir_search_value_variable, 0 }, + 1, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace97 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace97_0.value, &replace97_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search125_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search125_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search125 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search125_0.value, &search125_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace125 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search126_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search126_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search126 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search126_0.value, &search126_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace126 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search127_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search127_1 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search127 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search127_0.value, &search127_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace127 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search133_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search133_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search133_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search133_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search133_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search133_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search133 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search133_0.value, &search133_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace133_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace133_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace133_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &replace133_0_0.value, &replace133_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace133 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace133_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_0_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_0_0_0_0_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_0_0_0_0_0_0_0_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_0_0_0_0_0_0_0_0_0_1_0.value, &search235_0_0_0_0_0_0_0_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_0_0_0_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff /* 16711935 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_0_0_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_0_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_0_0_0_0_0_0_1_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_0_0_0_0_0_0_1_0_0_0_0.value, &search235_0_0_0_0_0_0_0_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_0_0_0_0_0_0_1_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_0_0_0_0_0_0_1_0_0_1_0.value, &search235_0_0_0_0_0_0_0_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_0_0_0_0_0_0_1_0_0_0.value, &search235_0_0_0_0_0_0_0_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff00 /* 4278255360 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_0_0_0_0_0_0_1_0_0.value, &search235_0_0_0_0_0_0_0_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_0_0_0_0_0_0_1_0.value, &search235_0_0_0_0_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xf0f0f0f /* 252645135 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x4 /* 4 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_0_0_0_1_0_0_0_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_0_0_0_1_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_1_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_0_0_0_1_0_0_0_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_0_0_0_1_0_0_0_0_0_1_0.value, &search235_0_0_0_0_0_0_1_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_0_0_0_1_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_1_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff /* 16711935 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_0_0_0_1_0_0_0_0_0.value, &search235_0_0_0_0_0_0_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_0_0_0_1_0_0_0_0.value, &search235_0_0_0_0_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_0_0_0_1_0_0_1_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_0_0_0_1_0_0_1_0_0_0_0.value, &search235_0_0_0_0_0_0_1_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_0_0_0_1_0_0_1_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_0_0_0_1_0_0_1_0_0_1_0.value, &search235_0_0_0_0_0_0_1_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_0_0_0_1_0_0_1_0_0_0.value, &search235_0_0_0_0_0_0_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff00 /* 4278255360 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_0_0_0_1_0_0_1_0_0.value, &search235_0_0_0_0_0_0_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_0_0_0_1_0_0_1_0.value, &search235_0_0_0_0_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_0_0_0_1_0_0_0.value, &search235_0_0_0_0_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xf0f0f0f0 /* 4042322160 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_0_0_0_1_0_0.value, &search235_0_0_0_0_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x4 /* 4 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_0_0_0_1_0.value, &search235_0_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_0_0_0_0.value, &search235_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x33333333 /* 858993459 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_0_0_0.value, &search235_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x2 /* 2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_0_0.value, &search235_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_1_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_1_0_0_0_0_0_0_0_0_0_0.value, &search235_0_0_0_1_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_1_0_0_0_0_0_0_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_1_0_0_0_0_0_0_0_0_1_0.value, &search235_0_0_0_1_0_0_0_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_1_0_0_0_0_0_0_0_0_0.value, &search235_0_0_0_1_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff /* 16711935 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_1_0_0_0_0_0_0_0_0.value, &search235_0_0_0_1_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_1_0_0_0_0_0_0_0.value, &search235_0_0_0_1_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_1_0_0_0_0_0_1_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_1_0_0_0_0_0_1_0_0_0_0.value, &search235_0_0_0_1_0_0_0_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_1_0_0_0_0_0_1_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_1_0_0_0_0_0_1_0_0_1_0.value, &search235_0_0_0_1_0_0_0_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_1_0_0_0_0_0_1_0_0_0.value, &search235_0_0_0_1_0_0_0_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff00 /* 4278255360 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_1_0_0_0_0_0_1_0_0.value, &search235_0_0_0_1_0_0_0_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_1_0_0_0_0_0_1_0.value, &search235_0_0_0_1_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_1_0_0_0_0_0_0.value, &search235_0_0_0_1_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xf0f0f0f /* 252645135 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_1_0_0_0_0_0.value, &search235_0_0_0_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x4 /* 4 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_1_0_0_0_0.value, &search235_0_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_1_0_0_1_0_0_0_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_1_0_0_1_0_0_0_0_0_0_0.value, &search235_0_0_0_1_0_0_1_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_1_0_0_1_0_0_0_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_1_0_0_1_0_0_0_0_0_1_0.value, &search235_0_0_0_1_0_0_1_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_1_0_0_1_0_0_0_0_0_0.value, &search235_0_0_0_1_0_0_1_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff /* 16711935 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_1_0_0_1_0_0_0_0_0.value, &search235_0_0_0_1_0_0_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_1_0_0_1_0_0_0_0.value, &search235_0_0_0_1_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_1_0_0_1_0_0_1_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0_0_1_0_0_1_0_0_1_0_0_0_0.value, &search235_0_0_0_1_0_0_1_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_0_0_0_1_0_0_1_0_0_1_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_1_0_0_1_0_0_1_0_0_1_0.value, &search235_0_0_0_1_0_0_1_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_1_0_0_1_0_0_1_0_0_0.value, &search235_0_0_0_1_0_0_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff00 /* 4278255360 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_1_0_0_1_0_0_1_0_0.value, &search235_0_0_0_1_0_0_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_1_0_0_1_0_0_1_0.value, &search235_0_0_0_1_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_1_0_0_1_0_0_0.value, &search235_0_0_0_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xf0f0f0f0 /* 4042322160 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_1_0_0_1_0_0.value, &search235_0_0_0_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x4 /* 4 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_1_0_0_1_0.value, &search235_0_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_1_0_0_0.value, &search235_0_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xcccccccc /* 3435973836 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0_1_0_0.value, &search235_0_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x2 /* 2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_0_0_0_1_0.value, &search235_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0_0_0_0.value, &search235_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x55555555 /* 1431655765 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_0_0_0.value, &search235_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_0_0.value, &search235_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_0_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_0_0_0_0_0_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_0_0_0_0_0_0_0_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_0_0_0_0_0_0_0_0_0_1_0.value, &search235_1_0_0_0_0_0_0_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_0_0_0_0_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff /* 16711935 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_0_0_0_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_0_0_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_0_0_0_0_0_0_1_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_0_0_0_0_0_0_1_0_0_0_0.value, &search235_1_0_0_0_0_0_0_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_0_0_0_0_0_0_1_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_0_0_0_0_0_0_1_0_0_1_0.value, &search235_1_0_0_0_0_0_0_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_0_0_0_0_0_0_1_0_0_0.value, &search235_1_0_0_0_0_0_0_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff00 /* 4278255360 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_0_0_0_0_0_0_1_0_0.value, &search235_1_0_0_0_0_0_0_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_0_0_0_0_0_0_1_0.value, &search235_1_0_0_0_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_0_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xf0f0f0f /* 252645135 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x4 /* 4 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_0_0_0_1_0_0_0_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_0_0_0_1_0_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_1_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_0_0_0_1_0_0_0_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_0_0_0_1_0_0_0_0_0_1_0.value, &search235_1_0_0_0_0_0_1_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_0_0_0_1_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_1_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff /* 16711935 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_0_0_0_1_0_0_0_0_0.value, &search235_1_0_0_0_0_0_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_0_0_0_1_0_0_0_0.value, &search235_1_0_0_0_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_0_0_0_1_0_0_1_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_0_0_0_1_0_0_1_0_0_0_0.value, &search235_1_0_0_0_0_0_1_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_0_0_0_1_0_0_1_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_0_0_0_1_0_0_1_0_0_1_0.value, &search235_1_0_0_0_0_0_1_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_0_0_0_1_0_0_1_0_0_0.value, &search235_1_0_0_0_0_0_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff00 /* 4278255360 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_0_0_0_1_0_0_1_0_0.value, &search235_1_0_0_0_0_0_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_0_0_0_1_0_0_1_0.value, &search235_1_0_0_0_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_0_0_0_1_0_0_0.value, &search235_1_0_0_0_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xf0f0f0f0 /* 4042322160 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_0_0_0_1_0_0.value, &search235_1_0_0_0_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x4 /* 4 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_0_0_0_1_0.value, &search235_1_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_0_0_0_0.value, &search235_1_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x33333333 /* 858993459 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_0_0_0.value, &search235_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x2 /* 2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_0_0.value, &search235_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_1_0_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_1_0_0_0_0_0_0_0_0_0_0.value, &search235_1_0_0_1_0_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_1_0_0_0_0_0_0_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_1_0_0_0_0_0_0_0_0_1_0.value, &search235_1_0_0_1_0_0_0_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_1_0_0_0_0_0_0_0_0_0.value, &search235_1_0_0_1_0_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff /* 16711935 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_1_0_0_0_0_0_0_0_0.value, &search235_1_0_0_1_0_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_1_0_0_0_0_0_0_0.value, &search235_1_0_0_1_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_1_0_0_0_0_0_1_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_1_0_0_0_0_0_1_0_0_0_0.value, &search235_1_0_0_1_0_0_0_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_1_0_0_0_0_0_1_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_1_0_0_0_0_0_1_0_0_1_0.value, &search235_1_0_0_1_0_0_0_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_1_0_0_0_0_0_1_0_0_0.value, &search235_1_0_0_1_0_0_0_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff00 /* 4278255360 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_1_0_0_0_0_0_1_0_0.value, &search235_1_0_0_1_0_0_0_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_1_0_0_0_0_0_1_0.value, &search235_1_0_0_1_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_1_0_0_0_0_0_0.value, &search235_1_0_0_1_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xf0f0f0f /* 252645135 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_1_0_0_0_0_0.value, &search235_1_0_0_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x4 /* 4 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_1_0_0_0_0.value, &search235_1_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_1_0_0_1_0_0_0_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_0_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_1_0_0_1_0_0_0_0_0_0_0.value, &search235_1_0_0_1_0_0_1_0_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_1_0_0_1_0_0_0_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_0_0_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_0_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_1_0_0_1_0_0_0_0_0_1_0.value, &search235_1_0_0_1_0_0_1_0_0_0_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_1_0_0_1_0_0_0_0_0_0.value, &search235_1_0_0_1_0_0_1_0_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff /* 16711935 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_1_0_0_1_0_0_0_0_0.value, &search235_1_0_0_1_0_0_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_1_0_0_1_0_0_0_0.value, &search235_1_0_0_1_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_1_0_0_1_0_0_1_0_0_0_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &search235_1_0_0_1_0_0_1_0_0_1_0_0_0_0.value, &search235_1_0_0_1_0_0_1_0_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search235_1_0_0_1_0_0_1_0_0_1_0_0_1_0 = { + { nir_search_value_variable, 32 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_1_0_0_1_0_0_1_0_0_1_0.value, &search235_1_0_0_1_0_0_1_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_1_0_0_1_0_0_1_0_0_0.value, &search235_1_0_0_1_0_0_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xff00ff00 /* 4278255360 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_1_0_0_1_0_0_1_0_0.value, &search235_1_0_0_1_0_0_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_1_0_0_1_0_0_1_0.value, &search235_1_0_0_1_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_1_0_0_1_0_0_0.value, &search235_1_0_0_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xf0f0f0f0 /* 4042322160 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_1_0_0_1_0_0.value, &search235_1_0_0_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x4 /* 4 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_1_0_0_1_0.value, &search235_1_0_0_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_1_0_0_0.value, &search235_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xcccccccc /* 3435973836 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0_1_0_0.value, &search235_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x2 /* 2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0_0_1_0.value, &search235_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_1_0_0_0.value, &search235_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xaaaaaaaa /* 2863311530 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &search235_1_0_0.value, &search235_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search235_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search235_1_0.value, &search235_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search235 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &search235_0.value, &search235_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace235_0 = { + { nir_search_value_variable, 0 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace235 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bitfield_reverse, + { &replace235_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ior_xforms[] = { + { &search94, &replace94.value, 0 }, + { &search95, &replace95.value, 0 }, + { &search96, &replace96.value, 0 }, + { &search97, &replace97.value, 0 }, + { &search125, &replace125.value, 0 }, + { &search126, &replace126.value, 0 }, + { &search127, &replace127.value, 0 }, + { &search133, &replace133.value, 0 }, + { &search235, &replace235.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search197_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search197_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search197 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ussub_4x8, + { &search197_0.value, &search197_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace197 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search198_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search198_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x1 /* -1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search198 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ussub_4x8, + { &search198_0.value, &search198_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace198 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +static const struct transform nir_opt_algebraic_ussub_4x8_xforms[] = { + { &search197, &replace197.value, 0 }, + { &search198, &replace198.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search232_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search232 = { + { nir_search_value_expression, 0 }, + false, + nir_op_unpack_snorm_4x8, + { &search232_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace232_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace232_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbff0000000000000L /* -1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace232_1_1_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace232_1_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232_1_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_i8, + { &replace232_1_1_0_0_0_0.value, &replace232_1_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace232_1_1_0_0_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace232_1_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232_1_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_i8, + { &replace232_1_1_0_0_1_0.value, &replace232_1_1_0_0_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace232_1_1_0_0_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace232_1_1_0_0_2_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x2 /* 2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232_1_1_0_0_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_i8, + { &replace232_1_1_0_0_2_0.value, &replace232_1_1_0_0_2_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace232_1_1_0_0_3_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace232_1_1_0_0_3_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x3 /* 3 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232_1_1_0_0_3 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_i8, + { &replace232_1_1_0_0_3_0.value, &replace232_1_1_0_0_3_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232_1_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_vec4, + { &replace232_1_1_0_0_0.value, &replace232_1_1_0_0_1.value, &replace232_1_1_0_0_2.value, &replace232_1_1_0_0_3.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_i2f, + { &replace232_1_1_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace232_1_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x405fc00000000000 /* 127.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdiv, + { &replace232_1_1_0.value, &replace232_1_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace232_1_0.value, &replace232_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace232 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace232_0.value, &replace232_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_unpack_snorm_4x8_xforms[] = { + { &search232, &replace232.value, 36 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search215_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search215_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search215 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frem, + { &search215_0.value, &search215_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace215_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace215_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace215_1_1_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace215_1_1_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace215_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdiv, + { &replace215_1_1_0_0.value, &replace215_1_1_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace215_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ftrunc, + { &replace215_1_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace215_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace215_1_0.value, &replace215_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace215 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &replace215_0.value, &replace215_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_frem_xforms[] = { + { &search215, &replace215.value, 21 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search229_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search229 = { + { nir_search_value_expression, 0 }, + false, + nir_op_unpack_unorm_2x16, + { &search229_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace229_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace229_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace229_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u16, + { &replace229_0_0_0_0.value, &replace229_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace229_0_0_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace229_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace229_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u16, + { &replace229_0_0_1_0.value, &replace229_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace229_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_vec2, + { &replace229_0_0_0.value, &replace229_0_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace229_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_u2f, + { &replace229_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace229_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x40efffe000000000 /* 65535.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace229 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdiv, + { &replace229_0.value, &replace229_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_unpack_unorm_2x16_xforms[] = { + { &search229, &replace229.value, 33 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search231_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search231 = { + { nir_search_value_expression, 0 }, + false, + nir_op_unpack_snorm_2x16, + { &search231_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace231_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace231_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbff0000000000000L /* -1.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace231_1_1_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace231_1_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace231_1_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_i16, + { &replace231_1_1_0_0_0_0.value, &replace231_1_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace231_1_1_0_0_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace231_1_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace231_1_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_i16, + { &replace231_1_1_0_0_1_0.value, &replace231_1_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace231_1_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_vec2, + { &replace231_1_1_0_0_0.value, &replace231_1_1_0_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace231_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_i2f, + { &replace231_1_1_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace231_1_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x40dfffc000000000 /* 32767.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace231_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdiv, + { &replace231_1_1_0.value, &replace231_1_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace231_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace231_1_0.value, &replace231_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace231 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace231_0.value, &replace231_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_unpack_snorm_2x16_xforms[] = { + { &search231, &replace231.value, 35 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search81_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search81_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search81 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &search81_0.value, &search81_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace81 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_imax_xforms[] = { + { &search81, &replace81.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search86_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search86 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &search86_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace86_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace86_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace86_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace86_0_0.value, &replace86_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace86_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace86 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace86_0.value, &replace86_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search87_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search87_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &search87_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search87 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &search87_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace87_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace87 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &replace87_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search110_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search110_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search110_0_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search110_0_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search110_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search110_0_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search110_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search110_0_0.value, &search110_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search110 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &search110_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace110_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace110_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace110_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ior, + { &replace110_0_0.value, &replace110_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace110 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace110_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fsat_xforms[] = { + { &search86, &replace86.value, 10 }, + { &search87, &replace87.value, 0 }, + { &search110, &replace110.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search224_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search224_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search224 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u16, + { &search224_0.value, &search224_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace224_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace224_0_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace224_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace224_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace224_0_1_0.value, &replace224_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace224_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &replace224_0_0.value, &replace224_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace224_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xffff /* 65535 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace224 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iand, + { &replace224_0.value, &replace224_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_extract_u16_xforms[] = { + { &search224, &replace224.value, 28 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search69_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search69_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search69_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search69_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search69 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search69_0.value, &search69_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace69_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace69 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace69_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search70_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search70_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search70_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search70_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search70_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search70_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search70 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search70_0.value, &search70_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace70_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace70 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace70_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search72_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search72_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search72_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search72_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search72_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search72_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search72 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search72_0.value, &search72_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace72_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace72_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace72 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace72_0.value, &replace72_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search244_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search244_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search244_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search244_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search244_0_0.value, &search244_0_1.value, &search244_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search244_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search244 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search244_0.value, &search244_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace244_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace244_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace244_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace244_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace244_1_0.value, &replace244_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace244_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace244_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace244_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace244_2_0.value, &replace244_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace244 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace244_0.value, &replace244_1.value, &replace244_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search245_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search245_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search245_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search245_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search245_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search245_1_0.value, &search245_1_1.value, &search245_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search245 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &search245_0.value, &search245_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace245_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace245_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace245_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace245_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace245_1_0.value, &replace245_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace245_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace245_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace245_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace245_2_0.value, &replace245_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace245 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace245_0.value, &replace245_1.value, &replace245_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fge_xforms[] = { + { &search69, &replace69.value, 0 }, + { &search70, &replace70.value, 0 }, + { &search72, &replace72.value, 0 }, + { &search244, &replace244.value, 0 }, + { &search245, &replace245.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search154_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search154_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &search154_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search154 = { + { nir_search_value_expression, 0 }, + true, + nir_op_frcp, + { &search154_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace154_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace154_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace154_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace154 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fexp2, + { &replace154_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search163_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search163_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frcp, + { &search163_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search163 = { + { nir_search_value_expression, 0 }, + true, + nir_op_frcp, + { &search163_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace163 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search164_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search164_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsqrt, + { &search164_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search164 = { + { nir_search_value_expression, 0 }, + true, + nir_op_frcp, + { &search164_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace164_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace164 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frsq, + { &replace164_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search166_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search166_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_frsq, + { &search166_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search166 = { + { nir_search_value_expression, 0 }, + true, + nir_op_frcp, + { &search166_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace166_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace166 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsqrt, + { &replace166_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_frcp_xforms[] = { + { &search154, &replace154.value, 0 }, + { &search163, &replace163.value, 0 }, + { &search164, &replace164.value, 0 }, + { &search166, &replace166.value, 16 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search128_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search128_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search128 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fxor, + { &search128_0.value, &search128_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace128 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +static const struct transform nir_opt_algebraic_fxor_xforms[] = { + { &search128, &replace128.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search138_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search138_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search138 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search138_0.value, &search138_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace138 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search139_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search139_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search139 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search139_0.value, &search139_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace139 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search189_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search189_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x18 /* 24 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search189 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search189_0.value, &search189_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace189_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace189_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x3 /* 3 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace189 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &replace189_0.value, &replace189_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search193_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search193_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search193 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &search193_0.value, &search193_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace193_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace193_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace193 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u16, + { &replace193_0.value, &replace193_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ushr_xforms[] = { + { &search138, &replace138.value, 0 }, + { &search139, &replace139.value, 0 }, + { &search189, &replace189.value, 17 }, + { &search193, &replace193.value, 18 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search142_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search142_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &search142_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search142 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fexp2, + { &search142_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace142 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search145_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search145_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &search145_0_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search145_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search145_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search145_0_0.value, &search145_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search145 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fexp2, + { &search145_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace145_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace145_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace145 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fpow, + { &replace145_0.value, &replace145_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search146_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search146_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &search146_0_0_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search146_0_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search146_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search146_0_0_0.value, &search146_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search146_0_1_0_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search146_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flog2, + { &search146_0_1_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search146_0_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search146_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &search146_0_1_0.value, &search146_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search146_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search146_0_0.value, &search146_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search146 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fexp2, + { &search146_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace146_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace146_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace146_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fpow, + { &replace146_0_0.value, &replace146_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace146_1_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace146_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace146_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fpow, + { &replace146_1_0.value, &replace146_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace146 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fmul, + { &replace146_0.value, &replace146_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fexp2_xforms[] = { + { &search142, &replace142.value, 0 }, + { &search145, &replace145.value, 13 }, + { &search146, &replace146.value, 13 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search136_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search136_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search136 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishr, + { &search136_0.value, &search136_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace136 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search137_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search137_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search137 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishr, + { &search137_0.value, &search137_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace137 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +static const struct transform nir_opt_algebraic_ishr_xforms[] = { + { &search136, &replace136.value, 0 }, + { &search137, &replace137.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search102_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search102_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search102 = { + { nir_search_value_expression, 0 }, + false, + nir_op_slt, + { &search102_0.value, &search102_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace102_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace102_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace102_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace102_0_0.value, &replace102_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace102 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &replace102_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_slt_xforms[] = { + { &search102, &replace102.value, 11 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search183_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search183_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ftrunc, + { &search183_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search183 = { + { nir_search_value_expression, 0 }, + false, + nir_op_f2i, + { &search183_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace183_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace183 = { + { nir_search_value_expression, 0 }, + false, + nir_op_f2i, + { &replace183_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_f2i_xforms[] = { + { &search183, &replace183.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search71_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search71_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search71_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fabs, + { &search71_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search71 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search71_0.value, &search71_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace71_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace71_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace71 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace71_0.value, &replace71_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search113_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search113_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search113_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search113_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search113_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search113_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search113 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search113_0.value, &search113_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace113 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search114_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search114_0_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search114_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search114_0_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search114_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &search114_0_0.value, &search114_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search114_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search114 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search114_0.value, &search114_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace114 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search242_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search242_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search242_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search242_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search242_0_0.value, &search242_0_1.value, &search242_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search242_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search242 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search242_0.value, &search242_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace242_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace242_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace242_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace242_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace242_1_0.value, &replace242_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace242_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace242_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace242_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace242_2_0.value, &replace242_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace242 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace242_0.value, &replace242_1.value, &replace242_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search243_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search243_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search243_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search243_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search243_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search243_1_0.value, &search243_1_1.value, &search243_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search243 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search243_0.value, &search243_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace243_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace243_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace243_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace243_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace243_1_0.value, &replace243_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace243_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace243_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace243_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace243_2_0.value, &replace243_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace243 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace243_0.value, &replace243_1.value, &replace243_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_flt_xforms[] = { + { &search71, &replace71.value, 0 }, + { &search113, &replace113.value, 0 }, + { &search114, &replace114.value, 0 }, + { &search242, &replace242.value, 0 }, + { &search243, &replace243.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search119_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search119_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search119 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &search119_0.value, &search119_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace119 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_FALSE /* False */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search258_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search258_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search258_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search258_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search258_0_0.value, &search258_0_1.value, &search258_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search258_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search258 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &search258_0.value, &search258_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace258_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace258_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace258_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace258_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &replace258_1_0.value, &replace258_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace258_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace258_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace258_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &replace258_2_0.value, &replace258_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace258 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace258_0.value, &replace258_1.value, &replace258_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search259_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search259_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search259_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search259_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search259_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search259_1_0.value, &search259_1_1.value, &search259_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search259 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &search259_0.value, &search259_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace259_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace259_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace259_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace259_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &replace259_1_0.value, &replace259_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace259_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace259_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace259_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &replace259_2_0.value, &replace259_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace259 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace259_0.value, &replace259_1.value, &replace259_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ult_xforms[] = { + { &search119, &replace119.value, 0 }, + { &search258, &replace258.value, 0 }, + { &search259, &replace259.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search195_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search195_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search195_1_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search195_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &search195_1_0.value, &search195_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search195 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fsub, + { &search195_0.value, &search195_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace195_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace195_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace195 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace195_0.value, &replace195_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search199_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search199_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search199 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &search199_0.value, &search199_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace199_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace199_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace199_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace199_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace199 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace199_0.value, &replace199_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fsub_xforms[] = { + { &search195, &replace195.value, 0 }, + { &search199, &replace199.value, 19 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search10_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search10_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search10_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search10 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search10_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace10 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search201_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search201 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search201_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace201_0 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace201_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace201 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsub, + { &replace201_0.value, &replace201_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fneg_xforms[] = { + { &search10, &replace10.value, 0 }, + { &search201, &replace201.value, 20 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search106_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search106_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search106_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search106_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search106 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &search106_0.value, &search106_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace106_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace106_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace106 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace106_0.value, &replace106_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search248_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search248_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search248_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search248_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search248_0_0.value, &search248_0_1.value, &search248_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search248_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search248 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &search248_0.value, &search248_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace248_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace248_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace248_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace248_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace248_1_0.value, &replace248_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace248_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace248_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace248_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace248_2_0.value, &replace248_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace248 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace248_0.value, &replace248_1.value, &replace248_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search249_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search249_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search249_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search249_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search249_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search249_1_0.value, &search249_1_1.value, &search249_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search249 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &search249_0.value, &search249_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace249_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace249_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace249_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace249_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace249_1_0.value, &replace249_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace249_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace249_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace249_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace249_2_0.value, &replace249_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace249 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace249_0.value, &replace249_1.value, &replace249_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fne_xforms[] = { + { &search106, &replace106.value, 0 }, + { &search248, &replace248.value, 0 }, + { &search249, &replace249.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search15_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search15_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &search15_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search15 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &search15_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace15_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace15 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &replace15_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search16_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search16_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ineg, + { &search16_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search16 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &search16_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace16_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace16 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &replace16_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search188_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search188_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &search188_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search188 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &search188_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace188_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace188 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &replace188_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search206_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search206_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search206_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &search206_0_0.value, &search206_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search206 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &search206_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace206_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace206 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iabs, + { &replace206_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_iabs_xforms[] = { + { &search15, &replace15.value, 0 }, + { &search16, &replace16.value, 0 }, + { &search188, &replace188.value, 0 }, + { &search206, &replace206.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search230_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search230 = { + { nir_search_value_expression, 0 }, + false, + nir_op_unpack_unorm_4x8, + { &search230_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace230_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace230_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace230_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &replace230_0_0_0_0.value, &replace230_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace230_0_0_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace230_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace230_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &replace230_0_0_1_0.value, &replace230_0_0_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace230_0_0_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace230_0_0_2_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x2 /* 2 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace230_0_0_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &replace230_0_0_2_0.value, &replace230_0_0_2_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace230_0_0_3_0 = { + { nir_search_value_variable, 0 }, + 0, /* v */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace230_0_0_3_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x3 /* 3 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace230_0_0_3 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_u8, + { &replace230_0_0_3_0.value, &replace230_0_0_3_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace230_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_vec4, + { &replace230_0_0_0.value, &replace230_0_0_1.value, &replace230_0_0_2.value, &replace230_0_0_3.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace230_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_u2f, + { &replace230_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace230_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x406fe00000000000 /* 255.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace230 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdiv, + { &replace230_0.value, &replace230_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_unpack_unorm_4x8_xforms[] = { + { &search230, &replace230.value, 34 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search78_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search78_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search78 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &search78_0.value, &search78_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace78 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search84_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search84_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search84_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &search84_0_0.value, &search84_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search84_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search84 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fmin, + { &search84_0.value, &search84_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace84_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace84 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &replace84_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search88_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search88_0_0_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search88_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &search88_0_0_0_0.value, &search88_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search88_0_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search88_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &search88_0_0_0.value, &search88_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search88_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search88_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &search88_0_0.value, &search88_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search88_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search88 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &search88_0.value, &search88_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace88_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace88_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace88_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace88_0_0.value, &replace88_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace88_1 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace88 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace88_0.value, &replace88_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search92_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search92_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &search92_0_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search92_1 = { + { nir_search_value_variable, 32 }, + 1, /* b */ + true, + nir_type_invalid, + (is_zero_to_one), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search92 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &search92_0.value, &search92_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace92_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace92_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace92_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace92_0_0.value, &replace92_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace92 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fsat, + { &replace92_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_fmin_xforms[] = { + { &search78, &replace78.value, 0 }, + { &search84, &replace84.value, 9 }, + { &search88, &replace88.value, 0 }, + { &search92, &replace92.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search118_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search118_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search118 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &search118_0.value, &search118_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace118 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_FALSE /* False */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search168_0 = { + { nir_search_value_variable, 32 }, + 0, /* a */ + false, + nir_type_bool32, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search168_1 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_TRUE /* True */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search168 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &search168_0.value, &search168_1.value }, + (is_not_used_by_if), +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace168_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace168 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &replace168_0.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search169_0 = { + { nir_search_value_variable, 32 }, + 0, /* a */ + false, + nir_type_bool32, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search169_1 = { + { nir_search_value_constant, 32 }, + nir_type_bool32, { NIR_FALSE /* False */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search169 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &search169_0.value, &search169_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace169 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search256_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search256_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search256_0_2 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search256_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search256_0_0.value, &search256_0_1.value, &search256_0_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search256_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search256 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &search256_0.value, &search256_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace256_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace256_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace256_1_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace256_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &replace256_1_0.value, &replace256_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace256_2_0 = { + { nir_search_value_variable, 0 }, + 2, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace256_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* d */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace256_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &replace256_2_0.value, &replace256_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace256 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace256_0.value, &replace256_1.value, &replace256_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search257_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search257_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search257_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search257_1_2 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + true, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search257_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &search257_1_0.value, &search257_1_1.value, &search257_1_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search257 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &search257_0.value, &search257_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace257_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace257_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace257_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace257_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &replace257_1_0.value, &replace257_1_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace257_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* d */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace257_2_1 = { + { nir_search_value_variable, 0 }, + 3, /* c */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace257_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ine, + { &replace257_2_0.value, &replace257_2_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace257 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace257_0.value, &replace257_1.value, &replace257_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ine_xforms[] = { + { &search118, &replace118.value, 0 }, + { &search168, &replace168.value, 0 }, + { &search169, &replace169.value, 0 }, + { &search256, &replace256.value, 0 }, + { &search257, &replace257.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search2_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search2_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_udiv, + { &search2_0.value, &search2_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace2 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search6_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search6_1 = { + { nir_search_value_variable, 32 }, + 1, /* b */ + true, + nir_type_invalid, + (is_pos_power_of_two), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search6 = { + { nir_search_value_expression, 0 }, + false, + nir_op_udiv, + { &search6_0.value, &search6_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace6_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace6_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace6_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_find_lsb, + { &replace6_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace6 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ushr, + { &replace6_0.value, &replace6_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_udiv_xforms[] = { + { &search2, &replace2.value, 0 }, + { &search6, &replace6.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search221_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search221_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search221 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_i8, + { &search221_0.value, &search221_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace221_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace221_0_1_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x3 /* 3 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace221_0_1_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace221_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &replace221_0_1_0_0.value, &replace221_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace221_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x8 /* 8 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace221_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace221_0_1_0.value, &replace221_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace221_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace221_0_0.value, &replace221_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace221_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x18 /* 24 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace221 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishr, + { &replace221_0.value, &replace221_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_extract_i8_xforms[] = { + { &search221, &replace221.value, 27 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search216_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search216_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search216 = { + { nir_search_value_expression, 32 }, + false, + nir_op_uadd_carry, + { &search216_0.value, &search216_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace216_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace216_0_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace216_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace216_0_0_0.value, &replace216_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace216_0_1 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace216_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ult, + { &replace216_0_0.value, &replace216_0_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace216 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2i, + { &replace216_0.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_uadd_carry_xforms[] = { + { &search216, &replace216.value, 23 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search219_0 = { + { nir_search_value_variable, 0 }, + 0, /* value */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search219_1 = { + { nir_search_value_variable, 0 }, + 1, /* offset */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search219_2 = { + { nir_search_value_variable, 0 }, + 2, /* bits */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search219 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ibitfield_extract, + { &search219_0.value, &search219_1.value, &search219_2.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace219_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1f /* 31 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace219_0_1 = { + { nir_search_value_variable, 0 }, + 2, /* bits */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace219_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ilt, + { &replace219_0_0.value, &replace219_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace219_1 = { + { nir_search_value_variable, 0 }, + 0, /* value */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace219_2_0 = { + { nir_search_value_variable, 0 }, + 0, /* value */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace219_2_1 = { + { nir_search_value_variable, 0 }, + 1, /* offset */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace219_2_2 = { + { nir_search_value_variable, 0 }, + 2, /* bits */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace219_2 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ibfe, + { &replace219_2_0.value, &replace219_2_1.value, &replace219_2_2.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace219 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace219_0.value, &replace219_1.value, &replace219_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ibitfield_extract_xforms[] = { + { &search219, &replace219.value, 26 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search233_0 = { + { nir_search_value_variable, 0 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search233_1 = { + { nir_search_value_variable, 0 }, + 1, /* exp */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search233 = { + { nir_search_value_expression, 32 }, + false, + nir_op_ldexp, + { &search233_0.value, &search233_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace233_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace233_0_1_0_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* exp */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_0_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0xfc /* -252 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_0_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &replace233_0_1_0_0_0_0_0.value, &replace233_0_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_0_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xfe /* 254 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_0_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &replace233_0_1_0_0_0_0.value, &replace233_0_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_0_1_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishr, + { &replace233_0_1_0_0_0.value, &replace233_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x7f /* 127 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace233_0_1_0_0.value, &replace233_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x17 /* 23 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace233_0_1_0.value, &replace233_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace233_0_0.value, &replace233_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace233_1_0_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* exp */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0xfc /* -252 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &replace233_1_0_0_0_0_0.value, &replace233_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xfe /* 254 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &replace233_1_0_0_0_0.value, &replace233_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace233_1_0_0_1_0_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* exp */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_1_0_0_1_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0xfc /* -252 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &replace233_1_0_0_1_0_0_0.value, &replace233_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0xfe /* 254 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &replace233_1_0_0_1_0_0.value, &replace233_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishr, + { &replace233_1_0_0_1_0.value, &replace233_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &replace233_1_0_0_0.value, &replace233_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x7f /* 127 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace233_1_0_0.value, &replace233_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace233_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x17 /* 23 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace233_1_0.value, &replace233_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace233 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace233_0.value, &replace233_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search234_0 = { + { nir_search_value_variable, 0 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search234_1 = { + { nir_search_value_variable, 0 }, + 1, /* exp */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search234 = { + { nir_search_value_expression, 64 }, + false, + nir_op_ldexp, + { &search234_0.value, &search234_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace234_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* x */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_0_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace234_0_1_1_0_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* exp */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_0_1_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x7fc /* -2044 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_0_1_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &replace234_0_1_1_0_0_0_0_0.value, &replace234_0_1_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_0_1_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x7fe /* 2046 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_0_1_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &replace234_0_1_1_0_0_0_0.value, &replace234_0_1_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_0_1_1_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_0_1_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishr, + { &replace234_0_1_1_0_0_0.value, &replace234_0_1_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_0_1_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x3ff /* 1023 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_0_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace234_0_1_1_0_0.value, &replace234_0_1_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_0_1_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x14 /* 20 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_0_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace234_0_1_1_0.value, &replace234_0_1_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_double_2x32_split, + { &replace234_0_1_0.value, &replace234_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace234_0_0.value, &replace234_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_1_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x0 /* 0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace234_1_1_0_0_0_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* exp */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_1_1_0_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x7fc /* -2044 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1_1_0_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &replace234_1_1_0_0_0_0_0.value, &replace234_1_1_0_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_1_1_0_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x7fe /* 2046 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1_1_0_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &replace234_1_1_0_0_0_0.value, &replace234_1_1_0_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace234_1_1_0_0_1_0_0_0 = { + { nir_search_value_variable, 0 }, + 1, /* exp */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_1_1_0_0_1_0_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { -0x7fc /* -2044 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1_1_0_0_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imax, + { &replace234_1_1_0_0_1_0_0_0.value, &replace234_1_1_0_0_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_1_1_0_0_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x7fe /* 2046 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1_1_0_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imin, + { &replace234_1_1_0_0_1_0_0.value, &replace234_1_1_0_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_1_1_0_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1_1_0_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishr, + { &replace234_1_1_0_0_1_0.value, &replace234_1_1_0_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1_1_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &replace234_1_1_0_0_0.value, &replace234_1_1_0_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_1_1_0_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x3ff /* 1023 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_iadd, + { &replace234_1_1_0_0.value, &replace234_1_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace234_1_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x14 /* 20 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace234_1_1_0.value, &replace234_1_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_pack_double_2x32_split, + { &replace234_1_0.value, &replace234_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace234 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmul, + { &replace234_0.value, &replace234_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_ldexp_xforms[] = { + { &search233, &replace233.value, 0 }, + { &search234, &replace234.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search223_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search223_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search223 = { + { nir_search_value_expression, 0 }, + false, + nir_op_extract_i16, + { &search223_0.value, &search223_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace223_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace223_0_1_0_0 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x1 /* 1 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace223_0_1_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace223_0_1_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_isub, + { &replace223_0_1_0_0.value, &replace223_0_1_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace223_0_1_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace223_0_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_imul, + { &replace223_0_1_0.value, &replace223_0_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace223_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishl, + { &replace223_0_0.value, &replace223_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace223_1 = { + { nir_search_value_constant, 0 }, + nir_type_int, { 0x10 /* 16 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace223 = { + { nir_search_value_expression, 0 }, + false, + nir_op_ishr, + { &replace223_0.value, &replace223_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_extract_i16_xforms[] = { + { &search223, &replace223.value, 28 }, +}; + +static bool +nir_opt_algebraic_block(nir_block *block, const bool *condition_flags, + void *mem_ctx) +{ + bool progress = false; + + nir_foreach_instr_reverse_safe(instr, block) { + if (instr->type != nir_instr_type_alu) + continue; + + nir_alu_instr *alu = nir_instr_as_alu(instr); + if (!alu->dest.dest.is_ssa) + continue; + + switch (alu->op) { + case nir_op_iand: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_iand_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_iand_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_i2b: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_i2b_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_i2b_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ixor: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ixor_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ixor_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_seq: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_seq_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_seq_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ilt: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ilt_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ilt_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_umod: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_umod_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_umod_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_imul: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_imul_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_imul_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_uge: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_uge_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_uge_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ineg: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ineg_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ineg_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fmul: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fmul_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fmul_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ubitfield_extract: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ubitfield_extract_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ubitfield_extract_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ffma: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ffma_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ffma_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_umin: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_umin_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_umin_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_umax: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_umax_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_umax_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_bcsel: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_bcsel_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_bcsel_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_sge: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_sge_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_sge_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fsqrt: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fsqrt_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fsqrt_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_iadd: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_iadd_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_iadd_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_pack_unorm_2x16: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_pack_unorm_2x16_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_pack_unorm_2x16_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_pack_unorm_4x8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_pack_unorm_4x8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_pack_unorm_4x8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_pack_snorm_4x8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_pack_snorm_4x8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_pack_snorm_4x8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fand: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fand_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fand_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fabs: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fabs_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fabs_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_imod: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_imod_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_imod_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ieq: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ieq_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ieq_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_imin: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_imin_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_imin_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_frsq: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_frsq_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_frsq_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_usadd_4x8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_usadd_4x8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_usadd_4x8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_idiv: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_idiv_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_idiv_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_extract_u8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_extract_u8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_extract_u8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_pack_snorm_2x16: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_pack_snorm_2x16_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_pack_snorm_2x16_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fpow: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fpow_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fpow_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ige: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ige_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ige_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fdiv: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fdiv_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fdiv_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ffract: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ffract_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ffract_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fadd: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fadd_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fadd_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ishl: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ishl_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ishl_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_usub_borrow: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_usub_borrow_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_usub_borrow_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_flog2: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_flog2_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_flog2_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_inot: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_inot_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_inot_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_sne: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_sne_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_sne_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fmod: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fmod_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fmod_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_f2u: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_f2u_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_f2u_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fcsel: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fcsel_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fcsel_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_isub: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_isub_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_isub_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fmax: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fmax_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fmax_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_umul_unorm_4x8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_umul_unorm_4x8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_umul_unorm_4x8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_bitfield_insert: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_bitfield_insert_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_bitfield_insert_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_feq: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_feq_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_feq_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_flrp: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_flrp_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_flrp_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ior: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ior_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ior_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ussub_4x8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ussub_4x8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ussub_4x8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_unpack_snorm_4x8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_unpack_snorm_4x8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_unpack_snorm_4x8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_frem: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_frem_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_frem_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_unpack_unorm_2x16: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_unpack_unorm_2x16_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_unpack_unorm_2x16_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_unpack_snorm_2x16: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_unpack_snorm_2x16_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_unpack_snorm_2x16_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_imax: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_imax_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_imax_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fsat: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fsat_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fsat_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_extract_u16: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_extract_u16_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_extract_u16_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fge: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fge_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fge_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_frcp: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_frcp_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_frcp_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fxor: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fxor_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fxor_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ushr: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ushr_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ushr_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fexp2: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fexp2_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fexp2_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ishr: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ishr_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ishr_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_slt: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_slt_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_slt_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_f2i: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_f2i_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_f2i_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_flt: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_flt_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_flt_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ult: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ult_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ult_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fsub: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fsub_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fsub_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fneg: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fneg_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fneg_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fne: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fne_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fne_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_iabs: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_iabs_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_iabs_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_unpack_unorm_4x8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_unpack_unorm_4x8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_unpack_unorm_4x8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fmin: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_fmin_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_fmin_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ine: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ine_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ine_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_udiv: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_udiv_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_udiv_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_extract_i8: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_extract_i8_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_extract_i8_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_uadd_carry: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_uadd_carry_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_uadd_carry_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ibitfield_extract: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ibitfield_extract_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ibitfield_extract_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_ldexp: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_ldexp_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_ldexp_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_extract_i16: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_extract_i16_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_extract_i16_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + default: + break; + } + } + + return progress; +} + +static bool +nir_opt_algebraic_impl(nir_function_impl *impl, const bool *condition_flags) +{ + void *mem_ctx = ralloc_parent(impl); + bool progress = false; + + nir_foreach_block_reverse(block, impl) { + progress |= nir_opt_algebraic_block(block, condition_flags, mem_ctx); + } + + if (progress) + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); + + return progress; +} + + +bool +nir_opt_algebraic(nir_shader *shader) +{ + bool progress = false; + bool condition_flags[37]; + const nir_shader_compiler_options *options = shader->options; + (void) options; + + condition_flags[0] = true; + condition_flags[1] = options->lower_idiv; + condition_flags[2] = options->lower_flrp32; + condition_flags[3] = options->lower_flrp64; + condition_flags[4] = options->lower_ffract; + condition_flags[5] = !options->lower_flrp32; + condition_flags[6] = !options->lower_flrp64; + condition_flags[7] = options->lower_ffma; + condition_flags[8] = options->fuse_ffma; + condition_flags[9] = !options->lower_fsat; + condition_flags[10] = options->lower_fsat; + condition_flags[11] = options->lower_scmp; + condition_flags[12] = options->lower_fpow; + condition_flags[13] = !options->lower_fpow; + condition_flags[14] = options->lower_fdiv; + condition_flags[15] = options->lower_fsqrt; + condition_flags[16] = !options->lower_fsqrt; + condition_flags[17] = !options->lower_extract_byte; + condition_flags[18] = !options->lower_extract_word; + condition_flags[19] = options->lower_sub; + condition_flags[20] = options->lower_negate; + condition_flags[21] = options->lower_fmod32; + condition_flags[22] = options->lower_fmod64; + condition_flags[23] = options->lower_uadd_carry; + condition_flags[24] = options->lower_usub_borrow; + condition_flags[25] = options->lower_bitfield_insert; + condition_flags[26] = options->lower_bitfield_extract; + condition_flags[27] = options->lower_extract_byte; + condition_flags[28] = options->lower_extract_word; + condition_flags[29] = options->lower_pack_unorm_2x16; + condition_flags[30] = options->lower_pack_unorm_4x8; + condition_flags[31] = options->lower_pack_snorm_2x16; + condition_flags[32] = options->lower_pack_snorm_4x8; + condition_flags[33] = options->lower_unpack_unorm_2x16; + condition_flags[34] = options->lower_unpack_unorm_4x8; + condition_flags[35] = options->lower_unpack_snorm_2x16; + condition_flags[36] = options->lower_unpack_snorm_4x8; + + nir_foreach_function(function, shader) { + if (function->impl) + progress |= nir_opt_algebraic_impl(function->impl, condition_flags); + } + + return progress; +} + + +#include "nir.h" +#include "nir_search.h" + +#ifndef NIR_OPT_ALGEBRAIC_STRUCT_DEFS +#define NIR_OPT_ALGEBRAIC_STRUCT_DEFS + +struct transform { + const nir_search_expression *search; + const nir_search_value *replace; + unsigned condition_offset; +}; + +#endif + + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search270_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search270_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search270_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search270 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search270_0.value }, + (is_used_more_than_once), +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace270_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace270_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace270_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x3ff0000000000000 /* 1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace270 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace270_0.value, &replace270_1.value, &replace270_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_b2f_xforms[] = { + { &search270, &replace270.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search268_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search268_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search268 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdot4, + { &search268_0.value, &search268_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace268_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace268_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace268 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdot_replicated4, + { &replace268_0.value, &replace268_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fdot4_xforms[] = { + { &search268, &replace268.value, 37 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search262_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search262_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search262_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search262_0_0.value, &search262_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search262_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search262 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &search262_0.value, &search262_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace262_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace262_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace262_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace262_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace262 = { + { nir_search_value_expression, 0 }, + false, + nir_op_flt, + { &replace262_0.value, &replace262_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_flt_xforms[] = { + { &search262, &replace262.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search266_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search266_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search266 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdot2, + { &search266_0.value, &search266_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace266_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace266_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace266 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdot_replicated2, + { &replace266_0.value, &replace266_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fdot2_xforms[] = { + { &search266, &replace266.value, 37 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search267_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search267_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search267 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdot3, + { &search267_0.value, &search267_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace267_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace267_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace267 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdot_replicated3, + { &replace267_0.value, &replace267_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fdot3_xforms[] = { + { &search267, &replace267.value, 37 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search271_0_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search271_0_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_inot, + { &search271_0_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search271_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_b2f, + { &search271_0_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search271 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &search271_0.value }, + (is_used_more_than_once), +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace271_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace271_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x8000000000000000L /* -0.0 */ }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant replace271_2 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0xbff0000000000000L /* -1.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace271 = { + { nir_search_value_expression, 0 }, + false, + nir_op_bcsel, + { &replace271_0.value, &replace271_1.value, &replace271_2.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fneg_xforms[] = { + { &search271, &replace271.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search273_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* c */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search273_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search273_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search273_0_0.value, &search273_0_1.value }, + (is_used_once), +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search273_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* c */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search273_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search273_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search273_1_0.value, &search273_1_1.value }, + (is_used_once), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search273 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &search273_0.value, &search273_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace273_0 = { + { nir_search_value_variable, 0 }, + 0, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace273_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace273_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace273_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmax, + { &replace273_1_0.value, &replace273_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace273 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace273_0.value, &replace273_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fmax_xforms[] = { + { &search273, &replace273.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search265_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search265_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search265_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search265_0_0.value, &search265_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search265_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search265 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fne, + { &search265_0.value, &search265_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace265_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace265_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace265_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace265_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace265 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fne, + { &replace265_0.value, &replace265_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fne_xforms[] = { + { &search265, &replace265.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search272_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* c */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search272_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search272_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search272_0_0.value, &search272_0_1.value }, + (is_used_once), +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search272_1_0 = { + { nir_search_value_variable, 0 }, + 0, /* c */ + true, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search272_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search272_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search272_1_0.value, &search272_1_1.value }, + (is_used_once), +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search272 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &search272_0.value, &search272_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace272_0 = { + { nir_search_value_variable, 0 }, + 0, /* c */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace272_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace272_1_1 = { + { nir_search_value_variable, 0 }, + 2, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace272_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fmin, + { &replace272_1_0.value, &replace272_1_1.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace272 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &replace272_0.value, &replace272_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fmin_xforms[] = { + { &search272, &replace272.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search264_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search264_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search264_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search264_0_0.value, &search264_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search264_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search264 = { + { nir_search_value_expression, 0 }, + true, + nir_op_feq, + { &search264_0.value, &search264_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace264_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace264_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace264_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace264_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace264 = { + { nir_search_value_expression, 0 }, + false, + nir_op_feq, + { &replace264_0.value, &replace264_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_feq_xforms[] = { + { &search264, &replace264.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search263_0_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search263_0_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search263_0 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fadd, + { &search263_0_0.value, &search263_0_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_constant search263_1 = { + { nir_search_value_constant, 0 }, + nir_type_float, { 0x0 /* 0.0 */ }, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search263 = { + { nir_search_value_expression, 0 }, + true, + nir_op_fge, + { &search263_0.value, &search263_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace263_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace263_1_0 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace263_1 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fneg, + { &replace263_1_0.value }, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace263 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fge, + { &replace263_0.value, &replace263_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fge_xforms[] = { + { &search263, &replace263.value, 0 }, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search269_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable search269_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression search269 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdph, + { &search269_0.value, &search269_1.value }, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace269_0 = { + { nir_search_value_variable, 0 }, + 0, /* a */ + false, + nir_type_invalid, + NULL, +}; + +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_variable replace269_1 = { + { nir_search_value_variable, 0 }, + 1, /* b */ + false, + nir_type_invalid, + NULL, +}; +#include "compiler/nir/nir_search_helpers.h" +static const nir_search_expression replace269 = { + { nir_search_value_expression, 0 }, + false, + nir_op_fdph_replicated, + { &replace269_0.value, &replace269_1.value }, + NULL, +}; + +static const struct transform nir_opt_algebraic_late_fdph_xforms[] = { + { &search269, &replace269.value, 37 }, +}; + +static bool +nir_opt_algebraic_late_block(nir_block *block, const bool *condition_flags, + void *mem_ctx) +{ + bool progress = false; + + nir_foreach_instr_reverse_safe(instr, block) { + if (instr->type != nir_instr_type_alu) + continue; + + nir_alu_instr *alu = nir_instr_as_alu(instr); + if (!alu->dest.dest.is_ssa) + continue; + + switch (alu->op) { + case nir_op_b2f: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_b2f_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_b2f_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fdot4: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fdot4_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fdot4_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_flt: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_flt_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_flt_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fdot2: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fdot2_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fdot2_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fdot3: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fdot3_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fdot3_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fneg: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fneg_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fneg_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fmax: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fmax_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fmax_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fne: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fne_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fne_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fmin: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fmin_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fmin_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_feq: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_feq_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_feq_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fge: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fge_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fge_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + case nir_op_fdph: + for (unsigned i = 0; i < ARRAY_SIZE(nir_opt_algebraic_late_fdph_xforms); i++) { + const struct transform *xform = &nir_opt_algebraic_late_fdph_xforms[i]; + if (condition_flags[xform->condition_offset] && + nir_replace_instr(alu, xform->search, xform->replace, + mem_ctx)) { + progress = true; + break; + } + } + break; + default: + break; + } + } + + return progress; +} + +static bool +nir_opt_algebraic_late_impl(nir_function_impl *impl, const bool *condition_flags) +{ + void *mem_ctx = ralloc_parent(impl); + bool progress = false; + + nir_foreach_block_reverse(block, impl) { + progress |= nir_opt_algebraic_late_block(block, condition_flags, mem_ctx); + } + + if (progress) + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); + + return progress; +} + + +bool +nir_opt_algebraic_late(nir_shader *shader) +{ + bool progress = false; + bool condition_flags[38]; + const nir_shader_compiler_options *options = shader->options; + (void) options; + + condition_flags[0] = true; + condition_flags[1] = options->lower_idiv; + condition_flags[2] = options->lower_flrp32; + condition_flags[3] = options->lower_flrp64; + condition_flags[4] = options->lower_ffract; + condition_flags[5] = !options->lower_flrp32; + condition_flags[6] = !options->lower_flrp64; + condition_flags[7] = options->lower_ffma; + condition_flags[8] = options->fuse_ffma; + condition_flags[9] = !options->lower_fsat; + condition_flags[10] = options->lower_fsat; + condition_flags[11] = options->lower_scmp; + condition_flags[12] = options->lower_fpow; + condition_flags[13] = !options->lower_fpow; + condition_flags[14] = options->lower_fdiv; + condition_flags[15] = options->lower_fsqrt; + condition_flags[16] = !options->lower_fsqrt; + condition_flags[17] = !options->lower_extract_byte; + condition_flags[18] = !options->lower_extract_word; + condition_flags[19] = options->lower_sub; + condition_flags[20] = options->lower_negate; + condition_flags[21] = options->lower_fmod32; + condition_flags[22] = options->lower_fmod64; + condition_flags[23] = options->lower_uadd_carry; + condition_flags[24] = options->lower_usub_borrow; + condition_flags[25] = options->lower_bitfield_insert; + condition_flags[26] = options->lower_bitfield_extract; + condition_flags[27] = options->lower_extract_byte; + condition_flags[28] = options->lower_extract_word; + condition_flags[29] = options->lower_pack_unorm_2x16; + condition_flags[30] = options->lower_pack_unorm_4x8; + condition_flags[31] = options->lower_pack_snorm_2x16; + condition_flags[32] = options->lower_pack_snorm_4x8; + condition_flags[33] = options->lower_unpack_unorm_2x16; + condition_flags[34] = options->lower_unpack_unorm_4x8; + condition_flags[35] = options->lower_unpack_snorm_2x16; + condition_flags[36] = options->lower_unpack_snorm_4x8; + condition_flags[37] = options->fdot_replicates; + + nir_foreach_function(function, shader) { + if (function->impl) + progress |= nir_opt_algebraic_late_impl(function->impl, condition_flags); + } + + return progress; +} + diff --git a/src/compiler/Android.glsl.gen.mk b/src/compiler/Android.glsl.gen.mk index 1308de2db97..f4bc9e86384 100644 --- a/src/compiler/Android.glsl.gen.mk +++ b/src/compiler/Android.glsl.gen.mk @@ -28,6 +28,7 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES endif intermediates := $(call local-generated-sources-dir) +prebuilt_intermediates := $(MESA_TOP)/prebuilt-intermediates LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) @@ -90,17 +91,14 @@ $(intermediates)/glsl/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-lex.l $(intermediates)/glsl/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-parse.y $(call glsl_local-y-to-c-and-h) -$(intermediates)/glsl/ir_expression_operation.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py - @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $< enum > $@ +$(intermediates)/glsl/ir_expression_operation.h: $(prebuilt_intermediates)/glsl/ir_expression_operation.h + cp -a $< $@ -$(intermediates)/glsl/ir_expression_operation_constant.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py - @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $< constant > $@ +$(intermediates)/glsl/ir_expression_operation_constant.h: $(prebuilt_intermediates)/glsl/ir_expression_operation_constant.h + cp -a $< $@ -$(intermediates)/glsl/ir_expression_operation_strings.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py - @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $< strings > $@ +$(intermediates)/glsl/ir_expression_operation_strings.h: $(prebuilt_intermediates)/glsl/ir_expression_operation_strings.h + cp -a $< $@ $(intermediates)/glsl/float64_glsl.h: $(LOCAL_PATH)/glsl/xxd.py @mkdir -p $(dir $@) diff --git a/src/compiler/Android.nir.gen.mk b/src/compiler/Android.nir.gen.mk index 26115f446a3..819cba1d17a 100644 --- a/src/compiler/Android.nir.gen.mk +++ b/src/compiler/Android.nir.gen.mk @@ -28,6 +28,7 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES endif intermediates := $(call local-generated-sources-dir) +prebuilt_intermediates := $(MESA_TOP)/prebuilt-intermediates LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) @@ -54,45 +55,40 @@ nir_builder_opcodes_deps := \ $(LOCAL_PATH)/nir/nir_opcodes.py \ $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py -$(intermediates)/nir/nir_builder_opcodes.h: $(nir_builder_opcodes_deps) - @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $(nir_builder_opcodes_gen) $< > $@ +$(intermediates)/nir/nir_builder_opcodes.h: $(prebuilt_intermediates)/nir/nir_builder_opcodes.h + cp -a $< $@ nir_constant_expressions_gen := $(LOCAL_PATH)/nir/nir_constant_expressions.py nir_constant_expressions_deps := \ $(LOCAL_PATH)/nir/nir_opcodes.py \ $(LOCAL_PATH)/nir/nir_constant_expressions.py -$(intermediates)/nir/nir_constant_expressions.c: $(nir_constant_expressions_deps) - @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $(nir_constant_expressions_gen) $< > $@ +$(intermediates)/nir/nir_constant_expressions.c: $(prebuilt_intermediates)/nir/nir_constant_expressions.c + cp -a $< $@ nir_opcodes_h_gen := $(LOCAL_PATH)/nir/nir_opcodes_h.py nir_opcodes_h_deps := \ $(LOCAL_PATH)/nir/nir_opcodes.py \ $(LOCAL_PATH)/nir/nir_opcodes_h.py -$(intermediates)/nir/nir_opcodes.h: $(nir_opcodes_h_deps) - @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $(nir_opcodes_h_gen) $< > $@ +$(intermediates)/nir/nir_opcodes.h: $(prebuilt_intermediates)/nir/nir_opcodes.h + cp -a $< $@ nir_opcodes_c_gen := $(LOCAL_PATH)/nir/nir_opcodes_c.py nir_opcodes_c_deps := \ $(LOCAL_PATH)/nir/nir_opcodes.py \ $(LOCAL_PATH)/nir/nir_opcodes_c.py -$(intermediates)/nir/nir_opcodes.c: $(nir_opcodes_c_deps) - @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $(nir_opcodes_c_gen) $< > $@ +$(intermediates)/nir/nir_opcodes.c: $(prebuilt_intermediates)/nir/nir_opcodes.c + cp -a $< $@ nir_opt_algebraic_gen := $(LOCAL_PATH)/nir/nir_opt_algebraic.py nir_opt_algebraic_deps := \ $(LOCAL_PATH)/nir/nir_opt_algebraic.py \ $(LOCAL_PATH)/nir/nir_algebraic.py -$(intermediates)/nir/nir_opt_algebraic.c: $(nir_opt_algebraic_deps) - @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $(nir_opt_algebraic_gen) $< > $@ +$(intermediates)/nir/nir_opt_algebraic.c: $(prebuilt_intermediates)/nir/nir_opt_algebraic.c + cp -a $< $@ $(intermediates)/spirv/spirv_info.c: $(LOCAL_PATH)/spirv/spirv_info_c.py $(LOCAL_PATH)/spirv/spirv.core.grammar.json @mkdir -p $(dir $@) diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk index ee2d1dec2c7..f25107ed5a2 100644 --- a/src/mesa/Android.gen.mk +++ b/src/mesa/Android.gen.mk @@ -28,6 +28,7 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES endif intermediates := $(call local-generated-sources-dir) +prebuilt_intermediates := $(MESA_TOP)/prebuilt-intermediates # This is the list of auto-generated files: sources and headers sources := \ @@ -104,6 +105,12 @@ $(intermediates)/main/api_exec.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml $(intermediates)/main/api_exec.c: $(dispatch_deps) $(call es-gen) +$(intermediates)/main/format_pack.c: $(prebuilt_intermediates)/main/format_pack.c + cp -a $< $@ + +$(intermediates)/main/format_unpack.c: $(prebuilt_intermediates)/main/format_unpack.c + cp -a $< $@ + $(intermediates)/main/marshal_generated.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_marshal.py $(intermediates)/main/marshal_generated.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml @@ -145,25 +152,3 @@ $(intermediates)/main/format_info.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_ $(intermediates)/main/format_info.h: PRIVATE_XML := $(intermediates)/main/format_info.h: $(format_info_deps) $(call es-gen, $<) - -FORMAT_PACK := $(LOCAL_PATH)/main/format_pack.py -format_pack_deps := \ - $(LOCAL_PATH)/main/formats.csv \ - $(LOCAL_PATH)/main/format_parser.py \ - $(FORMAT_PACK) - -$(intermediates)/main/format_pack.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_PACK) -$(intermediates)/main/format_pack.c: PRIVATE_XML := -$(intermediates)/main/format_pack.c: $(format_pack_deps) - $(call es-gen, $<) - -FORMAT_UNPACK := $(LOCAL_PATH)/main/format_unpack.py -format_unpack_deps := \ - $(LOCAL_PATH)/main/formats.csv \ - $(LOCAL_PATH)/main/format_parser.py \ - $(FORMAT_UNPACK) - -$(intermediates)/main/format_unpack.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_UNPACK) -$(intermediates)/main/format_unpack.c: PRIVATE_XML := -$(intermediates)/main/format_unpack.c: $(format_unpack_deps) - $(call es-gen, $<) |