(cmpsi): Make this into a define_expand; legitimize PIC addresses if necessary.
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 10 Dec 1994 21:57:40 +0000 (16:57 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 10 Dec 1994 21:57:40 +0000 (16:57 -0500)
(cmpsi): Make this into a define_expand; legitimize PIC addresses if
necessary.
Old cmpsi code now unnamed define_insn pattern.

From-SVN: r8642

gcc/config/m68k/m68k.md

index cfb5704f0eb3cea5930c480388980c3260550305..f71e9edf708dd438f0c06b03bc4e2becb212be2d 100644 (file)
 \f
 ;; compare instructions.
 
+;; This is the second "hook" for PIC code (in addition to movsi). See
+;; comment of movsi for a description of PIC handling.
+(define_expand "cmpsi"
+  [(set (cc0)
+       (compare (match_operand:SI 0 "nonimmediate_operand" "")
+                (match_operand:SI 1 "general_operand" "")))]
+  ""
+  "
+{
+  if (flag_pic && symbolic_operand (operands[1], SImode)) 
+    {
+      /* The source is an address which requires PIC relocation.  
+         Call legitimize_pic_address with the source, mode, and a relocation
+         register (a new pseudo, or the final destination if reload_in_progress
+         is set).   Then fall through normally */
+      extern rtx legitimize_pic_address();
+      rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
+      operands[1] = legitimize_pic_address (operands[1], SImode, temp);
+    }
+}")
+
 ;; A composite of the cmp, cmpa, & cmpi m68000 op codes.
-(define_insn "cmpsi"
+(define_insn ""
   [(set (cc0)
        (compare (match_operand:SI 0 "nonimmediate_operand" "rKs,mr,>")
                 (match_operand:SI 1 "general_operand" "mr,Ksr,>")))]