nv50/ir: Extend ImmediateValue::applyLog2 to 64-bit integers
authorPierre Moreau <pierre.morrow@free.fr>
Sat, 6 May 2017 15:55:43 +0000 (17:55 +0200)
committerKarol Herbst <kherbst@redhat.com>
Tue, 29 May 2018 11:37:45 +0000 (13:37 +0200)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir.cpp

index c987da9908597067a7c304e18970ae3268ef96e1..49425b98b9137058c986b1c5fdc03aeab5358534 100644 (file)
@@ -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;