aco: fix one-off error in Operand(uint16_t)
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 3 Sep 2020 14:41:32 +0000 (15:41 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 8 Sep 2020 12:17:43 +0000 (12:17 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 3d6f67950d9 ('aco: improve 8/16-bit constants')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6583>

src/amd/compiler/aco_ir.h

index d27726d..9b3f5a3 100644 (file)
@@ -449,7 +449,7 @@ public:
       if (v <= 64)
          setFixed(PhysReg{128u + v});
       else if (v >= 0xFFF0) /* [-16 .. -1] */
-         setFixed(PhysReg{192u + (0xFFFF - v)});
+         setFixed(PhysReg{(unsigned)(192 - (int16_t)v)});
       else if (v == 0x3800) /* 0.5 */
          setFixed(PhysReg{240});
       else if (v == 0xB800) /* -0.5 */