This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

fix named asm operands with modifiers


I failed to convert %a[name] to %a0 properly.  One of those 
things you don't necessarily think about until someone tries
to use the feature.



r~


        * stmt.c (resolve_operand_names): Handle operand modifiers.

        * gcc.dg/asm-4.c: Test operand modifiers.

Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.239
diff -c -p -d -r1.239 stmt.c
*** stmt.c	2001/12/24 05:57:01	1.239
--- stmt.c	2001/12/24 06:11:51
*************** resolve_operand_names (string, outputs, 
*** 2080,2087 ****
    p = buffer;
    while ((p = strchr (p, '%')) != NULL)
      {
!       if (*++p != '[')
! 	continue;
        p = resolve_operand_name_1 (p, outputs, inputs);
      }
  
--- 2080,2095 ----
    p = buffer;
    while ((p = strchr (p, '%')) != NULL)
      {
!       if (p[1] == '[')
! 	p += 1;
!       else if (ISALPHA (p[1]) && p[2] == '[')
! 	p += 2;
!       else
! 	{
! 	  p += 1;
! 	  continue;
! 	}
! 
        p = resolve_operand_name_1 (p, outputs, inputs);
      }
  
Index: testsuite/gcc.dg/asm-4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/asm-4.c,v
retrieving revision 1.1
diff -c -p -d -r1.1 asm-4.c
*** asm-4.c	2001/10/12 00:10:34	1.1
--- asm-4.c	2001/12/24 06:11:51
***************
*** 3,14 ****
  
  int main()
  {
!   int x;
  
    asm volatile ("test0 X%0Y%[arg]Z" : [arg] "=g" (x));
!   asm volatile ("test1 X%[out]Y%[in]Z" : [out] "=g" (x) : [in] "0"(x));
  }
  
  /* ??? Someone explain why the back reference dosn't work.  */
  /* { dontdg-final { scan-assembler "test0 X(.*)Y\1Z" } } */
  /* { dontdg-final { scan-assembler "test1 X(.*)Y\1Z" } } */
--- 3,16 ----
  
  int main()
  {
!   int x, y, z;
  
    asm volatile ("test0 X%0Y%[arg]Z" : [arg] "=g" (x));
!   asm volatile ("test1 X%[out]Y%[in]Z" : [out] "=g" (y) : [in] "0"(y));
!   asm volatile ("test2 X%a0Y%a[arg]Z" : : [arg] "p" (&z));
  }
  
  /* ??? Someone explain why the back reference dosn't work.  */
  /* { dontdg-final { scan-assembler "test0 X(.*)Y\1Z" } } */
  /* { dontdg-final { scan-assembler "test1 X(.*)Y\1Z" } } */
+ /* { dontdg-final { scan-assembler "test2 X(.*)Y\1Z" } } */


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