diff options
author | Kenneth Graunke <[email protected]> | 2019-04-01 16:01:50 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-07-25 18:42:55 +0000 |
commit | 27b5817b6c234d266425956287351dc424abe9ea (patch) | |
tree | d72244d21c72dc4bd43ed558a032364e133e5ced /src/intel/common/gen_mi_builder.h | |
parent | 4e16b838ba890837471f63ae9622043848afb4f2 (diff) |
intel/mi: Add gen_mi_nz() and gen_mi_z() helpers.
These provide comparisons against zero.
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/intel/common/gen_mi_builder.h')
-rw-r--r-- | src/intel/common/gen_mi_builder.h | 20 |
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) |