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]

[mips patch, trunk + 3.4] fix embedded-pic case statements.


Tested sb1-elf on the trunk, trunk slightly tweaked so that, uh, it'll
build.  8-)  I've applied it to the trunk as obvious.  (For some reason
I thought i'd got it in a few months ago.  Guess not.)

permission to apply to branch if it builds+tests OK there?

This is a regression relative to earlier releases, but there's no bug
report filed against it.  it's caused by the general use of '.set
nomacro' in the MIPS port now.  This doesn't effect
non-"-membedded-pic" operation, AFAIK our firmware is the only user of
-membedded-pic.


cgd
--
2004-02-12  Chris Demetriou  <cgd@broadcom.com>

        * config/mips/mips.md (casesi_internal, casesi_internal_di):
        Use ".set macro" to avoid warnings about multi-instruction
        macros, since they're intentional.

Index: mips.md
===================================================================
RCS file: /projects/bbp/cvsroot/systemsw/tools/src/gcc/gcc/config/mips/mips.md,v
retrieving revision 1.1.1.12
retrieving revision 1.35
diff -U10 -u -p -r1.1.1.12 -r1.35
--- mips.md	2003/10/23 17:27:11	1.1.1.12
+++ mips.md	2003/10/24 01:58:03	1.35
@@ -8018,39 +8018,53 @@ srl\t%M0,%M1,%2\n\
 ;;	...
 
 (define_insn "casesi_internal"
   [(set (pc)
 	(mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "d")
 				  (const_int 4))
 			 (label_ref (match_operand 1 "" "")))))
    (clobber (match_operand:SI 2 "register_operand" "=d"))
    (clobber (reg:SI 31))]
   "TARGET_EMBEDDED_PIC"
-  "%(bal\t%S1\;sll\t%2,%0,2\n%~%S1:\;addu\t%2,%2,$31%)\;\
-lw\t%2,%1-%S1(%2)\;addu\t%2,%2,$31\;%*j\t%2%/"
+  {
+    if (set_nomacro)
+      return "%(bal\\t%S1\;sll\\t%2,%0,2\\n%~%S1:\;addu\\t%2,%2,$31%)\;\\
+.set macro\;lw\\t%2,%1-%S1(%2)\;.set nomacro\;addu\\t%2,%2,$31\\n\\t%*j\\t%2%/";
+    return
+  "%(bal\\t%S1\;sll\\t%2,%0,2\\n%~%S1:\;addu\\t%2,%2,$31%)\;\\
+lw\\t%2,%1-%S1(%2)\;addu\\t%2,%2,$31\\n\\t%*j\\t%2%/"
+    ;
+  }
   [(set_attr "type"	"jump")
    (set_attr "mode"	"none")
    (set_attr "length"	"24")])
 
 ;; This code assumes that the table index will never be >= 29 bits wide,
 ;; which allows the 'sign extend' from SI to DI be a no-op.
 (define_insn "casesi_internal_di"
   [(set (pc)
 	(mem:DI (plus:DI (sign_extend:DI
 			  (mult:SI (match_operand:SI 0 "register_operand" "d")
 				  (const_int 8)))
 			 (label_ref (match_operand 1 "" "")))))
    (clobber (match_operand:DI 2 "register_operand" "=d"))
    (clobber (reg:DI 31))]
   "TARGET_EMBEDDED_PIC"
-  "%(bal\t%S1\;sll\t%2,%0,3\n%~%S1:\;daddu\t%2,%2,$31%)\;\
-ld\t%2,%1-%S1(%2)\;daddu\t%2,%2,$31\;%*j\t%2%/"
+  {
+    if (set_nomacro)
+      return "%(bal\\t%S1\;sll\\t%2,%0,3\\n%~%S1:\;daddu\\t%2,%2,$31%)\;\\
+.set macro\;ld\\t%2,%1-%S1(%2)\;.set nomacro\;daddu\\t%2,%2,$31\\n\\t%*j\\t%2%/";
+    return
+  "%(bal\\t%S1\;sll\\t%2,%0,3\\n%~%S1:\;daddu\\t%2,%2,$31%)\;\\
+ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\\n\\t%*j\\t%2%/"
+    ;
+  }
   [(set_attr "type"	"jump")
    (set_attr "mode"	"none")
    (set_attr "length"	"24")])
 
 ;; For TARGET_ABICALLS, we save the gp in the jmp_buf as well.
 ;; While it is possible to either pull it off the stack (in the
 ;; o32 case) or recalculate it given t9 and our target label,
 ;; it takes 3 or 4 insns to do so.
 
 (define_expand "builtin_setjmp_setup"



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