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]

i386.h fix for 4.0 branch (pr16888 fallout)


Hi,

after Alexandre has applied his patch for PR target/16888 it exposes an 
ugly behaviour with the following testcase (from gimp):
--------------------------
void
f (unsigned long long *a, unsigned long long *b)
{
      asm volatile (""
                    : "+m" (*a), "+m" (*b)
                    :
                    : "%mm1");
}
--------------------------

When compiled with -O2, but without -mmmx (or some equivalent -march 
switch), it gives this unintuitive error message:
  error: output operand 0 must use '&' constraint
  error: output operand 1 must use '&' constraint

This is because on the 4.0 branch Jims fix for ADDITIONAL_REGISTER_NAMES 
is missing, and hence even without -mmmx register "mm1" is known, but as 
Jim noticed defined to the wrong reg number.  So the above asm ends up 
clobbering st(1), and that in turn activates the machinery in reg-stack 
regarding certain rules how to write asms involving x87 stacked registers.

I would like to apply Jim patch (for reference below) also to the 4.0 
branch, which would make the error message look like so:
  error: unknown register name 'mm1' in 'asm'
giving a better hint to the user.

I'm currently regtesting Jims patch on i686-linux on the 4.0 branch, but I 
don't expect any surprises.


Ciao,
Michael.
-- 
2005-04-28  James E Wilson  <wilson@specifixinc.com>

	* config/i386/i386.h (HI_REGISTER_NAMES): Fix typos in comment.
	(ADDITIONAL_REGISTER_NAMES): Delete obsolete mmx register entries.

Index: i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.429
diff -p -p -r1.429 i386.h
*** i386.h	21 Apr 2005 07:35:01 -0000	1.429
--- i386.h	28 Apr 2005 23:14:28 -0000
*************** do {							\
*** 1949,1955 ****
  /* How to refer to registers in assembler output.
     This sequence is indexed by compiler's hard-register-number (see above).  */
  
! /* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
     For non floating point regs, the following are the HImode names.
  
     For float regs, the stack top is sometimes referred to as "%st(0)"
--- 1949,1955 ----
  /* How to refer to registers in assembler output.
     This sequence is indexed by compiler's hard-register-number (see above).  */
  
! /* In order to refer to the first 8 regs as 32 bit regs, prefix an "e".
     For non floating point regs, the following are the HImode names.
  
     For float regs, the stack top is sometimes referred to as "%st(0)"
*************** do {							\
*** 1974,1982 ****
    { "rax", 0 }, { "rdx", 1 }, { "rcx", 2 }, { "rbx", 3 },	\
    { "rsi", 4 }, { "rdi", 5 }, { "rbp", 6 }, { "rsp", 7 },	\
    { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 },		\
!   { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 },		\
!   { "mm0", 8},  { "mm1", 9},  { "mm2", 10}, { "mm3", 11},	\
!   { "mm4", 12}, { "mm5", 13}, { "mm6", 14}, { "mm7", 15} }
  
  /* Note we are omitting these since currently I don't know how
  to get gcc to use these, since they want the same but different
--- 1974,1980 ----
    { "rax", 0 }, { "rdx", 1 }, { "rcx", 2 }, { "rbx", 3 },	\
    { "rsi", 4 }, { "rdi", 5 }, { "rbp", 6 }, { "rsp", 7 },	\
    { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 },		\
!   { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } }
  
  /* Note we are omitting these since currently I don't know how
  to get gcc to use these, since they want the same but different


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