From: Richard Stallman Date: Tue, 2 Mar 1993 18:09:59 +0000 (+0000) Subject: (truncdfsf2+2): Use f%$move instead of fsmove. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2b362d2c866f4e3f70a66b2293b340e4ad406877;p=gcc.git (truncdfsf2+2): Use f%$move instead of fsmove. (fix_truncdfsi2, fix_truncdfhi2, fix_truncdfqi2): Use %# instead of #. (call, call_value): Set SYMBOL_REF_FLAG for the called function symbol_ref rtx. In PIC mode, output `bsr FUNC@PLTPC' when the operand is symbol_ref. From-SVN: r3594 --- diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index 5fac2b9b67f..dc8c45aa286 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -1472,8 +1472,8 @@ "* { if (FP_REG_P (operands[1])) - return \"fsmove%.x %1,%0\"; - return \"fsmove%.d %f1,%0\"; + return \"f%$move%.x %1,%0\"; + return \"f%$move%.d %f1,%0\"; }") (define_insn "" @@ -1565,7 +1565,7 @@ "* { CC_STATUS_INIT; - return \"fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.l %1,%0\;fmovem%.l %2,%!\"; + return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.l %1,%0\;fmovem%.l %2,%!\"; }") (define_insn "fix_truncdfhi2" @@ -1577,7 +1577,7 @@ "* { CC_STATUS_INIT; - return \"fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.w %1,%0\;fmovem%.l %2,%!\"; + return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.w %1,%0\;fmovem%.l %2,%!\"; }") (define_insn "fix_truncdfqi2" @@ -1589,7 +1589,7 @@ "* { CC_STATUS_INIT; - return \"fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.b %1,%0\;fmovem%.l %2,%!\"; + return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.b %1,%0\;fmovem%.l %2,%!\"; }") ;; Convert a float to a float whose value is an integer. @@ -4626,6 +4626,31 @@ ;; We have different patterns for PIC calls and non-PIC calls. The ;; different patterns are only used to choose the right syntax ;; ("jsr" vs "jbsr"). +;; +;; On svr4 m68k, PIC stuff is done differently. To be able to support +;; dynamic linker LAZY BINDING, all the procedure calls need to go +;; through the PLT (Procedure Linkage Table) section in PIC mode. The +;; svr4 m68k assembler recognizes this syntax: `bsr FUNC@PLTPC' and it +;; will create the correct relocation entry (R_68K_PLT32) for `FUNC', +;; that tells the linker editor to create an entry for `FUNC' in PLT +;; section at link time. However, all global objects reference are still +;; done by using `OBJ@GOT'. So, the goal here is to output the function +;; call operand as `FUNC@PLTPC', but output object operand as `OBJ@GOT'. +;; We need to have a way to differentiate these two different operands. +;; +;; The strategy I use here is to use SYMBOL_REF_FLAG to differentiate +;; these two different operands. The macro LEGITIMATE_PIC_OPERAND_P needs +;; to be changed to recognize function calls symbol_ref operand as a legal +;; PIC operand (by checking whether SYMBOL_REF_FLAG is set). This will +;; avoid the compiler to load this symbol_ref operand into a register. +;; Remember, the operand "foo@PLTPC" cannot be called via jsr directly +;; since the value is a PC relative offset, not a real address. +;; +;; All global objects are treated in the similar way as in SUN3. The only +;; difference is: on m68k svr4, the reference of such global object needs +;; to end with a suffix "@GOT" so the assembler and linker know to create +;; an entry for it in GOT (Global Offset Table) section. This is done in +;; m68k.c. ;; Call subroutine with no return value. (define_expand "call" @@ -4637,8 +4662,12 @@ " { if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF) +#ifdef MOTOROLA + SYMBOL_REF_FLAG (XEXP (operands[0], 0)) = 1; +#else operands[0] = gen_rtx (MEM, GET_MODE (operands[0]), force_reg (Pmode, XEXP (operands[0], 0))); +#endif }") ;; This is a normal call sequence. @@ -4664,6 +4693,11 @@ "flag_pic" "* +#ifdef MOTOROLA + if (GET_CODE (operands[0]) == MEM + && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF) + return \"bsr %0@PLTPC\"; +#endif return \"jsr %0\"; ") @@ -4679,8 +4713,12 @@ " { if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF) +#ifdef MOTOROLA + SYMBOL_REF_FLAG (XEXP (operands[1], 0)) = 1; +#else operands[1] = gen_rtx (MEM, GET_MODE (operands[1]), force_reg (Pmode, XEXP (operands[1], 0))); +#endif }") ;; This is a normal call_value @@ -4706,6 +4744,11 @@ ;; Operand 2 not really used on the m68000. "flag_pic" "* +#ifdef MOTOROLA + if (GET_CODE (operands[1]) == MEM + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF) + return \"bsr %1@PLTPC\"; +#endif return \"jsr %1\"; ")