X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcompiler%2Fglsl%2Fir_expression_operation.py;h=bde9c01db9b7b84a0ab3ce45f8892306db192f3c;hb=abc8a702d0f01852f85705a87c9d624300c1efec;hp=7d82ea80dd29307606aa547e0d2c8294f2ed143a;hpb=d8dd49419aebf025fece1a2342dd880e7504c2e5;p=mesa.git diff --git a/src/compiler/glsl/ir_expression_operation.py b/src/compiler/glsl/ir_expression_operation.py index 7d82ea80dd2..bde9c01db9b 100644 --- a/src/compiler/glsl/ir_expression_operation.py +++ b/src/compiler/glsl/ir_expression_operation.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python # # Copyright (C) 2015 Intel Corporation # @@ -80,73 +79,24 @@ class type_signature_iter(object): uint_type = type("unsigned", "u", "GLSL_TYPE_UINT") int_type = type("int", "i", "GLSL_TYPE_INT") +uint64_type = type("uint64_t", "u64", "GLSL_TYPE_UINT64") +int64_type = type("int64_t", "i64", "GLSL_TYPE_INT64") float_type = type("float", "f", "GLSL_TYPE_FLOAT") double_type = type("double", "d", "GLSL_TYPE_DOUBLE") bool_type = type("bool", "b", "GLSL_TYPE_BOOL") -all_types = (uint_type, int_type, float_type, double_type, bool_type) -numeric_types = (uint_type, int_type, float_type, double_type) -signed_numeric_types = (int_type, float_type, double_type) -integer_types = (uint_type, int_type) +all_types = (uint_type, int_type, float_type, double_type, uint64_type, int64_type, bool_type) +numeric_types = (uint_type, int_type, float_type, double_type, uint64_type, int64_type) +signed_numeric_types = (int_type, float_type, double_type, int64_type) +integer_types = (uint_type, int_type, uint64_type, int64_type) real_types = (float_type, double_type) -# This template is for unary and binary operations that can only have operands -# of a single type. ir_unop_logic_not is an example. -constant_template0 = mako.template.Template("""\ - case ${op.get_enum_name()}: - assert(op[0]->type->base_type == ${op.source_types[0].glsl_type}); - for (unsigned c = 0; c < op[0]->type->components(); c++) - data.${op.source_types[0].union_field}[c] = ${op.get_c_expression(op.source_types)}; - break;""") - -# This template is for unary operations that can have operands of a several -# different types. ir_unop_bit_not is an example. -constant_template1 = mako.template.Template("""\ - case ${op.get_enum_name()}: - switch (op[0]->type->base_type) { - % for dst_type, src_types in op.signatures(): - case ${src_types[0].glsl_type}: - for (unsigned c = 0; c < op[0]->type->components(); c++) - data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types)}; - break; - % endfor - default: - assert(0); - } - break;""") - -# This template is for unary operations that can have operands of a several -# different types, and each type has a different C expression. ir_unop_neg is -# an example. -constant_template3 = mako.template.Template("""\ +# This template is for operations that can have operands of a several +# different types, and each type may or may not has a different C expression. +# This is used by most operations. +constant_template_common = mako.template.Template("""\ case ${op.get_enum_name()}: for (unsigned c = 0; c < op[0]->type->components(); c++) { - switch (this->type->base_type) { - % for dst_type, src_types in op.signatures(): - case ${src_types[0].glsl_type}: - data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types)}; - break; - % endfor - default: - assert(0); - } - } - break;""") - -# This template is for unary operations that map an operand of one type to an -# operand of another type. ir_unop_f2b is an example. -constant_template2 = mako.template.Template("""\ - case ${op.get_enum_name()}: - assert(op[0]->type->base_type == ${op.source_types[0].glsl_type}); - for (unsigned c = 0; c < op[0]->type->components(); c++) - data.${op.dest_type.union_field}[c] = ${op.get_c_expression(op.source_types)}; - break;""") - -# This template is for operations with an output type that doesn't match the -# input types. -constant_template5 = mako.template.Template("""\ - case ${op.get_enum_name()}: - for (unsigned c = 0; c < components; c++) { switch (op[0]->type->base_type) { % for dst_type, src_types in op.signatures(): case ${src_types[0].glsl_type}: @@ -154,7 +104,7 @@ constant_template5 = mako.template.Template("""\ break; % endfor default: - assert(0); + unreachable("invalid type"); } } break;""") @@ -185,7 +135,7 @@ constant_template_vector_scalar = mako.template.Template("""\ break; % endfor default: - assert(0); + unreachable("invalid type"); } } break;""") @@ -208,7 +158,7 @@ constant_template_mul = mako.template.Template("""\ break; % endfor default: - assert(0); + unreachable("invalid type"); } } } else { @@ -266,7 +216,103 @@ constant_template_horizontal = mako.template.Template("""\ break; % endfor default: - assert(0); + unreachable("invalid type"); + } + break;""") + +# This template is for ir_binop_vector_extract. +constant_template_vector_extract = mako.template.Template("""\ + case ${op.get_enum_name()}: { + const int c = CLAMP(op[1]->value.i[0], 0, + (int) op[0]->type->vector_elements - 1); + + switch (op[0]->type->base_type) { + % for dst_type, src_types in op.signatures(): + case ${src_types[0].glsl_type}: + data.${dst_type.union_field}[0] = op[0]->value.${src_types[0].union_field}[c]; + break; + % endfor + default: + unreachable("invalid type"); + } + break; + }""") + +# This template is for ir_triop_vector_insert. +constant_template_vector_insert = mako.template.Template("""\ + case ${op.get_enum_name()}: { + const unsigned idx = op[2]->value.u[0]; + + memcpy(&data, &op[0]->value, sizeof(data)); + + switch (this->type->base_type) { + % for dst_type, src_types in op.signatures(): + case ${src_types[0].glsl_type}: + data.${dst_type.union_field}[idx] = op[1]->value.${src_types[0].union_field}[0]; + break; + % endfor + default: + unreachable("invalid type"); + } + break; + }""") + +# This template is for ir_quadop_vector. +constant_template_vector = mako.template.Template("""\ + case ${op.get_enum_name()}: + for (unsigned c = 0; c < this->type->vector_elements; c++) { + switch (this->type->base_type) { + % for dst_type, src_types in op.signatures(): + case ${src_types[0].glsl_type}: + data.${dst_type.union_field}[c] = op[c]->value.${src_types[0].union_field}[0]; + break; + % endfor + default: + unreachable("invalid type"); + } + } + break;""") + +# This template is for ir_triop_lrp. +constant_template_lrp = mako.template.Template("""\ + case ${op.get_enum_name()}: { + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT || + op[0]->type->base_type == GLSL_TYPE_DOUBLE); + assert(op[1]->type->base_type == GLSL_TYPE_FLOAT || + op[1]->type->base_type == GLSL_TYPE_DOUBLE); + assert(op[2]->type->base_type == GLSL_TYPE_FLOAT || + op[2]->type->base_type == GLSL_TYPE_DOUBLE); + + unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, c2 = 0; c < components; c2 += c2_inc, c++) { + switch (this->type->base_type) { + % for dst_type, src_types in op.signatures(): + case ${src_types[0].glsl_type}: + data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types, ("c", "c", "c2"))}; + break; + % endfor + default: + unreachable("invalid type"); + } + } + break; + }""") + +# This template is for ir_triop_csel. This expression is really unique +# because not all of the operands are the same type, and the second operand +# determines the type of the expression (instead of the first). +constant_template_csel = mako.template.Template("""\ + case ${op.get_enum_name()}: + for (unsigned c = 0; c < components; c++) { + switch (this->type->base_type) { + % for dst_type, src_types in op.signatures(): + case ${src_types[1].glsl_type}: + data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types)}; + break; + % endfor + default: + unreachable("invalid type"); + } } break;""") @@ -312,59 +358,54 @@ class operation(object): def get_enum_name(self): - return "ir_{}op_{}".format(("un", "bin", "tri", "quad")[self.num_operands-1], self.name) + return "ir_{0}op_{1}".format(("un", "bin", "tri", "quad")[self.num_operands-1], self.name) def get_template(self): if self.c_expression is None: return None - if self.num_operands == 1: - if horizontal_operation in self.flags and non_assign_operation in self.flags: + if horizontal_operation in self.flags: + if non_assign_operation in self.flags: return constant_template_horizontal_nonassignment.render(op=self) - elif horizontal_operation in self.flags: + elif types_identical_operation in self.flags: return constant_template_horizontal_single_implementation.render(op=self) - elif self.dest_type is not None and len(self.source_types) == 1: - return constant_template2.render(op=self) - elif self.dest_type is not None: - return constant_template5.render(op=self) - elif len(self.source_types) == 1: - return constant_template0.render(op=self) - elif len(self.c_expression) == 1 and 'default' in self.c_expression: - return constant_template1.render(op=self) else: - return constant_template3.render(op=self) - elif self.num_operands == 2: + return constant_template_horizontal.render(op=self) + + if self.num_operands == 2: if self.name == "mul": return constant_template_mul.render(op=self) + elif self.name == "vector_extract": + return constant_template_vector_extract.render(op=self) elif vector_scalar_operation in self.flags: return constant_template_vector_scalar.render(op=self) - elif horizontal_operation in self.flags and types_identical_operation in self.flags: - return constant_template_horizontal_single_implementation.render(op=self) - elif horizontal_operation in self.flags: - return constant_template_horizontal.render(op=self) - elif len(self.source_types) == 1: - return constant_template0.render(op=self) - elif self.dest_type is not None: - return constant_template5.render(op=self) - else: - return constant_template3.render(op=self) elif self.num_operands == 3: - return constant_template3.render(op=self) + if self.name == "vector_insert": + return constant_template_vector_insert.render(op=self) + elif self.name == "lrp": + return constant_template_lrp.render(op=self) + elif self.name == "csel": + return constant_template_csel.render(op=self) + elif self.num_operands == 4: + if self.name == "vector": + return constant_template_vector.render(op=self) - return None + return constant_template_common.render(op=self) def get_c_expression(self, types, indices=("c", "c", "c")): - src0 = "op[0]->value.{}[{}]".format(types[0].union_field, indices[0]) - src1 = "op[1]->value.{}[{}]".format(types[1].union_field, indices[1]) if len(types) >= 2 else "ERROR" - src2 = "op[2]->value.{}[{}]".format(types[2].union_field, indices[2]) if len(types) >= 3 else "ERROR" + src0 = "op[0]->value.{0}[{1}]".format(types[0].union_field, indices[0]) + src1 = "op[1]->value.{0}[{1}]".format(types[1].union_field, indices[1]) if len(types) >= 2 else "ERROR" + src2 = "op[2]->value.{0}[{1}]".format(types[2].union_field, indices[2]) if len(types) >= 3 else "ERROR" + src3 = "op[3]->value.{0}[c]".format(types[3].union_field) if len(types) >= 4 else "ERROR" expr = self.c_expression[types[0].union_field] if types[0].union_field in self.c_expression else self.c_expression['default'] return expr.format(src0=src0, src1=src1, - src2=src2) + src2=src2, + src3=src3) def signatures(self): @@ -378,9 +419,9 @@ ir_expression_operation = [ operation("bit_not", 1, printable_name="~", source_types=integer_types, c_expression="~ {src0}"), operation("logic_not", 1, printable_name="!", source_types=(bool_type,), c_expression="!{src0}"), operation("neg", 1, source_types=numeric_types, c_expression={'u': "-((int) {src0})", 'default': "-{src0}"}), - operation("abs", 1, source_types=signed_numeric_types, c_expression={'i': "{src0} < 0 ? -{src0} : {src0}", 'f': "fabsf({src0})", 'd': "fabs({src0})"}), - operation("sign", 1, source_types=signed_numeric_types, c_expression={'i': "({src0} > 0) - ({src0} < 0)", 'f': "float(({src0} > 0.0F) - ({src0} < 0.0F))", 'd': "double(({src0} > 0.0) - ({src0} < 0.0))"}), - operation("rcp", 1, source_types=real_types, c_expression={'f': "{src0} != 0.0F ? 1.0F / {src0} : 0.0F", 'd': "{src0} != 0.0 ? 1.0 / {src0} : 0.0"}), + operation("abs", 1, source_types=signed_numeric_types, c_expression={'i': "{src0} < 0 ? -{src0} : {src0}", 'f': "fabsf({src0})", 'd': "fabs({src0})", 'i64': "{src0} < 0 ? -{src0} : {src0}"}), + operation("sign", 1, source_types=signed_numeric_types, c_expression={'i': "({src0} > 0) - ({src0} < 0)", 'f': "float(({src0} > 0.0F) - ({src0} < 0.0F))", 'd': "double(({src0} > 0.0) - ({src0} < 0.0))", 'i64': "({src0} > 0) - ({src0} < 0)"}), + operation("rcp", 1, source_types=real_types, c_expression={'f': "1.0F / {src0}", 'd': "1.0 / {src0}"}), operation("rsq", 1, source_types=real_types, c_expression={'f': "1.0F / sqrtf({src0})", 'd': "1.0 / sqrt({src0})"}), operation("sqrt", 1, source_types=real_types, c_expression={'f': "sqrtf({src0})", 'd': "sqrt({src0})"}), operation("exp", 1, source_types=(float_type,), c_expression="expf({src0})"), # Log base e on gentype @@ -399,7 +440,7 @@ ir_expression_operation = [ # Boolean-to-float conversion operation("b2f", 1, source_types=(bool_type,), dest_type=float_type, c_expression="{src0} ? 1.0F : 0.0F"), # int-to-boolean conversion - operation("i2b", 1, source_types=integer_types, dest_type=bool_type, c_expression="{src0} ? true : false"), + operation("i2b", 1, source_types=(uint_type, int_type), dest_type=bool_type, c_expression="{src0} ? true : false"), # Boolean-to-int conversion operation("b2i", 1, source_types=(bool_type,), dest_type=int_type, c_expression="{src0} ? 1 : 0"), # Unsigned-to-float conversion. @@ -430,6 +471,37 @@ ir_expression_operation = [ operation("bitcast_u2f", 1, source_types=(uint_type,), dest_type=float_type, c_expression="bitcast_u2f({src0})"), # 'Bit-identical float-to-uint "conversion" operation("bitcast_f2u", 1, source_types=(float_type,), dest_type=uint_type, c_expression="bitcast_f2u({src0})"), + # Bit-identical u64-to-double "conversion" + operation("bitcast_u642d", 1, source_types=(uint64_type,), dest_type=double_type, c_expression="bitcast_u642d({src0})"), + # Bit-identical i64-to-double "conversion" + operation("bitcast_i642d", 1, source_types=(int64_type,), dest_type=double_type, c_expression="bitcast_i642d({src0})"), + # Bit-identical double-to_u64 "conversion" + operation("bitcast_d2u64", 1, source_types=(double_type,), dest_type=uint64_type, c_expression="bitcast_d2u64({src0})"), + # Bit-identical double-to-i64 "conversion" + operation("bitcast_d2i64", 1, source_types=(double_type,), dest_type=int64_type, c_expression="bitcast_d2i64({src0})"), + # i64-to-i32 conversion + operation("i642i", 1, source_types=(int64_type,), dest_type=int_type, c_expression="{src0}"), + # ui64-to-i32 conversion + operation("u642i", 1, source_types=(uint64_type,), dest_type=int_type, c_expression="{src0}"), + operation("i642u", 1, source_types=(int64_type,), dest_type=uint_type, c_expression="{src0}"), + operation("u642u", 1, source_types=(uint64_type,), dest_type=uint_type, c_expression="{src0}"), + operation("i642b", 1, source_types=(int64_type,), dest_type=bool_type, c_expression="{src0} != 0"), + operation("i642f", 1, source_types=(int64_type,), dest_type=float_type, c_expression="{src0}"), + operation("u642f", 1, source_types=(uint64_type,), dest_type=float_type, c_expression="{src0}"), + operation("i642d", 1, source_types=(int64_type,), dest_type=double_type, c_expression="{src0}"), + operation("u642d", 1, source_types=(uint64_type,), dest_type=double_type, c_expression="{src0}"), + operation("i2i64", 1, source_types=(int_type,), dest_type=int64_type, c_expression="{src0}"), + operation("u2i64", 1, source_types=(uint_type,), dest_type=int64_type, c_expression="{src0}"), + operation("b2i64", 1, source_types=(bool_type,), dest_type=int64_type, c_expression="{src0}"), + operation("f2i64", 1, source_types=(float_type,), dest_type=int64_type, c_expression="{src0}"), + operation("d2i64", 1, source_types=(double_type,), dest_type=int64_type, c_expression="{src0}"), + operation("i2u64", 1, source_types=(int_type,), dest_type=uint64_type, c_expression="{src0}"), + operation("u2u64", 1, source_types=(uint_type,), dest_type=uint64_type, c_expression="{src0}"), + operation("f2u64", 1, source_types=(float_type,), dest_type=uint64_type, c_expression="{src0}"), + operation("d2u64", 1, source_types=(double_type,), dest_type=uint64_type, c_expression="{src0}"), + operation("u642i64", 1, source_types=(uint64_type,), dest_type=int64_type, c_expression="{src0}"), + operation("i642u64", 1, source_types=(int64_type,), dest_type=uint64_type, c_expression="{src0}"), + # Unary floating-point rounding operations. operation("trunc", 1, source_types=real_types, c_expression={'f': "truncf({src0})", 'd': "trunc({src0})"}), @@ -463,10 +535,10 @@ ir_expression_operation = [ operation("unpack_half_2x16", 1, printable_name="unpackHalf2x16", source_types=(uint_type,), dest_type=float_type, c_expression="unpack_2x16(unpack_half_1x16, op[0]->value.u[0], &data.f[0], &data.f[1])", flags=frozenset((horizontal_operation, non_assign_operation))), # Bit operations, part of ARB_gpu_shader5. - operation("bitfield_reverse", 1, source_types=integer_types, c_expression="bitfield_reverse({src0})"), - operation("bit_count", 1, source_types=integer_types, dest_type=int_type, c_expression="_mesa_bitcount({src0})"), - operation("find_msb", 1, source_types=integer_types, dest_type=int_type, c_expression={'u': "find_msb_uint({src0})", 'i': "find_msb_int({src0})"}), - operation("find_lsb", 1, source_types=integer_types, dest_type=int_type, c_expression="find_msb_uint({src0} & -{src0})"), + operation("bitfield_reverse", 1, source_types=(uint_type, int_type), c_expression="bitfield_reverse({src0})"), + operation("bit_count", 1, source_types=(uint_type, int_type), dest_type=int_type, c_expression="_mesa_bitcount({src0})"), + operation("find_msb", 1, source_types=(uint_type, int_type), dest_type=int_type, c_expression={'u': "find_msb_uint({src0})", 'i': "find_msb_int({src0})"}), + operation("find_lsb", 1, source_types=(uint_type, int_type), dest_type=int_type, c_expression="find_msb_uint({src0} & -{src0})"), operation("saturate", 1, printable_name="sat", source_types=(float_type,), c_expression="CLAMP({src0}, 0.0f, 1.0f)"), @@ -503,12 +575,18 @@ ir_expression_operation = [ operation("vote_all", 1), operation("vote_eq", 1), + # 64-bit integer packing ops. + operation("pack_int_2x32", 1, printable_name="packInt2x32", source_types=(int_type,), dest_type=int64_type, c_expression="memcpy(&data.i64[0], &op[0]->value.i[0], sizeof(int64_t))", flags=frozenset((horizontal_operation, non_assign_operation))), + operation("pack_uint_2x32", 1, printable_name="packUint2x32", source_types=(uint_type,), dest_type=uint64_type, c_expression="memcpy(&data.u64[0], &op[0]->value.u[0], sizeof(uint64_t))", flags=frozenset((horizontal_operation, non_assign_operation))), + operation("unpack_int_2x32", 1, printable_name="unpackInt2x32", source_types=(int64_type,), dest_type=int_type, c_expression="memcpy(&data.i[0], &op[0]->value.i64[0], sizeof(int64_t))", flags=frozenset((horizontal_operation, non_assign_operation))), + operation("unpack_uint_2x32", 1, printable_name="unpackUint2x32", source_types=(uint64_type,), dest_type=uint_type, c_expression="memcpy(&data.u[0], &op[0]->value.u64[0], sizeof(uint64_t))", flags=frozenset((horizontal_operation, non_assign_operation))), + operation("add", 2, printable_name="+", source_types=numeric_types, c_expression="{src0} + {src1}", flags=vector_scalar_operation), operation("sub", 2, printable_name="-", source_types=numeric_types, c_expression="{src0} - {src1}", flags=vector_scalar_operation), # "Floating-point or low 32-bit integer multiply." operation("mul", 2, printable_name="*", source_types=numeric_types, c_expression="{src0} * {src1}"), operation("imul_high", 2), # Calculates the high 32-bits of a 64-bit multiply. - operation("div", 2, printable_name="/", source_types=numeric_types, c_expression={'u': "{src1} == 0 ? 0 : {src0} / {src1}", 'i': "{src1} == 0 ? 0 : {src0} / {src1}", 'default': "{src0} / {src1}"}, flags=vector_scalar_operation), + operation("div", 2, printable_name="/", source_types=numeric_types, c_expression={'u': "{src1} == 0 ? 0 : {src0} / {src1}", 'i': "{src1} == 0 ? 0 : {src0} / {src1}", 'u64': "{src1} == 0 ? 0 : {src0} / {src1}", 'i64': "{src1} == 0 ? 0 : {src0} / {src1}", 'default': "{src0} / {src1}"}, flags=vector_scalar_operation), # Returns the carry resulting from the addition of the two arguments. operation("carry", 2), @@ -521,7 +599,7 @@ ir_expression_operation = [ # # We don't use fmod because it rounds toward zero; GLSL specifies the use # of floor. - operation("mod", 2, printable_name="%", source_types=numeric_types, c_expression={'u': "{src1} == 0 ? 0 : {src0} % {src1}", 'i': "{src1} == 0 ? 0 : {src0} % {src1}", 'f': "{src0} - {src1} * floorf({src0} / {src1})", 'd': "{src0} - {src1} * floor({src0} / {src1})"}, flags=vector_scalar_operation), + operation("mod", 2, printable_name="%", source_types=numeric_types, c_expression={'u': "{src1} == 0 ? 0 : {src0} % {src1}", 'i': "{src1} == 0 ? 0 : {src0} % {src1}", 'f': "{src0} - {src1} * floorf({src0} / {src1})", 'd': "{src0} - {src1} * floor({src0} / {src1})", 'u64': "{src1} == 0 ? 0 : {src0} % {src1}", 'i64': "{src1} == 0 ? 0 : {src0} % {src1}"}, flags=vector_scalar_operation), # Binary comparison operators which return a boolean vector. # The type of both operands must be equal. @@ -574,7 +652,7 @@ ir_expression_operation = [ # # operand0 is the vector # operand1 is the index of the field to read from operand0 - operation("vector_extract", 2), + operation("vector_extract", 2, source_types=all_types, c_expression="anything-except-None"), # Interpolate fs input at offset # @@ -591,7 +669,7 @@ ir_expression_operation = [ # Fused floating-point multiply-add, part of ARB_gpu_shader5. operation("fma", 3, source_types=real_types, c_expression="{src0} * {src1} + {src2}"), - operation("lrp", 3), + operation("lrp", 3, source_types=real_types, c_expression={'f': "{src0} * (1.0f - {src2}) + ({src1} * {src2})", 'd': "{src0} * (1.0 - {src2}) + ({src1} * {src2})"}), # Conditional Select # @@ -599,7 +677,9 @@ ir_expression_operation = [ # component on vectors). # # See also lower_instructions_visitor::ldexp_to_arith - operation("csel", 3), + operation("csel", 3, + all_signatures=zip(all_types, zip(len(all_types) * (bool_type,), all_types, all_types)), + c_expression="{src0} ? {src1} : {src2}"), operation("bitfield_extract", 3, all_signatures=((int_type, (uint_type, int_type, int_type)), @@ -612,11 +692,14 @@ ir_expression_operation = [ # operand0 is the vector # operand1 is the value to write into the vector result # operand2 is the index in operand0 to be modified - operation("vector_insert", 3), + operation("vector_insert", 3, source_types=all_types, c_expression="anything-except-None"), - operation("bitfield_insert", 4), + operation("bitfield_insert", 4, + all_signatures=((uint_type, (uint_type, uint_type, int_type, int_type)), + (int_type, (int_type, int_type, int_type, int_type))), + c_expression="bitfield_insert({src0}, {src1}, {src2}, {src3})"), - operation("vector", 4), + operation("vector", 4, source_types=all_types, c_expression="anything-except-None"), ] @@ -662,6 +745,12 @@ const char *const ir_expression_operation_strings[] = { % for item in values: "${item.printable_name}", % endfor +}; + +const char *const ir_expression_operation_enum_strings[] = { +% for item in values: + "${item.name}", +% endfor };""") constant_template = mako.template.Template("""\