diff options
author | Jason Ekstrand <[email protected]> | 2015-09-22 16:54:27 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-09-22 20:37:35 -0700 |
commit | e5a9346d0046b0a78620687e75239b30e3876662 (patch) | |
tree | 63f5b6747640d099e27ed476d3b4ba5b57b8afbf /src | |
parent | 0f9bf647705db48a88c700bfa7ca3d4a9f6b4f56 (diff) |
nir: Add fdph and fdph_replicated opcodes
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/nir/nir_lower_vec_to_movs.c | 3 | ||||
-rw-r--r-- | src/glsl/nir/nir_opcodes.py | 5 | ||||
-rw-r--r-- | src/glsl/nir/nir_opt_algebraic.py | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c b/src/glsl/nir/nir_lower_vec_to_movs.c index b7ee4e8d33c..622e59c688e 100644 --- a/src/glsl/nir/nir_lower_vec_to_movs.c +++ b/src/glsl/nir/nir_lower_vec_to_movs.c @@ -89,7 +89,8 @@ has_replicated_dest(nir_alu_instr *alu) { return alu->op == nir_op_fdot_replicated2 || alu->op == nir_op_fdot_replicated3 || - alu->op == nir_op_fdot_replicated4; + alu->op == nir_op_fdot_replicated4 || + alu->op == nir_op_fdph_replicated; } /* Attempts to coalesce the "move" from the given source of the vec to the diff --git a/src/glsl/nir/nir_opcodes.py b/src/glsl/nir/nir_opcodes.py index 495d109375b..f2d584fe484 100644 --- a/src/glsl/nir/nir_opcodes.py +++ b/src/glsl/nir/nir_opcodes.py @@ -456,6 +456,11 @@ binop_reduce("fdot", 1, tfloat, tfloat, "{src0} * {src1}", "{src0} + {src1}", binop_reduce("fdot_replicated", 4, tfloat, tfloat, "{src0} * {src1}", "{src0} + {src1}", "{src}") +opcode("fdph", 1, tfloat, [3, 4], [tfloat, tfloat], "", + "src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w") +opcode("fdph_replicated", 4, tfloat, [3, 4], [tfloat, tfloat], "", + "src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w") + binop("fmin", tfloat, "", "fminf(src0, src1)") binop("imin", tint, commutative + associative, "src1 > src0 ? src0 : src1") binop("umin", tunsigned, commutative + associative, "src1 > src0 ? src0 : src1") diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 43558a547b4..585e5e0ae98 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -244,6 +244,7 @@ late_optimizations = [ (('fdot2', a, b), ('fdot_replicated2', a, b), 'options->fdot_replicates'), (('fdot3', a, b), ('fdot_replicated3', a, b), 'options->fdot_replicates'), (('fdot4', a, b), ('fdot_replicated4', a, b), 'options->fdot_replicates'), + (('fdph', a, b), ('fdph_replicated', a, b), 'options->fdot_replicates'), ] print nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render() |