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]

Re: GAS for ARM: Reject ASR/LSR/ROR with immediate of 0


Hi Richard,

: > patch below).  One thing I did add was a warning message if "ROR #0"
: > is used, since this is turned into RRX, which may not have been what
: > the programmer was expecting.
: 
: > If anyone has any problems with this patch (which I am about to check
: > in), please let me know. 
: 
: This is great except for converting ror #0 into rrx.  That is just plain 
: wrong.
: In the past we converted any shift or rotate of 0 into asl #0 (which is 
: the encoding of no shift at all);  while it might be considered dubious, 
: it was basically the same operation as was requested.  But ror #0 is 
: definitely not the same as rrx.
: 
: I think we should continue to convert any shift or rotate of 0 into "asl 
: #0"; though perhaps we should emit a warning that that is what is being 
: done.

OK I have done that.  (Patch below).  Incidentally this whole topic
started because on of customer had complained that GAS did not behave
in the same way as ARM's assembler.  (Apparently ARM's assembelr
rejects shifts of zero, rather than converting them into LSLs.)

Cheers
	Nick

2000-08-17  Nick Clifton  <nickc@redhat.com>

	* config/tc-arm.c (decode_shift): Allow illegal shifts by zero
	to be recoded as logical shift lefts by zero.

Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src//src/gas/config/tc-arm.c,v
retrieving revision 1.55
diff -p -r1.55 tc-arm.c
*** tc-arm.c	2000/08/16 19:01:59	1.55
--- tc-arm.c	2000/08/17 23:42:21
*************** decode_shift (str, unrestrict)
*** 2531,2537 ****
       char ** str;
       int     unrestrict;
  {
!   struct asm_shift_name * shift;
    char * p;
    char   c;
  
--- 2531,2537 ----
       char ** str;
       int     unrestrict;
  {
!   const struct asm_shift_name * shift;
    char * p;
    char   c;
  
*************** decode_shift (str, unrestrict)
*** 2548,2554 ****
  
    c = * p;
    * p = '\0';
!   shift = (struct asm_shift_name *) hash_find (arm_shift_hsh, * str);
    * p = c;
    
    if (shift == NULL)
--- 2548,2554 ----
  
    c = * p;
    * p = '\0';
!   shift = (const struct asm_shift_name *) hash_find (arm_shift_hsh, * str);
    * p = c;
    
    if (shift == NULL)
*************** decode_shift (str, unrestrict)
*** 2602,2611 ****
  	  || (num == 32 && shift->properties->allows_32 == 0)
  	  )
  	{
! 	  /* As a special case we allow ROR #0, but we issue a message
! 	     reminding the programmer that this is actually an RRX.  */
! 	  if (num == 0 && shift->properties->index == SHIFT_ROR)
! 	    as_tsktsk (_("ROR #0 is actually RRX"));
  	  else
  	    {
  	      inst.error = _("Invalid immediate shift");
--- 2602,2617 ----
  	  || (num == 32 && shift->properties->allows_32 == 0)
  	  )
  	{
! 	  /* As a special case we allow a shift of zero for
! 	     modes that do not support it to be recoded as an
! 	     logical shift left of zero (ie nothing).  We warn
! 	     about this though.  */
! 	  if (num == 0)
! 	    {
! 	      as_tsktsk (_("Shift of 0 ignored."));
! 	      shift = shift_names;
! 	      assert (shift->properties->index == SHIFT_LSL);
! 	    }
  	  else
  	    {
  	      inst.error = _("Invalid immediate shift");


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