gallivm: Use llvm.roundeven in lp_build_round()
`lp_build_round` intends to implement round with ties-to-even behavior,
as can be seen by its test's use of `nearbyint` to generate reference
values and by it use in implementing `nir_op_fround_even`.
Fixes: 0d3b285360 ("gallivm: use llvm intrinsics for 16-bit round/trunc/roundeven")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34937>
This commit is contained in:
@@ -2120,7 +2120,7 @@ lp_build_round(struct lp_build_context *bld,
|
||||
|
||||
if (type.width == 16) {
|
||||
char intrinsic[64];
|
||||
lp_format_intrinsic(intrinsic, 64, "llvm.round", bld->vec_type);
|
||||
lp_format_intrinsic(intrinsic, 64, "llvm.roundeven", bld->vec_type);
|
||||
return lp_build_intrinsic_unary(builder, intrinsic, bld->vec_type, a);
|
||||
}
|
||||
|
||||
|
||||
@@ -3356,13 +3356,7 @@ do_alu_action(struct lp_build_nir_soa_context *bld,
|
||||
result = lp_build_rcp(float_bld, src[0]);
|
||||
break;
|
||||
case nir_op_fround_even:
|
||||
if (src_bit_size[0] == 16) {
|
||||
char intrinsic[64];
|
||||
lp_format_intrinsic(intrinsic, 64, "llvm.roundeven", float_bld->vec_type);
|
||||
result = lp_build_intrinsic_unary(builder, intrinsic, float_bld->vec_type, src[0]);
|
||||
} else {
|
||||
result = lp_build_round(float_bld, src[0]);
|
||||
}
|
||||
result = lp_build_round(float_bld, src[0]);
|
||||
break;
|
||||
case nir_op_frsq:
|
||||
result = lp_build_rsqrt(float_bld, src[0]);
|
||||
|
||||
Reference in New Issue
Block a user