summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/intel/common/gen_mi_builder.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/intel/common/gen_mi_builder.h b/src/intel/common/gen_mi_builder.h
index 90ac795f48d..61d44eda5ae 100644
--- a/src/intel/common/gen_mi_builder.h
+++ b/src/intel/common/gen_mi_builder.h
@@ -644,6 +644,26 @@ gen_mi_iand(struct gen_mi_builder *b,
MI_ALU_STORE, MI_ALU_ACCU);
}
+/**
+ * Returns (src != 0) ? 1 : 0.
+ */
+static inline struct gen_mi_value
+gen_mi_nz(struct gen_mi_builder *b, struct gen_mi_value src)
+{
+ return gen_mi_math_binop(b, MI_ALU_ADD, src, gen_mi_imm(0),
+ MI_ALU_STOREINV, MI_ALU_ZF);
+}
+
+/**
+ * Returns (src == 0) ? 1 : 0.
+ */
+static inline struct gen_mi_value
+gen_mi_z(struct gen_mi_builder *b, struct gen_mi_value src)
+{
+ return gen_mi_math_binop(b, MI_ALU_ADD, src, gen_mi_imm(0),
+ MI_ALU_STORE, MI_ALU_ZF);
+}
+
static inline struct gen_mi_value
gen_mi_ior(struct gen_mi_builder *b,
struct gen_mi_value src0, struct gen_mi_value src1)