From 95b75c0115a8dfef2afcefd3db9f191383b7376f Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 9 Sep 2010 07:40:11 +0000 Subject: [PATCH] PR gas/11972 * config/tc-arm.c (parse_big_immediate): Allow for bignums being extended to the size of a .octa. --- gas/ChangeLog | 6 ++++++ gas/config/tc-arm.c | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index fd79897..cef0c18 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2010-09-09 Nick Clifton + + PR gas/11972 + * config/tc-arm.c (parse_big_immediate): Allow for bignums being + extended to the size of a .octa. + 2010-09-08 Julian Brown * config/tc-arm.c (create_neon_reg_alias): Deal with case diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 87b2b85..ce32aef 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -4420,14 +4420,32 @@ parse_big_immediate (char **str, int i) } } else if (exp.X_op == O_big - && LITTLENUM_NUMBER_OF_BITS * exp.X_add_number > 32 - && LITTLENUM_NUMBER_OF_BITS * exp.X_add_number <= 64) + && LITTLENUM_NUMBER_OF_BITS * exp.X_add_number > 32) { unsigned parts = 32 / LITTLENUM_NUMBER_OF_BITS, j, idx = 0; + /* Bignums have their least significant bits in generic_bignum[0]. Make sure we put 32 bits in imm and 32 bits in reg, in a (hopefully) portable way. */ gas_assert (parts != 0); + + /* Make sure that the number is not too big. + PR 11972: Bignums can now be sign-extended to the + size of a .octa so check that the out of range bits + are all zero or all one. */ + if (LITTLENUM_NUMBER_OF_BITS * exp.X_add_number > 64) + { + LITTLENUM_TYPE m = -1; + + if (generic_bignum[parts * 2] != 0 + && generic_bignum[parts * 2] != m) + return FAIL; + + for (j = parts * 2 + 1; j < (unsigned) exp.X_add_number; j++) + if (generic_bignum[j] != generic_bignum[j-1]) + return FAIL; + } + inst.operands[i].imm = 0; for (j = 0; j < parts; j++, idx++) inst.operands[i].imm |= generic_bignum[idx] -- 2.7.4