v850-protos.h (notice_update_cc): Remove.

* config/v850/v850-protos.h (notice_update_cc): Remove.
	* config/v850/v850.c (v850_compare_op0, v850_compare_op1): Remove.
	(v850_print_operand): Handle 'D' and "d".
	(v850_select_cc_mode): Remove ATTRIBUTE_UNUSED for last argument.
	Add handling of arithmetic/logical operations compared against zero.
	(v850_gen_float_compare): Remove ATTRIBUTE_UNUSED for last argument.
	Do not look at v850_compare_op, instead get mode from last argument.
	(v850_gen_compare): Remove
	(increment_stack): Use addsi3_clobber_flags to avoid splitting failure
	after reload for prologue insns.
	(expand_prologue): Account for CLOBBER of CC_REGNUM in various
	patterns.
	(construct_save_jarl): Likewise.
	(TARGET_FLAGS_REGNUM): Define.
	* config/v850/v850.h (v850_compare_op0, v850_compare_op1): Remove.
	(NOTICE_UPDATE_CC): Remove.
	* config/v850/v850.md (v850_tst1): Use (reg:CCZ CC_REGNUM) rather
	than cc0.  Conditionalize on reload_completed.
	(cmpsi_insn, setfcc_insn): Likewise.
	(tst1 splitter): Turn into define_and_split which sets the flags
	after reload.
	(cstoresi4, cbranchsf4, cbranchdf4, cbranchsi4_insn): Likewise.
	(cbranchsi4, branch_normal, branch_invert): Do not expose cc0 here.
	(cstoresf4, cstoredf4): Clobber the flags.
	(cmpsi, cmpsf, cmpdf): Remove expanders.
	(setf_insn): Remove pattern.
	(addsi3): Turn into define_and_split which clobbers the flags after
	reload and a suitable pattern (addsi3_clobber_flags) for use after
	reload.
	(subsi3, negsi2, andsi3, iorsi3, xorsi3, one_cmplsi2) Likewise.
	(ashlsi3, ashlsi3_v850e2, lshrsi3, lsh4si3_v850e2): Likewise.
	(ashrsi3, ashrsi3_v850e2): Likewise.
	(bins): Clobber the flags.
	(movsicc_normal_cc, movsicc_normal, movsicc_tst1): Likewise.
	(movsicc_tst1_revesed, sasf, swap and rotate patterns): Likewise.
	(fix_loop_counter, call_internal_short, call_internal_long): Likewise.
	(call_value_internal_short, call_value_internal_long): Likewise.
	(callt_save_interrupt, callt_return_interrupt): Likewise.
	(save_interrupt, return_interrupt): Likewise.
	(callt_save_all_interrupt, save_all_interrupt): Likewise.
	(_save_all_interrupt, callt_restore_all_interrupt): Likewise.
	(restore_all_interrupt, _restore_all_interrupt): Likewise.
	(All FP comparisons): Only allow after reload has completed.
	(trfsr): Likewise.
	(divh, divhu): Tweak output template.
	(branch_z_normal, branch_z_invert): Remove
	(branch_nz_normal, branch_nz_invert): Likewise.
	(extendhisi_insn, extendqisi_insn): Do not clobber flags.

Co-Authored-By: Austin Law <austinklaw@gmail.com>

From-SVN: r262190
This commit is contained in:
Jeff Law 2018-06-27 12:31:10 -06:00 committed by Jeff Law
parent 03e32fb748
commit 1ec0eb08ce
5 changed files with 495 additions and 338 deletions

View file

@ -1,6 +1,55 @@
2018-06-27 Jeff Law <law@redhat.com>
Austin Law <austinklaw@gmail.com>
* config/v850/v850-protos.h (notice_update_cc): Remove.
* config/v850/v850.c (v850_compare_op0, v850_compare_op1): Remove.
(v850_print_operand): Handle 'D' and "d".
(v850_select_cc_mode): Remove ATTRIBUTE_UNUSED for last argument.
Add handling of arithmetic/logical operations compared against zero.
(v850_gen_float_compare): Remove ATTRIBUTE_UNUSED for last argument.
Do not look at v850_compare_op, instead get mode from last argument.
(v850_gen_compare): Remove
(increment_stack): Use addsi3_clobber_flags to avoid splitting failure
after reload for prologue insns.
(expand_prologue): Account for CLOBBER of CC_REGNUM in various
patterns.
(construct_save_jarl): Likewise.
(TARGET_FLAGS_REGNUM): Define.
* config/v850/v850.h (v850_compare_op0, v850_compare_op1): Remove.
(NOTICE_UPDATE_CC): Remove.
* config/v850/v850.md (v850_tst1): Use (reg:CCZ CC_REGNUM) rather
than cc0. Conditionalize on reload_completed.
(cmpsi_insn, setfcc_insn): Likewise.
(tst1 splitter): Turn into define_and_split which sets the flags
after reload.
(cstoresi4, cbranchsf4, cbranchdf4, cbranchsi4_insn): Likewise.
(cbranchsi4, branch_normal, branch_invert): Do not expose cc0 here.
(cstoresf4, cstoredf4): Clobber the flags.
(cmpsi, cmpsf, cmpdf): Remove expanders.
(setf_insn): Remove pattern.
(addsi3): Turn into define_and_split which clobbers the flags after
reload and a suitable pattern (addsi3_clobber_flags) for use after
reload.
(subsi3, negsi2, andsi3, iorsi3, xorsi3, one_cmplsi2) Likewise.
(ashlsi3, ashlsi3_v850e2, lshrsi3, lsh4si3_v850e2): Likewise.
(ashrsi3, ashrsi3_v850e2): Likewise.
(bins): Clobber the flags.
(movsicc_normal_cc, movsicc_normal, movsicc_tst1): Likewise.
(movsicc_tst1_revesed, sasf, swap and rotate patterns): Likewise.
(fix_loop_counter, call_internal_short, call_internal_long): Likewise.
(call_value_internal_short, call_value_internal_long): Likewise.
(callt_save_interrupt, callt_return_interrupt): Likewise.
(save_interrupt, return_interrupt): Likewise.
(callt_save_all_interrupt, save_all_interrupt): Likewise.
(_save_all_interrupt, callt_restore_all_interrupt): Likewise.
(restore_all_interrupt, _restore_all_interrupt): Likewise.
(All FP comparisons): Only allow after reload has completed.
(trfsr): Likewise.
(divh, divhu): Tweak output template.
(branch_z_normal, branch_z_invert): Remove
(branch_nz_normal, branch_nz_invert): Likewise.
(extendhisi_insn, extendqisi_insn): Do not clobber flags.
* config/v850/v850-modes.def (CCZ, CCNZ): Add new modes.
* config/v850/v850.c (notice_update_cc): Remove.
* config/v850/v850.h (CC_OVERFLOW_UNUSABLE): Remove

View file

@ -32,7 +32,6 @@ extern void v850_init_expanders (void);
#ifdef RTX_CODE
extern rtx v850_return_addr (int);
extern const char *output_move_single (rtx *);
extern void notice_update_cc (rtx, rtx_insn *);
extern char * construct_save_jarl (rtx);
extern char * construct_restore_jr (rtx);
#ifdef HAVE_MACHINE_MODES

View file

@ -68,8 +68,6 @@ data_area_stack_element * data_area_stack = NULL;
function is an interrupt handler. */
static int v850_interrupt_cache_p = FALSE;
rtx v850_compare_op0, v850_compare_op1;
/* Whether current function is an interrupt handler. */
static int v850_interrupt_p = FALSE;
@ -418,7 +416,9 @@ v850_print_operand (FILE * file, rtx x, int code)
case 'b':
case 'B':
case 'C':
switch ((code == 'B' || code == 'C')
case 'd':
case 'D':
switch ((code == 'B' || code == 'C' || code == 'D')
? reverse_condition (GET_CODE (x)) : GET_CODE (x))
{
case NE:
@ -434,7 +434,10 @@ v850_print_operand (FILE * file, rtx x, int code)
fprintf (file, "e");
break;
case GE:
fprintf (file, "ge");
if (code == 'D' || code == 'd')
fprintf (file, "p");
else
fprintf (file, "ge");
break;
case GT:
fprintf (file, "gt");
@ -443,7 +446,10 @@ v850_print_operand (FILE * file, rtx x, int code)
fprintf (file, "le");
break;
case LT:
fprintf (file, "lt");
if (code == 'D' || code == 'd')
fprintf (file, "n");
else
fprintf (file, "lt");
break;
case GEU:
fprintf (file, "nl");
@ -905,7 +911,7 @@ output_move_single (rtx * operands)
}
machine_mode
v850_select_cc_mode (enum rtx_code cond, rtx op0, rtx op1 ATTRIBUTE_UNUSED)
v850_select_cc_mode (enum rtx_code cond, rtx op0, rtx op1)
{
if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_FLOAT)
{
@ -927,11 +933,20 @@ v850_select_cc_mode (enum rtx_code cond, rtx op0, rtx op1 ATTRIBUTE_UNUSED)
gcc_unreachable ();
}
}
if (op1 == const0_rtx
&& (cond == EQ || cond == NE || cond == LT || cond == GE)
&& (GET_CODE (op0) == PLUS || GET_CODE (op0) == MINUS
|| GET_CODE (op0) == NEG || GET_CODE (op0) == AND
|| GET_CODE (op0) == IOR || GET_CODE (op0) == XOR
|| GET_CODE (op0) == NOT || GET_CODE (op0) == ASHIFT))
return CCNZmode;
return CCmode;
}
machine_mode
v850_gen_float_compare (enum rtx_code cond, machine_mode mode ATTRIBUTE_UNUSED, rtx op0, rtx op1)
v850_gen_float_compare (enum rtx_code cond, machine_mode mode, rtx op0, rtx op1)
{
if (GET_MODE (op0) == DFmode)
{
@ -960,7 +975,7 @@ v850_gen_float_compare (enum rtx_code cond, machine_mode mode ATTRIBUTE_UNUSED,
gcc_unreachable ();
}
}
else if (GET_MODE (v850_compare_op0) == SFmode)
else if (mode == SFmode)
{
switch (cond)
{
@ -993,25 +1008,6 @@ v850_gen_float_compare (enum rtx_code cond, machine_mode mode ATTRIBUTE_UNUSED,
return v850_select_cc_mode (cond, op0, op1);
}
rtx
v850_gen_compare (enum rtx_code cond, machine_mode mode, rtx op0, rtx op1)
{
if (GET_MODE_CLASS(GET_MODE (op0)) != MODE_FLOAT)
{
emit_insn (gen_cmpsi_insn (op0, op1));
return gen_rtx_fmt_ee (cond, mode, gen_rtx_REG(CCmode, CC_REGNUM), const0_rtx);
}
else
{
rtx cc_reg;
mode = v850_gen_float_compare (cond, mode, op0, op1);
cc_reg = gen_rtx_REG (mode, CC_REGNUM);
emit_insn (gen_rtx_SET (cc_reg, gen_rtx_REG (mode, FCC_REGNUM)));
return gen_rtx_fmt_ee (cond, mode, cc_reg, const0_rtx);
}
}
/* Return maximum offset supported for a short EP memory reference of mode
MODE and signedness UNSIGNEDP. */
@ -1635,7 +1631,7 @@ increment_stack (signed int amount, bool in_prologue)
inc = reg;
}
inc = emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, inc));
inc = emit_insn (gen_addsi3_clobber_flags (stack_pointer_rtx, stack_pointer_rtx, inc));
if (in_prologue)
F (inc);
}
@ -1712,7 +1708,7 @@ expand_prologue (void)
save_all = gen_rtx_PARALLEL
(VOIDmode,
rtvec_alloc (num_save + 1
rtvec_alloc (num_save + 2
+ (TARGET_DISABLE_CALLT ? (TARGET_LONG_CALLS ? 2 : 1) : 0)));
XVECEXP (save_all, 0, 0)
@ -1731,13 +1727,16 @@ expand_prologue (void)
save_regs[i]);
}
XVECEXP (save_all, 0, num_save + 1)
= gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, CC_REGNUM));
if (TARGET_DISABLE_CALLT)
{
XVECEXP (save_all, 0, num_save + 1)
XVECEXP (save_all, 0, num_save + 2)
= gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 10));
if (TARGET_LONG_CALLS)
XVECEXP (save_all, 0, num_save + 2)
XVECEXP (save_all, 0, num_save + 3)
= gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 11));
}
@ -2330,7 +2329,7 @@ construct_save_jarl (rtx op)
stack_bytes = INTVAL (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 1));
/* Each push will put 4 bytes from the stack.... */
stack_bytes += (count - (TARGET_LONG_CALLS ? 3 : 2)) * 4;
stack_bytes += (count - (TARGET_LONG_CALLS ? 4 : 3)) * 4;
/* Make sure that the amount we are popping either 0 or 16 bytes. */
if (stack_bytes != 0)
@ -2341,7 +2340,7 @@ construct_save_jarl (rtx op)
/* Now compute the bit mask of registers to push. */
mask = 0;
for (i = 1; i < count - (TARGET_LONG_CALLS ? 2 : 1); i++)
for (i = 1; i < count - (TARGET_LONG_CALLS ? 3 : 2); i++)
{
rtx vector_element = XVECEXP (op, 0, i);
@ -3325,6 +3324,9 @@ v850_modes_tieable_p (machine_mode mode1, machine_mode mode2)
#undef TARGET_MODES_TIEABLE_P
#define TARGET_MODES_TIEABLE_P v850_modes_tieable_p
#undef TARGET_FLAGS_REGNUM
#define TARGET_FLAGS_REGNUM 32
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-v850.h"

View file

@ -26,9 +26,6 @@
#ifndef GCC_V850_H
#define GCC_V850_H
extern GTY(()) rtx v850_compare_op0;
extern GTY(()) rtx v850_compare_op1;
#undef LIB_SPEC
#define LIB_SPEC "%{!shared:%{!symbolic:--start-group -lc -lgcc --end-group}}"
@ -567,8 +564,6 @@ struct cum_arg { int nbytes; };
#define SELECT_CC_MODE(OP, X, Y) v850_select_cc_mode (OP, X, Y)
#define NOTICE_UPDATE_CC(EXP, INSN)
/* Nonzero if access to memory by bytes or half words is no faster
than accessing full words. */
#define SLOW_BYTE_ACCESS 1

File diff suppressed because it is too large Load diff