"*
{
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 ""
"*
{
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"
"*
{
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"
"*
{
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.
;; 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"
"
{
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.
"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\";
")
"
{
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
;; 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\";
")