diff options
author | Iago Toral Quiroga <[email protected]> | 2016-05-20 09:38:20 +0200 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2016-05-23 08:54:37 +0200 |
commit | 38b719d6244e831effe93a5d10e932aad2100984 (patch) | |
tree | c002a413787ceb3c6f6eb9f48efe4b240948dd39 /src/compiler/nir/nir_opcodes.py | |
parent | 3f73039adec1fb0f35a98c05f5622e74baf93a12 (diff) |
nir: handle double-precision in fsign, fsat, fnot and frcp
I think these are not strictly necessary since the floats in them
should be automatically promoted to doubles when operated with
double sources, but it makes things more explicit at least.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opcodes.py')
-rw-r--r-- | src/compiler/nir/nir_opcodes.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index 8ecf7b96a1b..15066c2b580 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -149,13 +149,18 @@ unop("imov", tint, "src0") unop("ineg", tint, "-src0") unop("fneg", tfloat, "-src0") unop("inot", tint, "~src0") # invert every bit of the integer -unop("fnot", tfloat, "(src0 == 0.0f) ? 1.0f : 0.0f") -unop("fsign", tfloat, "(src0 == 0.0f) ? 0.0f : ((src0 > 0.0f) ? 1.0f : -1.0f)") +unop("fnot", tfloat, ("bit_size == 64 ? ((src0 == 0.0) ? 1.0 : 0.0f) : " + + "((src0 == 0.0f) ? 1.0f : 0.0f)")) +unop("fsign", tfloat, ("bit_size == 64 ? " + + "((src0 == 0.0) ? 0.0 : ((src0 > 0.0) ? 1.0 : -1.0)) : " + + "((src0 == 0.0f) ? 0.0f : ((src0 > 0.0f) ? 1.0f : -1.0f))")) unop("isign", tint, "(src0 == 0) ? 0 : ((src0 > 0) ? 1 : -1)") unop("iabs", tint, "(src0 < 0) ? -src0 : src0") unop("fabs", tfloat, "bit_size == 64 ? fabs(src0) : fabsf(src0)") -unop("fsat", tfloat, "(src0 > 1.0f) ? 1.0f : ((src0 <= 0.0f) ? 0.0f : src0)") -unop("frcp", tfloat, "1.0f / src0") +unop("fsat", tfloat, ("bit_size == 64 ? " + + "((src0 > 1.0) ? 1.0 : ((src0 <= 0.0) ? 0.0 : src0)) : " + + "((src0 > 1.0f) ? 1.0f : ((src0 <= 0.0f) ? 0.0f : src0))")) +unop("frcp", tfloat, "bit_size == 64 ? 1.0 / src0 : 1.0f / src0") unop("frsq", tfloat, "bit_size == 64 ? 1.0 / sqrt(src0) : 1.0f / sqrtf(src0)") unop("fsqrt", tfloat, "bit_size == 64 ? sqrt(src0) : sqrtf(src0)") unop("fexp2", tfloat, "exp2f(src0)") |