summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-17 10:50:27 -0700
committerJason Ekstrand <[email protected]>2016-03-23 16:26:34 -0700
commit4ff89377d96e0670bd4f5e149a6dc5955b6bb635 (patch)
tree4d10abf2008fabaa41149b26ac95f5fcd870f01b
parentf849f53990c613a28c32826d09005e127adedeac (diff)
nir: Add an "exact" bit to nir_alu_instr
Reviewed-by: Francisco Jerez <[email protected]>
-rw-r--r--src/compiler/nir/nir.h11
-rw-r--r--src/compiler/nir/nir_clone.c1
-rw-r--r--src/compiler/nir/nir_print.c2
3 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 02acbfc9d73..76a511c2d4f 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -718,6 +718,17 @@ extern const nir_op_info nir_op_infos[nir_num_opcodes];
typedef struct nir_alu_instr {
nir_instr instr;
nir_op op;
+
+ /** Indicates that this ALU instruction generates an exact value
+ *
+ * This is kind of a mixture of GLSL "precise" and "invariant" and not
+ * really equivalent to either. This indicates that the value generated by
+ * this operation is high-precision and any code transformations that touch
+ * it must ensure that the resulting value is bit-for-bit identical to the
+ * original.
+ */
+ bool exact;
+
nir_alu_dest dest;
nir_alu_src src[];
} nir_alu_instr;
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index a721552f6a6..7d2e3835258 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -312,6 +312,7 @@ static nir_alu_instr *
clone_alu(clone_state *state, const nir_alu_instr *alu)
{
nir_alu_instr *nalu = nir_alu_instr_create(state->ns, alu->op);
+ nalu->exact = alu->exact;
__clone_dst(state, &nalu->instr, &nalu->dest.dest, &alu->dest.dest);
nalu->dest.saturate = alu->dest.saturate;
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index d3d5b84a024..c295c192c2a 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -207,6 +207,8 @@ print_alu_instr(nir_alu_instr *instr, print_state *state)
print_alu_dest(&instr->dest, state);
fprintf(fp, " = %s", nir_op_infos[instr->op].name);
+ if (instr->exact)
+ fprintf(fp, "!");
if (instr->dest.saturate)
fprintf(fp, ".sat");
fprintf(fp, " ");