This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] m68k: Use ASSEMBLER_DIALECT
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: law at redhat dot com, schwab at suse dot de
- Cc: bernie at develer dot com
- Date: Sun, 26 Aug 2007 12:59:58 -0700
- Subject: [patch] m68k: Use ASSEMBLER_DIALECT
Hi,
Attached is a patch to use ASSEMBLER_DIALECT to simplify constructs
that use MOTOROLA.
I assigned option 0 to the Motorola syntax because the motorola syntax
adds characters to the MIT syntax. This way, we can say
j{b}eq
rather than more cumbersome
j{|b}eq
I didn't go as far as replacing "%." with "{.}". We can do that
another time if people agree that it's a good idea. Personally, I
would like to have only one way, namely "{|}", to handle dialects, but
"{.}" is longer than "%.".
One good side effect of trying to use "{|}" instead of MOTOROLA is
that code whose behavior changes depending on MOTOROLA is now obvious.
We just have to search for MOTOROLA. Note that the m68k port emits
different code (beyond assembly dialects) in several places.
Tested on m68k-elf. OK to apply?
Kazu Hirata
2007-08-26 Kazu Hirata <kazu@codesourcery.com>
* config/m68k/m68k.c, config/m68k/m68k.md: Use the assembly
syntax for ASSEMBLER_DIALECT.
* config/m68k/m68k.h (ASSEMBLER_DIALECT): New.
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c (revision 127798)
+++ gcc/config/m68k/m68k.c (working copy)
@@ -1297,73 +1297,43 @@ output_dbcc_and_branch (rtx *operands)
switch (GET_CODE (operands[3]))
{
case EQ:
- output_asm_insn (MOTOROLA
- ? "dbeq %0,%l1\n\tjbeq %l2"
- : "dbeq %0,%l1\n\tjeq %l2",
- operands);
+ output_asm_insn ("dbeq %0,%l1\n\tj{b}eq %l2", operands);
break;
case NE:
- output_asm_insn (MOTOROLA
- ? "dbne %0,%l1\n\tjbne %l2"
- : "dbne %0,%l1\n\tjne %l2",
- operands);
+ output_asm_insn ("dbne %0,%l1\n\tj{b}ne %l2", operands);
break;
case GT:
- output_asm_insn (MOTOROLA
- ? "dbgt %0,%l1\n\tjbgt %l2"
- : "dbgt %0,%l1\n\tjgt %l2",
- operands);
+ output_asm_insn ("dbgt %0,%l1\n\tj{b}gt %l2", operands);
break;
case GTU:
- output_asm_insn (MOTOROLA
- ? "dbhi %0,%l1\n\tjbhi %l2"
- : "dbhi %0,%l1\n\tjhi %l2",
- operands);
+ output_asm_insn ("dbhi %0,%l1\n\tj{b}hi %l2", operands);
break;
case LT:
- output_asm_insn (MOTOROLA
- ? "dblt %0,%l1\n\tjblt %l2"
- : "dblt %0,%l1\n\tjlt %l2",
- operands);
+ output_asm_insn ("dblt %0,%l1\n\tj{b}lt %l2", operands);
break;
case LTU:
- output_asm_insn (MOTOROLA
- ? "dbcs %0,%l1\n\tjbcs %l2"
- : "dbcs %0,%l1\n\tjcs %l2",
- operands);
+ output_asm_insn ("dbcs %0,%l1\n\tj{b}cs %l2", operands);
break;
case GE:
- output_asm_insn (MOTOROLA
- ? "dbge %0,%l1\n\tjbge %l2"
- : "dbge %0,%l1\n\tjge %l2",
- operands);
+ output_asm_insn ("dbge %0,%l1\n\tj{b}ge %l2", operands);
break;
case GEU:
- output_asm_insn (MOTOROLA
- ? "dbcc %0,%l1\n\tjbcc %l2"
- : "dbcc %0,%l1\n\tjcc %l2",
- operands);
+ output_asm_insn ("dbcc %0,%l1\n\tj{b}cc %l2", operands);
break;
case LE:
- output_asm_insn (MOTOROLA
- ? "dble %0,%l1\n\tjble %l2"
- : "dble %0,%l1\n\tjle %l2",
- operands);
+ output_asm_insn ("dble %0,%l1\n\tj{b}le %l2", operands);
break;
case LEU:
- output_asm_insn (MOTOROLA
- ? "dbls %0,%l1\n\tjbls %l2"
- : "dbls %0,%l1\n\tjls %l2",
- operands);
+ output_asm_insn ("dbls %0,%l1\n\tj{b}ls %l2", operands);
break;
default:
@@ -1375,10 +1345,7 @@ output_dbcc_and_branch (rtx *operands)
switch (GET_MODE (operands[0]))
{
case SImode:
- output_asm_insn (MOTOROLA
- ? "clr%.w %0\n\tsubq%.l #1,%0\n\tjbpl %l1"
- : "clr%.w %0\n\tsubq%.l #1,%0\n\tjpl %l1",
- operands);
+ output_asm_insn ("clr%.w %0\n\tsubq%.l #1,%0\n\tj{b}pl %l1", operands);
break;
case HImode:
@@ -1424,12 +1391,7 @@ output_scc_di (rtx op, rtx operand1, rtx
}
loperands[4] = gen_label_rtx ();
if (operand2 != const0_rtx)
- {
- output_asm_insn (MOTOROLA
- ? "cmp%.l %2,%0\n\tjbne %l4\n\tcmp%.l %3,%1"
- : "cmp%.l %2,%0\n\tjne %l4\n\tcmp%.l %3,%1",
- loperands);
- }
+ output_asm_insn ("cmp%.l %2,%0\n\tj{b}ne %l4\n\tcmp%.l %3,%1", loperands);
else
{
if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (loperands[0]))
@@ -1437,7 +1399,7 @@ output_scc_di (rtx op, rtx operand1, rtx
else
output_asm_insn ("cmp%.w #0,%0", loperands);
- output_asm_insn (MOTOROLA ? "jbne %l4" : "jne %l4", loperands);
+ output_asm_insn ("j{b}ne %l4", loperands);
if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (loperands[1]))
output_asm_insn ("tst%.l %1", loperands);
@@ -1463,8 +1425,7 @@ output_scc_di (rtx op, rtx operand1, rtx
case GT:
loperands[6] = gen_label_rtx ();
- output_asm_insn (MOTOROLA ? "shi %5\n\tjbra %l6" : "shi %5\n\tjra %l6",
- loperands);
+ output_asm_insn ("shi %5\n\tj{b}ra %l6", loperands);
(*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (loperands[4]));
output_asm_insn ("sgt %5", loperands);
@@ -1480,8 +1441,7 @@ output_scc_di (rtx op, rtx operand1, rtx
case LT:
loperands[6] = gen_label_rtx ();
- output_asm_insn (MOTOROLA ? "scs %5\n\tjbra %l6" : "scs %5\n\tjra %l6",
- loperands);
+ output_asm_insn ("scs %5\n\tj{b}ra %l6", loperands);
(*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (loperands[4]));
output_asm_insn ("slt %5", loperands);
@@ -1497,8 +1457,7 @@ output_scc_di (rtx op, rtx operand1, rtx
case GE:
loperands[6] = gen_label_rtx ();
- output_asm_insn (MOTOROLA ? "scc %5\n\tjbra %l6" : "scc %5\n\tjra %l6",
- loperands);
+ output_asm_insn ("scc %5\n\tj{b}ra %l6", loperands);
(*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (loperands[4]));
output_asm_insn ("sge %5", loperands);
@@ -1514,8 +1473,7 @@ output_scc_di (rtx op, rtx operand1, rtx
case LE:
loperands[6] = gen_label_rtx ();
- output_asm_insn (MOTOROLA ? "sls %5\n\tjbra %l6" : "sls %5\n\tjra %l6",
- loperands);
+ output_asm_insn ("sls %5\n\tj{b}ra %l6", loperands);
(*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (loperands[4]));
output_asm_insn ("sle %5", loperands);
@@ -3203,16 +3161,16 @@ m68k_output_movem (rtx *operands, rtx pa
if (FP_REGNO_P (REGNO (XEXP (XVECEXP (pattern, 0, first), store_p))))
{
if (store_p)
- return MOTOROLA ? "fmovm %1,%a0" : "fmovem %1,%a0";
+ return "fmov{|e}m %1,%a0";
else
- return MOTOROLA ? "fmovm %a0,%1" : "fmovem %a0,%1";
+ return "fmov{|e}m %a0,%1";
}
else
{
if (store_p)
- return MOTOROLA ? "movm.l %1,%a0" : "moveml %1,%a0";
+ return "mov{m.|em}l %1,%a0";
else
- return MOTOROLA ? "movm.l %a0,%1" : "moveml %a0,%1";
+ return "mov{m.|em}l %a0,%1";
}
}
@@ -3260,8 +3218,8 @@ output_addsi3 (rtx *operands)
&& (INTVAL (operands[2]) < -32768 || INTVAL (operands[2]) > 32767))
return "move%.l %2,%0\n\tadd%.l %1,%0";
if (GET_CODE (operands[2]) == REG)
- return MOTOROLA ? "lea (%1,%2.l),%0" : "lea %1@(0,%2:l),%0";
- return MOTOROLA ? "lea (%c2,%1),%0" : "lea %1@(%c2),%0";
+ return "lea {(%1,%2.l)|%1@(0,%2:l)},%0";
+ return "lea {(%c2,%1)|%1@(%c2)},%0";
}
if (GET_CODE (operands[2]) == CONST_INT)
{
@@ -3299,7 +3257,7 @@ output_addsi3 (rtx *operands)
if (TUNE_68040)
return "add%.w %2,%0";
else
- return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
+ return "lea {(%c2,%0)|%0@(%c2)},%0";
}
}
return "add%.l %2,%0";
@@ -3608,11 +3566,11 @@ print_operand (FILE *file, rtx op, int l
else if (letter == '#')
asm_fprintf (file, "%I");
else if (letter == '-')
- asm_fprintf (file, MOTOROLA ? "-(%Rsp)" : "%Rsp@-");
+ asm_fprintf (file, "{-(%Rsp)|%Rsp@-}");
else if (letter == '+')
- asm_fprintf (file, MOTOROLA ? "(%Rsp)+" : "%Rsp@+");
+ asm_fprintf (file, "{(%Rsp)+|%Rsp@+}");
else if (letter == '@')
- asm_fprintf (file, MOTOROLA ? "(%Rsp)" : "%Rsp@");
+ asm_fprintf (file, "{(%Rsp)|%Rsp@}");
else if (letter == '!')
asm_fprintf (file, "%Rfpcr");
else if (letter == '$')
@@ -3652,7 +3610,7 @@ print_operand (FILE *file, rtx op, int l
&& !(GET_CODE (XEXP (op, 0)) == CONST_INT
&& INTVAL (XEXP (op, 0)) < 0x8000
&& INTVAL (XEXP (op, 0)) >= -0x8000))
- fprintf (file, MOTOROLA ? ".l" : ":l");
+ asm_fprintf (file, "{.|:}l");
}
else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == SFmode)
{
@@ -3725,11 +3683,11 @@ print_operand_address (FILE *file, rtx a
gcc_unreachable ();
if (address.code == PRE_DEC)
- fprintf (file, MOTOROLA ? "-(%s)" : "%s@-",
- M68K_REGNAME (REGNO (address.base)));
+ asm_fprintf (file, "{-(%s)|%s@-}",
+ M68K_REGNAME (REGNO (address.base)));
else if (address.code == POST_INC)
- fprintf (file, MOTOROLA ? "(%s)+" : "%s@+",
- M68K_REGNAME (REGNO (address.base)));
+ asm_fprintf (file, "{(%s)+|%s@+}",
+ M68K_REGNAME (REGNO (address.base)));
else if (!address.base && !address.index)
{
/* A constant address. */
@@ -3738,7 +3696,7 @@ print_operand_address (FILE *file, rtx a
{
/* (xxx).w or (xxx).l. */
if (IN_RANGE (INTVAL (addr), -0x8000, 0x7fff))
- fprintf (file, MOTOROLA ? "%d.w" : "%d:w", (int) INTVAL (addr));
+ asm_fprintf (file, "%d{.|:}w", (int) INTVAL (addr));
else
fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (addr));
}
Index: gcc/config/m68k/m68k.h
===================================================================
--- gcc/config/m68k/m68k.h (revision 127798)
+++ gcc/config/m68k/m68k.h (working copy)
@@ -29,6 +29,10 @@ along with GCC; see the file COPYING3.
# define TARGET_VERSION fprintf (stderr, " (68k, MIT syntax)")
#endif
+/* Options 0 and 1 are the Motorola and MIT syntaxes,
+ respectively. */
+#define ASSEMBLER_DIALECT !MOTOROLA
+
/* Handle --with-cpu default option from configure script. */
#define OPTION_DEFAULT_SPECS \
{ "cpu", "%{!mc68000:%{!m68000:%{!m68302:%{!m68010:%{!mc68020:%{!m68020:\
@@ -966,17 +970,11 @@ do { if (cc_prev_status.flags & CC_IN_68
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long)(NUM))
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- asm_fprintf (FILE, (MOTOROLA \
- ? "\tmove.l %s,-(%Rsp)\n" \
- : "\tmovel %s,%Rsp@-\n"), \
- reg_names[REGNO])
+#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
+ asm_fprintf (FILE, "\tmove%.l %s,{-(%Rsp)|%Rsp@-}\n", reg_names[REGNO])
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- asm_fprintf (FILE, (MOTOROLA \
- ? "\tmove.l (%Rsp)+,%s\n" \
- : "\tmovel %Rsp@+,%s\n"), \
- reg_names[REGNO])
+#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
+ asm_fprintf (FILE, "\tmove%.l {(%Rsp)+|%Rsp@+},%s\n", reg_names[REGNO])
/* The m68k does not use absolute case-vectors, but we must define this macro
anyway. */
Index: gcc/config/m68k/m68k.md
===================================================================
--- gcc/config/m68k/m68k.md (revision 127798)
+++ gcc/config/m68k/m68k.md (working copy)
@@ -612,7 +612,7 @@ (define_insn "movsi_const0"
{
/* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
if (TUNE_68040_60)
- return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
+ return "lea 0{.|:}w,%0";
else
return "sub%.l %0,%0";
}
@@ -848,7 +848,7 @@ (define_insn ""
{
/* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
if (TUNE_68040_60)
- return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
+ return "lea 0{.|:}w,%0";
else
return "sub%.l %0,%0";
}
@@ -2080,7 +2080,7 @@ (define_insn "addsi_lshrsi_31"
operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
}
output_asm_insn ("move%.l %1,%0", operands);
- output_asm_insn (MOTOROLA ? "jbpl %l3" : "jpl %l3", operands);
+ output_asm_insn ("j{b}pl %l3", operands);
output_asm_insn ("addq%.l #1,%2", operands);
(*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (operands[3]));
@@ -2166,7 +2166,7 @@ (define_insn "addhi3"
}
}
if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
- return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
+ return "lea {(%c2,%0)|%0@(%c2)},%0";
}
return "add%.w %2,%0";
})
@@ -2221,7 +2221,7 @@ (define_insn ""
}
}
if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
- return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
+ return "lea {(%c1,%0)|%0@(%c1)},%0";
}
return "add%.w %1,%0";
})
@@ -2270,7 +2270,7 @@ (define_insn ""
}
}
if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
- return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
+ return "lea {(%c1,%0)|%0@(%c1)},%0";
}
return "add%.w %1,%0";
})
@@ -2607,9 +2607,7 @@ (define_insn "mulhi3"
(mult:HI (match_operand:HI 1 "general_operand" "%0")
(match_operand:HI 2 "general_src_operand" "dmSn")))]
""
-{
- return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
-})
+ "muls{.w} %2,%0")
(define_insn "mulhisi3"
[(set (match_operand:SI 0 "nonimmediate_operand" "=d")
@@ -2618,9 +2616,7 @@ (define_insn "mulhisi3"
(sign_extend:SI
(match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
""
-{
- return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
-})
+ "muls{.w} %2,%0")
(define_insn ""
[(set (match_operand:SI 0 "nonimmediate_operand" "=d")
@@ -2628,9 +2624,7 @@ (define_insn ""
(match_operand:HI 1 "nonimmediate_operand" "%0"))
(match_operand:SI 2 "const_int_operand" "n")))]
"INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
-{
- return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
-})
+ "muls{.w} %2,%0")
(define_expand "mulsi3"
[(set (match_operand:SI 0 "nonimmediate_operand" "")
@@ -2661,9 +2655,7 @@ (define_insn "umulhisi3"
(zero_extend:SI
(match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
""
-{
- return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
-})
+ "mulu{.w} %2,%0")
(define_insn ""
[(set (match_operand:SI 0 "nonimmediate_operand" "=d")
@@ -2671,9 +2663,7 @@ (define_insn ""
(match_operand:HI 1 "nonimmediate_operand" "%0"))
(match_operand:SI 2 "const_int_operand" "n")))]
"INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
-{
- return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
-})
+ "mulu{.w} %2,%0")
;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
;; proper matching constraint. This is because the matching is between
@@ -3092,10 +3082,7 @@ (define_insn "divmodhi4"
(mod:HI (match_dup 1) (match_dup 2)))]
"!TARGET_COLDFIRE || TARGET_CF_HWDIV"
{
- output_asm_insn (MOTOROLA ?
- "ext%.l %0\;divs%.w %2,%0" :
- "extl %0\;divs %2,%0",
- operands);
+ output_asm_insn ("ext%.l %0\;divs{.w} %2,%0", operands);
if (!find_reg_note(insn, REG_UNUSED, operands[3]))
{
CC_STATUS_INIT;
@@ -3114,15 +3101,9 @@ (define_insn "udivmodhi4"
"!TARGET_COLDFIRE || TARGET_CF_HWDIV"
{
if (ISA_HAS_MVS_MVZ)
- output_asm_insn (MOTOROLA ?
- "mvz%.w %0,%0\;divu%.w %2,%0" :
- "mvz%.w %0,%0\;divu %2,%0",
- operands);
+ output_asm_insn ("mvz%.w %0,%0\;divu{.w} %2,%0", operands);
else
- output_asm_insn (MOTOROLA ?
- "and%.l #0xFFFF,%0\;divu%.w %2,%0" :
- "and%.l #0xFFFF,%0\;divu %2,%0",
- operands);
+ output_asm_insn ("and%.l #0xFFFF,%0\;divu{.w} %2,%0", operands);
if (!find_reg_note(insn, REG_UNUSED, operands[3]))
{
@@ -5880,19 +5861,14 @@ (define_insn "beq0_di"
{
CC_STATUS_INIT;
if (which_alternative == 1)
- {
- if (MOTOROLA)
- return "move%.l %0,%2\;or%.l %0,%2\;jbeq %l1";
- else
- return "move%.l %0,%2\;or%.l %0,%2\;jeq %l1";
- }
+ return "move%.l %0,%2\;or%.l %0,%2\;j{b}eq %l1";
if ((cc_prev_status.value1
&& rtx_equal_p (cc_prev_status.value1, operands[0]))
|| (cc_prev_status.value2
&& rtx_equal_p (cc_prev_status.value2, operands[0])))
{
cc_status = cc_prev_status;
- return MOTOROLA ? "jbeq %l1" : "jeq %l1";
+ return "j{b}eq %l1";
}
if (GET_CODE (operands[0]) == REG)
operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
@@ -5903,40 +5879,17 @@ (define_insn "beq0_di"
if (reg_overlap_mentioned_p (operands[2], operands[0]))
{
if (reg_overlap_mentioned_p (operands[2], operands[3]))
- {
- if (MOTOROLA)
- return "or%.l %0,%2\;jbeq %l1";
- else
- return "or%.l %0,%2\;jeq %l1";
- }
+ return "or%.l %0,%2\;j{b}eq %l1";
else
- {
- if (MOTOROLA)
- return "or%.l %3,%2\;jbeq %l1";
- else
- return "or%.l %3,%2\;jeq %l1";
- }
+ return "or%.l %3,%2\;j{b}eq %l1";
}
- if (MOTOROLA)
- return "move%.l %0,%2\;or%.l %3,%2\;jbeq %l1";
- else
- return "move%.l %0,%2\;or%.l %3,%2\;jeq %l1";
+ return "move%.l %0,%2\;or%.l %3,%2\;j{b}eq %l1";
}
operands[4] = gen_label_rtx();
if (TARGET_68020 || TARGET_COLDFIRE)
- {
- if (MOTOROLA)
- output_asm_insn ("tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1", operands);
- else
- output_asm_insn ("tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1", operands);
- }
+ output_asm_insn ("tst%.l %0\;j{b}ne %l4\;tst%.l %3\;j{b}eq %l1", operands);
else
- {
- if (MOTOROLA)
- output_asm_insn ("cmp%.w #0,%0\;jbne %l4\;cmp%.w #0,%3\;jbeq %l1", operands);
- else
- output_asm_insn ("cmp%.w #0,%0\;jne %l4\;cmp%.w #0,%3\;jeq %l1", operands);
- }
+ output_asm_insn ("cmp%.w #0,%0\;j{b}ne %l4\;cmp%.w #0,%3\;j{b}eq %l1", operands);
(*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (operands[4]));
return "";
@@ -5957,7 +5910,7 @@ (define_insn "bne0_di"
&& rtx_equal_p (cc_prev_status.value2, operands[0])))
{
cc_status = cc_prev_status;
- return MOTOROLA ? "jbne %l1" : "jne %l1";
+ return "j{b}ne %l1";
}
CC_STATUS_INIT;
if (GET_CODE (operands[0]) == REG)
@@ -5969,39 +5922,16 @@ (define_insn "bne0_di"
if (reg_overlap_mentioned_p (operands[2], operands[0]))
{
if (reg_overlap_mentioned_p (operands[2], operands[3]))
- {
- if (MOTOROLA)
- return "or%.l %0,%2\;jbne %l1";
- else
- return "or%.l %0,%2\;jne %l1";
- }
+ return "or%.l %0,%2\;j{b}ne %l1";
else
- {
- if (MOTOROLA)
- return "or%.l %3,%2\;jbne %l1";
- else
- return "or%.l %3,%2\;jne %l1";
- }
+ return "or%.l %3,%2\;j{b}ne %l1";
}
- if (MOTOROLA)
- return "move%.l %0,%2\;or%.l %3,%2\;jbne %l1";
- else
- return "move%.l %0,%2\;or%.l %3,%2\;jne %l1";
+ return "move%.l %0,%2\;or%.l %3,%2\;j{b}ne %l1";
}
if (TARGET_68020 || TARGET_COLDFIRE)
- {
- if (MOTOROLA)
- return "tst%.l %0\;jbne %l1\;tst%.l %3\;jbne %l1";
- else
- return "tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1";
- }
+ return "tst%.l %0\;j{b}ne %l1\;tst%.l %3\;j{b}ne %l1";
else
- {
- if (MOTOROLA)
- return "cmp%.w #0,%0\;jbne %l1\;cmp%.w #0,%3\;jbne %l1";
- else
- return "cmp%.w #0,%0\;jne %l1\;cmp%.w #0,%3\;jne %l1";
- }
+ return "cmp%.w #0,%0\;j{b}ne %l1\;cmp%.w #0,%3\;j{b}ne %l1";
})
(define_insn "bge0_di"
@@ -6019,13 +5949,9 @@ (define_insn "bge0_di"
{
cc_status = cc_prev_status;
if (cc_status.flags & CC_REVERSED)
- {
- return MOTOROLA ? "jble %l1" : "jle %l1";
- }
+ return "j{b}le %l1";
else
- {
- return MOTOROLA ? "jbpl %l1" : "jpl %l1";
- }
+ return "j{b}pl %l1";
}
CC_STATUS_INIT;
if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
@@ -6035,7 +5961,7 @@ (define_insn "bge0_di"
/* On an address reg, cmpw may replace cmpl. */
output_asm_insn("cmp%.w #0,%0", operands);
}
- return MOTOROLA ? "jbpl %l1" : "jpl %l1";
+ return "j{b}pl %l1";
})
(define_insn "blt0_di"
@@ -6053,13 +5979,9 @@ (define_insn "blt0_di"
{
cc_status = cc_prev_status;
if (cc_status.flags & CC_REVERSED)
- {
- return MOTOROLA ? "jbgt %l1" : "jgt %l1";
- }
+ return "j{b}gt %l1";
else
- {
- return MOTOROLA ? "jbmi %l1" : "jmi %l1";
- }
+ return "j{b}mi %l1";
}
CC_STATUS_INIT;
if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
@@ -6070,7 +5992,7 @@ (define_insn "blt0_di"
output_asm_insn("cmp%.w #0,%0", operands);
}
- return MOTOROLA ? "jbmi %l1" : "jmi %l1";
+ return "j{b}mi %l1";
})
(define_insn "beq"
@@ -6081,10 +6003,7 @@ (define_insn "beq"
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
- else
- OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
+ OUTPUT_JUMP ("j{b}eq %l0", "f{b|j}eq %l0", "j{b}eq %l0");
})
(define_insn "bne"
@@ -6095,10 +6014,7 @@ (define_insn "bne"
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
- else
- OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
+ OUTPUT_JUMP ("j{b}ne %l0", "f{b|j}ne %l0", "j{b}ne %l0");
})
(define_insn "bgt"
@@ -6109,10 +6025,7 @@ (define_insn "bgt"
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbgt %l0", "fbgt %l0", 0);
- else
- OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
+ OUTPUT_JUMP ("j{b}gt %l0", "f{b|j}gt %l0", 0);
})
(define_insn "bgtu"
@@ -6122,9 +6035,7 @@ (define_insn "bgtu"
(label_ref (match_operand 0 "" ""))
(pc)))]
""
-{
- return MOTOROLA ? "jbhi %l0" : "jhi %l0";
-})
+ "j{b}hi %l0")
(define_insn "blt"
[(set (pc)
@@ -6134,10 +6045,7 @@ (define_insn "blt"
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jblt %l0", "fblt %l0", "jbmi %l0");
- else
- OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
+ OUTPUT_JUMP ("j{b}lt %l0", "f{b|j}lt %l0", "j{b}mi %l0");
})
(define_insn "bltu"
@@ -6147,9 +6055,8 @@ (define_insn "bltu"
(label_ref (match_operand 0 "" ""))
(pc)))]
""
-{
- return MOTOROLA ? "jbcs %l0" : "jcs %l0";
-})
+ "j{b}cs %l0";
+)
(define_insn "bge"
[(set (pc)
@@ -6159,10 +6066,7 @@ (define_insn "bge"
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbge %l0", "fbge %l0", "jbpl %l0");
- else
- OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
+ OUTPUT_JUMP ("j{b}ge %l0", "f{b|j}ge %l0", "j{b}pl %l0");
})
(define_insn "bgeu"
@@ -6172,9 +6076,7 @@ (define_insn "bgeu"
(label_ref (match_operand 0 "" ""))
(pc)))]
""
-{
- return MOTOROLA ? "jbcc %l0" : "jcc %l0";
-})
+ "j{b}cc %l0")
(define_insn "ble"
[(set (pc)
@@ -6184,10 +6086,7 @@ (define_insn "ble"
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jble %l0", "fble %l0", 0);
- else
- OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
+ OUTPUT_JUMP ("j{b}le %l0", "f{b|j}le %l0", 0);
})
(define_insn "bleu"
@@ -6197,9 +6096,7 @@ (define_insn "bleu"
(label_ref (match_operand 0 "" ""))
(pc)))]
""
-{
- return MOTOROLA ? "jbls %l0" : "jls %l0";
-})
+ "j{b}ls %l0")
(define_insn "bordered"
[(set (pc)
@@ -6209,7 +6106,7 @@ (define_insn "bordered"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbor %l0" : "fjor %l0";
+ return "f{b|j}or %l0";
})
(define_insn "bunordered"
@@ -6220,7 +6117,7 @@ (define_insn "bunordered"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbun %l0" : "fjun %l0";
+ return "f{b|j}un %l0";
})
(define_insn "buneq"
@@ -6231,7 +6128,7 @@ (define_insn "buneq"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
+ return "f{b|j}ueq %l0";
})
(define_insn "bunge"
@@ -6242,7 +6139,7 @@ (define_insn "bunge"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbuge %l0" : "fjuge %l0";
+ return "f{b|j}uge %l0";
})
(define_insn "bungt"
@@ -6253,7 +6150,7 @@ (define_insn "bungt"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbugt %l0" : "fjugt %l0";
+ return "f{b|j}ugt %l0";
})
(define_insn "bunle"
@@ -6264,7 +6161,7 @@ (define_insn "bunle"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbule %l0" : "fjule %l0";
+ return "f{b|j}ule %l0";
})
(define_insn "bunlt"
@@ -6275,7 +6172,7 @@ (define_insn "bunlt"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbult %l0" : "fjult %l0";
+ return "f{b|j}ult %l0";
})
(define_insn "bltgt"
@@ -6286,7 +6183,7 @@ (define_insn "bltgt"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
+ return "f{b|j}ogl %l0";
})
;; Negated conditional jump instructions.
@@ -6299,10 +6196,7 @@ (define_insn ""
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
- else
- OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
+ OUTPUT_JUMP ("j{b}ne %l0", "f{b|j}ne %l0", "j{b}ne %l0");
})
(define_insn ""
@@ -6313,10 +6207,7 @@ (define_insn ""
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
- else
- OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
+ OUTPUT_JUMP ("j{b}eq %l0", "f{b|j}eq %l0", "j{b}eq %l0");
})
(define_insn ""
@@ -6327,10 +6218,7 @@ (define_insn ""
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jble %l0", "fbngt %l0", 0);
- else
- OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
+ OUTPUT_JUMP ("j{b}le %l0", "f{b|j}ngt %l0", 0);
})
(define_insn ""
@@ -6340,9 +6228,7 @@ (define_insn ""
(pc)
(label_ref (match_operand 0 "" ""))))]
""
-{
- return MOTOROLA ? "jbls %l0" : "jls %l0";
-})
+ "j{b}ls %l0")
(define_insn ""
[(set (pc)
@@ -6352,10 +6238,7 @@ (define_insn ""
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbge %l0", "fbnlt %l0", "jbpl %l0");
- else
- OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
+ OUTPUT_JUMP ("j{b}ge %l0", "f{b|j}nlt %l0", "j{b}pl %l0");
})
(define_insn ""
@@ -6365,9 +6248,7 @@ (define_insn ""
(pc)
(label_ref (match_operand 0 "" ""))))]
""
-{
- return MOTOROLA ? "jbcc %l0" : "jcc %l0";
-})
+ "j{b}cc %l0")
(define_insn ""
[(set (pc)
@@ -6377,10 +6258,7 @@ (define_insn ""
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jblt %l0", "fbnge %l0", "jbmi %l0");
- else
- OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
+ OUTPUT_JUMP ("j{b}lt %l0", "f{b|j}nge %l0", "j{b}mi %l0");
})
(define_insn ""
@@ -6390,9 +6268,7 @@ (define_insn ""
(pc)
(label_ref (match_operand 0 "" ""))))]
""
-{
- return MOTOROLA ? "jbcs %l0" : "jcs %l0";
-})
+ "j{b}cs %l0")
(define_insn ""
[(set (pc)
@@ -6402,10 +6278,7 @@ (define_insn ""
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbgt %l0", "fbnle %l0", 0);
- else
- OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
+ OUTPUT_JUMP ("j{b}gt %l0", "f{b|j}nle %l0", 0);
})
(define_insn ""
@@ -6415,9 +6288,7 @@ (define_insn ""
(pc)
(label_ref (match_operand 0 "" ""))))]
""
-{
- return MOTOROLA ? "jbhi %l0" : "jhi %l0";
-})
+ "j{b}hi %l0")
(define_insn "*bordered_rev"
[(set (pc)
@@ -6427,7 +6298,7 @@ (define_insn "*bordered_rev"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbun %l0" : "fjun %l0";
+ return "f{b|j}un %l0";
})
(define_insn "*bunordered_rev"
@@ -6438,7 +6309,7 @@ (define_insn "*bunordered_rev"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbor %l0" : "fjor %l0";
+ return "f{b|j}or %l0";
})
(define_insn "*buneq_rev"
@@ -6449,7 +6320,7 @@ (define_insn "*buneq_rev"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
+ return "f{b|j}ogl %l0";
})
(define_insn "*bunge_rev"
@@ -6460,7 +6331,7 @@ (define_insn "*bunge_rev"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbolt %l0" : "fjolt %l0";
+ return "f{b|j}olt %l0";
})
(define_insn "*bungt_rev"
@@ -6471,7 +6342,7 @@ (define_insn "*bungt_rev"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbole %l0" : "fjole %l0";
+ return "f{b|j}ole %l0";
})
(define_insn "*bunle_rev"
@@ -6482,7 +6353,7 @@ (define_insn "*bunle_rev"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbogt %l0" : "fjogt %l0";
+ return "f{b|j}ogt %l0";
})
(define_insn "*bunlt_rev"
@@ -6493,7 +6364,7 @@ (define_insn "*bunlt_rev"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fboge %l0" : "fjoge %l0";
+ return "f{b|j}oge %l0";
})
(define_insn "*bltgt_rev"
@@ -6504,7 +6375,7 @@ (define_insn "*bltgt_rev"
"TARGET_HARD_FLOAT"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
+ return "f{b|j}ueq %l0";
})
;; Unconditional and other jump instructions
@@ -6512,9 +6383,7 @@ (define_insn "jump"
[(set (pc)
(label_ref (match_operand 0 "" "")))]
""
-{
- return MOTOROLA ? "jbra %l0" : "jra %l0";
-})
+ "j{b}ra %l0")
(define_expand "tablejump"
[(parallel [(set (pc) (match_operand 0 "" ""))
@@ -6532,9 +6401,7 @@ (define_insn ""
[(set (pc) (match_operand:SI 0 "register_operand" "a"))
(use (label_ref (match_operand 1 "" "")))]
""
-{
- return MOTOROLA ? "jmp (%0)" : "jmp %0@";
-})
+ "jmp {(%0)|%0@}")
;; Jump to variable address from dispatch table of relative addresses.
(define_insn ""
@@ -6550,14 +6417,12 @@ (define_insn ""
if (TARGET_COLDFIRE)
{
if (ADDRESS_REG_P (operands[0]))
- return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)";
- else if (MOTOROLA)
- return "ext%.l %0\;jmp (2,pc,%0.l)";
+ return "jmp {(2,pc,%0.l)|pc@(2,%0:l)}";
else
- return "extl %0\;jmp pc@(2,%0:l)";
+ return "ext%.l %0\;jmp {(2,pc,%0.l)|pc@(2,%0:l)}";
}
else
- return MOTOROLA ? "jmp (2,pc,%0.w)" : "jmp pc@(2,%0:w)";
+ return "jmp {(2,pc,%0.w)|pc@(2,%0:w)}";
#endif
})
@@ -6578,12 +6443,8 @@ (define_insn ""
if (DATA_REG_P (operands[0]))
return "dbra %0,%l1";
if (GET_CODE (operands[0]) == MEM)
- return MOTOROLA ?
- "subq%.w #1,%0\;jbcc %l1" :
- "subqw #1,%0\;jcc %l1";
- return MOTOROLA ?
- "subq%.w #1,%0\;cmp%.w #-1,%0\;jbne %l1" :
- "subqw #1,%0\;cmpw #-1,%0\;jne %l1";
+ return "subq%.w #1,%0\;j{b}cc %l1";
+ return "subq%.w #1,%0\;cmp%.w #-1,%0\;j{b}ne %l1";
})
(define_insn ""
@@ -6600,16 +6461,10 @@ (define_insn ""
{
CC_STATUS_INIT;
if (DATA_REG_P (operands[0]))
- return MOTOROLA ?
- "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jbcc %l1" :
- "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
+ return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;j{b}cc %l1";
if (GET_CODE (operands[0]) == MEM)
- return MOTOROLA ?
- "subq%.l #1,%0\;jbcc %l1" :
- "subq%.l #1,%0\;jcc %l1";
- return MOTOROLA ?
- "subq.l #1,%0\;cmp.l #-1,%0\;jbne %l1" :
- "subql #1,%0\;cmpl #-1,%0\;jne %l1";
+ return "subq%.l #1,%0\;j{b}cc %l1";
+ return "subq%.l #1,%0\;cmp%.l #-1,%0\;j{b}ne %l1";
})
;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
@@ -6631,12 +6486,8 @@ (define_insn ""
if (DATA_REG_P (operands[0]))
return "dbra %0,%l1";
if (GET_CODE (operands[0]) == MEM)
- return MOTOROLA ?
- "subq%.w #1,%0\;jbcc %l1" :
- "subq%.w #1,%0\;jcc %l1";
- return MOTOROLA ?
- "subq.w #1,%0\;cmp.w #-1,%0\;jbne %l1" :
- "subqw #1,%0\;cmpw #-1,%0\;jne %l1";
+ return "subq%.w #1,%0\;j{b}cc %l1";
+ return "subq%.w #1,%0\;cmp%.w #-1,%0\;j{b}ne %l1";
})
(define_expand "decrement_and_branch_until_zero"
@@ -6668,16 +6519,10 @@ (define_insn ""
{
CC_STATUS_INIT;
if (DATA_REG_P (operands[0]))
- return MOTOROLA ?
- "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jbcc %l1" :
- "dbra %0,%l1\;clr%.w %0\;subql #1,%0\;jcc %l1";
+ return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;j{b}cc %l1";
if (GET_CODE (operands[0]) == MEM)
- return MOTOROLA ?
- "subq%.l #1,%0\;jbcc %l1" :
- "subql #1,%0\;jcc %l1";
- return MOTOROLA ?
- "subq.l #1,%0\;cmp.l #-1,%0\;jbne %l1" :
- "subql #1,%0\;cmpl #-1,%0\;jne %l1";
+ return "subq%.l #1,%0\;j{b}cc %l1";
+ return "subq%.l #1,%0\;cmp%.l #-1,%0\;j{b}ne %l1";
})
(define_expand "sibcall"
@@ -6949,7 +6794,7 @@ (define_insn "load_got"
if (TARGET_ID_SHARED_LIBRARY)
{
operands[1] = gen_rtx_REG (Pmode, PIC_REG);
- return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0";
+ return "move%.l {%?(%1)|%1@(%?)},%0";
}
else if (MOTOROLA)
{
@@ -7051,10 +6896,8 @@ (define_peephole
{
if (TUNE_68040)
output_asm_insn ("add%.w %1,%0", xoperands);
- else if (MOTOROLA)
- output_asm_insn ("lea (%c1,%0),%0", xoperands);
else
- output_asm_insn ("lea %0@(%c1),%0", xoperands);
+ output_asm_insn ("lea {(%c1,%0)|%0@(%c1)},%0", xoperands);
}
else
output_asm_insn ("add%.l %1,%0", xoperands);
@@ -7095,10 +6938,8 @@ (define_peephole
{
if (TUNE_68040)
output_asm_insn ("add%.w %1,%0", xoperands);
- else if (MOTOROLA)
- output_asm_insn ("lea (%c1,%0),%0", xoperands);
else
- output_asm_insn ("lea %0@(%c1),%0", xoperands);
+ output_asm_insn ("lea {(%c1,%0)|%0@(%c1)},%0", xoperands);
}
else
output_asm_insn ("add%.l %1,%0", xoperands);