summaryrefslogtreecommitdiff
path: root/gcc/config/c4x
diff options
context:
space:
mode:
authorm.hayes <m.hayes@138bc75d-0d04-0410-961f-82ee72b054a4>1998-10-14 22:46:04 +0000
committerm.hayes <m.hayes@138bc75d-0d04-0410-961f-82ee72b054a4>1998-10-14 22:46:04 +0000
commita694d620f3b8c61e5583c5e96d12e8edf25ce8cb (patch)
treeae00e679557ca7c5f5350410855181869d321c1a /gcc/config/c4x
parent218607b826b60f3ff2e94143357b965e5938c93a (diff)
downloadgcc-a694d620f3b8c61e5583c5e96d12e8edf25ce8cb.tar.gz
* config/c4x/c4x.c: Convert to use GEN_INT.
(c4x_parallel_process): Rework to handle new repeat loop structure. * config/c4x/c4x.md: Convert to use GEN_INT. (rptb_end): Convert to use GE test. Replace uses with clobbers. (decrement_and_branch_on_count): Likewise. * config/c4x/c4x.h (REPEAT_BLOCK_PROCESS): Deleted hook now that loop.c has the desired functionality. (rc_reg_operand): New prototype. * config/c4x/t-c4x: Can now build all front ends. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23103 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/c4x')
-rw-r--r--gcc/config/c4x/c4x.c154
-rw-r--r--gcc/config/c4x/c4x.h7
-rw-r--r--gcc/config/c4x/c4x.md60
-rw-r--r--gcc/config/c4x/t-c4x6
4 files changed, 91 insertions, 136 deletions
diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c
index b471e3758d2..312c2daa154 100644
--- a/gcc/config/c4x/c4x.c
+++ b/gcc/config/c4x/c4x.c
@@ -1120,7 +1120,7 @@ c4x_emit_libcall_mulhi (name, code, mode, operands)
gen_rtx_MULT (HImode,
gen_rtx (code, HImode, operands[1]),
gen_rtx (code, HImode, operands[2])),
- gen_rtx_CONST_INT (VOIDmode, 32)));
+ GEN_INT (32)));
insns = get_insns ();
end_sequence ();
emit_libcall_block (insns, operands[0], ret, equiv);
@@ -1910,9 +1910,9 @@ c4x_scan_for_ldp (newop, insn, operand0)
addr = XEXP (addr, 0);
if (GET_CODE (addr) == CONST_INT)
{
- op1 = gen_rtx_CONST_INT (VOIDmode, INTVAL (addr) & ~0xffff);
+ op1 = GEN_INT (INTVAL (addr) & ~0xffff);
emit_insn_before (gen_movqi (operand0, op1), insn);
- op1 = gen_rtx_CONST_INT (VOIDmode, INTVAL (addr) & 0xffff);
+ op1 = GEN_INT (INTVAL (addr) & 0xffff);
emit_insn_before (gen_iorqi3_noclobber (operand0,
operand0, op1), insn);
delete_insn (insn);
@@ -4598,14 +4598,18 @@ c4x_parallel_process (loop_start, loop_end)
rtx insn;
rtx insn2;
rtx pack;
- rtx hoist;
- rtx sink;
+ rtx hoist_pos;
+ rtx sink_pos;
rtx loop_count;
rtx loop_count_set;
+ rtx loop_count_reg;
+ rtx jump_insn;
rtx end_label;
int num_packs;
int bb;
+ jump_insn = PREV_INSN (loop_end);
+
/* The loop must have a calculable number of iterations
since we need to reduce the loop count by one.
@@ -4614,77 +4618,34 @@ c4x_parallel_process (loop_start, loop_end)
The loop count must be at least 2? */
- loop_count = NEXT_INSN (loop_start);
-
- /* Skip past CLOBBER and USE and deleted insn. This is from flow. */
- for (;;)
- {
- if (GET_CODE (loop_count) == INSN)
- {
- rtx x = PATTERN (loop_count);
- if (GET_CODE (x) != USE && GET_CODE (x) != CLOBBER)
- break;
- }
- else if (GET_CODE (loop_count) == NOTE)
- {
- if (! INSN_DELETED_P (loop_count))
- break;
- }
- else
- break;
- loop_count = NEXT_INSN (loop_count);
- }
+ loop_count = PREV_INSN (loop_start);
if (!(loop_count_set = single_set (loop_count)))
return 0;
-
- if (!REG_P (SET_DEST (loop_count_set))
- || REGNO (SET_DEST (loop_count_set)) != RC_REGNO)
+
+ if (!find_reg_note (loop_count, REG_LOOP_COUNT, NULL_RTX))
return 0;
- /* Determine places to hoist and sink insns out of the loop. We
- won't have to update basic_block_head if we move things after
- loop_count. */
+ loop_count_reg = SET_DEST (loop_count_set);
+
+ /* Determine places to hoist and sink insns out of the loop.
+ We need to hoist insns before the label at the top of the loop.
+ We'll have to update basic_block_head. */
- hoist = loop_count;
- end_label = PREV_INSN (loop_end);
-
- /* Skip past filler insn if present. */
- if (GET_CODE (end_label) != CODE_LABEL)
- end_label = PREV_INSN (end_label);
-
- /* Skip past CLOBBER, USE, and deleted insns inserted by the flow pass. */
- for (;;)
- {
- if (GET_CODE (end_label) == INSN)
- {
- rtx x = PATTERN (end_label);
- if (GET_CODE (x) != USE && GET_CODE (x) != CLOBBER)
- break;
- }
- else if (GET_CODE (end_label) == NOTE)
- {
- if (! INSN_DELETED_P (end_label))
- break;
- }
- else
- break;
- end_label = PREV_INSN (end_label);
- }
+ /* Place in the rtx where we hoist insns after. */
+ hoist_pos = loop_count;
- if (GET_CODE (end_label) != CODE_LABEL)
- return 0;
-
- sink = end_label;
+ /* Place in the rtx where we sink insns after. */
+ sink_pos = loop_end;
/* There must be an easier way to work out which basic block we are
in. */
for (bb = 0; bb < n_basic_blocks; bb++)
- if (basic_block_head[bb] == sink)
+ if (basic_block_head[bb] == NEXT_INSN (loop_end))
break;
if (bb >= n_basic_blocks)
- fatal_insn("Cannot find basic block for insn", sink);
+ fatal_insn("Cannot find basic block for insn", NEXT_INSN (loop_end));
/* Skip to label at top of loop. */
for (; GET_CODE (loop_start) != CODE_LABEL;
@@ -4750,12 +4711,13 @@ c4x_parallel_process (loop_start, loop_end)
/* We need to hoist all the insns from the loop top
to and including insn. */
- c4x_copy_insns_after(NEXT_INSN (loop_start), insn, &hoist, bb);
+ c4x_copy_insns_after (NEXT_INSN (loop_start), insn,
+ &hoist_pos, bb);
/* We need to sink all the insns after insn to
loop_end. */
- c4x_copy_insns_after (NEXT_INSN (insn), PREV_INSN(end_label),
- &sink, bb + 1);
+ c4x_copy_insns_after (NEXT_INSN (insn), PREV_INSN (jump_insn),
+ &sink_pos, bb + 1);
/* Change insn to the new parallel insn, retaining the notes
of the old insn. */
@@ -4776,34 +4738,30 @@ c4x_parallel_process (loop_start, loop_end)
if (note)
remove_note (insn, note);
- /* Do we have to modify the LOG_LINKS? */
+ /* ??? Do we have to modify the LOG_LINKS? */
/* We need to decrement the loop count. We probably
- should test if RC is negative and branch to end label
- if so. */
+ should test if the loop count is negative and branch
+ to end label if so. */
if (GET_CODE (SET_SRC (loop_count_set)) == CONST_INT)
{
/* The loop count must be more than 1 surely? */
SET_SRC (loop_count_set)
- = gen_rtx_CONST_INT (VOIDmode,
- INTVAL (SET_SRC (loop_count_set)) -1);
+ = GEN_INT (INTVAL (SET_SRC (loop_count_set)) - 1);
}
else if (GET_CODE (SET_SRC (loop_count_set)) == PLUS
&& GET_CODE (XEXP (SET_SRC (loop_count_set), 1))
== CONST_INT)
{
XEXP (SET_SRC (loop_count_set), 1)
- = gen_rtx_CONST_INT (VOIDmode,
- INTVAL (XEXP (SET_SRC (loop_count_set), 1))
- - 1);
+ = GEN_INT (INTVAL (XEXP (SET_SRC (loop_count_set), 1))
+ - 1);
}
else
{
start_sequence ();
- expand_binop (QImode, sub_optab,
- gen_rtx_REG (QImode, RC_REGNO),
- gen_rtx_CONST_INT (VOIDmode, 1),
- gen_rtx_REG (QImode, RC_REGNO),
+ expand_binop (QImode, sub_optab, loop_count_reg,
+ GEN_INT (1), loop_count_reg,
1, OPTAB_DIRECT);
seq_start = get_insns ();
end_sequence ();
@@ -4813,23 +4771,30 @@ c4x_parallel_process (loop_start, loop_end)
Can we emit more than one insn? */
REG_NOTES (seq_start)
= gen_rtx_EXPR_LIST (REG_UNUSED,
- gen_rtx_REG (QImode, RC_REGNO),
+ loop_count_reg,
REG_NOTES (seq_start));
}
- start_sequence ();
- emit_cmp_insn (gen_rtx_REG (QImode, RC_REGNO),
- const0_rtx, LT, NULL_RTX, QImode, 0, 0);
- emit_jump_insn (gen_blt (end_label));
- seq_start = get_insns ();
- end_sequence ();
- emit_insns_after (seq_start, hoist);
-
- /* This is a bit of a hack... */
- REG_NOTES (NEXT_INSN (seq_start))
- = gen_rtx_EXPR_LIST (REG_DEAD,
- gen_rtx_REG (QImode, RC_REGNO),
- REG_NOTES (NEXT_INSN (seq_start)));
+ if (GET_CODE (SET_SRC (loop_count_set)) != CONST_INT)
+ {
+ end_label = gen_label_rtx();
+ start_sequence ();
+ emit_cmp_insn (loop_count_reg,
+ const0_rtx, LT, NULL_RTX, word_mode, 0, 0);
+ emit_jump_insn (gen_blt (end_label));
+ seq_start = get_insns ();
+ end_sequence ();
+ emit_insns_after (seq_start, hoist_pos);
+ emit_label_after (end_label, sink_pos);
+
+#if 0
+ /* This is a bit of a hack...but why was it necessary? */
+ REG_NOTES (NEXT_INSN (seq_start))
+ = gen_rtx_EXPR_LIST (REG_DEAD,
+ loop_count_reg,
+ REG_NOTES (NEXT_INSN (seq_start)));
+#endif
+ }
if (TARGET_DEVEL)
debug_rtx(insn);
@@ -5258,7 +5223,7 @@ c4x_rptb_emit_init (loop_info)
/* If have a known constant loop count, things are easy... */
if (loop_info->loop_count > 0)
- return gen_rtx_CONST_INT (VOIDmode, loop_info->loop_count - 1);
+ return GEN_INT (loop_info->loop_count - 1);
if (loop_info->shift < 0)
abort ();
@@ -5288,14 +5253,13 @@ c4x_rptb_emit_init (loop_info)
/* (end_value - start_value + adjust) >> shift */
result = expand_binop (QImode, loop_info->unsigned_p ?
lshr_optab : ashr_optab, result,
- gen_rtx_CONST_INT (VOIDmode,
- loop_info->shift),
+ GEN_INT (loop_info->shift),
0, loop_info->unsigned_p, OPTAB_DIRECT);
}
/* ((end_value - start_value + adjust) >> shift) - 1 */
result = expand_binop (QImode, sub_optab,
- result, gen_rtx_CONST_INT (VOIDmode, 1),
+ result, GEN_INT (1),
0, loop_info->unsigned_p, OPTAB_DIRECT);
seq_start = get_insns ();
diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h
index d68427d3261..527c0a721bd 100644
--- a/gcc/config/c4x/c4x.h
+++ b/gcc/config/c4x/c4x.h
@@ -2458,11 +2458,6 @@ if (final_sequence != NULL_RTX) \
#define NO_FUNCTION_CSE
-/* Repeat block stuff (hook into strength_reduce() in loop.c). */
-
-extern void c4x_rptb_process ();
-#define REPEAT_BLOCK_PROCESS(START, END) c4x_rptb_process(START, END)
-
/* We don't want a leading tab. */
#define ASM_OUTPUT_ASM(FILE, STRING) fprintf (FILE, "%s\n", STRING)
@@ -2581,6 +2576,8 @@ extern int dp_reg_operand ();
extern int sp_reg_operand ();
+extern int rc_reg_operand ();
+
extern int st_reg_operand ();
extern int call_operand ();
diff --git a/gcc/config/c4x/c4x.md b/gcc/config/c4x/c4x.md
index ccccdeb12d9..bfcc7b0e33b 100644
--- a/gcc/config/c4x/c4x.md
+++ b/gcc/config/c4x/c4x.md
@@ -1134,8 +1134,7 @@
if (!TARGET_C3X && which_alternative == 3)
{
- operands[1] = gen_rtx_CONST_INT (VOIDmode,
- (INTVAL (operands[1]) >> 16) & 0xffff);
+ operands[1] = GEN_INT ((INTVAL (operands[1]) >> 16) & 0xffff);
return \"ldhi\\t%1,%0\";
}
@@ -2639,10 +2638,10 @@
"*
if (INTVAL (operands[2]) == 8)
{
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
return \"lb%3\\t%1,%0\";
}
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 16);
return \"lh%3\\t%1,%0\";
"
[(set_attr "type" "binarycc,binary")
@@ -2661,10 +2660,10 @@
"*
if (INTVAL (operands[2]) == 8)
{
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
return \"lb%3\\t%1,%0\";
}
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 16);
return \"lh%3\\t%1,%0\";
"
[(set_attr "type" "binarycc")
@@ -2686,10 +2685,10 @@
"*
if (INTVAL (operands[2]) == 8)
{
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
return \"lb%3\\t%1,%0\";
}
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 16);
return \"lh%3\\t%1,%0\";
"
[(set_attr "type" "binarycc")
@@ -2722,10 +2721,10 @@
"*
if (INTVAL (operands[2]) == 8)
{
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
return \"lbu%3\\t%1,%0\";
}
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 16);
return \"lhu%3\\t%1,%0\";
"
[(set_attr "type" "binarycc,binary")
@@ -2744,10 +2743,10 @@
"*
if (INTVAL (operands[2]) == 8)
{
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
return \"lbu%3\\t%1,%0\";
}
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 16);
return \"lhu%3\\t%1,%0\";
"
[(set_attr "type" "binarycc")
@@ -2769,10 +2768,10 @@
"*
if (INTVAL (operands[2]) == 8)
{
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
return \"lbu%3\\t%1,%0\";
}
- operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
+ operands[3] = GEN_INT (INTVAL (operands[3]) / 16);
return \"lhu%3\\t%1,%0\";
"
[(set_attr "type" "binarycc")
@@ -2807,12 +2806,12 @@
"*
if (INTVAL (operands[1]) == 8)
{
- operands[2] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[2]) / 8);
+ operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
return \"mb%2\\t%3,%0\";
}
else if (INTVAL (operands[1]) == 16)
{
- operands[2] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[2]) / 16);
+ operands[2] = GEN_INT (INTVAL (operands[2]) / 16);
return \"mh%2\\t%3,%0\";
}
return \"lwl1\\t%3,%0\";
@@ -2834,10 +2833,10 @@
"*
if (INTVAL (operands[1]) == 8)
{
- operands[2] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[2]) / 8);
+ operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
return \"mb%2\\t%3,%0\";
}
- operands[2] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[2]) / 16);
+ operands[2] = GEN_INT (INTVAL (operands[2]) / 16);
return \"mh%2\\t%3,%0\";
"
[(set_attr "type" "binarycc")
@@ -4564,15 +4563,15 @@
(define_insn "rptb_end"
[(set (pc)
- (if_then_else (ne (match_operand:QI 0 "rc_reg_operand" "v")
+ (if_then_else (ge (match_operand:QI 0 "rc_reg_operand" "v")
(const_int 0))
(label_ref (match_operand 1 "" ""))
(pc)))
- (use (reg:QI 25))
- (use (reg:QI 26))
(set (match_dup 0)
(plus:QI (match_dup 0)
- (const_int -1)))]
+ (const_int -1)))
+ (clobber (reg:QI 25))
+ (clobber (reg:QI 26))]
""
"*
return c4x_rptb_nop_p(insn) ? \"nop\" : \"\";"
@@ -4581,13 +4580,13 @@
(define_expand "decrement_and_branch_on_count"
[(parallel [(set (pc)
- (if_then_else (ne (match_operand:QI 0 "rc_reg_operand" "v")
+ (if_then_else (ge (match_operand:QI 0 "rc_reg_operand" "v")
(const_int 0))
(label_ref (match_operand 1 "" ""))
(pc)))
- (use (reg:QI 25))
- (use (reg:QI 26))
- (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))])]
+ (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))
+ (clobber (reg:QI 25))
+ (clobber (reg:QI 26))])]
""
"")
@@ -5731,7 +5730,7 @@
rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
rtx op1lo = operand_subword (operands[1], 0, 0, HImode);
- rtx count = gen_rtx_CONST_INT (VOIDmode, (INTVAL (operands[2]) - 32));
+ rtx count = GEN_INT ((INTVAL (operands[2]) - 32));
if (INTVAL (count))
emit_insn (gen_ashlqi3 (op0hi, op1lo, count));
@@ -5793,7 +5792,7 @@
rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
rtx op1hi = operand_subword (operands[1], 1, 0, HImode);
- rtx count = gen_rtx_CONST_INT (VOIDmode, (INTVAL (operands[2]) - 32));
+ rtx count = GEN_INT ((INTVAL (operands[2]) - 32));
if (INTVAL (count))
emit_insn (gen_lshrqi3 (op0lo, op1hi, count));
@@ -5861,14 +5860,13 @@
rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
rtx op1hi = operand_subword (operands[1], 1, 0, HImode);
- rtx count = gen_rtx_CONST_INT (VOIDmode, (INTVAL (operands[2]) - 32));
+ rtx count = GEN_INT ((INTVAL (operands[2]) - 32));
if (INTVAL (count))
emit_insn (gen_ashrqi3 (op0lo, op1hi, count));
else
emit_insn (gen_movqi (op0lo, op1hi));
- emit_insn (gen_ashrqi3 (op0hi, op1hi,
- gen_rtx_CONST_INT (VOIDmode, 31)));
+ emit_insn (gen_ashrqi3 (op0hi, op1hi, GEN_INT (31)));
DONE;
}
emit_insn (gen_ashrhi3_reg (operands[0], operands[1], operands[2]));
diff --git a/gcc/config/c4x/t-c4x b/gcc/config/c4x/t-c4x
index 1a16b90444c..39e316e4d8d 100644
--- a/gcc/config/c4x/t-c4x
+++ b/gcc/config/c4x/t-c4x
@@ -8,7 +8,7 @@ LIB1ASMFUNCS = _divqf3 _divqi3 _udivqi3 _umodqi3 _modqi3 _mulqi3 \
# We do not have DF or DI types (or SF and SI for that matter),
# so fake out the libgcc2 compilation.
-LIBGCC2_CFLAGS = -O2 -Dexit=unused_exit $(GCC_CFLAGS) $(LIBGCC2_INCLUDES) -DDF=HF -DDI=HI -DSF=QF -DSI=QI
+LIBGCC2_CFLAGS = -O2 -Dexit=unused_exit $(GCC_CFLAGS) $(LIBGCC2_INCLUDES) -DDF=HF -DDI=HI -DSF=QF -DSI=QI -Dinhibit_libc
MULTILIB_OPTIONS = m30 msmall mmemparm
MULTILIB_DIRNAMES = c3x small mem
@@ -20,7 +20,3 @@ INSTALL_LIBGCC = install-multilib
# Don't make libgcc1-test since require crt0.o
LIBGCC1_TEST =
-
-# C[34]x has its own float and limits.h
-TARGET_FLOAT_H=config/c4x/c4x-float.h
-TARGET_LIMITS_H=config/c4x/c4x-limits.h