From 29cb008faa794a5a06b0ddf08906b34daaa54beb Mon Sep 17 00:00:00 2001 From: George Koehler Date: Fri, 14 Oct 2016 23:59:26 -0400 Subject: [PATCH] In powerpc table, fix macros los() and his(). Change the operator in his() from a - minus to a + plus. When los(n) becomes negative, then his(n) needs to add 0x10000, not subtract it. Also change los(n) to do the sign extension, because smalls(los(n)) should be true, not false. Also change hi(n) and lo(n) to wrap n in parentheses, as (n), because these are macros and n might still contain operators. --- mach/powerpc/ncg/table | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mach/powerpc/ncg/table b/mach/powerpc/ncg/table index b36a29f2f..e68c3ff3a 100644 --- a/mach/powerpc/ncg/table +++ b/mach/powerpc/ncg/table @@ -18,14 +18,14 @@ PC_OFFSET = 4 /* Offset of saved PC relative to our FP */ #define smalls(n) sfit(n, 16) #define smallu(n) ufit(n, 16) -#define lo(n) (n & 0xFFFF) -#define hi(n) ((n>>16) & 0xFFFF) +#define lo(n) ((n) & 0xFFFF) +#define hi(n) (((n)>>16) & 0xFFFF) /* Use these for instructions that treat the low half as signed --- his() * includes a modifier to produce the correct value when the low half gets * sign extended. Er, do make sure you load the low half second. */ -#define los(n) (n & 0xFFFF) -#define his(n) ((hi(n) - (lo(n)>>15)) & 0xFFFF) +#define los(n) (lo(n) | (((0-(lo(n)>>15)) & ~0xFFFF))) +#define his(n) ((hi(n) + (lo(n)>>15)) & 0xFFFF) #define IFFALSE {CONST, 4} #define IFTRUE {CONST, 12} -- 2.34.1