2 * Copyright (C) 2010 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 /* Update ir_expression::get_num_operands() and operator_strs when
27 enum ir_expression_operation
{
36 ir_unop_exp
, /**< Log base e on gentype */
37 ir_unop_log
, /**< Natural log on gentype */
40 ir_unop_f2i
, /**< Float-to-integer conversion. */
41 ir_unop_f2u
, /**< Float-to-unsigned conversion. */
42 ir_unop_i2f
, /**< Integer-to-float conversion. */
43 ir_unop_f2b
, /**< Float-to-boolean conversion */
44 ir_unop_b2f
, /**< Boolean-to-float conversion */
45 ir_unop_i2b
, /**< int-to-boolean conversion */
46 ir_unop_b2i
, /**< Boolean-to-int conversion */
47 ir_unop_u2f
, /**< Unsigned-to-float conversion. */
48 ir_unop_i2u
, /**< Integer-to-unsigned conversion. */
49 ir_unop_u2i
, /**< Unsigned-to-integer conversion. */
50 ir_unop_d2f
, /**< Double-to-float conversion. */
51 ir_unop_f2d
, /**< Float-to-double conversion. */
52 ir_unop_d2i
, /**< Double-to-integer conversion. */
53 ir_unop_i2d
, /**< Integer-to-double conversion. */
54 ir_unop_d2u
, /**< Double-to-unsigned conversion. */
55 ir_unop_u2d
, /**< Unsigned-to-double conversion. */
56 ir_unop_d2b
, /**< Double-to-boolean conversion. */
57 ir_unop_bitcast_i2f
, /**< Bit-identical int-to-float "conversion" */
58 ir_unop_bitcast_f2i
, /**< Bit-identical float-to-int "conversion" */
59 ir_unop_bitcast_u2f
, /**< Bit-identical uint-to-float "conversion" */
60 ir_unop_bitcast_f2u
, /**< Bit-identical float-to-uint "conversion" */
63 * \name Unary floating-point rounding operations.
74 * \name Trigonometric operations.
82 * \name Partial derivatives.
94 * \name Floating point pack and unpack operations.
97 ir_unop_pack_snorm_2x16
,
98 ir_unop_pack_snorm_4x8
,
99 ir_unop_pack_unorm_2x16
,
100 ir_unop_pack_unorm_4x8
,
101 ir_unop_pack_half_2x16
,
102 ir_unop_unpack_snorm_2x16
,
103 ir_unop_unpack_snorm_4x8
,
104 ir_unop_unpack_unorm_2x16
,
105 ir_unop_unpack_unorm_4x8
,
106 ir_unop_unpack_half_2x16
,
110 * \name Bit operations, part of ARB_gpu_shader5.
113 ir_unop_bitfield_reverse
,
122 * \name Double packing, part of ARB_gpu_shader_fp64.
125 ir_unop_pack_double_2x32
,
126 ir_unop_unpack_double_2x32
,
134 ir_unop_subroutine_to_int
,
136 * Interpolate fs input at centroid
138 * operand0 is the fs input.
140 ir_unop_interpolate_at_centroid
,
143 * Ask the driver for the total size of a buffer block.
145 * operand0 is the ir_constant buffer block index in the linked shader.
147 ir_unop_get_buffer_size
,
150 * Calculate length of an unsized array inside a buffer block.
151 * This opcode is going to be replaced in a lowering pass inside
154 * operand0 is the unsized array's ir_value for the calculation
157 ir_unop_ssbo_unsized_array_length
,
160 * Vote among threads on the value of the boolean argument.
167 * A sentinel marking the last of the unary operations.
169 ir_last_unop
= ir_unop_vote_eq
,
173 ir_binop_mul
, /**< Floating-point or low 32-bit integer multiply. */
174 ir_binop_imul_high
, /**< Calculates the high 32-bits of a 64-bit multiply. */
178 * Returns the carry resulting from the addition of the two arguments.
185 * Returns the borrow resulting from the subtraction of the second argument
186 * from the first argument.
193 * Takes one of two combinations of arguments:
198 * Does not take integer types.
203 * \name Binary comparison operators which return a boolean vector.
204 * The type of both operands must be equal.
214 * Returns single boolean for whether all components of operands[0]
215 * equal the components of operands[1].
219 * Returns single boolean for whether any component of operands[0]
220 * is not equal to the corresponding component of operands[1].
226 * \name Bit-wise binary operations.
247 * Load a value the size of a given GLSL type from a uniform block.
249 * operand0 is the ir_constant uniform block index in the linked shader.
250 * operand1 is a byte offset within the uniform block.
255 * \name Multiplies a number by two to a power, part of ARB_gpu_shader5.
262 * Extract a scalar from a vector
264 * operand0 is the vector
265 * operand1 is the index of the field to read from operand0
267 ir_binop_vector_extract
,
270 * Interpolate fs input at offset
272 * operand0 is the fs input
273 * operand1 is the offset from the pixel center
275 ir_binop_interpolate_at_offset
,
278 * Interpolate fs input at sample position
280 * operand0 is the fs input
281 * operand1 is the sample ID
283 ir_binop_interpolate_at_sample
,
286 * A sentinel marking the last of the binary operations.
288 ir_last_binop
= ir_binop_interpolate_at_sample
,
291 * \name Fused floating-point multiply-add, part of ARB_gpu_shader5.
300 * \name Conditional Select
302 * A vector conditional select instruction (like ?:, but operating per-
303 * component on vectors).
305 * \see lower_instructions_visitor::ldexp_to_arith
311 ir_triop_bitfield_extract
,
314 * Generate a value with one field of a vector changed
316 * operand0 is the vector
317 * operand1 is the value to write into the vector result
318 * operand2 is the index in operand0 to be modified
320 ir_triop_vector_insert
,
323 * A sentinel marking the last of the ternary operations.
325 ir_last_triop
= ir_triop_vector_insert
,
327 ir_quadop_bitfield_insert
,
332 * A sentinel marking the last of the ternary operations.
334 ir_last_quadop
= ir_quadop_vector
,
337 * A sentinel marking the last of all operations.
339 ir_last_opcode
= ir_quadop_vector