|
|
|
@@ -32,9 +32,10 @@
|
|
|
|
|
#include "util/u_math.h"
|
|
|
|
|
#include "nir.h"
|
|
|
|
|
#include "nir_range_analysis.h"
|
|
|
|
|
#include "nir_search.h"
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_pos_power_of_two(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_pos_power_of_two(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -66,7 +67,7 @@ is_pos_power_of_two(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_neg_power_of_two(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_neg_power_of_two(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -95,7 +96,7 @@ is_neg_power_of_two(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_bitcount2(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_bitcount2(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -113,7 +114,7 @@ is_bitcount2(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_nan(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_nan(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components, const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
/* only constant srcs: */
|
|
|
|
@@ -129,7 +130,7 @@ is_nan(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_negative_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_negative_zero(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components, const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
/* only constant srcs: */
|
|
|
|
@@ -147,7 +148,7 @@ is_negative_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_any_comp_nan(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_any_comp_nan(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components, const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
/* only constant srcs: */
|
|
|
|
@@ -164,7 +165,7 @@ is_any_comp_nan(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
|
|
|
|
|
#define MULTIPLE(test) \
|
|
|
|
|
static inline bool \
|
|
|
|
|
is_unsigned_multiple_of_##test(UNUSED struct hash_table *ht, \
|
|
|
|
|
is_unsigned_multiple_of_##test(UNUSED const nir_search_state *state, \
|
|
|
|
|
const nir_alu_instr *instr, \
|
|
|
|
|
unsigned src, unsigned num_components, \
|
|
|
|
|
const uint8_t *swizzle) \
|
|
|
|
@@ -190,7 +191,7 @@ MULTIPLE(32)
|
|
|
|
|
MULTIPLE(64)
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_zero_to_one(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_zero_to_one(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -222,7 +223,7 @@ is_zero_to_one(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
* 1 while this function tests 0 < src < 1.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_gt_0_and_lt_1(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_gt_0_and_lt_1(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -251,7 +252,7 @@ is_gt_0_and_lt_1(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
* x & 1 != 0
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_odd(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_odd(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -277,7 +278,7 @@ is_odd(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_not_const_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_not_const_zero(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -327,7 +328,7 @@ is_ult(const nir_alu_instr *instr, unsigned src, unsigned num_components, const
|
|
|
|
|
|
|
|
|
|
/** Is value unsigned less than 32? */
|
|
|
|
|
static inline bool
|
|
|
|
|
is_ult_32(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_ult_32(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -336,7 +337,7 @@ is_ult_32(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
|
|
|
|
|
/** Is value unsigned less than 0xfffc07fc? */
|
|
|
|
|
static inline bool
|
|
|
|
|
is_ult_0xfffc07fc(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_ult_0xfffc07fc(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -345,7 +346,7 @@ is_ult_0xfffc07fc(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
|
|
|
|
|
/** Is the first 5 bits of value unsigned greater than or equal 2? */
|
|
|
|
|
static inline bool
|
|
|
|
|
is_first_5_bits_uge_2(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_first_5_bits_uge_2(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -408,7 +409,7 @@ is_16_bits_with_scale(const nir_alu_instr *instr,
|
|
|
|
|
|
|
|
|
|
/** Is this a constant that could be either int16_t or uint16_t? */
|
|
|
|
|
static inline bool
|
|
|
|
|
is_16_bits(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_16_bits(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -417,7 +418,7 @@ is_16_bits(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
|
|
|
|
|
/** Like is_16_bits, but could 2 times the constant fit in 16 bits? */
|
|
|
|
|
static inline bool
|
|
|
|
|
is_2x_16_bits(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_2x_16_bits(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -426,7 +427,7 @@ is_2x_16_bits(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
|
|
|
|
|
/** Like is_16_bits, but could -2 times the constant fit in 16 bits? */
|
|
|
|
|
static inline bool
|
|
|
|
|
is_neg2x_16_bits(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_neg2x_16_bits(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -434,7 +435,7 @@ is_neg2x_16_bits(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_not_const(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_not_const(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, UNUSED unsigned num_components,
|
|
|
|
|
UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -442,7 +443,7 @@ is_not_const(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_not_fmul(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
is_not_fmul(const nir_search_state *state, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
UNUSED unsigned num_components, UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
nir_alu_instr *src_alu =
|
|
|
|
@@ -452,13 +453,13 @@ is_not_fmul(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (src_alu->op == nir_op_fneg)
|
|
|
|
|
return is_not_fmul(ht, src_alu, 0, 0, NULL);
|
|
|
|
|
return is_not_fmul(state, src_alu, 0, 0, NULL);
|
|
|
|
|
|
|
|
|
|
return src_alu->op != nir_op_fmul && src_alu->op != nir_op_fmulz;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_fmul(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
is_fmul(const nir_search_state *state, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
UNUSED unsigned num_components, UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
nir_alu_instr *src_alu =
|
|
|
|
@@ -468,7 +469,7 @@ is_fmul(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (src_alu->op == nir_op_fneg)
|
|
|
|
|
return is_fmul(ht, src_alu, 0, 0, NULL);
|
|
|
|
|
return is_fmul(state, src_alu, 0, 0, NULL);
|
|
|
|
|
|
|
|
|
|
return src_alu->op == nir_op_fmul || src_alu->op == nir_op_fmulz;
|
|
|
|
|
}
|
|
|
|
@@ -490,16 +491,16 @@ is_fsign(const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_not_const_and_not_fsign(struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_not_const_and_not_fsign(const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
return is_not_const(ht, instr, src, num_components, swizzle) &&
|
|
|
|
|
return is_not_const(state, instr, src, num_components, swizzle) &&
|
|
|
|
|
!is_fsign(instr, src, num_components, swizzle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
has_multiple_uses(struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
has_multiple_uses(const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -713,7 +714,7 @@ only_lower_16_bits_used(const nir_alu_instr *instr)
|
|
|
|
|
* of all its components is zero.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_upper_half_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_upper_half_zero(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -739,7 +740,7 @@ is_upper_half_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
* of all its components is zero.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_lower_half_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_lower_half_zero(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -756,7 +757,7 @@ is_lower_half_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_upper_half_negative_one(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_upper_half_negative_one(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -777,7 +778,7 @@ is_upper_half_negative_one(UNUSED struct hash_table *ht, const nir_alu_instr *in
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_lower_half_negative_one(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_lower_half_negative_one(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -800,7 +801,7 @@ is_lower_half_negative_one(UNUSED struct hash_table *ht, const nir_alu_instr *in
|
|
|
|
|
* for the optimizations where this function is used.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_const_bitmask(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_const_bitmask(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -823,7 +824,7 @@ is_const_bitmask(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
* that can be created by nir_op_bfm.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_const_bfm(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_const_bfm(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -846,7 +847,7 @@ is_const_bfm(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
* Returns whether the 5 LSBs of an operand are non-zero.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_5lsb_not_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_5lsb_not_zero(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -866,7 +867,7 @@ is_5lsb_not_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
* Returns whether at least one bit is 0.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_not_uint_max(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_not_uint_max(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, unsigned num_components,
|
|
|
|
|
const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
@@ -901,10 +902,10 @@ xz_components_unused(const nir_alu_instr *instr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_integral(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
is_integral(const nir_search_state *state, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
UNUSED unsigned num_components, UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range r = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range r = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
|
|
|
|
|
return r.is_integral;
|
|
|
|
|
}
|
|
|
|
@@ -913,21 +914,21 @@ is_integral(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
* Is the value finite?
|
|
|
|
|
*/
|
|
|
|
|
static inline bool
|
|
|
|
|
is_finite(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_finite(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, UNUSED unsigned num_components,
|
|
|
|
|
UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
|
|
|
|
|
return v.is_finite;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_finite_not_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_finite_not_zero(UNUSED const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, UNUSED unsigned num_components,
|
|
|
|
|
UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
|
|
|
|
|
return v.is_finite &&
|
|
|
|
|
(v.range == lt_zero || v.range == gt_zero || v.range == ne_zero);
|
|
|
|
@@ -935,20 +936,20 @@ is_finite_not_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
|
|
|
|
|
#define RELATION(r) \
|
|
|
|
|
static inline bool \
|
|
|
|
|
is_##r(struct hash_table *ht, const nir_alu_instr *instr, \
|
|
|
|
|
is_##r(const nir_search_state *state, const nir_alu_instr *instr, \
|
|
|
|
|
unsigned src, UNUSED unsigned num_components, \
|
|
|
|
|
UNUSED const uint8_t *swizzle) \
|
|
|
|
|
{ \
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src); \
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src); \
|
|
|
|
|
return v.range == r; \
|
|
|
|
|
} \
|
|
|
|
|
\
|
|
|
|
|
static inline bool \
|
|
|
|
|
is_a_number_##r(struct hash_table *ht, const nir_alu_instr *instr, \
|
|
|
|
|
is_a_number_##r(const nir_search_state *state, const nir_alu_instr *instr, \
|
|
|
|
|
unsigned src, UNUSED unsigned num_components, \
|
|
|
|
|
UNUSED const uint8_t *swizzle) \
|
|
|
|
|
{ \
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src); \
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src); \
|
|
|
|
|
return v.is_a_number && v.range == r; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -959,64 +960,64 @@ RELATION(ge_zero)
|
|
|
|
|
RELATION(ne_zero)
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_not_negative(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
is_not_negative(const nir_search_state *state, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
UNUSED unsigned num_components, UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
return v.range == ge_zero || v.range == gt_zero || v.range == eq_zero;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_a_number_not_negative(struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_a_number_not_negative(const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, UNUSED unsigned num_components,
|
|
|
|
|
UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
return v.is_a_number &&
|
|
|
|
|
(v.range == ge_zero || v.range == gt_zero || v.range == eq_zero);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_not_positive(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
is_not_positive(const nir_search_state *state, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
UNUSED unsigned num_components, UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
return v.range == le_zero || v.range == lt_zero || v.range == eq_zero;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_a_number_not_positive(struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_a_number_not_positive(const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, UNUSED unsigned num_components,
|
|
|
|
|
UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
return v.is_a_number &&
|
|
|
|
|
(v.range == le_zero || v.range == lt_zero || v.range == eq_zero);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_not_zero(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
is_not_zero(const nir_search_state *state, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
UNUSED unsigned num_components, UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
return v.range == lt_zero || v.range == gt_zero || v.range == ne_zero;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_a_number_not_zero(struct hash_table *ht, const nir_alu_instr *instr,
|
|
|
|
|
is_a_number_not_zero(const nir_search_state *state, const nir_alu_instr *instr,
|
|
|
|
|
unsigned src, UNUSED unsigned num_components,
|
|
|
|
|
UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
return v.is_a_number &&
|
|
|
|
|
(v.range == lt_zero || v.range == gt_zero || v.range == ne_zero);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_a_number(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
is_a_number(const nir_search_state *state, const nir_alu_instr *instr, unsigned src,
|
|
|
|
|
UNUSED unsigned num_components, UNUSED const uint8_t *swizzle)
|
|
|
|
|
{
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
|
|
|
|
const struct ssa_result_range v = nir_analyze_range(state->range_ht, instr, src);
|
|
|
|
|
return v.is_a_number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|