From a255f00a28d31979293d10cd2b121a1ca8d1fcf9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 18 May 2016 11:27:56 +0930 Subject: [PATCH] PPC_OPERAND_SIGNOPT range. Commit b84bf58a accidentally extended the range of allowed negative numbers. * config/tc-ppc.c (ppc_insert_operand): Trim PPC_OPERAND_SIGNOPT allowed negative range. * testsuite/gas/ppc/power9.s: Test xxspltib of -128, not -256. * testsuite/gas/ppc/power9.d: Update. --- gas/ChangeLog | 7 +++++++ gas/config/tc-ppc.c | 12 +++++------- gas/testsuite/gas/ppc/power9.d | 2 +- gas/testsuite/gas/ppc/power9.s | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 745c13c492f..59bf3504d3d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2016-05-18 Alan Modra + + * config/tc-ppc.c (ppc_insert_operand): Trim PPC_OPERAND_SIGNOPT + allowed negative range. + * testsuite/gas/ppc/power9.s: Test xxspltib of -128, not -256. + * testsuite/gas/ppc/power9.d: Update. + 2016-05-17 Thomas Preud'homme * testsuite/gas/arm/archv8m-cmse-msr-base.d: Force Thumb when diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 6346570ac34..249257337cc 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1787,17 +1787,15 @@ ppc_insert_operand (unsigned long insn, if ((operand->flags & PPC_OPERAND_SIGNOPT) != 0) { - /* Extend the allowed range for addis to [-65536, 65535]. - Similarly for some VLE high part insns. For 64-bit it - would be good to disable this for signed fields since the + /* Extend the allowed range for addis to [-32768, 65535]. + Similarly for cmpli and some VLE high part insns. For 64-bit + it would be good to disable this for signed fields since the value is sign extended into the high 32 bits of the register. If the value is, say, an address, then we might care about the high bits. However, gcc as of 2014-06 uses unsigned values when loading the high part of 64-bit constants using - lis. - Use the same extended range for cmpli, to allow at least - [-32768, 65535]. */ - min = ~max & -right; + lis. */ + min = ~(max >> 1) & -right; } else if ((operand->flags & PPC_OPERAND_SIGNED) != 0) { diff --git a/gas/testsuite/gas/ppc/power9.d b/gas/testsuite/gas/ppc/power9.d index d84e6357679..a1d46812857 100644 --- a/gas/testsuite/gas/ppc/power9.d +++ b/gas/testsuite/gas/ppc/power9.d @@ -140,7 +140,7 @@ Disassembly of section \.text: .*: (f0 80 2a 94|94 2a 80 f0) xxextractuw vs4,vs5,0 .*: (f1 0f 92 97|97 92 0f f1) xxextractuw vs40,vs50,15 .*: (f0 80 02 d0|d0 02 80 f0) xxspltib vs4,0 -.*: (f0 80 02 d0|d0 02 80 f0) xxspltib vs4,0 +.*: (f0 84 02 d0|d0 02 84 f0) xxspltib vs4,128 .*: (f1 27 fa d1|d1 fa 27 f1) xxspltib vs41,255 .*: (f1 27 fa d1|d1 fa 27 f1) xxspltib vs41,255 .*: (f0 a0 32 d4|d4 32 a0 f0) xxinsertw vs5,vs6,0 diff --git a/gas/testsuite/gas/ppc/power9.s b/gas/testsuite/gas/ppc/power9.s index 9cf306c6e3b..34576b72ae0 100644 --- a/gas/testsuite/gas/ppc/power9.s +++ b/gas/testsuite/gas/ppc/power9.s @@ -131,7 +131,7 @@ power9: xxextractuw 4,5,0x0 xxextractuw 40,50,0xf xxspltib 4,0x0 - xxspltib 4,-256 + xxspltib 4,-128 xxspltib 41,255 xxspltib 41,-1 xxinsertw 5,6,0 -- 2.30.2