Commit c49c4c85 by Eric Botcazou

invoke.texi (SPARC options): Document -mfix-at697f.

	* doc/invoke.texi (SPARC options): Document -mfix-at697f.
	* config/sparc/sparc.opt (mfix-at697f): New option.
	* config/sparc/sparc.c (TARGET_MACHINE_DEPENDENT_REORG): Define.
	(sparc_reorg): New function.

From-SVN: r179921
parent 83e0724e
...@@ -444,6 +444,7 @@ static void sparc_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, ...@@ -444,6 +444,7 @@ static void sparc_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
HOST_WIDE_INT, tree); HOST_WIDE_INT, tree);
static bool sparc_can_output_mi_thunk (const_tree, HOST_WIDE_INT, static bool sparc_can_output_mi_thunk (const_tree, HOST_WIDE_INT,
HOST_WIDE_INT, const_tree); HOST_WIDE_INT, const_tree);
static void sparc_reorg (void);
static struct machine_function * sparc_init_machine_status (void); static struct machine_function * sparc_init_machine_status (void);
static bool sparc_cannot_force_const_mem (enum machine_mode, rtx); static bool sparc_cannot_force_const_mem (enum machine_mode, rtx);
static rtx sparc_tls_get_addr (void); static rtx sparc_tls_get_addr (void);
...@@ -582,6 +583,9 @@ char sparc_hard_reg_printed[8]; ...@@ -582,6 +583,9 @@ char sparc_hard_reg_printed[8];
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
#define TARGET_ASM_CAN_OUTPUT_MI_THUNK sparc_can_output_mi_thunk #define TARGET_ASM_CAN_OUTPUT_MI_THUNK sparc_can_output_mi_thunk
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG sparc_reorg
#undef TARGET_RTX_COSTS #undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS sparc_rtx_costs #define TARGET_RTX_COSTS sparc_rtx_costs
#undef TARGET_ADDRESS_COST #undef TARGET_ADDRESS_COST
...@@ -10389,6 +10393,104 @@ sparc_can_output_mi_thunk (const_tree thunk_fndecl ATTRIBUTE_UNUSED, ...@@ -10389,6 +10393,104 @@ sparc_can_output_mi_thunk (const_tree thunk_fndecl ATTRIBUTE_UNUSED,
return (vcall_offset >= -32768 || ! fixed_regs[5]); return (vcall_offset >= -32768 || ! fixed_regs[5]);
} }
/* We use the machine specific reorg pass to enable workarounds for errata. */
static void
sparc_reorg (void)
{
rtx insn, next;
/* The only erratum we handle for now is that of the AT697F processor. */
if (!sparc_fix_at697f)
return;
/* We need to have the (essentially) final form of the insn stream in order
to properly detect the various hazards. Run delay slot scheduling. */
if (optimize > 0 && flag_delayed_branch)
dbr_schedule (get_insns ());
/* Now look for specific patterns in the insn stream. */
for (insn = get_insns (); insn; insn = next)
{
bool insert_nop = false;
rtx set;
/* Look for a single-word load into an odd-numbered FP register. */
if (NONJUMP_INSN_P (insn)
&& (set = single_set (insn)) != NULL_RTX
&& GET_MODE_SIZE (GET_MODE (SET_SRC (set))) == 4
&& MEM_P (SET_SRC (set))
&& REG_P (SET_DEST (set))
&& REGNO (SET_DEST (set)) > 31
&& REGNO (SET_DEST (set)) % 2 != 0)
{
/* The wrong dependency is on the enclosing double register. */
unsigned int x = REGNO (SET_DEST (set)) - 1;
unsigned int src1, src2, dest;
int code;
/* If the insn has a delay slot, then it cannot be problematic. */
next = next_active_insn (insn);
if (NONJUMP_INSN_P (next) && GET_CODE (PATTERN (next)) == SEQUENCE)
code = -1;
else
{
extract_insn (next);
code = INSN_CODE (next);
}
switch (code)
{
case CODE_FOR_adddf3:
case CODE_FOR_subdf3:
case CODE_FOR_muldf3:
case CODE_FOR_divdf3:
dest = REGNO (recog_data.operand[0]);
src1 = REGNO (recog_data.operand[1]);
src2 = REGNO (recog_data.operand[2]);
if (src1 != src2)
{
/* Case [1-4]:
ld [address], %fx+1
FPOPd %f{x,y}, %f{y,x}, %f{x,y} */
if ((src1 == x || src2 == x)
&& (dest == src1 || dest == src2))
insert_nop = true;
}
else
{
/* Case 5:
ld [address], %fx+1
FPOPd %fx, %fx, %fx */
if (src1 == x
&& dest == src1
&& (code == CODE_FOR_adddf3 || code == CODE_FOR_muldf3))
insert_nop = true;
}
break;
case CODE_FOR_sqrtdf2:
dest = REGNO (recog_data.operand[0]);
src1 = REGNO (recog_data.operand[1]);
/* Case 6:
ld [address], %fx+1
fsqrtd %fx, %fx */
if (src1 == x && dest == src1)
insert_nop = true;
break;
default:
break;
}
}
else
next = NEXT_INSN (insn);
if (insert_nop)
emit_insn_after (gen_nop (), insn);
}
}
/* How to allocate a 'struct machine_function'. */ /* How to allocate a 'struct machine_function'. */
static struct machine_function * static struct machine_function *
......
...@@ -184,6 +184,11 @@ mstd-struct-return ...@@ -184,6 +184,11 @@ mstd-struct-return
Target Report RejectNegative Var(sparc_std_struct_return) Target Report RejectNegative Var(sparc_std_struct_return)
Enable strict 32-bit psABI struct return checking. Enable strict 32-bit psABI struct return checking.
mfix-at697f
Target Report RejectNegative Var(sparc_fix_at697f)
Enable workaround for single erratum of AT697F processor
(corresponding to erratum #13 of AT697E processor)
Mask(LITTLE_ENDIAN) Mask(LITTLE_ENDIAN)
;; Generate code for little-endian ;; Generate code for little-endian
......
...@@ -885,7 +885,8 @@ See RS/6000 and PowerPC Options. ...@@ -885,7 +885,8 @@ See RS/6000 and PowerPC Options.
-munaligned-doubles -mno-unaligned-doubles @gol -munaligned-doubles -mno-unaligned-doubles @gol
-mv8plus -mno-v8plus -mvis -mno-vis @gol -mv8plus -mno-v8plus -mvis -mno-vis @gol
-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
-mfmaf -mno-fmaf -mpopc -mno-popc} -mfmaf -mno-fmaf -mpopc -mno-popc @gol
-mfix-at697f}
@emph{SPU Options} @emph{SPU Options}
@gccoptlist{-mwarn-reloc -merror-reloc @gol @gccoptlist{-mwarn-reloc -merror-reloc @gol
...@@ -4001,19 +4002,19 @@ The message is in keeping with the output of @option{-fstack-usage}. ...@@ -4001,19 +4002,19 @@ The message is in keeping with the output of @option{-fstack-usage}.
If the stack usage is fully static but exceeds the specified amount, it's: If the stack usage is fully static but exceeds the specified amount, it's:
@smallexample @smallexample
  warning: stack usage is 1120 bytes warning: stack usage is 1120 bytes
@end smallexample @end smallexample
@item @item
If the stack usage is (partly) dynamic but bounded, it's: If the stack usage is (partly) dynamic but bounded, it's:
@smallexample @smallexample
  warning: stack usage might be 1648 bytes warning: stack usage might be 1648 bytes
@end smallexample @end smallexample
@item @item
If the stack usage is (partly) dynamic and not bounded, it's: If the stack usage is (partly) dynamic and not bounded, it's:
@smallexample @smallexample
  warning: stack usage might be unbounded warning: stack usage might be unbounded
@end smallexample @end smallexample
@end itemize @end itemize
...@@ -17549,6 +17550,11 @@ With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC ...@@ -17549,6 +17550,11 @@ With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf} Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
when targetting a cpu that supports such instructions, such as Niagara-3 and when targetting a cpu that supports such instructions, such as Niagara-3 and
later. later.
@item -mfix-at697f
@opindex mfix-at697f
Enable the documented workaround for the single erratum of the Atmel AT697F
processor (which corresponds to erratum #13 of the AT697E processor).
@end table @end table
These @samp{-m} options are supported in addition to the above These @samp{-m} options are supported in addition to the above
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment