aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohn David Anglin <dave@hiauly1.hia.nrc.ca>2001-11-16 22:40:21 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2001-11-16 22:40:21 +0000
commit268399cd7f8fbfd0cc82fa15c5c195e40b12f7a4 (patch)
tree36e29ac4be21dafdd4bc1a34786fd82349fefdc9 /gcc
parent550b2951cdd64ccce65c2580fdfcce7d8c494cf9 (diff)
downloadgcc-268399cd7f8fbfd0cc82fa15c5c195e40b12f7a4.zip
gcc-268399cd7f8fbfd0cc82fa15c5c195e40b12f7a4.tar.gz
gcc-268399cd7f8fbfd0cc82fa15c5c195e40b12f7a4.tar.bz2
vax-protos.h (reg_was_0_p): New prototype.
* vax-protos.h (reg_was_0_p): New prototype. * vax.md (movsi, movhi, movqi): Use reg_was_0_p. * vax.c (follows_p, reg_was_0_p): New functions. From-SVN: r47110
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/vax/vax-protos.h1
-rw-r--r--gcc/config/vax/vax.c36
-rw-r--r--gcc/config/vax/vax.md34
4 files changed, 47 insertions, 30 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fc249e5..1bff544 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2001-11-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
+ * vax-protos.h (reg_was_0_p): New prototype.
+ * vax.md (movsi, movhi, movqi): Use reg_was_0_p.
+ * vax.c (follows_p, reg_was_0_p): New functions.
+
+2001-11-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
* vax.md (casesi): Swap arguments in "(plus:SI (pc) (mult))". Reformat.
(casesi1): Likewise. Define new pattern which arises by simplification
when operand 1 is a constant int. Correct pattern which arises by
diff --git a/gcc/config/vax/vax-protos.h b/gcc/config/vax/vax-protos.h
index f836c1e..f3a239d 100644
--- a/gcc/config/vax/vax-protos.h
+++ b/gcc/config/vax/vax-protos.h
@@ -25,6 +25,7 @@ extern void print_operand_address PARAMS ((FILE *, rtx));
extern int vax_float_literal PARAMS ((rtx));
extern int vax_address_cost PARAMS ((rtx));
extern int vax_rtx_cost PARAMS ((rtx));
+extern int reg_was_0_p PARAMS ((rtx, rtx));
#endif /* RTX_CODE */
#ifdef REAL_VALUE_TYPE
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 9f0387c..df14f9e 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA. */
#include "target.h"
#include "target-def.h"
+static int follows_p PARAMS ((rtx, rtx));
static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
#if VMS_TARGET
static void vms_asm_out_constructor PARAMS ((rtx, int));
@@ -946,3 +947,38 @@ not_qsort (array, count, size, compare)
return;
}
#endif /* QSORT_WORKAROUND */
+
+/* Return 1 if insn A follows B. */
+
+static int
+follows_p (a, b)
+ rtx a, b;
+{
+ register rtx p;
+
+ for (p = a; p != b; p = NEXT_INSN (p))
+ if (! p)
+ return 1;
+
+ return 0;
+}
+
+/* Returns 1 if we know operand OP was 0 before INSN. */
+
+int
+reg_was_0_p (insn, op)
+ rtx insn, op;
+{
+ rtx link;
+
+ return ((link = find_reg_note (insn, REG_WAS_0, 0))
+ /* Make sure the insn that stored the 0 is still present
+ and doesn't follow INSN in the insn sequence. */
+ && ! INSN_DELETED_P (XEXP (link, 0))
+ && GET_CODE (XEXP (link, 0)) != NOTE
+ && ! follows_p (XEXP (link, 0), insn)
+ /* Make sure cross jumping didn't happen here. */
+ && no_labels_between_p (XEXP (link, 0), insn)
+ /* Make sure the reg hasn't been clobbered. */
+ && ! reg_set_between_p (op, XEXP (link, 0), insn));
+}
diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md
index b985c5b..4280ac6 100644
--- a/gcc/config/vax/vax.md
+++ b/gcc/config/vax/vax.md
@@ -184,17 +184,9 @@
""
"*
{
- rtx link;
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
+ if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
return \"incl %0\";
+
if (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
{
if (push_operand (operands[0], SImode))
@@ -229,16 +221,7 @@
""
"*
{
- rtx link;
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
+ if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
return \"incw %0\";
if (GET_CODE (operands[1]) == CONST_INT)
@@ -283,16 +266,7 @@
""
"*
{
- rtx link;
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
+ if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
return \"incb %0\";
if (GET_CODE (operands[1]) == CONST_INT)