}
})
-;; 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" "")
""
{
m68k_last_compare_had_fp_operands = 0;
- if (flag_pic && !TARGET_PCREL && 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 */
- 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 & cmpm m68000 op codes.
[(set (match_operand:SF 0 "nonimmediate_operand" "=f")
(float_truncate:SF
(match_operand:DF 1 "general_operand" "fmG")))]
- "TARGET_68881 && TARGET_68040_ONLY"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f%$move%.x %1,%0";
(match_operand:FP 1 "general_operand" "0")))]
"TARGET_68881"
{
- return TARGET_68040_ONLY
+ return TARGET_68040
? "f<FP:round>mul%.l %2,%0"
: "f<FP:round_mul>mul%.l %2,%0";
})
(match_operand:FP 1 "general_operand" "0")))]
"TARGET_68881"
{
- return TARGET_68040_ONLY
+ return TARGET_68040
? "f<FP:round>mul%.w %2,%0"
: "f<FP:round_mul>mul%.w %2,%0";
})
(match_operand:FP 1 "general_operand" "0")))]
"TARGET_68881"
{
- return TARGET_68040_ONLY
+ return TARGET_68040
? "f<FP:round>mul%.b %2,%0"
: "f<FP:round_mul>mul%.b %2,%0";
})
"TARGET_68881"
{
if (FP_REG_P (operands[2]))
- return (TARGET_68040_ONLY
+ return (TARGET_68040
? "fsmul%.x %2,%0"
: "fsglmul%.x %2,%0");
- return (TARGET_68040_ONLY
+ return (TARGET_68040
? "fsmul%.s %f2,%0"
: "fsglmul%.s %f2,%0");
})
(float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
"TARGET_68881"
{
- return TARGET_68040_ONLY
+ return TARGET_68040
? "f<FP:round>div%.l %2,%0"
: "f<FP:round_mul>div%.l %2,%0";
})
(float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
"TARGET_68881"
{
- return TARGET_68040_ONLY
+ return TARGET_68040
? "f<FP:round>div%.w %2,%0"
: "f<FP:round_mul>div%.w %2,%0";
})
(float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
"TARGET_68881"
{
- return TARGET_68040_ONLY
+ return TARGET_68040
? "f<FP:round>div%.b %2,%0"
: "f<FP:round_mul>div%.b %2,%0";
})
"TARGET_68881"
{
if (FP_REG_P (operands[2]))
- return (TARGET_68040_ONLY
+ return (TARGET_68040
? "f<FP:round>div%.x %2,%0"
: "f<FP:round_mul>div%.x %2,%0");
- return (TARGET_68040_ONLY
+ return (TARGET_68040
? "f<FP:round>div%.<FP:prec> %f2,%0"
: "f<FP:round_mul>div%.<FP:prec> %f2,%0");
})
"subql #1,%0\;cmpl #-1,%0\;jne %l1";
})
-
-;; For PIC calls, in order 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.
-;;
-;; PIC calls are handled by loading the address of the function into a
-;; register (via movsi), then emitting a register indirect call using
-;; the "jsr" function call syntax.
-;;
-;; When outputting MIT syntax (e.g. on Suns), we add a bogus extra
-;; operand to the jbsr statement to indicate that this call should
-;; go through the PLT (why? because this is the way that Sun does it).
-;;
-;; We have different patterns for PIC calls and non-PIC calls. The
-;; different patterns are only used to choose the right syntax.
-;;
-;; 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 valid
-;; 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"
[(call (match_operand:QI 0 "memory_operand" "")
(match_operand:SI 1 "general_operand" ""))]
;; Operand 1 not really used on the m68000.
-
""
{
- if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
- SYMBOL_REF_FLAG (XEXP (operands[0], 0)) = 1;
-})
-
-;; This is a normal call sequence.
-(define_insn ""
- [(call (match_operand:QI 0 "memory_operand" "o")
- (match_operand:SI 1 "general_operand" "g"))]
- ;; Operand 1 not really used on the m68000.
-
- "! flag_pic"
-{
-#if MOTOROLA && !defined (USE_GAS)
- return "jsr %0";
-#else
- return "jbsr %0";
-#endif
+ operands[0] = m68k_legitimize_call_address (operands[0]);
})
-;; This is a PIC call sequence.
-(define_insn ""
- [(call (match_operand:QI 0 "memory_operand" "o")
- (match_operand:SI 1 "general_operand" "g"))]
+(define_insn "*call"
+ [(call (mem:QI (match_operand:SI 0 "call_operand" "a,W"))
+ (match_operand:SI 1 "general_operand" "g,g"))]
;; Operand 1 not really used on the m68000.
-
- "flag_pic"
+ ""
{
- m68k_output_pic_call(operands[0]);
- return "";
+ return output_call (operands[0]);
})
;; Call subroutine, returning value in operand 0
;; (which must be a hard register).
-;; See comments before "call" regarding PIC calls.
(define_expand "call_value"
[(set (match_operand 0 "" "")
(call (match_operand:QI 1 "memory_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
+ (match_operand:SI 2 "general_operand" "")))]
;; Operand 2 not really used on the m68000.
""
{
- if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
- SYMBOL_REF_FLAG (XEXP (operands[1], 0)) = 1;
+ operands[1] = m68k_legitimize_call_address (operands[1]);
})
-;; This is a normal call_value
-(define_insn ""
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "memory_operand" "o")
- (match_operand:SI 2 "general_operand" "g")))]
- ;; Operand 2 not really used on the m68000.
- "! flag_pic"
-{
-#if MOTOROLA && !defined (USE_GAS)
- return "jsr %1";
-#else
- return "jbsr %1";
-#endif
-})
-
-;; This is a PIC call_value
-(define_insn ""
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "memory_operand" "o")
- (match_operand:SI 2 "general_operand" "g")))]
+(define_insn "*call_value"
+ [(set (match_operand 0 "" "=rf,rf")
+ (call (mem:QI (match_operand:SI 1 "call_operand" "a,W"))
+ (match_operand:SI 2 "general_operand" "g,g")))]
;; Operand 2 not really used on the m68000.
- "flag_pic"
+ ""
{
- m68k_output_pic_call(operands[1]);
- return "";
+ operands[0] = operands[1];
+ return output_call (operands[0]);
})
;; Call subroutine returning any type.