This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH:


Alan Modra wrote:

On Tue, Aug 10, 2004 at 04:44:25PM -0700, Mark Mitchell wrote:


* expr.c (operand): Handle the "~", "-", and "!" operators applied
to bignums.



OK.


Here is the patch as checked in. (I added a testsuite entry.)

Thanks,

--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com

2004-08-10  Mark Mitchell  <mark@codesourcery.com>

	* expr.c (operand): Handle the "~", "-", and "!" operators applied
	to bignums.

2004-08-10  Mark Mitchell  <mark@codesourcery.com>

	* gas/arm/bignum1.s: New test.
	* gas/arm/arm.exp: Run it.

Index: expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.51
diff -c -5 -p -r1.51 expr.c
*** expr.c	23 May 2004 04:35:11 -0000	1.51
--- expr.c	11 Aug 2004 02:10:05 -0000
*************** operand (expressionS *expressionP)
*** 1074,1083 ****
--- 1074,1112 ----
  	    if (generic_floating_point_number.sign == '+')
  	      generic_floating_point_number.sign = '-';
  	    else
  	      generic_floating_point_number.sign = 'N';
  	  }
+ 	else if (expressionP->X_op == O_big
+ 		 && expressionP->X_add_number > 0)
+ 	  {
+ 	    int i;
+ 
+ 	    if (c == '~' || c == '-')
+ 	      {
+ 		for (i = 0; i < expressionP->X_add_number; ++i)
+ 		  generic_bignum[i] = ~generic_bignum[i];
+ 		if (c == '-')
+ 		  for (i = 0; i < expressionP->X_add_number; ++i)
+ 		    {
+ 		      generic_bignum[i] += 1;
+ 		      if (generic_bignum[i])
+ 			break;
+ 		    }
+ 	      }
+ 	    else if (c == '!')
+ 	      {
+ 		int nonzero = 0;
+ 		for (i = 0; i < expressionP->X_add_number; ++i)
+ 		  {
+ 		    if (generic_bignum[i])
+ 		      nonzero = 1;
+ 		    generic_bignum[i] = 0;
+ 		  }
+ 		generic_bignum[0] = nonzero;
+ 	      }
+ 	  }
  	else if (expressionP->X_op != O_illegal
  		 && expressionP->X_op != O_absent)
  	  {
  	    expressionP->X_add_symbol = make_expr_symbol (expressionP);
  	    if (c == '-')
Index: testsuite/gas/arm/arm.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/arm.exp,v
retrieving revision 1.29
diff -c -5 -p -r1.29 arm.exp
*** testsuite/gas/arm/arm.exp	30 Apr 2004 10:51:13 -0000	1.29
--- testsuite/gas/arm/arm.exp	11 Aug 2004 02:10:05 -0000
*************** if {[istarget *arm*-*-*] || [istarget "x
*** 33,42 ****
--- 33,43 ----
      gas_test "arm7dm.s" "-mcpu=arm7dm" $stdoptlist "Arm 7DM instructions"
      gas_test "arch4t.s" "-march=armv4t" $stdoptlist "Arm architecture 4t instructions"
      gas_test "immed.s" "" $stdoptlist "immediate expressions"
      gas_test "float.s" "-mcpu=arm7tdmi -mfpu=fpa" $stdoptlist "Core floating point instructions"
      gas_test "offset.s" "" $stdoptlist "OFFSET_IMM regression"
+     gas_test "bignum1.s" "" $stdoptlist "bignums"
  
      run_dump_test "armv1"
      run_dump_test "arch5tej"
      run_dump_test "fpa-monadic"
      run_dump_test "fpa-dyadic"
Index: testsuite/gas/arm/bignum1.s
===================================================================
RCS file: testsuite/gas/arm/bignum1.s
diff -N testsuite/gas/arm/bignum1.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gas/arm/bignum1.s	11 Aug 2004 02:10:05 -0000
***************
*** 0 ****
--- 1 ----
+ 	.8byte	-9223372036854775808

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]