#include "agx_nir.h"

#include "nir.h"
#include "nir_builder.h"
#include "nir_search.h"
#include "nir_search_helpers.h"

/* What follows is NIR algebraic transform code for the following 44
 * transforms:
 *    ('ishl', 'a@8', 'b') => ('ishl', 'a', ('iand', 'b', 7))
 *    ('ishr', 'a@8', 'b') => ('ishr', 'a', ('iand', 'b', 7))
 *    ('ushr', 'a@8', 'b') => ('ushr', 'a', ('iand', 'b', 7))
 *    ('ishl', 'a@16', 'b') => ('ishl', 'a', ('iand', 'b', 15))
 *    ('ishr', 'a@16', 'b') => ('ishr', 'a', ('iand', 'b', 15))
 *    ('ushr', 'a@16', 'b') => ('ushr', 'a', ('iand', 'b', 15))
 *    ('ishl', 'a@32', 'b') => ('ishl', 'a', ('iand', 'b', 31))
 *    ('ishr', 'a@32', 'b') => ('ishr', 'a', ('iand', 'b', 31))
 *    ('ushr', 'a@32', 'b') => ('ushr', 'a', ('iand', 'b', 31))
 *    ('ishl', 'a@64', 'b') => ('ishl', 'a', ('iand', 'b', 63))
 *    ('ishr', 'a@64', 'b') => ('ishr', 'a', ('iand', 'b', 63))
 *    ('ushr', 'a@64', 'b') => ('ushr', 'a', ('iand', 'b', 63))
 *    ('pack_half_2x16_split', 'a', 'b') => ('pack_32_2x16_split', ('f2f16', 'a'), ('f2f16', 'b'))
 *    ('pack_32_4x8_split', 'a', 'b', 'c', 'd') => ('pack_32_2x16_split', ('ior', ('u2u16', 'a'), ('ishl', ('u2u16', 'b'), 8)), ('ior', ('u2u16', 'c'), ('ishl', ('u2u16', 'd'), 8)))
 *    ('unpack_half_2x16_split_x', 'a') => ('f2f32', ('unpack_32_2x16_split_x', 'a'))
 *    ('unpack_half_2x16_split_y', 'a') => ('f2f32', ('unpack_32_2x16_split_y', 'a'))
 *    ('extract_u16', 'a@32', 0) => ('u2u32', ('unpack_32_2x16_split_x', 'a'))
 *    ('extract_u16', 'a@32', 1) => ('u2u32', ('unpack_32_2x16_split_y', 'a'))
 *    ('extract_i16', 'a@32', 0) => ('i2i32', ('unpack_32_2x16_split_x', 'a'))
 *    ('extract_i16', 'a@32', 1) => ('i2i32', ('unpack_32_2x16_split_y', 'a'))
 *    ('u2f32', ('u2u32', 'a')) => ('u2f32', 'a')
 *    ('i2f32', ('i2i32', 'a')) => ('i2f32', 'a')
 *    ('f2u8', 'a') => ('u2u8', ('f2u16', 'a'))
 *    ('f2i8', 'a') => ('i2i8', ('f2i16', 'a'))
 *    ('f2f16_rtz', 'a@32') => ('bcsel', ('flt', ('fabs', 'a'), ('fabs', ('f2f32', ('f2f16_rtne', 'a')))), ('isub', ('f2f16_rtne', 'a'), 1), ('f2f16_rtne', 'a'))
 *    ('ibitfield_extract', 'value', 'offset', 'bits(is_not_const)') => ('bcsel', ('ieq', 0, 'bits'), 0, ('ishr', ('ishl', 'value', ('isub', ('isub', 32, 'bits'), 'offset')), ('isub', 32, 'bits')))
 *    ('ubitfield_extract', 'value', 'offset', 'bits(is_not_const)') => ('iand', ('ushr', 'value', 'offset'), ('bcsel', ('ieq', 'bits', 32), 4294967295, ('isub', ('ishl', 1, 'bits'), 1)))
 *    ('ubitfield_extract', 'value', 'offset', 0) => 0
 *    ('ibitfield_extract', 'value', 'offset', 0) => 0
 *    ('ibitfield_extract', 'a', 'b', '#bits') => ('ishr', ('ishl', ('ubitfield_extract', 'a', 'b', 'bits'), ('isub', 32, 'bits')), ('isub', 32, 'bits'))
 *    ('b2f16', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1.0)
 *    ('b2f16', 'a@1') => ('bcsel', 'a', 1.0, 0)
 *    ('b2f32', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1.0)
 *    ('b2f32', 'a@1') => ('bcsel', 'a', 1.0, 0)
 *    ('b2i8', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1)
 *    ('b2i8', 'a@1') => ('bcsel', 'a', 1, 0)
 *    ('b2i16', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1)
 *    ('b2i16', 'a@1') => ('bcsel', 'a', 1, 0)
 *    ('b2i32', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1)
 *    ('b2i32', 'a@1') => ('bcsel', 'a', 1, 0)
 *    ('b2b16', ('inot', 'a@1')) => ('bcsel', 'a', 0, -1)
 *    ('b2b16', 'a@1') => ('bcsel', 'a', -1, 0)
 *    ('b2b32', ('inot', 'a@1')) => ('bcsel', 'a', 0, -1)
 *    ('b2b32', 'a@1') => ('bcsel', 'a', -1, 0)
 */


static const nir_search_value_union agx_nir_lower_algebraic_late_values[] = {
   /* ('ishl', 'a@8', 'b') => ('ishl', 'a', ('iand', 'b', 7)) */
   { .variable = {
      { nir_search_value_variable, 8 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, 32 },
      1, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 0, 1 },
      -1,
   } },

   /* replace0_0 -> 0 in the cache */
   /* replace0_1_0 -> 1 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7ull /* 7 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 1, 3 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 1,
      { 0, 4 },
      -1,
   } },

   /* ('ishr', 'a@8', 'b') => ('ishr', 'a', ('iand', 'b', 7)) */
   /* search1_0 -> 0 in the cache */
   /* search1_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 0,
      { 0, 1 },
      -1,
   } },

   /* replace1_0 -> 0 in the cache */
   /* replace1_1_0 -> 1 in the cache */
   /* replace1_1_1 -> 3 in the cache */
   /* replace1_1 -> 4 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 1,
      { 0, 4 },
      -1,
   } },

   /* ('ushr', 'a@8', 'b') => ('ushr', 'a', ('iand', 'b', 7)) */
   /* search2_0 -> 0 in the cache */
   /* search2_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 1 },
      -1,
   } },

   /* replace2_0 -> 0 in the cache */
   /* replace2_1_0 -> 1 in the cache */
   /* replace2_1_1 -> 3 in the cache */
   /* replace2_1 -> 4 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 1,
      { 0, 4 },
      -1,
   } },

   /* ('ishl', 'a@16', 'b') => ('ishl', 'a', ('iand', 'b', 15)) */
   { .variable = {
      { nir_search_value_variable, 16 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   /* search3_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 10, 1 },
      -1,
   } },

   /* replace3_0 -> 10 in the cache */
   /* replace3_1_0 -> 1 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xfull /* 15 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 1, 12 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 1,
      { 10, 13 },
      -1,
   } },

   /* ('ishr', 'a@16', 'b') => ('ishr', 'a', ('iand', 'b', 15)) */
   /* search4_0 -> 10 in the cache */
   /* search4_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 0,
      { 10, 1 },
      -1,
   } },

   /* replace4_0 -> 10 in the cache */
   /* replace4_1_0 -> 1 in the cache */
   /* replace4_1_1 -> 12 in the cache */
   /* replace4_1 -> 13 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 1,
      { 10, 13 },
      -1,
   } },

   /* ('ushr', 'a@16', 'b') => ('ushr', 'a', ('iand', 'b', 15)) */
   /* search5_0 -> 10 in the cache */
   /* search5_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 10, 1 },
      -1,
   } },

   /* replace5_0 -> 10 in the cache */
   /* replace5_1_0 -> 1 in the cache */
   /* replace5_1_1 -> 12 in the cache */
   /* replace5_1 -> 13 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 1,
      { 10, 13 },
      -1,
   } },

   /* ('ishl', 'a@32', 'b') => ('ishl', 'a', ('iand', 'b', 31)) */
   { .variable = {
      { nir_search_value_variable, 32 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   /* search6_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 19, 1 },
      -1,
   } },

   /* replace6_0 -> 19 in the cache */
   /* replace6_1_0 -> 1 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1full /* 31 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 1, 21 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 1,
      { 19, 22 },
      -1,
   } },

   /* ('ishr', 'a@32', 'b') => ('ishr', 'a', ('iand', 'b', 31)) */
   /* search7_0 -> 19 in the cache */
   /* search7_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 0,
      { 19, 1 },
      -1,
   } },

   /* replace7_0 -> 19 in the cache */
   /* replace7_1_0 -> 1 in the cache */
   /* replace7_1_1 -> 21 in the cache */
   /* replace7_1 -> 22 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 1,
      { 19, 22 },
      -1,
   } },

   /* ('ushr', 'a@32', 'b') => ('ushr', 'a', ('iand', 'b', 31)) */
   /* search8_0 -> 19 in the cache */
   /* search8_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 19, 1 },
      -1,
   } },

   /* replace8_0 -> 19 in the cache */
   /* replace8_1_0 -> 1 in the cache */
   /* replace8_1_1 -> 21 in the cache */
   /* replace8_1 -> 22 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 1,
      { 19, 22 },
      -1,
   } },

   /* ('ishl', 'a@64', 'b') => ('ishl', 'a', ('iand', 'b', 63)) */
   { .variable = {
      { nir_search_value_variable, 64 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   /* search9_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 64 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 28, 1 },
      -1,
   } },

   /* replace9_0 -> 28 in the cache */
   /* replace9_1_0 -> 1 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3full /* 63 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 1, 30 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 64 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 1,
      { 28, 31 },
      -1,
   } },

   /* ('ishr', 'a@64', 'b') => ('ishr', 'a', ('iand', 'b', 63)) */
   /* search10_0 -> 28 in the cache */
   /* search10_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 64 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 0,
      { 28, 1 },
      -1,
   } },

   /* replace10_0 -> 28 in the cache */
   /* replace10_1_0 -> 1 in the cache */
   /* replace10_1_1 -> 30 in the cache */
   /* replace10_1 -> 31 in the cache */
   { .expression = {
      { nir_search_value_expression, 64 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 1,
      { 28, 31 },
      -1,
   } },

   /* ('ushr', 'a@64', 'b') => ('ushr', 'a', ('iand', 'b', 63)) */
   /* search11_0 -> 28 in the cache */
   /* search11_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 64 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 28, 1 },
      -1,
   } },

   /* replace11_0 -> 28 in the cache */
   /* replace11_1_0 -> 1 in the cache */
   /* replace11_1_1 -> 30 in the cache */
   /* replace11_1 -> 31 in the cache */
   { .expression = {
      { nir_search_value_expression, 64 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 1,
      { 28, 31 },
      -1,
   } },

   /* ('pack_half_2x16_split', 'a', 'b') => ('pack_32_2x16_split', ('f2f16', 'a'), ('f2f16', 'b')) */
   /* search12_0 -> 19 in the cache */
   /* search12_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_pack_half_2x16_split,
      -1, 0,
      { 19, 1 },
      -1,
   } },

   /* replace12_0_0 -> 19 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2f16,
      -1, 0,
      { 19 },
      -1,
   } },
   /* replace12_1_0 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2f16,
      -1, 0,
      { 1 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_pack_32_2x16_split,
      -1, 0,
      { 38, 39 },
      -1,
   } },

   /* ('pack_32_4x8_split', 'a', 'b', 'c', 'd') => ('pack_32_2x16_split', ('ior', ('u2u16', 'a'), ('ishl', ('u2u16', 'b'), 8)), ('ior', ('u2u16', 'c'), ('ishl', ('u2u16', 'd'), 8))) */
   /* search13_0 -> 0 in the cache */
   { .variable = {
      { nir_search_value_variable, 8 },
      1, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, 8 },
      2, /* c */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, 8 },
      3, /* d */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_pack_32_4x8_split,
      -1, 0,
      { 0, 41, 42, 43 },
      -1,
   } },

   /* replace13_0_0_0 -> 0 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2u16,
      -1, 0,
      { 0 },
      -1,
   } },
   /* replace13_0_1_0_0 -> 41 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2u16,
      -1, 0,
      { 41 },
      -1,
   } },
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x8ull /* 8 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 46, 47 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 45, 48 },
      -1,
   } },
   /* replace13_1_0_0 -> 42 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2u16,
      -1, 0,
      { 42 },
      -1,
   } },
   /* replace13_1_1_0_0 -> 43 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2u16,
      -1, 0,
      { 43 },
      -1,
   } },
   /* replace13_1_1_1 -> 47 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 51, 47 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      1, 1,
      { 50, 52 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_pack_32_2x16_split,
      -1, 2,
      { 49, 53 },
      -1,
   } },

   /* ('unpack_half_2x16_split_x', 'a') => ('f2f32', ('unpack_32_2x16_split_x', 'a')) */
   /* search14_0 -> 19 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_unpack_half_2x16_split_x,
      -1, 0,
      { 19 },
      -1,
   } },

   /* replace14_0_0 -> 19 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_unpack_32_2x16_split_x,
      -1, 0,
      { 19 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2f32,
      -1, 0,
      { 56 },
      -1,
   } },

   /* ('unpack_half_2x16_split_y', 'a') => ('f2f32', ('unpack_32_2x16_split_y', 'a')) */
   /* search15_0 -> 19 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_unpack_half_2x16_split_y,
      -1, 0,
      { 19 },
      -1,
   } },

   /* replace15_0_0 -> 19 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_unpack_32_2x16_split_y,
      -1, 0,
      { 19 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2f32,
      -1, 0,
      { 59 },
      -1,
   } },

   /* ('extract_u16', 'a@32', 0) => ('u2u32', ('unpack_32_2x16_split_x', 'a')) */
   /* search16_0 -> 19 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x0ull /* 0 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extract_u16,
      -1, 0,
      { 19, 61 },
      -1,
   } },

   /* replace16_0_0 -> 19 in the cache */
   /* replace16_0 -> 56 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2u32,
      -1, 0,
      { 56 },
      -1,
   } },

   /* ('extract_u16', 'a@32', 1) => ('u2u32', ('unpack_32_2x16_split_y', 'a')) */
   /* search17_0 -> 19 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1ull /* 1 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extract_u16,
      -1, 0,
      { 19, 64 },
      -1,
   } },

   /* replace17_0_0 -> 19 in the cache */
   /* replace17_0 -> 59 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2u32,
      -1, 0,
      { 59 },
      -1,
   } },

   /* ('extract_i16', 'a@32', 0) => ('i2i32', ('unpack_32_2x16_split_x', 'a')) */
   /* search18_0 -> 19 in the cache */
   /* search18_1 -> 61 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extract_i16,
      -1, 0,
      { 19, 61 },
      -1,
   } },

   /* replace18_0_0 -> 19 in the cache */
   /* replace18_0 -> 56 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_i2i32,
      -1, 0,
      { 56 },
      -1,
   } },

   /* ('extract_i16', 'a@32', 1) => ('i2i32', ('unpack_32_2x16_split_y', 'a')) */
   /* search19_0 -> 19 in the cache */
   /* search19_1 -> 64 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extract_i16,
      -1, 0,
      { 19, 64 },
      -1,
   } },

   /* replace19_0_0 -> 19 in the cache */
   /* replace19_0 -> 59 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_i2i32,
      -1, 0,
      { 59 },
      -1,
   } },

   /* ('u2f32', ('u2u32', 'a')) => ('u2f32', 'a') */
   { .variable = {
      { nir_search_value_variable, -1 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2u32,
      -1, 0,
      { 71 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2f32,
      -1, 0,
      { 72 },
      -1,
   } },

   /* replace20_0 -> 71 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2f32,
      -1, 0,
      { 71 },
      -1,
   } },

   /* ('i2f32', ('i2i32', 'a')) => ('i2f32', 'a') */
   /* search21_0_0 -> 71 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_i2i32,
      -1, 0,
      { 71 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_i2f32,
      -1, 0,
      { 75 },
      -1,
   } },

   /* replace21_0 -> 71 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_i2f32,
      -1, 0,
      { 71 },
      -1,
   } },

   /* ('f2u8', 'a') => ('u2u8', ('f2u16', 'a')) */
   /* search22_0 -> 71 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2u8,
      -1, 0,
      { 71 },
      -1,
   } },

   /* replace22_0_0 -> 71 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2u16,
      -1, 0,
      { 71 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_u2u8,
      -1, 0,
      { 79 },
      -1,
   } },

   /* ('f2i8', 'a') => ('i2i8', ('f2i16', 'a')) */
   /* search23_0 -> 71 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2i8,
      -1, 0,
      { 71 },
      -1,
   } },

   /* replace23_0_0 -> 71 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2i16,
      -1, 0,
      { 71 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_i2i8,
      -1, 0,
      { 82 },
      -1,
   } },

   /* ('f2f16_rtz', 'a@32') => ('bcsel', ('flt', ('fabs', 'a'), ('fabs', ('f2f32', ('f2f16_rtne', 'a')))), ('isub', ('f2f16_rtne', 'a'), 1), ('f2f16_rtne', 'a')) */
   /* search24_0 -> 19 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2f16_rtz,
      -1, 0,
      { 19 },
      -1,
   } },

   /* replace24_0_0_0 -> 19 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_fabs,
      -1, 0,
      { 19 },
      -1,
   } },
   /* replace24_0_1_0_0_0 -> 19 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2f16_rtne,
      -1, 0,
      { 19 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_f2f32,
      -1, 0,
      { 86 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_fabs,
      -1, 0,
      { 87 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_flt,
      -1, 0,
      { 85, 88 },
      -1,
   } },
   /* replace24_1_0_0 -> 19 in the cache */
   /* replace24_1_0 -> 86 in the cache */
   { .constant = {
      { nir_search_value_constant, 16 },
      nir_type_int, { 0x1ull /* 1 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 0,
      { 86, 90 },
      -1,
   } },
   /* replace24_2_0 -> 19 in the cache */
   /* replace24_2 -> 86 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 89, 91, 86 },
      -1,
   } },

   /* ('ibitfield_extract', 'value', 'offset', 'bits(is_not_const)') => ('bcsel', ('ieq', 0, 'bits'), 0, ('ishr', ('ishl', 'value', ('isub', ('isub', 32, 'bits'), 'offset')), ('isub', 32, 'bits'))) */
   { .variable = {
      { nir_search_value_variable, 32 },
      0, /* value */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, 32 },
      1, /* offset */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, 32 },
      2, /* bits */
      false,
      nir_type_invalid,
      0,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ibitfield_extract,
      -1, 0,
      { 93, 94, 95 },
      -1,
   } },

   /* replace25_0_0 -> 61 in the cache */
   { .variable = {
      { nir_search_value_variable, 32 },
      2, /* bits */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ieq,
      0, 1,
      { 61, 97 },
      -1,
   } },
   /* replace25_1 -> 61 in the cache */
   /* replace25_2_0_0 -> 93 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x20ull /* 32 */ },
   } },
   /* replace25_2_0_1_0_1 -> 97 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 0,
      { 99, 97 },
      -1,
   } },
   /* replace25_2_0_1_1 -> 94 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 0,
      { 100, 94 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 93, 101 },
      -1,
   } },
   /* replace25_2_1_0 -> 99 in the cache */
   /* replace25_2_1_1 -> 97 in the cache */
   /* replace25_2_1 -> 100 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 0,
      { 102, 100 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 1,
      { 98, 61, 103 },
      -1,
   } },

   /* ('ubitfield_extract', 'value', 'offset', 'bits(is_not_const)') => ('iand', ('ushr', 'value', 'offset'), ('bcsel', ('ieq', 'bits', 32), 4294967295, ('isub', ('ishl', 1, 'bits'), 1))) */
   /* search26_0 -> 93 in the cache */
   /* search26_1 -> 94 in the cache */
   /* search26_2 -> 95 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 93, 94, 95 },
      -1,
   } },

   /* replace26_0_0 -> 93 in the cache */
   /* replace26_0_1 -> 94 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 93, 94 },
      -1,
   } },
   /* replace26_1_0_0 -> 97 in the cache */
   /* replace26_1_0_1 -> 99 in the cache */
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ieq,
      1, 1,
      { 97, 99 },
      -1,
   } },
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xffffffffull /* 4294967295 */ },
   } },
   /* replace26_1_2_0_0 -> 64 in the cache */
   /* replace26_1_2_0_1 -> 97 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 64, 97 },
      -1,
   } },
   /* replace26_1_2_1 -> 64 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 0,
      { 109, 64 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 1,
      { 107, 108, 110 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 2,
      { 106, 111 },
      -1,
   } },

   /* ('ubitfield_extract', 'value', 'offset', 0) => 0 */
   /* search27_0 -> 93 in the cache */
   /* search27_1 -> 94 in the cache */
   /* search27_2 -> 61 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 93, 94, 61 },
      -1,
   } },

   /* replace27 -> 61 in the cache */

   /* ('ibitfield_extract', 'value', 'offset', 0) => 0 */
   /* search28_0 -> 93 in the cache */
   /* search28_1 -> 94 in the cache */
   /* search28_2 -> 61 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ibitfield_extract,
      -1, 0,
      { 93, 94, 61 },
      -1,
   } },

   /* replace28 -> 61 in the cache */

   /* ('ibitfield_extract', 'a', 'b', '#bits') => ('ishr', ('ishl', ('ubitfield_extract', 'a', 'b', 'bits'), ('isub', 32, 'bits')), ('isub', 32, 'bits')) */
   /* search29_0 -> 19 in the cache */
   /* search29_1 -> 1 in the cache */
   { .variable = {
      { nir_search_value_variable, 32 },
      2, /* bits */
      true,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ibitfield_extract,
      -1, 0,
      { 19, 1, 115 },
      -1,
   } },

   /* replace29_0_0_0 -> 19 in the cache */
   /* replace29_0_0_1 -> 1 in the cache */
   /* replace29_0_0_2 -> 97 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 19, 1, 97 },
      -1,
   } },
   /* replace29_0_1_0 -> 99 in the cache */
   /* replace29_0_1_1 -> 97 in the cache */
   /* replace29_0_1 -> 100 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 117, 100 },
      -1,
   } },
   /* replace29_1_0 -> 99 in the cache */
   /* replace29_1_1 -> 97 in the cache */
   /* replace29_1 -> 100 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishr,
      -1, 0,
      { 118, 100 },
      -1,
   } },

   /* ('b2f16', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1.0) */
   { .variable = {
      { nir_search_value_variable, 1 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_inot,
      -1, 0,
      { 120 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2f16,
      -1, 0,
      { 121 },
      -1,
   } },

   /* replace30_0 -> 120 in the cache */
   { .constant = {
      { nir_search_value_constant, 16 },
      nir_type_int, { 0x0ull /* 0 */ },
   } },
   { .constant = {
      { nir_search_value_constant, 16 },
      nir_type_float, { 0x3ff0000000000000ull /* 1.0 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 123, 124 },
      -1,
   } },

   /* ('b2f16', 'a@1') => ('bcsel', 'a', 1.0, 0) */
   /* search31_0 -> 120 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2f16,
      -1, 0,
      { 120 },
      -1,
   } },

   /* replace31_0 -> 120 in the cache */
   /* replace31_1 -> 124 in the cache */
   /* replace31_2 -> 123 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 124, 123 },
      -1,
   } },

   /* ('b2f32', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1.0) */
   /* search32_0_0 -> 120 in the cache */
   /* search32_0 -> 121 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2f32,
      -1, 0,
      { 121 },
      -1,
   } },

   /* replace32_0 -> 120 in the cache */
   /* replace32_1 -> 61 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_float, { 0x3ff0000000000000ull /* 1.0 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 61, 129 },
      -1,
   } },

   /* ('b2f32', 'a@1') => ('bcsel', 'a', 1.0, 0) */
   /* search33_0 -> 120 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2f32,
      -1, 0,
      { 120 },
      -1,
   } },

   /* replace33_0 -> 120 in the cache */
   /* replace33_1 -> 129 in the cache */
   /* replace33_2 -> 61 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 129, 61 },
      -1,
   } },

   /* ('b2i8', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1) */
   /* search34_0_0 -> 120 in the cache */
   /* search34_0 -> 121 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2i8,
      -1, 0,
      { 121 },
      -1,
   } },

   /* replace34_0 -> 120 in the cache */
   { .constant = {
      { nir_search_value_constant, 8 },
      nir_type_int, { 0x0ull /* 0 */ },
   } },
   { .constant = {
      { nir_search_value_constant, 8 },
      nir_type_int, { 0x1ull /* 1 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 134, 135 },
      -1,
   } },

   /* ('b2i8', 'a@1') => ('bcsel', 'a', 1, 0) */
   /* search35_0 -> 120 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2i8,
      -1, 0,
      { 120 },
      -1,
   } },

   /* replace35_0 -> 120 in the cache */
   /* replace35_1 -> 135 in the cache */
   /* replace35_2 -> 134 in the cache */
   { .expression = {
      { nir_search_value_expression, 8 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 135, 134 },
      -1,
   } },

   /* ('b2i16', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1) */
   /* search36_0_0 -> 120 in the cache */
   /* search36_0 -> 121 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2i16,
      -1, 0,
      { 121 },
      -1,
   } },

   /* replace36_0 -> 120 in the cache */
   /* replace36_1 -> 123 in the cache */
   /* replace36_2 -> 90 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 123, 90 },
      -1,
   } },

   /* ('b2i16', 'a@1') => ('bcsel', 'a', 1, 0) */
   /* search37_0 -> 120 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2i16,
      -1, 0,
      { 120 },
      -1,
   } },

   /* replace37_0 -> 120 in the cache */
   /* replace37_1 -> 90 in the cache */
   /* replace37_2 -> 123 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 90, 123 },
      -1,
   } },

   /* ('b2i32', ('inot', 'a@1')) => ('bcsel', 'a', 0, 1) */
   /* search38_0_0 -> 120 in the cache */
   /* search38_0 -> 121 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2i32,
      -1, 0,
      { 121 },
      -1,
   } },

   /* replace38_0 -> 120 in the cache */
   /* replace38_1 -> 61 in the cache */
   /* replace38_2 -> 64 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 61, 64 },
      -1,
   } },

   /* ('b2i32', 'a@1') => ('bcsel', 'a', 1, 0) */
   /* search39_0 -> 120 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2i32,
      -1, 0,
      { 120 },
      -1,
   } },

   /* replace39_0 -> 120 in the cache */
   /* replace39_1 -> 64 in the cache */
   /* replace39_2 -> 61 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 64, 61 },
      -1,
   } },

   /* ('b2b16', ('inot', 'a@1')) => ('bcsel', 'a', 0, -1) */
   /* search40_0_0 -> 120 in the cache */
   /* search40_0 -> 121 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2b16,
      -1, 0,
      { 121 },
      -1,
   } },

   /* replace40_0 -> 120 in the cache */
   /* replace40_1 -> 123 in the cache */
   { .constant = {
      { nir_search_value_constant, 16 },
      nir_type_int, { 0xffffffffffffffffull /* -1 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 123, 148 },
      -1,
   } },

   /* ('b2b16', 'a@1') => ('bcsel', 'a', -1, 0) */
   /* search41_0 -> 120 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2b16,
      -1, 0,
      { 120 },
      -1,
   } },

   /* replace41_0 -> 120 in the cache */
   /* replace41_1 -> 148 in the cache */
   /* replace41_2 -> 123 in the cache */
   { .expression = {
      { nir_search_value_expression, 16 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 148, 123 },
      -1,
   } },

   /* ('b2b32', ('inot', 'a@1')) => ('bcsel', 'a', 0, -1) */
   /* search42_0_0 -> 120 in the cache */
   /* search42_0 -> 121 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2b32,
      -1, 0,
      { 121 },
      -1,
   } },

   /* replace42_0 -> 120 in the cache */
   /* replace42_1 -> 61 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xffffffffffffffffull /* -1 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 61, 153 },
      -1,
   } },

   /* ('b2b32', 'a@1') => ('bcsel', 'a', -1, 0) */
   /* search43_0 -> 120 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_b2b32,
      -1, 0,
      { 120 },
      -1,
   } },

   /* replace43_0 -> 120 in the cache */
   /* replace43_1 -> 153 in the cache */
   /* replace43_2 -> 61 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 120, 153, 61 },
      -1,
   } },

};


static const nir_search_variable_cond agx_nir_lower_algebraic_late_variable_cond[] = {
   (is_not_const),
};

static const struct transform agx_nir_lower_algebraic_late_transforms[] = {
   { ~0, ~0, ~0 }, /* Sentinel */

   { 2, 5, 0 },
   { 11, 14, 0 },
   { 20, 23, 0 },
   { 29, 32, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 6, 7, 0 },
   { 15, 16, 0 },
   { 24, 25, 0 },
   { 33, 34, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 8, 9, 0 },
   { 17, 18, 0 },
   { 26, 27, 0 },
   { 35, 36, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 37, 40, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 44, 54, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 55, 57, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 58, 60, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 62, 63, 0 },
   { 65, 66, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 67, 68, 0 },
   { 69, 70, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 78, 80, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 81, 83, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 84, 92, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 96, 104, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 96, 104, 0 },
   { 114, 61, 0 },
   { 116, 119, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 105, 112, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 105, 112, 0 },
   { 113, 61, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 126, 127, 0 },
   { 131, 132, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 137, 138, 0 },
   { 141, 142, 0 },
   { 145, 146, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 150, 151, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 155, 156, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 73, 74, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 76, 77, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 122, 125, 0 },
   { 126, 127, 0 },
   { 128, 130, 0 },
   { 131, 132, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 133, 136, 0 },
   { 137, 138, 0 },
   { 139, 140, 0 },
   { 141, 142, 0 },
   { 143, 144, 0 },
   { 145, 146, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 147, 149, 0 },
   { 150, 151, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 152, 154, 0 },
   { 155, 156, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

};

static const struct per_op_table agx_nir_lower_algebraic_late_pass_op_table[nir_num_search_ops] = {
   [nir_op_ishl] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         2,
      },
   },
   [nir_op_ishr] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         3,
      },
   },
   [nir_op_ushr] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         4,
      },
   },
   [nir_op_pack_half_2x16_split] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         5,
      },
   },
   [nir_op_pack_32_4x8_split] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         6,
      },
   },
   [nir_op_unpack_half_2x16_split_x] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         7,
      },
   },
   [nir_op_unpack_half_2x16_split_y] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         8,
      },
   },
   [nir_op_extract_u16] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         0,
         9,
         0,
         9,
      },
   },
   [nir_op_extract_i16] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         0,
         10,
         0,
         10,
      },
   },
   [nir_search_op_u2f] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         0,
         25,
      },
   },
   [nir_search_op_u2u] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         11,
      },
   },
   [nir_search_op_i2f] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         0,
         26,
      },
   },
   [nir_search_op_i2i] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         12,
      },
   },
   [nir_search_op_f2u] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         13,
      },
   },
   [nir_search_op_f2i] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         14,
      },
   },
   [nir_op_f2f16_rtz] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         15,
      },
   },
   [nir_op_ibitfield_extract] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         16,
         17,
         16,
         17,
         16,
         17,
         16,
         17,
      },
   },
   [nir_op_ubitfield_extract] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         18,
         19,
         18,
         19,
         18,
         19,
         18,
         19,
      },
   },
   [nir_search_op_b2f] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         20,
         27,
      },
   },
   [nir_op_inot] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         21,
      },
   },
   [nir_search_op_b2i] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         22,
         28,
      },
   },
   [nir_op_b2b16] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         23,
         29,
      },
   },
   [nir_op_b2b32] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         24,
         30,
      },
   },
};

/* Mapping from state index to offset in transforms (0 being no transforms) */
static const uint16_t agx_nir_lower_algebraic_late_transform_offsets[] = {
   0,
   0,
   1,
   6,
   11,
   16,
   18,
   20,
   22,
   24,
   27,
   0,
   0,
   30,
   32,
   34,
   36,
   38,
   42,
   44,
   47,
   0,
   50,
   54,
   56,
   58,
   60,
   62,
   67,
   74,
   77,
};

static const nir_algebraic_table agx_nir_lower_algebraic_late_table = {
   .transforms = agx_nir_lower_algebraic_late_transforms,
   .transform_offsets = agx_nir_lower_algebraic_late_transform_offsets,
   .pass_op_table = agx_nir_lower_algebraic_late_pass_op_table,
   .values = agx_nir_lower_algebraic_late_values,
   .expression_cond = NULL,
   .variable_cond = agx_nir_lower_algebraic_late_variable_cond,
};

bool
agx_nir_lower_algebraic_late(
   nir_shader *shader
) {
   bool progress = false;
   bool condition_flags[1];
   const nir_shader_compiler_options *options = shader->options;
   const shader_info *info = &shader->info;
   (void) options;
   (void) info;

   STATIC_ASSERT(157 == ARRAY_SIZE(agx_nir_lower_algebraic_late_values));
   condition_flags[0] = true;

   nir_foreach_function_impl(impl, shader) {
     progress |= nir_algebraic_impl(impl, condition_flags, &agx_nir_lower_algebraic_late_table);
   }

   return progress;
}


#include "nir.h"
#include "nir_builder.h"
#include "nir_search.h"
#include "nir_search_helpers.h"

/* What follows is NIR algebraic transform code for the following 4
 * transforms:
 *    ('bcsel', ('ior(is_used_once)', 'a', 'b'), 'c', 'd') => ('bcsel', 'a', 'c', ('bcsel', 'b', 'c', 'd'))
 *    ('bcsel', ('iand(is_used_once)', 'a', 'b'), 'c', 'd') => ('bcsel', 'a', ('bcsel', 'b', 'c', 'd'), 'd')
 *    ('iand', 'a@1', 'b') => ('bcsel', 'a', 'b', False)
 *    ('ior', 'a@1', 'b') => ('bcsel', 'a', True, 'b')
 */


static const nir_search_value_union agx_nir_fuse_selects_values[] = {
   /* ('bcsel', ('ior(is_used_once)', 'a', 'b'), 'c', 'd') => ('bcsel', 'a', 'c', ('bcsel', 'b', 'c', 'd')) */
   { .variable = {
      { nir_search_value_variable, 1 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, 1 },
      1, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 0, 1 },
      0,
   } },
   { .variable = {
      { nir_search_value_variable, -4 },
      2, /* c */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, -4 },
      3, /* d */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 1,
      { 2, 3, 4 },
      -1,
   } },

   /* replace44_0 -> 0 in the cache */
   /* replace44_1 -> 3 in the cache */
   /* replace44_2_0 -> 1 in the cache */
   /* replace44_2_1 -> 3 in the cache */
   /* replace44_2_2 -> 4 in the cache */
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 1, 3, 4 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 0, 3, 6 },
      -1,
   } },

   /* ('bcsel', ('iand(is_used_once)', 'a', 'b'), 'c', 'd') => ('bcsel', 'a', ('bcsel', 'b', 'c', 'd'), 'd') */
   /* search45_0_0 -> 0 in the cache */
   /* search45_0_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 0, 1 },
      0,
   } },
   /* search45_1 -> 3 in the cache */
   /* search45_2 -> 4 in the cache */
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 1,
      { 8, 3, 4 },
      -1,
   } },

   /* replace45_0 -> 0 in the cache */
   /* replace45_1_0 -> 1 in the cache */
   /* replace45_1_1 -> 3 in the cache */
   /* replace45_1_2 -> 4 in the cache */
   /* replace45_1 -> 6 in the cache */
   /* replace45_2 -> 4 in the cache */
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 0, 6, 4 },
      -1,
   } },

   /* ('iand', 'a@1', 'b') => ('bcsel', 'a', 'b', False) */
   /* search46_0 -> 0 in the cache */
   /* search46_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 0, 1 },
      -1,
   } },

   /* replace46_0 -> 0 in the cache */
   /* replace46_1 -> 1 in the cache */
   { .constant = {
      { nir_search_value_constant, 1 },
      nir_type_bool, { NIR_FALSE /* False */ },
   } },
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 0, 1, 12 },
      -1,
   } },

   /* ('ior', 'a@1', 'b') => ('bcsel', 'a', True, 'b') */
   /* search47_0 -> 0 in the cache */
   /* search47_1 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 0, 1 },
      -1,
   } },

   /* replace47_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 1 },
      nir_type_bool, { NIR_TRUE /* True */ },
   } },
   /* replace47_2 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 0, 15, 1 },
      -1,
   } },

};

static const nir_search_expression_cond agx_nir_fuse_selects_expression_cond[] = {
   is_used_once,
};


static const struct transform agx_nir_fuse_selects_transforms[] = {
   { ~0, ~0, ~0 }, /* Sentinel */

   { 14, 16, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 11, 13, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 5, 7, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 9, 10, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

};

static const struct per_op_table agx_nir_fuse_selects_pass_op_table[nir_num_search_ops] = {
   [nir_op_bcsel] = {
      .filter = (const uint16_t []) {
         0,
         0,
         1,
         2,
         0,
         0,
      },
      
      .num_filtered_states = 3,
      .table = (const uint16_t []) {
      
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         4,
         4,
         4,
         4,
         4,
         4,
         4,
         4,
         4,
         5,
         5,
         5,
         5,
         5,
         5,
         5,
         5,
         5,
      },
   },
   [nir_op_ior] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         2,
      },
   },
   [nir_op_iand] = {
      .filter = NULL,
      
      .num_filtered_states = 1,
      .table = (const uint16_t []) {
      
         3,
      },
   },
};

/* Mapping from state index to offset in transforms (0 being no transforms) */
static const uint16_t agx_nir_fuse_selects_transform_offsets[] = {
   0,
   0,
   1,
   3,
   5,
   7,
};

static const nir_algebraic_table agx_nir_fuse_selects_table = {
   .transforms = agx_nir_fuse_selects_transforms,
   .transform_offsets = agx_nir_fuse_selects_transform_offsets,
   .pass_op_table = agx_nir_fuse_selects_pass_op_table,
   .values = agx_nir_fuse_selects_values,
   .expression_cond = agx_nir_fuse_selects_expression_cond,
   .variable_cond = NULL,
};

bool
agx_nir_fuse_selects(
   nir_shader *shader
) {
   bool progress = false;
   bool condition_flags[1];
   const nir_shader_compiler_options *options = shader->options;
   const shader_info *info = &shader->info;
   (void) options;
   (void) info;

   STATIC_ASSERT(17 == ARRAY_SIZE(agx_nir_fuse_selects_values));
   condition_flags[0] = true;

   nir_foreach_function_impl(impl, shader) {
     progress |= nir_algebraic_impl(impl, condition_flags, &agx_nir_fuse_selects_table);
   }

   return progress;
}


#include "nir.h"
#include "nir_builder.h"
#include "nir_search.h"
#include "nir_search_helpers.h"

/* What follows is NIR algebraic transform code for the following 103
 * transforms:
 *    ('ior', ('ushr', 'a@32', 0), ('ishl', 'b@32', 32)) => ('extr_agx', 'a', 'b', 0, 0)
 *    ('ior', ('ushr', 'a@32', 1), ('ishl', 'b@32', 31)) => ('extr_agx', 'a', 'b', 1, 0)
 *    ('ior', ('ushr', 'a@32', 2), ('ishl', 'b@32', 30)) => ('extr_agx', 'a', 'b', 2, 0)
 *    ('ior', ('ushr', 'a@32', 3), ('ishl', 'b@32', 29)) => ('extr_agx', 'a', 'b', 3, 0)
 *    ('ior', ('ushr', 'a@32', 4), ('ishl', 'b@32', 28)) => ('extr_agx', 'a', 'b', 4, 0)
 *    ('ior', ('ushr', 'a@32', 5), ('ishl', 'b@32', 27)) => ('extr_agx', 'a', 'b', 5, 0)
 *    ('ior', ('ushr', 'a@32', 6), ('ishl', 'b@32', 26)) => ('extr_agx', 'a', 'b', 6, 0)
 *    ('ior', ('ushr', 'a@32', 7), ('ishl', 'b@32', 25)) => ('extr_agx', 'a', 'b', 7, 0)
 *    ('ior', ('ushr', 'a@32', 8), ('ishl', 'b@32', 24)) => ('extr_agx', 'a', 'b', 8, 0)
 *    ('ior', ('ushr', 'a@32', 9), ('ishl', 'b@32', 23)) => ('extr_agx', 'a', 'b', 9, 0)
 *    ('ior', ('ushr', 'a@32', 10), ('ishl', 'b@32', 22)) => ('extr_agx', 'a', 'b', 10, 0)
 *    ('ior', ('ushr', 'a@32', 11), ('ishl', 'b@32', 21)) => ('extr_agx', 'a', 'b', 11, 0)
 *    ('ior', ('ushr', 'a@32', 12), ('ishl', 'b@32', 20)) => ('extr_agx', 'a', 'b', 12, 0)
 *    ('ior', ('ushr', 'a@32', 13), ('ishl', 'b@32', 19)) => ('extr_agx', 'a', 'b', 13, 0)
 *    ('ior', ('ushr', 'a@32', 14), ('ishl', 'b@32', 18)) => ('extr_agx', 'a', 'b', 14, 0)
 *    ('ior', ('ushr', 'a@32', 15), ('ishl', 'b@32', 17)) => ('extr_agx', 'a', 'b', 15, 0)
 *    ('ior', ('ushr', 'a@32', 16), ('ishl', 'b@32', 16)) => ('extr_agx', 'a', 'b', 16, 0)
 *    ('ior', ('ushr', 'a@32', 17), ('ishl', 'b@32', 15)) => ('extr_agx', 'a', 'b', 17, 0)
 *    ('ior', ('ushr', 'a@32', 18), ('ishl', 'b@32', 14)) => ('extr_agx', 'a', 'b', 18, 0)
 *    ('ior', ('ushr', 'a@32', 19), ('ishl', 'b@32', 13)) => ('extr_agx', 'a', 'b', 19, 0)
 *    ('ior', ('ushr', 'a@32', 20), ('ishl', 'b@32', 12)) => ('extr_agx', 'a', 'b', 20, 0)
 *    ('ior', ('ushr', 'a@32', 21), ('ishl', 'b@32', 11)) => ('extr_agx', 'a', 'b', 21, 0)
 *    ('ior', ('ushr', 'a@32', 22), ('ishl', 'b@32', 10)) => ('extr_agx', 'a', 'b', 22, 0)
 *    ('ior', ('ushr', 'a@32', 23), ('ishl', 'b@32', 9)) => ('extr_agx', 'a', 'b', 23, 0)
 *    ('ior', ('ushr', 'a@32', 24), ('ishl', 'b@32', 8)) => ('extr_agx', 'a', 'b', 24, 0)
 *    ('ior', ('ushr', 'a@32', 25), ('ishl', 'b@32', 7)) => ('extr_agx', 'a', 'b', 25, 0)
 *    ('ior', ('ushr', 'a@32', 26), ('ishl', 'b@32', 6)) => ('extr_agx', 'a', 'b', 26, 0)
 *    ('ior', ('ushr', 'a@32', 27), ('ishl', 'b@32', 5)) => ('extr_agx', 'a', 'b', 27, 0)
 *    ('ior', ('ushr', 'a@32', 28), ('ishl', 'b@32', 4)) => ('extr_agx', 'a', 'b', 28, 0)
 *    ('ior', ('ushr', 'a@32', 29), ('ishl', 'b@32', 3)) => ('extr_agx', 'a', 'b', 29, 0)
 *    ('ior', ('ushr', 'a@32', 30), ('ishl', 'b@32', 2)) => ('extr_agx', 'a', 'b', 30, 0)
 *    ('ior', ('ushr', 'a@32', 31), ('ishl', 'b@32', 1)) => ('extr_agx', 'a', 'b', 31, 0)
 *    ('iand', ('ushr', 'a@32', 'b'), 1) => ('ubitfield_extract', 'a', 'b', 1)
 *    ('iand', ('ushr', 'a@32', 'b'), 3) => ('ubitfield_extract', 'a', 'b', 2)
 *    ('iand', ('ushr', 'a@32', 'b'), 7) => ('ubitfield_extract', 'a', 'b', 3)
 *    ('iand', ('ushr', 'a@32', 'b'), 15) => ('ubitfield_extract', 'a', 'b', 4)
 *    ('iand', ('ushr', 'a@32', 'b'), 31) => ('ubitfield_extract', 'a', 'b', 5)
 *    ('iand', ('ushr', 'a@32', 'b'), 63) => ('ubitfield_extract', 'a', 'b', 6)
 *    ('iand', ('ushr', 'a@32', 'b'), 127) => ('ubitfield_extract', 'a', 'b', 7)
 *    ('iand', ('ushr', 'a@32', 'b'), 255) => ('ubitfield_extract', 'a', 'b', 8)
 *    ('iand', ('ushr', 'a@32', 'b'), 511) => ('ubitfield_extract', 'a', 'b', 9)
 *    ('iand', ('ushr', 'a@32', 'b'), 1023) => ('ubitfield_extract', 'a', 'b', 10)
 *    ('iand', ('ushr', 'a@32', 'b'), 2047) => ('ubitfield_extract', 'a', 'b', 11)
 *    ('iand', ('ushr', 'a@32', 'b'), 4095) => ('ubitfield_extract', 'a', 'b', 12)
 *    ('iand', ('ushr', 'a@32', 'b'), 8191) => ('ubitfield_extract', 'a', 'b', 13)
 *    ('iand', ('ushr', 'a@32', 'b'), 16383) => ('ubitfield_extract', 'a', 'b', 14)
 *    ('iand', ('ushr', 'a@32', 'b'), 32767) => ('ubitfield_extract', 'a', 'b', 15)
 *    ('iand', ('ushr', 'a@32', 'b'), 65535) => ('ubitfield_extract', 'a', 'b', 16)
 *    ('iand', ('ushr', 'a@32', 'b'), 131071) => ('ubitfield_extract', 'a', 'b', 17)
 *    ('iand', ('ushr', 'a@32', 'b'), 262143) => ('ubitfield_extract', 'a', 'b', 18)
 *    ('iand', ('ushr', 'a@32', 'b'), 524287) => ('ubitfield_extract', 'a', 'b', 19)
 *    ('iand', ('ushr', 'a@32', 'b'), 1048575) => ('ubitfield_extract', 'a', 'b', 20)
 *    ('iand', ('ushr', 'a@32', 'b'), 2097151) => ('ubitfield_extract', 'a', 'b', 21)
 *    ('iand', ('ushr', 'a@32', 'b'), 4194303) => ('ubitfield_extract', 'a', 'b', 22)
 *    ('iand', ('ushr', 'a@32', 'b'), 8388607) => ('ubitfield_extract', 'a', 'b', 23)
 *    ('iand', ('ushr', 'a@32', 'b'), 16777215) => ('ubitfield_extract', 'a', 'b', 24)
 *    ('iand', ('ushr', 'a@32', 'b'), 33554431) => ('ubitfield_extract', 'a', 'b', 25)
 *    ('iand', ('ushr', 'a@32', 'b'), 67108863) => ('ubitfield_extract', 'a', 'b', 26)
 *    ('iand', ('ushr', 'a@32', 'b'), 134217727) => ('ubitfield_extract', 'a', 'b', 27)
 *    ('iand', ('ushr', 'a@32', 'b'), 268435455) => ('ubitfield_extract', 'a', 'b', 28)
 *    ('iand', ('ushr', 'a@32', 'b'), 536870911) => ('ubitfield_extract', 'a', 'b', 29)
 *    ('iand', ('ushr', 'a@32', 'b'), 1073741823) => ('ubitfield_extract', 'a', 'b', 30)
 *    ('iand', ('ushr', 'a@32', 'b'), 2147483647) => ('ubitfield_extract', 'a', 'b', 31)
 *    ('iadd', ('iadd(is_used_once)', ('imul(is_used_once)', 'a', 'b'), ('imul(is_used_once)', 'c', 'd')), 'e') => ('imadshl_agx', 'a', 'b', ('imadshl_agx', 'c', 'd', 'e', 0), 0)
 *    ('iadd', ('imul(is_used_once)', 'a', 'b'), 'c') => ('imadshl_agx', 'a', 'b', 'c', 0)
 *    ('isub', ('imul(is_used_once)', 'a', 'b'), 'c') => ('imsubshl_agx', 'a', 'b', 'c', 0)
 *    ('iadd', 'a', ('ishl(is_used_once)', 'b', 1)) => ('imadshl_agx', 'a', 1, 'b', 1)
 *    ('isub', 'a', ('ishl(is_used_once)', 'b', 1)) => ('imsubshl_agx', 'a', 1, 'b', 1)
 *    ('ineg', ('ishl(is_used_once)', 'b', 1)) => ('imsubshl_agx', 0, 1, 'b', 1)
 *    ('imadshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 1), 0) => ('imadshl_agx', 'a', 'b', 'c', 1)
 *    ('imsubshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 1), 0) => ('imsubshl_agx', 'a', 'b', 'c', 1)
 *    ('imul', 'a', 3) => ('imadshl_agx', 'a', 1, 'a', 1)
 *    ('imul', 'a', -1) => ('imsubshl_agx', 'a', 1, 'a', 1)
 *    ('ineg', ('imul(is_used_once)', 'a', 1)) => ('imsubshl_agx', 'a', 1, 'a', 1)
 *    ('ishl', 'a', 1) => ('imadshl_agx', 0, 1, 'a', 1)
 *    ('iadd', 'a', ('ishl(is_used_once)', 'b', 2)) => ('imadshl_agx', 'a', 1, 'b', 2)
 *    ('isub', 'a', ('ishl(is_used_once)', 'b', 2)) => ('imsubshl_agx', 'a', 1, 'b', 2)
 *    ('ineg', ('ishl(is_used_once)', 'b', 2)) => ('imsubshl_agx', 0, 1, 'b', 2)
 *    ('imadshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 2), 0) => ('imadshl_agx', 'a', 'b', 'c', 2)
 *    ('imsubshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 2), 0) => ('imsubshl_agx', 'a', 'b', 'c', 2)
 *    ('imul', 'a', 5) => ('imadshl_agx', 'a', 1, 'a', 2)
 *    ('imul', 'a', -3) => ('imsubshl_agx', 'a', 1, 'a', 2)
 *    ('ineg', ('imul(is_used_once)', 'a', 3)) => ('imsubshl_agx', 'a', 1, 'a', 2)
 *    ('ishl', 'a', 2) => ('imadshl_agx', 0, 1, 'a', 2)
 *    ('iadd', 'a', ('ishl(is_used_once)', 'b', 3)) => ('imadshl_agx', 'a', 1, 'b', 3)
 *    ('isub', 'a', ('ishl(is_used_once)', 'b', 3)) => ('imsubshl_agx', 'a', 1, 'b', 3)
 *    ('ineg', ('ishl(is_used_once)', 'b', 3)) => ('imsubshl_agx', 0, 1, 'b', 3)
 *    ('imadshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 3), 0) => ('imadshl_agx', 'a', 'b', 'c', 3)
 *    ('imsubshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 3), 0) => ('imsubshl_agx', 'a', 'b', 'c', 3)
 *    ('imul', 'a', 9) => ('imadshl_agx', 'a', 1, 'a', 3)
 *    ('imul', 'a', -7) => ('imsubshl_agx', 'a', 1, 'a', 3)
 *    ('ineg', ('imul(is_used_once)', 'a', 7)) => ('imsubshl_agx', 'a', 1, 'a', 3)
 *    ('ishl', 'a', 3) => ('imadshl_agx', 0, 1, 'a', 3)
 *    ('iadd', 'a', ('ishl(is_used_once)', 'b', 4)) => ('imadshl_agx', 'a', 1, 'b', 4)
 *    ('isub', 'a', ('ishl(is_used_once)', 'b', 4)) => ('imsubshl_agx', 'a', 1, 'b', 4)
 *    ('ineg', ('ishl(is_used_once)', 'b', 4)) => ('imsubshl_agx', 0, 1, 'b', 4)
 *    ('imadshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 4), 0) => ('imadshl_agx', 'a', 'b', 'c', 4)
 *    ('imsubshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 4), 0) => ('imsubshl_agx', 'a', 'b', 'c', 4)
 *    ('imul', 'a', 17) => ('imadshl_agx', 'a', 1, 'a', 4)
 *    ('imul', 'a', -15) => ('imsubshl_agx', 'a', 1, 'a', 4)
 *    ('ineg', ('imul(is_used_once)', 'a', 15)) => ('imsubshl_agx', 'a', 1, 'a', 4)
 *    ('ishl', 'a', 4) => ('imadshl_agx', 0, 1, 'a', 4)
 *    ('ixor', ('bcsel', 'a', '#b', '#c'), '#d') => ('bcsel', 'a', ('ixor', 'b', 'd'), ('ixor', 'c', 'd'))
 */


static const nir_search_value_union agx_nir_fuse_algebraic_late_values[] = {
   /* ('ior', ('ushr', 'a@32', 0), ('ishl', 'b@32', 32)) => ('extr_agx', 'a', 'b', 0, 0) */
   { .variable = {
      { nir_search_value_variable, 32 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x0ull /* 0 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 1 },
      -1,
   } },
   { .variable = {
      { nir_search_value_variable, 32 },
      1, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x20ull /* 32 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 4 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 2, 5 },
      -1,
   } },

   /* replace48_0 -> 0 in the cache */
   /* replace48_1 -> 3 in the cache */
   /* replace48_2 -> 1 in the cache */
   /* replace48_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 1, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 1), ('ishl', 'b@32', 31)) => ('extr_agx', 'a', 'b', 1, 0) */
   /* search49_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1ull /* 1 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 8 },
      -1,
   } },
   /* search49_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1full /* 31 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 10 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 9, 11 },
      -1,
   } },

   /* replace49_0 -> 0 in the cache */
   /* replace49_1 -> 3 in the cache */
   /* replace49_2 -> 8 in the cache */
   /* replace49_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 8, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 2), ('ishl', 'b@32', 30)) => ('extr_agx', 'a', 'b', 2, 0) */
   /* search50_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x2ull /* 2 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 14 },
      -1,
   } },
   /* search50_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1eull /* 30 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 16 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 15, 17 },
      -1,
   } },

   /* replace50_0 -> 0 in the cache */
   /* replace50_1 -> 3 in the cache */
   /* replace50_2 -> 14 in the cache */
   /* replace50_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 14, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 3), ('ishl', 'b@32', 29)) => ('extr_agx', 'a', 'b', 3, 0) */
   /* search51_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3ull /* 3 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 20 },
      -1,
   } },
   /* search51_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1dull /* 29 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 22 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 21, 23 },
      -1,
   } },

   /* replace51_0 -> 0 in the cache */
   /* replace51_1 -> 3 in the cache */
   /* replace51_2 -> 20 in the cache */
   /* replace51_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 20, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 4), ('ishl', 'b@32', 28)) => ('extr_agx', 'a', 'b', 4, 0) */
   /* search52_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x4ull /* 4 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 26 },
      -1,
   } },
   /* search52_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1cull /* 28 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 28 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 27, 29 },
      -1,
   } },

   /* replace52_0 -> 0 in the cache */
   /* replace52_1 -> 3 in the cache */
   /* replace52_2 -> 26 in the cache */
   /* replace52_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 26, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 5), ('ishl', 'b@32', 27)) => ('extr_agx', 'a', 'b', 5, 0) */
   /* search53_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x5ull /* 5 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 32 },
      -1,
   } },
   /* search53_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1bull /* 27 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 34 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 33, 35 },
      -1,
   } },

   /* replace53_0 -> 0 in the cache */
   /* replace53_1 -> 3 in the cache */
   /* replace53_2 -> 32 in the cache */
   /* replace53_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 32, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 6), ('ishl', 'b@32', 26)) => ('extr_agx', 'a', 'b', 6, 0) */
   /* search54_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x6ull /* 6 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 38 },
      -1,
   } },
   /* search54_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1aull /* 26 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 40 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 39, 41 },
      -1,
   } },

   /* replace54_0 -> 0 in the cache */
   /* replace54_1 -> 3 in the cache */
   /* replace54_2 -> 38 in the cache */
   /* replace54_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 38, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 7), ('ishl', 'b@32', 25)) => ('extr_agx', 'a', 'b', 7, 0) */
   /* search55_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7ull /* 7 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 44 },
      -1,
   } },
   /* search55_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x19ull /* 25 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 46 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 45, 47 },
      -1,
   } },

   /* replace55_0 -> 0 in the cache */
   /* replace55_1 -> 3 in the cache */
   /* replace55_2 -> 44 in the cache */
   /* replace55_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 44, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 8), ('ishl', 'b@32', 24)) => ('extr_agx', 'a', 'b', 8, 0) */
   /* search56_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x8ull /* 8 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 50 },
      -1,
   } },
   /* search56_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x18ull /* 24 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 52 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 51, 53 },
      -1,
   } },

   /* replace56_0 -> 0 in the cache */
   /* replace56_1 -> 3 in the cache */
   /* replace56_2 -> 50 in the cache */
   /* replace56_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 50, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 9), ('ishl', 'b@32', 23)) => ('extr_agx', 'a', 'b', 9, 0) */
   /* search57_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x9ull /* 9 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 56 },
      -1,
   } },
   /* search57_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x17ull /* 23 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 58 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 57, 59 },
      -1,
   } },

   /* replace57_0 -> 0 in the cache */
   /* replace57_1 -> 3 in the cache */
   /* replace57_2 -> 56 in the cache */
   /* replace57_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 56, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 10), ('ishl', 'b@32', 22)) => ('extr_agx', 'a', 'b', 10, 0) */
   /* search58_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xaull /* 10 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 62 },
      -1,
   } },
   /* search58_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x16ull /* 22 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 64 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 63, 65 },
      -1,
   } },

   /* replace58_0 -> 0 in the cache */
   /* replace58_1 -> 3 in the cache */
   /* replace58_2 -> 62 in the cache */
   /* replace58_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 62, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 11), ('ishl', 'b@32', 21)) => ('extr_agx', 'a', 'b', 11, 0) */
   /* search59_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xbull /* 11 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 68 },
      -1,
   } },
   /* search59_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x15ull /* 21 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 70 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 69, 71 },
      -1,
   } },

   /* replace59_0 -> 0 in the cache */
   /* replace59_1 -> 3 in the cache */
   /* replace59_2 -> 68 in the cache */
   /* replace59_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 68, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 12), ('ishl', 'b@32', 20)) => ('extr_agx', 'a', 'b', 12, 0) */
   /* search60_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xcull /* 12 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 74 },
      -1,
   } },
   /* search60_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x14ull /* 20 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 76 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 75, 77 },
      -1,
   } },

   /* replace60_0 -> 0 in the cache */
   /* replace60_1 -> 3 in the cache */
   /* replace60_2 -> 74 in the cache */
   /* replace60_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 74, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 13), ('ishl', 'b@32', 19)) => ('extr_agx', 'a', 'b', 13, 0) */
   /* search61_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xdull /* 13 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 80 },
      -1,
   } },
   /* search61_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x13ull /* 19 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 82 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 81, 83 },
      -1,
   } },

   /* replace61_0 -> 0 in the cache */
   /* replace61_1 -> 3 in the cache */
   /* replace61_2 -> 80 in the cache */
   /* replace61_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 80, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 14), ('ishl', 'b@32', 18)) => ('extr_agx', 'a', 'b', 14, 0) */
   /* search62_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xeull /* 14 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 86 },
      -1,
   } },
   /* search62_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x12ull /* 18 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 88 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 87, 89 },
      -1,
   } },

   /* replace62_0 -> 0 in the cache */
   /* replace62_1 -> 3 in the cache */
   /* replace62_2 -> 86 in the cache */
   /* replace62_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 86, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 15), ('ishl', 'b@32', 17)) => ('extr_agx', 'a', 'b', 15, 0) */
   /* search63_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xfull /* 15 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 92 },
      -1,
   } },
   /* search63_1_0 -> 3 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x11ull /* 17 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 94 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 93, 95 },
      -1,
   } },

   /* replace63_0 -> 0 in the cache */
   /* replace63_1 -> 3 in the cache */
   /* replace63_2 -> 92 in the cache */
   /* replace63_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 92, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 16), ('ishl', 'b@32', 16)) => ('extr_agx', 'a', 'b', 16, 0) */
   /* search64_0_0 -> 0 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x10ull /* 16 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 98 },
      -1,
   } },
   /* search64_1_0 -> 3 in the cache */
   /* search64_1_1 -> 98 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 98 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 99, 100 },
      -1,
   } },

   /* replace64_0 -> 0 in the cache */
   /* replace64_1 -> 3 in the cache */
   /* replace64_2 -> 98 in the cache */
   /* replace64_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 98, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 17), ('ishl', 'b@32', 15)) => ('extr_agx', 'a', 'b', 17, 0) */
   /* search65_0_0 -> 0 in the cache */
   /* search65_0_1 -> 94 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 94 },
      -1,
   } },
   /* search65_1_0 -> 3 in the cache */
   /* search65_1_1 -> 92 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 92 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 103, 104 },
      -1,
   } },

   /* replace65_0 -> 0 in the cache */
   /* replace65_1 -> 3 in the cache */
   /* replace65_2 -> 94 in the cache */
   /* replace65_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 94, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 18), ('ishl', 'b@32', 14)) => ('extr_agx', 'a', 'b', 18, 0) */
   /* search66_0_0 -> 0 in the cache */
   /* search66_0_1 -> 88 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 88 },
      -1,
   } },
   /* search66_1_0 -> 3 in the cache */
   /* search66_1_1 -> 86 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 86 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 107, 108 },
      -1,
   } },

   /* replace66_0 -> 0 in the cache */
   /* replace66_1 -> 3 in the cache */
   /* replace66_2 -> 88 in the cache */
   /* replace66_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 88, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 19), ('ishl', 'b@32', 13)) => ('extr_agx', 'a', 'b', 19, 0) */
   /* search67_0_0 -> 0 in the cache */
   /* search67_0_1 -> 82 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 82 },
      -1,
   } },
   /* search67_1_0 -> 3 in the cache */
   /* search67_1_1 -> 80 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 80 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 111, 112 },
      -1,
   } },

   /* replace67_0 -> 0 in the cache */
   /* replace67_1 -> 3 in the cache */
   /* replace67_2 -> 82 in the cache */
   /* replace67_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 82, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 20), ('ishl', 'b@32', 12)) => ('extr_agx', 'a', 'b', 20, 0) */
   /* search68_0_0 -> 0 in the cache */
   /* search68_0_1 -> 76 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 76 },
      -1,
   } },
   /* search68_1_0 -> 3 in the cache */
   /* search68_1_1 -> 74 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 74 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 115, 116 },
      -1,
   } },

   /* replace68_0 -> 0 in the cache */
   /* replace68_1 -> 3 in the cache */
   /* replace68_2 -> 76 in the cache */
   /* replace68_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 76, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 21), ('ishl', 'b@32', 11)) => ('extr_agx', 'a', 'b', 21, 0) */
   /* search69_0_0 -> 0 in the cache */
   /* search69_0_1 -> 70 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 70 },
      -1,
   } },
   /* search69_1_0 -> 3 in the cache */
   /* search69_1_1 -> 68 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 68 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 119, 120 },
      -1,
   } },

   /* replace69_0 -> 0 in the cache */
   /* replace69_1 -> 3 in the cache */
   /* replace69_2 -> 70 in the cache */
   /* replace69_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 70, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 22), ('ishl', 'b@32', 10)) => ('extr_agx', 'a', 'b', 22, 0) */
   /* search70_0_0 -> 0 in the cache */
   /* search70_0_1 -> 64 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 64 },
      -1,
   } },
   /* search70_1_0 -> 3 in the cache */
   /* search70_1_1 -> 62 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 62 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 123, 124 },
      -1,
   } },

   /* replace70_0 -> 0 in the cache */
   /* replace70_1 -> 3 in the cache */
   /* replace70_2 -> 64 in the cache */
   /* replace70_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 64, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 23), ('ishl', 'b@32', 9)) => ('extr_agx', 'a', 'b', 23, 0) */
   /* search71_0_0 -> 0 in the cache */
   /* search71_0_1 -> 58 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 58 },
      -1,
   } },
   /* search71_1_0 -> 3 in the cache */
   /* search71_1_1 -> 56 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 56 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 127, 128 },
      -1,
   } },

   /* replace71_0 -> 0 in the cache */
   /* replace71_1 -> 3 in the cache */
   /* replace71_2 -> 58 in the cache */
   /* replace71_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 58, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 24), ('ishl', 'b@32', 8)) => ('extr_agx', 'a', 'b', 24, 0) */
   /* search72_0_0 -> 0 in the cache */
   /* search72_0_1 -> 52 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 52 },
      -1,
   } },
   /* search72_1_0 -> 3 in the cache */
   /* search72_1_1 -> 50 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 50 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 131, 132 },
      -1,
   } },

   /* replace72_0 -> 0 in the cache */
   /* replace72_1 -> 3 in the cache */
   /* replace72_2 -> 52 in the cache */
   /* replace72_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 52, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 25), ('ishl', 'b@32', 7)) => ('extr_agx', 'a', 'b', 25, 0) */
   /* search73_0_0 -> 0 in the cache */
   /* search73_0_1 -> 46 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 46 },
      -1,
   } },
   /* search73_1_0 -> 3 in the cache */
   /* search73_1_1 -> 44 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 44 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 135, 136 },
      -1,
   } },

   /* replace73_0 -> 0 in the cache */
   /* replace73_1 -> 3 in the cache */
   /* replace73_2 -> 46 in the cache */
   /* replace73_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 46, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 26), ('ishl', 'b@32', 6)) => ('extr_agx', 'a', 'b', 26, 0) */
   /* search74_0_0 -> 0 in the cache */
   /* search74_0_1 -> 40 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 40 },
      -1,
   } },
   /* search74_1_0 -> 3 in the cache */
   /* search74_1_1 -> 38 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 38 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 139, 140 },
      -1,
   } },

   /* replace74_0 -> 0 in the cache */
   /* replace74_1 -> 3 in the cache */
   /* replace74_2 -> 40 in the cache */
   /* replace74_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 40, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 27), ('ishl', 'b@32', 5)) => ('extr_agx', 'a', 'b', 27, 0) */
   /* search75_0_0 -> 0 in the cache */
   /* search75_0_1 -> 34 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 34 },
      -1,
   } },
   /* search75_1_0 -> 3 in the cache */
   /* search75_1_1 -> 32 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 32 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 143, 144 },
      -1,
   } },

   /* replace75_0 -> 0 in the cache */
   /* replace75_1 -> 3 in the cache */
   /* replace75_2 -> 34 in the cache */
   /* replace75_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 34, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 28), ('ishl', 'b@32', 4)) => ('extr_agx', 'a', 'b', 28, 0) */
   /* search76_0_0 -> 0 in the cache */
   /* search76_0_1 -> 28 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 28 },
      -1,
   } },
   /* search76_1_0 -> 3 in the cache */
   /* search76_1_1 -> 26 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 26 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 147, 148 },
      -1,
   } },

   /* replace76_0 -> 0 in the cache */
   /* replace76_1 -> 3 in the cache */
   /* replace76_2 -> 28 in the cache */
   /* replace76_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 28, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 29), ('ishl', 'b@32', 3)) => ('extr_agx', 'a', 'b', 29, 0) */
   /* search77_0_0 -> 0 in the cache */
   /* search77_0_1 -> 22 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 22 },
      -1,
   } },
   /* search77_1_0 -> 3 in the cache */
   /* search77_1_1 -> 20 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 20 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 151, 152 },
      -1,
   } },

   /* replace77_0 -> 0 in the cache */
   /* replace77_1 -> 3 in the cache */
   /* replace77_2 -> 22 in the cache */
   /* replace77_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 22, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 30), ('ishl', 'b@32', 2)) => ('extr_agx', 'a', 'b', 30, 0) */
   /* search78_0_0 -> 0 in the cache */
   /* search78_0_1 -> 16 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 16 },
      -1,
   } },
   /* search78_1_0 -> 3 in the cache */
   /* search78_1_1 -> 14 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 14 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 155, 156 },
      -1,
   } },

   /* replace78_0 -> 0 in the cache */
   /* replace78_1 -> 3 in the cache */
   /* replace78_2 -> 16 in the cache */
   /* replace78_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 16, 1 },
      -1,
   } },

   /* ('ior', ('ushr', 'a@32', 31), ('ishl', 'b@32', 1)) => ('extr_agx', 'a', 'b', 31, 0) */
   /* search79_0_0 -> 0 in the cache */
   /* search79_0_1 -> 10 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 10 },
      -1,
   } },
   /* search79_1_0 -> 3 in the cache */
   /* search79_1_1 -> 8 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 3, 8 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ior,
      0, 1,
      { 159, 160 },
      -1,
   } },

   /* replace79_0 -> 0 in the cache */
   /* replace79_1 -> 3 in the cache */
   /* replace79_2 -> 10 in the cache */
   /* replace79_3 -> 1 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_extr_agx,
      -1, 0,
      { 0, 3, 10, 1 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 1) => ('ubitfield_extract', 'a', 'b', 1) */
   /* search80_0_0 -> 0 in the cache */
   /* search80_0_1 -> 3 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ushr,
      -1, 0,
      { 0, 3 },
      -1,
   } },
   /* search80_1 -> 8 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 8 },
      -1,
   } },

   /* replace80_0 -> 0 in the cache */
   /* replace80_1 -> 3 in the cache */
   /* replace80_2 -> 8 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 8 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 3) => ('ubitfield_extract', 'a', 'b', 2) */
   /* search81_0_0 -> 0 in the cache */
   /* search81_0_1 -> 3 in the cache */
   /* search81_0 -> 163 in the cache */
   /* search81_1 -> 20 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 20 },
      -1,
   } },

   /* replace81_0 -> 0 in the cache */
   /* replace81_1 -> 3 in the cache */
   /* replace81_2 -> 14 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 14 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 7) => ('ubitfield_extract', 'a', 'b', 3) */
   /* search82_0_0 -> 0 in the cache */
   /* search82_0_1 -> 3 in the cache */
   /* search82_0 -> 163 in the cache */
   /* search82_1 -> 44 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 44 },
      -1,
   } },

   /* replace82_0 -> 0 in the cache */
   /* replace82_1 -> 3 in the cache */
   /* replace82_2 -> 20 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 20 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 15) => ('ubitfield_extract', 'a', 'b', 4) */
   /* search83_0_0 -> 0 in the cache */
   /* search83_0_1 -> 3 in the cache */
   /* search83_0 -> 163 in the cache */
   /* search83_1 -> 92 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 92 },
      -1,
   } },

   /* replace83_0 -> 0 in the cache */
   /* replace83_1 -> 3 in the cache */
   /* replace83_2 -> 26 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 26 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 31) => ('ubitfield_extract', 'a', 'b', 5) */
   /* search84_0_0 -> 0 in the cache */
   /* search84_0_1 -> 3 in the cache */
   /* search84_0 -> 163 in the cache */
   /* search84_1 -> 10 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 10 },
      -1,
   } },

   /* replace84_0 -> 0 in the cache */
   /* replace84_1 -> 3 in the cache */
   /* replace84_2 -> 32 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 32 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 63) => ('ubitfield_extract', 'a', 'b', 6) */
   /* search85_0_0 -> 0 in the cache */
   /* search85_0_1 -> 3 in the cache */
   /* search85_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3full /* 63 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 174 },
      -1,
   } },

   /* replace85_0 -> 0 in the cache */
   /* replace85_1 -> 3 in the cache */
   /* replace85_2 -> 38 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 38 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 127) => ('ubitfield_extract', 'a', 'b', 7) */
   /* search86_0_0 -> 0 in the cache */
   /* search86_0_1 -> 3 in the cache */
   /* search86_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7full /* 127 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 177 },
      -1,
   } },

   /* replace86_0 -> 0 in the cache */
   /* replace86_1 -> 3 in the cache */
   /* replace86_2 -> 44 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 44 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 255) => ('ubitfield_extract', 'a', 'b', 8) */
   /* search87_0_0 -> 0 in the cache */
   /* search87_0_1 -> 3 in the cache */
   /* search87_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xffull /* 255 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 180 },
      -1,
   } },

   /* replace87_0 -> 0 in the cache */
   /* replace87_1 -> 3 in the cache */
   /* replace87_2 -> 50 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 50 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 511) => ('ubitfield_extract', 'a', 'b', 9) */
   /* search88_0_0 -> 0 in the cache */
   /* search88_0_1 -> 3 in the cache */
   /* search88_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1ffull /* 511 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 183 },
      -1,
   } },

   /* replace88_0 -> 0 in the cache */
   /* replace88_1 -> 3 in the cache */
   /* replace88_2 -> 56 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 56 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 1023) => ('ubitfield_extract', 'a', 'b', 10) */
   /* search89_0_0 -> 0 in the cache */
   /* search89_0_1 -> 3 in the cache */
   /* search89_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3ffull /* 1023 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 186 },
      -1,
   } },

   /* replace89_0 -> 0 in the cache */
   /* replace89_1 -> 3 in the cache */
   /* replace89_2 -> 62 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 62 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 2047) => ('ubitfield_extract', 'a', 'b', 11) */
   /* search90_0_0 -> 0 in the cache */
   /* search90_0_1 -> 3 in the cache */
   /* search90_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7ffull /* 2047 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 189 },
      -1,
   } },

   /* replace90_0 -> 0 in the cache */
   /* replace90_1 -> 3 in the cache */
   /* replace90_2 -> 68 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 68 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 4095) => ('ubitfield_extract', 'a', 'b', 12) */
   /* search91_0_0 -> 0 in the cache */
   /* search91_0_1 -> 3 in the cache */
   /* search91_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xfffull /* 4095 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 192 },
      -1,
   } },

   /* replace91_0 -> 0 in the cache */
   /* replace91_1 -> 3 in the cache */
   /* replace91_2 -> 74 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 74 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 8191) => ('ubitfield_extract', 'a', 'b', 13) */
   /* search92_0_0 -> 0 in the cache */
   /* search92_0_1 -> 3 in the cache */
   /* search92_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1fffull /* 8191 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 195 },
      -1,
   } },

   /* replace92_0 -> 0 in the cache */
   /* replace92_1 -> 3 in the cache */
   /* replace92_2 -> 80 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 80 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 16383) => ('ubitfield_extract', 'a', 'b', 14) */
   /* search93_0_0 -> 0 in the cache */
   /* search93_0_1 -> 3 in the cache */
   /* search93_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3fffull /* 16383 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 198 },
      -1,
   } },

   /* replace93_0 -> 0 in the cache */
   /* replace93_1 -> 3 in the cache */
   /* replace93_2 -> 86 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 86 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 32767) => ('ubitfield_extract', 'a', 'b', 15) */
   /* search94_0_0 -> 0 in the cache */
   /* search94_0_1 -> 3 in the cache */
   /* search94_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7fffull /* 32767 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 201 },
      -1,
   } },

   /* replace94_0 -> 0 in the cache */
   /* replace94_1 -> 3 in the cache */
   /* replace94_2 -> 92 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 92 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 65535) => ('ubitfield_extract', 'a', 'b', 16) */
   /* search95_0_0 -> 0 in the cache */
   /* search95_0_1 -> 3 in the cache */
   /* search95_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xffffull /* 65535 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 204 },
      -1,
   } },

   /* replace95_0 -> 0 in the cache */
   /* replace95_1 -> 3 in the cache */
   /* replace95_2 -> 98 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 98 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 131071) => ('ubitfield_extract', 'a', 'b', 17) */
   /* search96_0_0 -> 0 in the cache */
   /* search96_0_1 -> 3 in the cache */
   /* search96_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1ffffull /* 131071 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 207 },
      -1,
   } },

   /* replace96_0 -> 0 in the cache */
   /* replace96_1 -> 3 in the cache */
   /* replace96_2 -> 94 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 94 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 262143) => ('ubitfield_extract', 'a', 'b', 18) */
   /* search97_0_0 -> 0 in the cache */
   /* search97_0_1 -> 3 in the cache */
   /* search97_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3ffffull /* 262143 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 210 },
      -1,
   } },

   /* replace97_0 -> 0 in the cache */
   /* replace97_1 -> 3 in the cache */
   /* replace97_2 -> 88 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 88 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 524287) => ('ubitfield_extract', 'a', 'b', 19) */
   /* search98_0_0 -> 0 in the cache */
   /* search98_0_1 -> 3 in the cache */
   /* search98_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7ffffull /* 524287 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 213 },
      -1,
   } },

   /* replace98_0 -> 0 in the cache */
   /* replace98_1 -> 3 in the cache */
   /* replace98_2 -> 82 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 82 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 1048575) => ('ubitfield_extract', 'a', 'b', 20) */
   /* search99_0_0 -> 0 in the cache */
   /* search99_0_1 -> 3 in the cache */
   /* search99_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xfffffull /* 1048575 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 216 },
      -1,
   } },

   /* replace99_0 -> 0 in the cache */
   /* replace99_1 -> 3 in the cache */
   /* replace99_2 -> 76 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 76 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 2097151) => ('ubitfield_extract', 'a', 'b', 21) */
   /* search100_0_0 -> 0 in the cache */
   /* search100_0_1 -> 3 in the cache */
   /* search100_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1fffffull /* 2097151 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 219 },
      -1,
   } },

   /* replace100_0 -> 0 in the cache */
   /* replace100_1 -> 3 in the cache */
   /* replace100_2 -> 70 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 70 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 4194303) => ('ubitfield_extract', 'a', 'b', 22) */
   /* search101_0_0 -> 0 in the cache */
   /* search101_0_1 -> 3 in the cache */
   /* search101_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3fffffull /* 4194303 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 222 },
      -1,
   } },

   /* replace101_0 -> 0 in the cache */
   /* replace101_1 -> 3 in the cache */
   /* replace101_2 -> 64 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 64 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 8388607) => ('ubitfield_extract', 'a', 'b', 23) */
   /* search102_0_0 -> 0 in the cache */
   /* search102_0_1 -> 3 in the cache */
   /* search102_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7fffffull /* 8388607 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 225 },
      -1,
   } },

   /* replace102_0 -> 0 in the cache */
   /* replace102_1 -> 3 in the cache */
   /* replace102_2 -> 58 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 58 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 16777215) => ('ubitfield_extract', 'a', 'b', 24) */
   /* search103_0_0 -> 0 in the cache */
   /* search103_0_1 -> 3 in the cache */
   /* search103_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xffffffull /* 16777215 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 228 },
      -1,
   } },

   /* replace103_0 -> 0 in the cache */
   /* replace103_1 -> 3 in the cache */
   /* replace103_2 -> 52 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 52 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 33554431) => ('ubitfield_extract', 'a', 'b', 25) */
   /* search104_0_0 -> 0 in the cache */
   /* search104_0_1 -> 3 in the cache */
   /* search104_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1ffffffull /* 33554431 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 231 },
      -1,
   } },

   /* replace104_0 -> 0 in the cache */
   /* replace104_1 -> 3 in the cache */
   /* replace104_2 -> 46 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 46 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 67108863) => ('ubitfield_extract', 'a', 'b', 26) */
   /* search105_0_0 -> 0 in the cache */
   /* search105_0_1 -> 3 in the cache */
   /* search105_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3ffffffull /* 67108863 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 234 },
      -1,
   } },

   /* replace105_0 -> 0 in the cache */
   /* replace105_1 -> 3 in the cache */
   /* replace105_2 -> 40 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 40 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 134217727) => ('ubitfield_extract', 'a', 'b', 27) */
   /* search106_0_0 -> 0 in the cache */
   /* search106_0_1 -> 3 in the cache */
   /* search106_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7ffffffull /* 134217727 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 237 },
      -1,
   } },

   /* replace106_0 -> 0 in the cache */
   /* replace106_1 -> 3 in the cache */
   /* replace106_2 -> 34 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 34 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 268435455) => ('ubitfield_extract', 'a', 'b', 28) */
   /* search107_0_0 -> 0 in the cache */
   /* search107_0_1 -> 3 in the cache */
   /* search107_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0xfffffffull /* 268435455 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 240 },
      -1,
   } },

   /* replace107_0 -> 0 in the cache */
   /* replace107_1 -> 3 in the cache */
   /* replace107_2 -> 28 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 28 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 536870911) => ('ubitfield_extract', 'a', 'b', 29) */
   /* search108_0_0 -> 0 in the cache */
   /* search108_0_1 -> 3 in the cache */
   /* search108_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x1fffffffull /* 536870911 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 243 },
      -1,
   } },

   /* replace108_0 -> 0 in the cache */
   /* replace108_1 -> 3 in the cache */
   /* replace108_2 -> 22 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 22 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 1073741823) => ('ubitfield_extract', 'a', 'b', 30) */
   /* search109_0_0 -> 0 in the cache */
   /* search109_0_1 -> 3 in the cache */
   /* search109_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x3fffffffull /* 1073741823 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 246 },
      -1,
   } },

   /* replace109_0 -> 0 in the cache */
   /* replace109_1 -> 3 in the cache */
   /* replace109_2 -> 16 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 16 },
      -1,
   } },

   /* ('iand', ('ushr', 'a@32', 'b'), 2147483647) => ('ubitfield_extract', 'a', 'b', 31) */
   /* search110_0_0 -> 0 in the cache */
   /* search110_0_1 -> 3 in the cache */
   /* search110_0 -> 163 in the cache */
   { .constant = {
      { nir_search_value_constant, 32 },
      nir_type_int, { 0x7fffffffull /* 2147483647 */ },
   } },
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iand,
      0, 1,
      { 163, 249 },
      -1,
   } },

   /* replace110_0 -> 0 in the cache */
   /* replace110_1 -> 3 in the cache */
   /* replace110_2 -> 10 in the cache */
   { .expression = {
      { nir_search_value_expression, 32 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ubitfield_extract,
      -1, 0,
      { 0, 3, 10 },
      -1,
   } },

   /* ('iadd', ('iadd(is_used_once)', ('imul(is_used_once)', 'a', 'b'), ('imul(is_used_once)', 'c', 'd')), 'e') => ('imadshl_agx', 'a', 'b', ('imadshl_agx', 'c', 'd', 'e', 0), 0) */
   { .variable = {
      { nir_search_value_variable, -5 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, -5 },
      1, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -5 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      2, 1,
      { 252, 253 },
      0,
   } },
   { .variable = {
      { nir_search_value_variable, -5 },
      2, /* c */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, -5 },
      3, /* d */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -5 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      3, 1,
      { 255, 256 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -5 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iadd,
      1, 3,
      { 254, 257 },
      0,
   } },
   { .variable = {
      { nir_search_value_variable, -5 },
      4, /* e */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -5 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iadd,
      0, 4,
      { 258, 259 },
      -1,
   } },

   /* replace111_0 -> 252 in the cache */
   /* replace111_1 -> 253 in the cache */
   /* replace111_2_0 -> 255 in the cache */
   /* replace111_2_1 -> 256 in the cache */
   /* replace111_2_2 -> 259 in the cache */
   { .constant = {
      { nir_search_value_constant, -5 },
      nir_type_int, { 0x0ull /* 0 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -5 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 255, 256, 259, 261 },
      -1,
   } },
   /* replace111_3 -> 261 in the cache */
   { .expression = {
      { nir_search_value_expression, -5 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 252, 253, 262, 261 },
      -1,
   } },

   /* ('iadd', ('imul(is_used_once)', 'a', 'b'), 'c') => ('imadshl_agx', 'a', 'b', 'c', 0) */
   { .variable = {
      { nir_search_value_variable, -3 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, -3 },
      1, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      1, 1,
      { 264, 265 },
      0,
   } },
   { .variable = {
      { nir_search_value_variable, -3 },
      2, /* c */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iadd,
      0, 2,
      { 266, 267 },
      -1,
   } },

   /* replace112_0 -> 264 in the cache */
   /* replace112_1 -> 265 in the cache */
   /* replace112_2 -> 267 in the cache */
   { .constant = {
      { nir_search_value_constant, -3 },
      nir_type_int, { 0x0ull /* 0 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 267, 269 },
      -1,
   } },

   /* ('isub', ('imul(is_used_once)', 'a', 'b'), 'c') => ('imsubshl_agx', 'a', 'b', 'c', 0) */
   /* search113_0_0 -> 264 in the cache */
   /* search113_0_1 -> 265 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 264, 265 },
      0,
   } },
   /* search113_1 -> 267 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 1,
      { 271, 267 },
      -1,
   } },

   /* replace113_0 -> 264 in the cache */
   /* replace113_1 -> 265 in the cache */
   /* replace113_2 -> 267 in the cache */
   /* replace113_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 267, 269 },
      -1,
   } },

   /* ('iadd', 'a', ('ishl(is_used_once)', 'b', 1)) => ('imadshl_agx', 'a', 1, 'b', 1) */
   { .variable = {
      { nir_search_value_variable, -2 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, -2 },
      1, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   /* search114_1_1 -> 8 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 275, 8 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iadd,
      0, 1,
      { 274, 276 },
      -1,
   } },

   /* replace114_0 -> 274 in the cache */
   { .constant = {
      { nir_search_value_constant, -2 },
      nir_type_int, { 0x1ull /* 1 */ },
   } },
   /* replace114_2 -> 275 in the cache */
   /* replace114_3 -> 278 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 274, 278, 275, 278 },
      -1,
   } },

   /* ('isub', 'a', ('ishl(is_used_once)', 'b', 1)) => ('imsubshl_agx', 'a', 1, 'b', 1) */
   /* search115_0 -> 274 in the cache */
   /* search115_1_0 -> 275 in the cache */
   /* search115_1_1 -> 8 in the cache */
   /* search115_1 -> 276 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 0,
      { 274, 276 },
      -1,
   } },

   /* replace115_0 -> 274 in the cache */
   /* replace115_1 -> 278 in the cache */
   /* replace115_2 -> 275 in the cache */
   /* replace115_3 -> 278 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 274, 278, 275, 278 },
      -1,
   } },

   /* ('ineg', ('ishl(is_used_once)', 'b', 1)) => ('imsubshl_agx', 0, 1, 'b', 1) */
   { .variable = {
      { nir_search_value_variable, -1 },
      0, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   /* search116_0_1 -> 8 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 282, 8 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ineg,
      -1, 0,
      { 283 },
      -1,
   } },

   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x0ull /* 0 */ },
   } },
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x1ull /* 1 */ },
   } },
   /* replace116_2 -> 282 in the cache */
   /* replace116_3 -> 286 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 285, 286, 282, 286 },
      -1,
   } },

   /* ('imadshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 1), 0) => ('imadshl_agx', 'a', 'b', 'c', 1) */
   /* search117_0 -> 264 in the cache */
   /* search117_1 -> 265 in the cache */
   /* search117_2_0 -> 267 in the cache */
   /* search117_2_1 -> 8 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 267, 8 },
      0,
   } },
   /* search117_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 288, 269 },
      -1,
   } },

   /* replace117_0 -> 264 in the cache */
   /* replace117_1 -> 265 in the cache */
   /* replace117_2 -> 267 in the cache */
   { .constant = {
      { nir_search_value_constant, -3 },
      nir_type_int, { 0x1ull /* 1 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 267, 290 },
      -1,
   } },

   /* ('imsubshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 1), 0) => ('imsubshl_agx', 'a', 'b', 'c', 1) */
   /* search118_0 -> 264 in the cache */
   /* search118_1 -> 265 in the cache */
   /* search118_2_0 -> 267 in the cache */
   /* search118_2_1 -> 8 in the cache */
   /* search118_2 -> 288 in the cache */
   /* search118_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 288, 269 },
      -1,
   } },

   /* replace118_0 -> 264 in the cache */
   /* replace118_1 -> 265 in the cache */
   /* replace118_2 -> 267 in the cache */
   /* replace118_3 -> 290 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 267, 290 },
      -1,
   } },

   /* ('imul', 'a', 3) => ('imadshl_agx', 'a', 1, 'a', 1) */
   { .variable = {
      { nir_search_value_variable, -1 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x3ull /* 3 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 295 },
      -1,
   } },

   /* replace119_0 -> 294 in the cache */
   /* replace119_1 -> 286 in the cache */
   /* replace119_2 -> 294 in the cache */
   /* replace119_3 -> 286 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 294, 286, 294, 286 },
      -1,
   } },

   /* ('imul', 'a', -1) => ('imsubshl_agx', 'a', 1, 'a', 1) */
   /* search120_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0xffffffffffffffffull /* -1 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 298 },
      -1,
   } },

   /* replace120_0 -> 294 in the cache */
   /* replace120_1 -> 286 in the cache */
   /* replace120_2 -> 294 in the cache */
   /* replace120_3 -> 286 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 294, 286, 294, 286 },
      -1,
   } },

   /* ('ineg', ('imul(is_used_once)', 'a', 1)) => ('imsubshl_agx', 'a', 1, 'a', 1) */
   /* search121_0_0 -> 294 in the cache */
   /* search121_0_1 -> 286 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 286 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ineg,
      -1, 1,
      { 301 },
      -1,
   } },

   /* replace121_0 -> 294 in the cache */
   /* replace121_1 -> 286 in the cache */
   /* replace121_2 -> 294 in the cache */
   /* replace121_3 -> 286 in the cache */
   /* replace121 -> 300 in the cache */

   /* ('ishl', 'a', 1) => ('imadshl_agx', 0, 1, 'a', 1) */
   /* search122_0 -> 294 in the cache */
   /* search122_1 -> 8 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 294, 8 },
      -1,
   } },

   /* replace122_0 -> 285 in the cache */
   /* replace122_1 -> 286 in the cache */
   /* replace122_2 -> 294 in the cache */
   /* replace122_3 -> 286 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 285, 286, 294, 286 },
      -1,
   } },

   /* ('iadd', 'a', ('ishl(is_used_once)', 'b', 2)) => ('imadshl_agx', 'a', 1, 'b', 2) */
   /* search123_0 -> 274 in the cache */
   /* search123_1_0 -> 275 in the cache */
   /* search123_1_1 -> 14 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 275, 14 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iadd,
      0, 1,
      { 274, 305 },
      -1,
   } },

   /* replace123_0 -> 274 in the cache */
   /* replace123_1 -> 278 in the cache */
   /* replace123_2 -> 275 in the cache */
   { .constant = {
      { nir_search_value_constant, -2 },
      nir_type_int, { 0x2ull /* 2 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 274, 278, 275, 307 },
      -1,
   } },

   /* ('isub', 'a', ('ishl(is_used_once)', 'b', 2)) => ('imsubshl_agx', 'a', 1, 'b', 2) */
   /* search124_0 -> 274 in the cache */
   /* search124_1_0 -> 275 in the cache */
   /* search124_1_1 -> 14 in the cache */
   /* search124_1 -> 305 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 0,
      { 274, 305 },
      -1,
   } },

   /* replace124_0 -> 274 in the cache */
   /* replace124_1 -> 278 in the cache */
   /* replace124_2 -> 275 in the cache */
   /* replace124_3 -> 307 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 274, 278, 275, 307 },
      -1,
   } },

   /* ('ineg', ('ishl(is_used_once)', 'b', 2)) => ('imsubshl_agx', 0, 1, 'b', 2) */
   /* search125_0_0 -> 282 in the cache */
   /* search125_0_1 -> 14 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 282, 14 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ineg,
      -1, 0,
      { 311 },
      -1,
   } },

   /* replace125_0 -> 285 in the cache */
   /* replace125_1 -> 286 in the cache */
   /* replace125_2 -> 282 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x2ull /* 2 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 285, 286, 282, 313 },
      -1,
   } },

   /* ('imadshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 2), 0) => ('imadshl_agx', 'a', 'b', 'c', 2) */
   /* search126_0 -> 264 in the cache */
   /* search126_1 -> 265 in the cache */
   /* search126_2_0 -> 267 in the cache */
   /* search126_2_1 -> 14 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 267, 14 },
      0,
   } },
   /* search126_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 315, 269 },
      -1,
   } },

   /* replace126_0 -> 264 in the cache */
   /* replace126_1 -> 265 in the cache */
   /* replace126_2 -> 267 in the cache */
   { .constant = {
      { nir_search_value_constant, -3 },
      nir_type_int, { 0x2ull /* 2 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 267, 317 },
      -1,
   } },

   /* ('imsubshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 2), 0) => ('imsubshl_agx', 'a', 'b', 'c', 2) */
   /* search127_0 -> 264 in the cache */
   /* search127_1 -> 265 in the cache */
   /* search127_2_0 -> 267 in the cache */
   /* search127_2_1 -> 14 in the cache */
   /* search127_2 -> 315 in the cache */
   /* search127_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 315, 269 },
      -1,
   } },

   /* replace127_0 -> 264 in the cache */
   /* replace127_1 -> 265 in the cache */
   /* replace127_2 -> 267 in the cache */
   /* replace127_3 -> 317 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 267, 317 },
      -1,
   } },

   /* ('imul', 'a', 5) => ('imadshl_agx', 'a', 1, 'a', 2) */
   /* search128_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x5ull /* 5 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 321 },
      -1,
   } },

   /* replace128_0 -> 294 in the cache */
   /* replace128_1 -> 286 in the cache */
   /* replace128_2 -> 294 in the cache */
   /* replace128_3 -> 313 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 294, 286, 294, 313 },
      -1,
   } },

   /* ('imul', 'a', -3) => ('imsubshl_agx', 'a', 1, 'a', 2) */
   /* search129_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0xfffffffffffffffdull /* -3 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 324 },
      -1,
   } },

   /* replace129_0 -> 294 in the cache */
   /* replace129_1 -> 286 in the cache */
   /* replace129_2 -> 294 in the cache */
   /* replace129_3 -> 313 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 294, 286, 294, 313 },
      -1,
   } },

   /* ('ineg', ('imul(is_used_once)', 'a', 3)) => ('imsubshl_agx', 'a', 1, 'a', 2) */
   /* search130_0_0 -> 294 in the cache */
   /* search130_0_1 -> 295 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 295 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ineg,
      -1, 1,
      { 327 },
      -1,
   } },

   /* replace130_0 -> 294 in the cache */
   /* replace130_1 -> 286 in the cache */
   /* replace130_2 -> 294 in the cache */
   /* replace130_3 -> 313 in the cache */
   /* replace130 -> 326 in the cache */

   /* ('ishl', 'a', 2) => ('imadshl_agx', 0, 1, 'a', 2) */
   /* search131_0 -> 294 in the cache */
   /* search131_1 -> 14 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 294, 14 },
      -1,
   } },

   /* replace131_0 -> 285 in the cache */
   /* replace131_1 -> 286 in the cache */
   /* replace131_2 -> 294 in the cache */
   /* replace131_3 -> 313 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 285, 286, 294, 313 },
      -1,
   } },

   /* ('iadd', 'a', ('ishl(is_used_once)', 'b', 3)) => ('imadshl_agx', 'a', 1, 'b', 3) */
   /* search132_0 -> 274 in the cache */
   /* search132_1_0 -> 275 in the cache */
   /* search132_1_1 -> 20 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 275, 20 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iadd,
      0, 1,
      { 274, 331 },
      -1,
   } },

   /* replace132_0 -> 274 in the cache */
   /* replace132_1 -> 278 in the cache */
   /* replace132_2 -> 275 in the cache */
   { .constant = {
      { nir_search_value_constant, -2 },
      nir_type_int, { 0x3ull /* 3 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 274, 278, 275, 333 },
      -1,
   } },

   /* ('isub', 'a', ('ishl(is_used_once)', 'b', 3)) => ('imsubshl_agx', 'a', 1, 'b', 3) */
   /* search133_0 -> 274 in the cache */
   /* search133_1_0 -> 275 in the cache */
   /* search133_1_1 -> 20 in the cache */
   /* search133_1 -> 331 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 0,
      { 274, 331 },
      -1,
   } },

   /* replace133_0 -> 274 in the cache */
   /* replace133_1 -> 278 in the cache */
   /* replace133_2 -> 275 in the cache */
   /* replace133_3 -> 333 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 274, 278, 275, 333 },
      -1,
   } },

   /* ('ineg', ('ishl(is_used_once)', 'b', 3)) => ('imsubshl_agx', 0, 1, 'b', 3) */
   /* search134_0_0 -> 282 in the cache */
   /* search134_0_1 -> 20 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 282, 20 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ineg,
      -1, 0,
      { 337 },
      -1,
   } },

   /* replace134_0 -> 285 in the cache */
   /* replace134_1 -> 286 in the cache */
   /* replace134_2 -> 282 in the cache */
   /* replace134_3 -> 295 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 285, 286, 282, 295 },
      -1,
   } },

   /* ('imadshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 3), 0) => ('imadshl_agx', 'a', 'b', 'c', 3) */
   /* search135_0 -> 264 in the cache */
   /* search135_1 -> 265 in the cache */
   /* search135_2_0 -> 267 in the cache */
   /* search135_2_1 -> 20 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 267, 20 },
      0,
   } },
   /* search135_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 340, 269 },
      -1,
   } },

   /* replace135_0 -> 264 in the cache */
   /* replace135_1 -> 265 in the cache */
   /* replace135_2 -> 267 in the cache */
   { .constant = {
      { nir_search_value_constant, -3 },
      nir_type_int, { 0x3ull /* 3 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 267, 342 },
      -1,
   } },

   /* ('imsubshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 3), 0) => ('imsubshl_agx', 'a', 'b', 'c', 3) */
   /* search136_0 -> 264 in the cache */
   /* search136_1 -> 265 in the cache */
   /* search136_2_0 -> 267 in the cache */
   /* search136_2_1 -> 20 in the cache */
   /* search136_2 -> 340 in the cache */
   /* search136_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 340, 269 },
      -1,
   } },

   /* replace136_0 -> 264 in the cache */
   /* replace136_1 -> 265 in the cache */
   /* replace136_2 -> 267 in the cache */
   /* replace136_3 -> 342 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 267, 342 },
      -1,
   } },

   /* ('imul', 'a', 9) => ('imadshl_agx', 'a', 1, 'a', 3) */
   /* search137_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x9ull /* 9 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 346 },
      -1,
   } },

   /* replace137_0 -> 294 in the cache */
   /* replace137_1 -> 286 in the cache */
   /* replace137_2 -> 294 in the cache */
   /* replace137_3 -> 295 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 294, 286, 294, 295 },
      -1,
   } },

   /* ('imul', 'a', -7) => ('imsubshl_agx', 'a', 1, 'a', 3) */
   /* search138_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0xfffffffffffffff9ull /* -7 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 349 },
      -1,
   } },

   /* replace138_0 -> 294 in the cache */
   /* replace138_1 -> 286 in the cache */
   /* replace138_2 -> 294 in the cache */
   /* replace138_3 -> 295 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 294, 286, 294, 295 },
      -1,
   } },

   /* ('ineg', ('imul(is_used_once)', 'a', 7)) => ('imsubshl_agx', 'a', 1, 'a', 3) */
   /* search139_0_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x7ull /* 7 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 352 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ineg,
      -1, 1,
      { 353 },
      -1,
   } },

   /* replace139_0 -> 294 in the cache */
   /* replace139_1 -> 286 in the cache */
   /* replace139_2 -> 294 in the cache */
   /* replace139_3 -> 295 in the cache */
   /* replace139 -> 351 in the cache */

   /* ('ishl', 'a', 3) => ('imadshl_agx', 0, 1, 'a', 3) */
   /* search140_0 -> 294 in the cache */
   /* search140_1 -> 20 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 294, 20 },
      -1,
   } },

   /* replace140_0 -> 285 in the cache */
   /* replace140_1 -> 286 in the cache */
   /* replace140_2 -> 294 in the cache */
   /* replace140_3 -> 295 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 285, 286, 294, 295 },
      -1,
   } },

   /* ('iadd', 'a', ('ishl(is_used_once)', 'b', 4)) => ('imadshl_agx', 'a', 1, 'b', 4) */
   /* search141_0 -> 274 in the cache */
   /* search141_1_0 -> 275 in the cache */
   /* search141_1_1 -> 26 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 275, 26 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_iadd,
      0, 1,
      { 274, 357 },
      -1,
   } },

   /* replace141_0 -> 274 in the cache */
   /* replace141_1 -> 278 in the cache */
   /* replace141_2 -> 275 in the cache */
   { .constant = {
      { nir_search_value_constant, -2 },
      nir_type_int, { 0x4ull /* 4 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 274, 278, 275, 359 },
      -1,
   } },

   /* ('isub', 'a', ('ishl(is_used_once)', 'b', 4)) => ('imsubshl_agx', 'a', 1, 'b', 4) */
   /* search142_0 -> 274 in the cache */
   /* search142_1_0 -> 275 in the cache */
   /* search142_1_1 -> 26 in the cache */
   /* search142_1 -> 357 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_isub,
      -1, 0,
      { 274, 357 },
      -1,
   } },

   /* replace142_0 -> 274 in the cache */
   /* replace142_1 -> 278 in the cache */
   /* replace142_2 -> 275 in the cache */
   /* replace142_3 -> 359 in the cache */
   { .expression = {
      { nir_search_value_expression, -2 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 274, 278, 275, 359 },
      -1,
   } },

   /* ('ineg', ('ishl(is_used_once)', 'b', 4)) => ('imsubshl_agx', 0, 1, 'b', 4) */
   /* search143_0_0 -> 282 in the cache */
   /* search143_0_1 -> 26 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 282, 26 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ineg,
      -1, 0,
      { 363 },
      -1,
   } },

   /* replace143_0 -> 285 in the cache */
   /* replace143_1 -> 286 in the cache */
   /* replace143_2 -> 282 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x4ull /* 4 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 285, 286, 282, 365 },
      -1,
   } },

   /* ('imadshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 4), 0) => ('imadshl_agx', 'a', 'b', 'c', 4) */
   /* search144_0 -> 264 in the cache */
   /* search144_1 -> 265 in the cache */
   /* search144_2_0 -> 267 in the cache */
   /* search144_2_1 -> 26 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 267, 26 },
      0,
   } },
   /* search144_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 367, 269 },
      -1,
   } },

   /* replace144_0 -> 264 in the cache */
   /* replace144_1 -> 265 in the cache */
   /* replace144_2 -> 267 in the cache */
   { .constant = {
      { nir_search_value_constant, -3 },
      nir_type_int, { 0x4ull /* 4 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 264, 265, 267, 369 },
      -1,
   } },

   /* ('imsubshl_agx', 'a', 'b', ('ishl(is_used_once)', 'c', 4), 0) => ('imsubshl_agx', 'a', 'b', 'c', 4) */
   /* search145_0 -> 264 in the cache */
   /* search145_1 -> 265 in the cache */
   /* search145_2_0 -> 267 in the cache */
   /* search145_2_1 -> 26 in the cache */
   /* search145_2 -> 367 in the cache */
   /* search145_3 -> 269 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 367, 269 },
      -1,
   } },

   /* replace145_0 -> 264 in the cache */
   /* replace145_1 -> 265 in the cache */
   /* replace145_2 -> 267 in the cache */
   /* replace145_3 -> 369 in the cache */
   { .expression = {
      { nir_search_value_expression, -3 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 264, 265, 267, 369 },
      -1,
   } },

   /* ('imul', 'a', 17) => ('imadshl_agx', 'a', 1, 'a', 4) */
   /* search146_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0x11ull /* 17 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 373 },
      -1,
   } },

   /* replace146_0 -> 294 in the cache */
   /* replace146_1 -> 286 in the cache */
   /* replace146_2 -> 294 in the cache */
   /* replace146_3 -> 365 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 294, 286, 294, 365 },
      -1,
   } },

   /* ('imul', 'a', -15) => ('imsubshl_agx', 'a', 1, 'a', 4) */
   /* search147_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0xfffffffffffffff1ull /* -15 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 376 },
      -1,
   } },

   /* replace147_0 -> 294 in the cache */
   /* replace147_1 -> 286 in the cache */
   /* replace147_2 -> 294 in the cache */
   /* replace147_3 -> 365 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imsubshl_agx,
      -1, 0,
      { 294, 286, 294, 365 },
      -1,
   } },

   /* ('ineg', ('imul(is_used_once)', 'a', 15)) => ('imsubshl_agx', 'a', 1, 'a', 4) */
   /* search148_0_0 -> 294 in the cache */
   { .constant = {
      { nir_search_value_constant, -1 },
      nir_type_int, { 0xfull /* 15 */ },
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imul,
      0, 1,
      { 294, 379 },
      0,
   } },
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ineg,
      -1, 1,
      { 380 },
      -1,
   } },

   /* replace148_0 -> 294 in the cache */
   /* replace148_1 -> 286 in the cache */
   /* replace148_2 -> 294 in the cache */
   /* replace148_3 -> 365 in the cache */
   /* replace148 -> 378 in the cache */

   /* ('ishl', 'a', 4) => ('imadshl_agx', 0, 1, 'a', 4) */
   /* search149_0 -> 294 in the cache */
   /* search149_1 -> 26 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ishl,
      -1, 0,
      { 294, 26 },
      -1,
   } },

   /* replace149_0 -> 285 in the cache */
   /* replace149_1 -> 286 in the cache */
   /* replace149_2 -> 294 in the cache */
   /* replace149_3 -> 365 in the cache */
   { .expression = {
      { nir_search_value_expression, -1 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_imadshl_agx,
      -1, 0,
      { 285, 286, 294, 365 },
      -1,
   } },

   /* ('ixor', ('bcsel', 'a', '#b', '#c'), '#d') => ('bcsel', 'a', ('ixor', 'b', 'd'), ('ixor', 'c', 'd')) */
   { .variable = {
      { nir_search_value_variable, 1 },
      0, /* a */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, -4 },
      1, /* b */
      true,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, -4 },
      2, /* c */
      true,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 0,
      { 384, 385, 386 },
      -1,
   } },
   { .variable = {
      { nir_search_value_variable, -4 },
      3, /* d */
      true,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ixor,
      0, 1,
      { 387, 388 },
      -1,
   } },

   /* replace150_0 -> 384 in the cache */
   { .variable = {
      { nir_search_value_variable, -4 },
      1, /* b */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .variable = {
      { nir_search_value_variable, -4 },
      3, /* d */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ixor,
      0, 1,
      { 390, 391 },
      -1,
   } },
   { .variable = {
      { nir_search_value_variable, -4 },
      2, /* c */
      false,
      nir_type_invalid,
      -1,
      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
   } },
   /* replace150_2_1 -> 391 in the cache */
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_ixor,
      1, 1,
      { 393, 391 },
      -1,
   } },
   { .expression = {
      { nir_search_value_expression, -4 },
      false,
      false,
      false,
      false,
      false,
      false,
      nir_op_bcsel,
      -1, 2,
      { 384, 392, 394 },
      -1,
   } },

};

static const nir_search_expression_cond agx_nir_fuse_algebraic_late_expression_cond[] = {
   is_used_once,
};


static const struct transform agx_nir_fuse_algebraic_late_transforms[] = {
   { ~0, ~0, ~0 }, /* Sentinel */

   { 303, 304, 0 },
   { 329, 330, 0 },
   { 355, 356, 0 },
   { 382, 383, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 296, 297, 0 },
   { 299, 300, 0 },
   { 322, 323, 0 },
   { 325, 326, 0 },
   { 347, 348, 0 },
   { 350, 351, 0 },
   { 374, 375, 0 },
   { 377, 378, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 164, 165, 0 },
   { 166, 167, 0 },
   { 168, 169, 0 },
   { 170, 171, 0 },
   { 172, 173, 0 },
   { 175, 176, 0 },
   { 178, 179, 0 },
   { 181, 182, 0 },
   { 184, 185, 0 },
   { 187, 188, 0 },
   { 190, 191, 0 },
   { 193, 194, 0 },
   { 196, 197, 0 },
   { 199, 200, 0 },
   { 202, 203, 0 },
   { 205, 206, 0 },
   { 208, 209, 0 },
   { 211, 212, 0 },
   { 214, 215, 0 },
   { 217, 218, 0 },
   { 220, 221, 0 },
   { 223, 224, 0 },
   { 226, 227, 0 },
   { 229, 230, 0 },
   { 232, 233, 0 },
   { 235, 236, 0 },
   { 238, 239, 0 },
   { 241, 242, 0 },
   { 244, 245, 0 },
   { 247, 248, 0 },
   { 250, 251, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 6, 7, 0 },
   { 12, 13, 0 },
   { 18, 19, 0 },
   { 24, 25, 0 },
   { 30, 31, 0 },
   { 36, 37, 0 },
   { 42, 43, 0 },
   { 48, 49, 0 },
   { 54, 55, 0 },
   { 60, 61, 0 },
   { 66, 67, 0 },
   { 72, 73, 0 },
   { 78, 79, 0 },
   { 84, 85, 0 },
   { 90, 91, 0 },
   { 96, 97, 0 },
   { 101, 102, 0 },
   { 105, 106, 0 },
   { 109, 110, 0 },
   { 113, 114, 0 },
   { 117, 118, 0 },
   { 121, 122, 0 },
   { 125, 126, 0 },
   { 129, 130, 0 },
   { 133, 134, 0 },
   { 137, 138, 0 },
   { 141, 142, 0 },
   { 145, 146, 0 },
   { 149, 150, 0 },
   { 153, 154, 0 },
   { 157, 158, 0 },
   { 161, 162, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 277, 279, 0 },
   { 306, 308, 0 },
   { 332, 334, 0 },
   { 358, 360, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 268, 270, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 268, 270, 0 },
   { 277, 279, 0 },
   { 306, 308, 0 },
   { 332, 334, 0 },
   { 358, 360, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 268, 270, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 280, 281, 0 },
   { 309, 310, 0 },
   { 335, 336, 0 },
   { 361, 362, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 272, 273, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 272, 273, 0 },
   { 280, 281, 0 },
   { 309, 310, 0 },
   { 335, 336, 0 },
   { 361, 362, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 284, 287, 0 },
   { 312, 314, 0 },
   { 338, 339, 0 },
   { 364, 366, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 302, 300, 0 },
   { 328, 326, 0 },
   { 354, 351, 0 },
   { 381, 378, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 289, 291, 0 },
   { 316, 318, 0 },
   { 341, 343, 0 },
   { 368, 370, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 292, 293, 0 },
   { 319, 320, 0 },
   { 344, 345, 0 },
   { 371, 372, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 389, 395, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 260, 263, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 260, 263, 0 },
   { 277, 279, 0 },
   { 306, 308, 0 },
   { 332, 334, 0 },
   { 358, 360, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

   { 260, 263, 0 },
   { 268, 270, 0 },
   { ~0, ~0, ~0 }, /* Sentinel */

};

static const struct per_op_table agx_nir_fuse_algebraic_late_pass_op_table[nir_num_search_ops] = {
   [nir_op_ior] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         1,
         2,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 3,
      .table = (const uint16_t []) {
      
         0,
         0,
         0,
         0,
         0,
         9,
         0,
         9,
         0,
      },
   },
   [nir_op_ushr] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         2,
         3,
         2,
         3,
      },
   },
   [nir_op_ishl] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         0,
         4,
         0,
         4,
      },
   },
   [nir_op_iand] = {
      .filter = (const uint16_t []) {
         0,
         1,
         2,
         2,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 3,
      .table = (const uint16_t []) {
      
         0,
         0,
         0,
         0,
         0,
         8,
         0,
         8,
         0,
      },
   },
   [nir_op_iadd] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         1,
         2,
         2,
         0,
         0,
         0,
         0,
         0,
         0,
         3,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 4,
      .table = (const uint16_t []) {
      
         0,
         10,
         11,
         22,
         10,
         10,
         12,
         23,
         11,
         12,
         13,
         24,
         22,
         23,
         24,
         22,
      },
   },
   [nir_op_imul] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         5,
         6,
         6,
         6,
      },
   },
   [nir_op_isub] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         1,
         2,
         2,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 3,
      .table = (const uint16_t []) {
      
         0,
         14,
         0,
         0,
         14,
         0,
         15,
         16,
         15,
      },
   },
   [nir_op_ineg] = {
      .filter = (const uint16_t []) {
         0,
         0,
         0,
         0,
         1,
         0,
         2,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 3,
      .table = (const uint16_t []) {
      
         0,
         17,
         18,
      },
   },
   [nir_op_imadshl_agx] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         2,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 3,
      .table = (const uint16_t []) {
      
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         19,
         0,
      },
   },
   [nir_op_imsubshl_agx] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         2,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 3,
      .table = (const uint16_t []) {
      
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         20,
         0,
      },
   },
   [nir_op_ixor] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         2,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 3,
      .table = (const uint16_t []) {
      
         0,
         0,
         0,
         0,
         0,
         21,
         0,
         21,
         0,
      },
   },
   [nir_op_bcsel] = {
      .filter = (const uint16_t []) {
         0,
         1,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
      },
      
      .num_filtered_states = 2,
      .table = (const uint16_t []) {
      
         0,
         0,
         0,
         7,
         0,
         0,
         0,
         7,
      },
   },
};

/* Mapping from state index to offset in transforms (0 being no transforms) */
static const uint16_t agx_nir_fuse_algebraic_late_transform_offsets[] = {
   0,
   0,
   0,
   0,
   1,
   0,
   6,
   0,
   15,
   47,
   80,
   85,
   87,
   93,
   95,
   100,
   102,
   108,
   113,
   118,
   123,
   128,
   130,
   132,
   138,
};

static const nir_algebraic_table agx_nir_fuse_algebraic_late_table = {
   .transforms = agx_nir_fuse_algebraic_late_transforms,
   .transform_offsets = agx_nir_fuse_algebraic_late_transform_offsets,
   .pass_op_table = agx_nir_fuse_algebraic_late_pass_op_table,
   .values = agx_nir_fuse_algebraic_late_values,
   .expression_cond = agx_nir_fuse_algebraic_late_expression_cond,
   .variable_cond = NULL,
};

bool
agx_nir_fuse_algebraic_late(
   nir_shader *shader
) {
   bool progress = false;
   bool condition_flags[1];
   const nir_shader_compiler_options *options = shader->options;
   const shader_info *info = &shader->info;
   (void) options;
   (void) info;

   STATIC_ASSERT(396 == ARRAY_SIZE(agx_nir_fuse_algebraic_late_values));
   condition_flags[0] = true;

   nir_foreach_function_impl(impl, shader) {
     progress |= nir_algebraic_impl(impl, condition_flags, &agx_nir_fuse_algebraic_late_table);
   }

   return progress;
}

