nir_type_convert(nir_builder *b,
nir_ssa_def *src,
nir_alu_type src_type,
- nir_alu_type dest_type);
+ nir_alu_type dest_type,
+ nir_rounding_mode rnd);
static inline nir_ssa_def *
nir_convert_to_bit_size(nir_builder *b,
nir_alu_type type,
unsigned bit_size)
{
- return nir_type_convert(b, src, type, (nir_alu_type) (type | bit_size));
+ return nir_type_convert(b, src, type, (nir_alu_type) (type | bit_size),
+ nir_rounding_mode_undef);
}
static inline nir_ssa_def *
static inline nir_ssa_def *
nir_f2b(nir_builder *b, nir_ssa_def *src)
{
- return nir_type_convert(b, src, nir_type_float, nir_type_bool1);
+ return nir_type_convert(b, src, nir_type_float, nir_type_bool1,
+ nir_rounding_mode_undef);
}
static inline nir_ssa_def *
nir_b2iN(nir_builder *b, nir_ssa_def *src, uint32_t bit_size)
{
return nir_type_convert(b, src, nir_type_bool,
- (nir_alu_type) (nir_type_int | bit_size));
+ (nir_alu_type) (nir_type_int | bit_size),
+ nir_rounding_mode_undef);
}
static inline nir_ssa_def *
nir_b2fN(nir_builder *b, nir_ssa_def *src, uint32_t bit_size)
{
return nir_type_convert(b, src, nir_type_bool,
- (nir_alu_type) (nir_type_float | bit_size));
+ (nir_alu_type) (nir_type_float | bit_size),
+ nir_rounding_mode_undef);
}
static inline nir_ssa_def *
nir_i2fN(nir_builder *b, nir_ssa_def *src, unsigned bit_size)
{
return nir_type_convert(b, src, nir_type_int,
- (nir_alu_type) (nir_type_float | bit_size));
+ (nir_alu_type) (nir_type_float | bit_size),
+ nir_rounding_mode_undef);
}
static inline nir_ssa_def *
nir_u2fN(nir_builder *b, nir_ssa_def *src, unsigned bit_size)
{
return nir_type_convert(b, src, nir_type_uint,
- (nir_alu_type) (nir_type_float | bit_size));
+ (nir_alu_type) (nir_type_float | bit_size),
+ nir_rounding_mode_undef);
}
static inline nir_ssa_def *
nir_f2uN(nir_builder *b, nir_ssa_def *src, unsigned bit_size)
{
return nir_type_convert(b, src, nir_type_float,
- (nir_alu_type) (nir_type_uint | bit_size));
+ (nir_alu_type) (nir_type_uint | bit_size),
+ nir_rounding_mode_undef);
}
static inline nir_ssa_def *
nir_f2iN(nir_builder *b, nir_ssa_def *src, unsigned bit_size)
{
return nir_type_convert(b, src, nir_type_float,
- (nir_alu_type) (nir_type_int | bit_size));
+ (nir_alu_type) (nir_type_int | bit_size),
+ nir_rounding_mode_undef);
}
static inline nir_ssa_def *
nir_alu_type int_type = nir_op_infos[op].output_type | sz;
nir_alu_type float_type = nir_type_float | (options->allow_fp16 ? sz * 2 : 32);
- nir_ssa_def *p = nir_type_convert(b, numer, int_type, float_type);
- nir_ssa_def *q = nir_type_convert(b, denom, int_type, float_type);
+ nir_ssa_def *p = nir_type_convert(b, numer, int_type, float_type, nir_rounding_mode_undef);
+ nir_ssa_def *q = nir_type_convert(b, denom, int_type, float_type, nir_rounding_mode_undef);
/* Take 1/q but offset mantissa by 1 to correct for rounding. This is
* needed for correct results and has been checked exhaustively for
nir_ssa_def *res = nir_fmul(b, p, rcp);
/* Convert back to integer space with rounding inferred by type */
- res = nir_type_convert(b, res, float_type, int_type);
+ res = nir_type_convert(b, res, float_type, int_type, nir_rounding_mode_undef);
/* Get remainder given the quotient */
if (op == nir_op_umod || op == nir_op_imod || op == nir_op_irem)