[Mesa-dev] [PATCH 13/13] nir/lower_double_ops: optimize set_exponent()
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Tue Apr 12 08:05:22 UTC 2016
From: Iago Toral Quiroga <itoral at igalia.com>
By using pack_double_2x32_split_y instead of pack_double_2x32 we
reduce register pressure since we no longer need to unpack the
low 32-bits of the double.
---
src/compiler/nir/nir_lower_double_ops.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/compiler/nir/nir_lower_double_ops.c b/src/compiler/nir/nir_lower_double_ops.c
index 3d98075..f5cd938 100644
--- a/src/compiler/nir/nir_lower_double_ops.c
+++ b/src/compiler/nir/nir_lower_double_ops.c
@@ -40,8 +40,7 @@
static nir_ssa_def *
set_exponent(nir_builder *b, nir_ssa_def *src, nir_ssa_def *exp)
{
- /* Split into bits 0-31 and 32-63 */
- nir_ssa_def *lo = nir_unpack_double_2x32_split_x(b, src);
+ /* The exponent is encoded in the high 32-bits */
nir_ssa_def *hi = nir_unpack_double_2x32_split_y(b, src);
/* The exponent is bits 52-62, or 20-30 of the high word, so set those bits
@@ -49,8 +48,8 @@ set_exponent(nir_builder *b, nir_ssa_def *src, nir_ssa_def *exp)
*/
nir_ssa_def *new_hi = nir_bfi(b, nir_imm_uint(b, 0x7ff00000),
exp, hi);
- /* recombine */
- return nir_pack_double_2x32_split(b, lo, new_hi);
+ /* recombine the high 32-bits of the double with the new exponent */
+ return nir_pack_double_2x32_split_y(b, src, new_hi);
}
static nir_ssa_def *
--
2.5.0
More information about the mesa-dev
mailing list