summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Moreau <[email protected]>2017-05-06 17:55:43 +0200
committerKarol Herbst <[email protected]>2018-05-29 13:37:45 +0200
commitf0e80e123c343f0c1e1163c72ead0d05ec117b0f (patch)
tree5702fcbf54214fe114cf936107bf6cca3a276ff7
parent03f592a164fa95abbc839dc9820d2ef9fdd21edd (diff)
nv50/ir: Extend ImmediateValue::applyLog2 to 64-bit integers
Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Karol Herbst <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
index c987da99085..49425b98b91 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
@@ -423,7 +423,10 @@ ImmediateValue::isNegative() const
bool
ImmediateValue::isPow2() const
{
- return util_is_power_of_two_or_zero(reg.data.u32);
+ if (reg.type == TYPE_U64 || reg.type == TYPE_S64)
+ return util_is_power_of_two_or_zero64(reg.data.u64);
+ else
+ return util_is_power_of_two_or_zero(reg.data.u32);
}
void
@@ -440,6 +443,12 @@ ImmediateValue::applyLog2()
case TYPE_U32:
reg.data.u32 = util_logbase2(reg.data.u32);
break;
+ case TYPE_S64:
+ assert(!this->isNegative());
+ // fall through
+ case TYPE_U64:
+ reg.data.u64 = util_logbase2_64(reg.data.u64);
+ break;
case TYPE_F32:
reg.data.f32 = log2f(reg.data.f32);
break;