ppc call_value* fixes (plus minor apple gripe)

Aldy Hernandez aldyh@redhat.com
Mon Jan 28 01:05:00 GMT 2002


<gripe>
both of the problems described here had obviously
been debugged and fixed by apple, and at least one of them was coded
after my altivec changes went in, so it would have been VERY simple
to submit the fix to the gcc list as well.

guys, if you have fixes in your local tree that are very obviously 
correct,
and will undoubtedly be encountered by others, post them.  it saves
the rest of us cycles that could be used to do other cool things in gcc
(and not spent re-fixing things that have already been fixed).
</gripe>

find_reloads was dying trying to fit the register constraints of
*call_value_nonlocal_sysv.  the first operand needed a "v" constraint 
added.
likewise for a couple more call_value* patterns.  i didn't mess with the 
AIX
call_value patterns because currently there is no AIX altivec, but i 
could
add it if someone wants it.

i also added a new register class because find_reloads was picking the
wrong register for the pattern:

	(define_insn "*call_value_nonlocal_sysv"
	  [(set (match_operand 0 "" "=fgv,fgv,fgv,fgv")

upon seeing f and g, the biggest subunion containing them was set to
NON_SPECIAL_REGS, then when it tried to get the union of that and
ALTIVEC_REGS it got confused.  i noticed apple-gcc has moved
NON_SPECIAL_REGS before ALTIVEC_REGS to fix the problem, but
i believe the proper solution is to add a register class encompassing all
three register classes.

so... this patch:
	a) fixes the call_value patterns to handle vector return values
	b) adds GEN_OR_FLOAT_OR_ALTIVEC_REGS

ok?

2002-01-28  Aldy Hernandez  <aldyh@redhat.com>

	* config/rs6000/rs6000.h (reg_class): New class
	GEN_OR_FLOAT_OR_ALTIVEC_REGS.
	(REG_CLASS_NAMES): Same.
	(REG_CLASS_CONTENTS): Same.

	* rs6000.md ("*call_value_local32"): Support vector registers.
	("*call_value_local64"): Same.
	("*call_value_nonlocal_sysv"): Same.

Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.176
diff -c -p -r1.176 rs6000.h
*** rs6000.h	2002/01/22 02:36:52	1.176
--- rs6000.h	2002/01/28 07:30:17
*************** enum reg_class
*** 1046,1051 ****
--- 1046,1052 ----
     GENERAL_REGS,
     FLOAT_REGS,
     ALTIVEC_REGS,
+   GEN_OR_FLOAT_OR_ALTIVEC_REGS,
     VRSAVE_REGS,
     NON_SPECIAL_REGS,
     MQ_REGS,
*************** enum reg_class
*** 1073,1078 ****
--- 1074,1080 ----
     "GENERAL_REGS",							\
     "FLOAT_REGS",								\
     "ALTIVEC_REGS",							\
+   
"GEN_OR_FLOAT_OR_ALTIVEC_REGS",                                       \
     "VRSAVE_REGS",							\
     "NON_SPECIAL_REGS",							\
     "MQ_REGS",								\
*************** enum reg_class
*** 1099,1104 ****
--- 1101,1107 ----
     { 0xffffffff, 0x00000000, 0x00000008, 0x00000000 }, /* 
GENERAL_REGS */     \
     { 0x00000000, 0xffffffff, 0x00000000, 0x00000000 }, /* 
FLOAT_REGS */       \
     { 0x00000000, 0x00000000, 0xffffe000, 0x00001fff }, /* 
ALTIVEC_REGS */     \
+   { 0xffffffff, 0xffffffff, 0xffffe008, 0x00001fff }, /* 
GEN_OR_FLOAT_OR_ALTIVEC_REGS */ \
     { 0x00000000, 0x00000000, 0x00000000, 0x00002000 }, /* VRSAVE_REGS */	
      \
     { 0xffffffff, 0xffffffff, 0x00000008, 0x00000000 }, /* 
NON_SPECIAL_REGS */ \
     { 0x00000000, 0x00000000, 0x00000001, 0x00000000 }, /* MQ_REGS */	    
  \
Index: config/rs6000/rs6000.md
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.161
diff -c -p -r1.161 rs6000.md
*** rs6000.md	2002/01/25 17:52:43	1.161
--- rs6000.md	2002/01/28 07:30:28
***************
*** 9878,9884 ****
      (set_attr "length" "4,8")])

   (define_insn "*call_value_local32"
!   [(set (match_operand 0 "" "=fg,fg")
   	(call (mem:SI (match_operand:SI 1 "current_file_function_operand" 
"s,s"))
   	      (match_operand 2 "" "g,g")))
      (use (match_operand:SI 3 "immediate_operand" "O,n"))
--- 9878,9884 ----
      (set_attr "length" "4,8")])

   (define_insn "*call_value_local32"
!   [(set (match_operand 0 "" "=fgv,fgv")
   	(call (mem:SI (match_operand:SI 1 "current_file_function_operand" 
"s,s"))
   	      (match_operand 2 "" "g,g")))
      (use (match_operand:SI 3 "immediate_operand" "O,n"))
***************
*** 9899,9905 ****


   (define_insn "*call_value_local64"
!   [(set (match_operand 0 "" "=fg,fg")
   	(call (mem:SI (match_operand:DI 1 "current_file_function_operand" 
"s,s"))
   	      (match_operand 2 "" "g,g")))
      (use (match_operand:SI 3 "immediate_operand" "O,n"))
--- 9899,9905 ----


   (define_insn "*call_value_local64"
!   [(set (match_operand 0 "" "=fgv,fgv")
   	(call (mem:SI (match_operand:DI 1 "current_file_function_operand" 
"s,s"))
   	      (match_operand 2 "" "g,g")))
      (use (match_operand:SI 3 "immediate_operand" "O,n"))
***************
*** 10067,10073 ****
      (set_attr "length" "4,8,4,8")])

   (define_insn "*call_value_nonlocal_sysv"
!   [(set (match_operand 0 "" "=fg,fg,fg,fg")
   	(call (mem:SI (match_operand:SI 1 "call_operand" "cl,cl,s,s"))
   	      (match_operand 2 "" "g,g,g,g")))
      (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
--- 10067,10073 ----
      (set_attr "length" "4,8,4,8")])

   (define_insn "*call_value_nonlocal_sysv"
!   [(set (match_operand 0 "" "=fgv,fgv,fgv,fgv")
   	(call (mem:SI (match_operand:SI 1 "call_operand" "cl,cl,s,s"))
   	      (match_operand 2 "" "g,g,g,g")))
      (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 5615 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20020128/21bceebb/attachment.bin>


More information about the Gcc-patches mailing list