Mesa (master): nir/opcodes: Make ldexp take an explicitly 32-bit int

Jason Ekstrand jekstrand at kemper.freedesktop.org
Fri Apr 29 04:37:33 UTC 2016


Module: Mesa
Branch: master
Commit: f0af5b87ec140875dbc99d579b9b17ab935e27be
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0af5b87ec140875dbc99d579b9b17ab935e27be

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Apr 27 11:12:44 2016 -0700

nir/opcodes: Make ldexp take an explicitly 32-bit int

There is no sense in having the double version of ldexp take a 64-bit
integer.  Instead, let's just take a 32-bit int all the time.  This also
matches what GLSL does where both variants of ldexp take a regular integer
for the exponent argument.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

---

 src/compiler/nir/nir_opcodes.py       | 2 +-
 src/compiler/nir/nir_opt_algebraic.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 6f024bf..54ea720 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -571,7 +571,7 @@ else
    dst = ((1u << bits) - 1) << offset;
 """)
 
-opcode("ldexp", 0, tfloat, [0, 0], [tfloat, tint], "", """
+opcode("ldexp", 0, tfloat, [0, 0], [tfloat, tint32], "", """
 dst = (bit_size == 64) ? ldexp(src0, src1) : ldexpf(src0, src1);
 /* flush denormals to zero. */
 if (!isnormal(dst))
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 60ee170..b5d90b2 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -410,7 +410,7 @@ def ldexp32(f, exp):
    pow2_2 = fexp2i(('isub', exp, ('ishr', exp, 1)))
    return ('fmul', ('fmul', f, pow2_1), pow2_2)
 
-optimizations += [(('ldexp', 'x', 'exp'), ldexp32('x', 'exp'))]
+optimizations += [(('ldexp at 32', 'x', 'exp'), ldexp32('x', 'exp'))]
 
 # Unreal Engine 4 demo applications open-codes bitfieldReverse()
 def bitfield_reverse(u):




More information about the mesa-commit mailing list