summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_alu.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-10-18 11:44:38 -0500
committerJason Ekstrand <[email protected]>2018-12-16 21:03:02 +0000
commit80e8dfe9dead5a034f8e5ae3f92cc60e99de88b6 (patch)
treec2264945096149705cdf621145ce9d4fd4240903 /src/compiler/spirv/vtn_alu.c
parentb569093566f9138dc8890fe1ef9615d11177d140 (diff)
nir: Rename Boolean-related opcodes to include 32 in the name
This is a squash of a bunch of individual changes: nir/builder: Generate 32-bit bool opcodes transparently nir/algebraic: Remap Boolean opcodes to the 32-bit variant Use 32-bit opcodes in the NIR producers and optimizations Generated with a little hand-editing and the following sed commands: sed -i 's/nir_op_ball_fequal/nir_op_b32all_fequal/g' **/*.c sed -i 's/nir_op_bany_fnequal/nir_op_b32any_fnequal/g' **/*.c sed -i 's/nir_op_ball_iequal/nir_op_b32all_iequal/g' **/*.c sed -i 's/nir_op_bany_inequal/nir_op_b32any_inequal/g' **/*.c sed -i 's/nir_op_\([fiu]lt\)/nir_op_\132/g' **/*.c sed -i 's/nir_op_\([fiu]ge\)/nir_op_\132/g' **/*.c sed -i 's/nir_op_\([fiu]ne\)/nir_op_\132/g' **/*.c sed -i 's/nir_op_\([fiu]eq\)/nir_op_\132/g' **/*.c sed -i 's/nir_op_\([fi]\)ne32g/nir_op_\1neg/g' **/*.c sed -i 's/nir_op_bcsel/nir_op_b32csel/g' **/*.c Use 32-bit opcodes in the NIR back-ends Generated with a little hand-editing and the following sed commands: sed -i 's/nir_op_ball_fequal/nir_op_b32all_fequal/g' **/*.c sed -i 's/nir_op_bany_fnequal/nir_op_b32any_fnequal/g' **/*.c sed -i 's/nir_op_ball_iequal/nir_op_b32all_iequal/g' **/*.c sed -i 's/nir_op_bany_inequal/nir_op_b32any_inequal/g' **/*.c sed -i 's/nir_op_\([fiu]lt\)/nir_op_\132/g' **/*.c sed -i 's/nir_op_\([fiu]ge\)/nir_op_\132/g' **/*.c sed -i 's/nir_op_\([fiu]ne\)/nir_op_\132/g' **/*.c sed -i 's/nir_op_\([fiu]eq\)/nir_op_\132/g' **/*.c sed -i 's/nir_op_\([fi]\)ne32g/nir_op_\1neg/g' **/*.c sed -i 's/nir_op_bcsel/nir_op_b32csel/g' **/*.c Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Tested-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_alu.c')
-rw-r--r--src/compiler/spirv/vtn_alu.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c
index dc6fedc9129..b04ada92199 100644
--- a/src/compiler/spirv/vtn_alu.c
+++ b/src/compiler/spirv/vtn_alu.c
@@ -244,15 +244,15 @@ vtn_nir_alu_op_for_spirv_opcode(struct vtn_builder *b,
case SpvOpShiftRightArithmetic: return nir_op_ishr;
case SpvOpShiftLeftLogical: return nir_op_ishl;
case SpvOpLogicalOr: return nir_op_ior;
- case SpvOpLogicalEqual: return nir_op_ieq;
- case SpvOpLogicalNotEqual: return nir_op_ine;
+ case SpvOpLogicalEqual: return nir_op_ieq32;
+ case SpvOpLogicalNotEqual: return nir_op_ine32;
case SpvOpLogicalAnd: return nir_op_iand;
case SpvOpLogicalNot: return nir_op_inot;
case SpvOpBitwiseOr: return nir_op_ior;
case SpvOpBitwiseXor: return nir_op_ixor;
case SpvOpBitwiseAnd: return nir_op_iand;
- case SpvOpSelect: return nir_op_bcsel;
- case SpvOpIEqual: return nir_op_ieq;
+ case SpvOpSelect: return nir_op_b32csel;
+ case SpvOpIEqual: return nir_op_ieq32;
case SpvOpBitFieldInsert: return nir_op_bitfield_insert;
case SpvOpBitFieldSExtract: return nir_op_ibitfield_extract;
@@ -264,27 +264,27 @@ vtn_nir_alu_op_for_spirv_opcode(struct vtn_builder *b,
* the logical operator to use since they also need to check if operands are
* ordered.
*/
- case SpvOpFOrdEqual: return nir_op_feq;
- case SpvOpFUnordEqual: return nir_op_feq;
- case SpvOpINotEqual: return nir_op_ine;
- case SpvOpFOrdNotEqual: return nir_op_fne;
- case SpvOpFUnordNotEqual: return nir_op_fne;
- case SpvOpULessThan: return nir_op_ult;
- case SpvOpSLessThan: return nir_op_ilt;
- case SpvOpFOrdLessThan: return nir_op_flt;
- case SpvOpFUnordLessThan: return nir_op_flt;
- case SpvOpUGreaterThan: *swap = true; return nir_op_ult;
- case SpvOpSGreaterThan: *swap = true; return nir_op_ilt;
- case SpvOpFOrdGreaterThan: *swap = true; return nir_op_flt;
- case SpvOpFUnordGreaterThan: *swap = true; return nir_op_flt;
- case SpvOpULessThanEqual: *swap = true; return nir_op_uge;
- case SpvOpSLessThanEqual: *swap = true; return nir_op_ige;
- case SpvOpFOrdLessThanEqual: *swap = true; return nir_op_fge;
- case SpvOpFUnordLessThanEqual: *swap = true; return nir_op_fge;
- case SpvOpUGreaterThanEqual: return nir_op_uge;
- case SpvOpSGreaterThanEqual: return nir_op_ige;
- case SpvOpFOrdGreaterThanEqual: return nir_op_fge;
- case SpvOpFUnordGreaterThanEqual: return nir_op_fge;
+ case SpvOpFOrdEqual: return nir_op_feq32;
+ case SpvOpFUnordEqual: return nir_op_feq32;
+ case SpvOpINotEqual: return nir_op_ine32;
+ case SpvOpFOrdNotEqual: return nir_op_fne32;
+ case SpvOpFUnordNotEqual: return nir_op_fne32;
+ case SpvOpULessThan: return nir_op_ult32;
+ case SpvOpSLessThan: return nir_op_ilt32;
+ case SpvOpFOrdLessThan: return nir_op_flt32;
+ case SpvOpFUnordLessThan: return nir_op_flt32;
+ case SpvOpUGreaterThan: *swap = true; return nir_op_ult32;
+ case SpvOpSGreaterThan: *swap = true; return nir_op_ilt32;
+ case SpvOpFOrdGreaterThan: *swap = true; return nir_op_flt32;
+ case SpvOpFUnordGreaterThan: *swap = true; return nir_op_flt32;
+ case SpvOpULessThanEqual: *swap = true; return nir_op_uge32;
+ case SpvOpSLessThanEqual: *swap = true; return nir_op_ige32;
+ case SpvOpFOrdLessThanEqual: *swap = true; return nir_op_fge32;
+ case SpvOpFUnordLessThanEqual: *swap = true; return nir_op_fge32;
+ case SpvOpUGreaterThanEqual: return nir_op_uge32;
+ case SpvOpSGreaterThanEqual: return nir_op_ige32;
+ case SpvOpFOrdGreaterThanEqual: return nir_op_fge32;
+ case SpvOpFUnordGreaterThanEqual: return nir_op_fge32;
/* Conversions: */
case SpvOpQuantizeToF16: return nir_op_fquantize2f16;
@@ -413,9 +413,9 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
} else {
nir_op op;
switch (src[0]->num_components) {
- case 2: op = nir_op_bany_inequal2; break;
- case 3: op = nir_op_bany_inequal3; break;
- case 4: op = nir_op_bany_inequal4; break;
+ case 2: op = nir_op_b32any_inequal2; break;
+ case 3: op = nir_op_b32any_inequal3; break;
+ case 4: op = nir_op_b32any_inequal4; break;
default: vtn_fail("invalid number of components");
}
val->ssa->def = nir_build_alu(&b->nb, op, src[0],
@@ -430,9 +430,9 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
} else {
nir_op op;
switch (src[0]->num_components) {
- case 2: op = nir_op_ball_iequal2; break;
- case 3: op = nir_op_ball_iequal3; break;
- case 4: op = nir_op_ball_iequal4; break;
+ case 2: op = nir_op_b32all_iequal2; break;
+ case 3: op = nir_op_b32all_iequal3; break;
+ case 4: op = nir_op_b32all_iequal4; break;
default: vtn_fail("invalid number of components");
}
val->ssa->def = nir_build_alu(&b->nb, op, src[0],