aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2000-11-06 11:42:20 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2000-11-06 11:42:20 +0100
commit8b1c5fd0255ca3710cfeb86e5a2c2c50d1000ea9 (patch)
tree93f76c20cec258871e34c34edb6c9c73abb25f6e /gcc
parenta0115140d05f5dd8b2206a3c9ab1f930730fba3e (diff)
downloadgcc-8b1c5fd0255ca3710cfeb86e5a2c2c50d1000ea9.zip
gcc-8b1c5fd0255ca3710cfeb86e5a2c2c50d1000ea9.tar.gz
gcc-8b1c5fd0255ca3710cfeb86e5a2c2c50d1000ea9.tar.bz2
sparc.md (adddi3): If operands[2] is 4096 and operands[1] is constant...
* config/sparc/sparc.md (adddi3): If operands[2] is 4096 and operands[1] is constant, calculate the sum and generate movdi. (addsi3): Similarly. Use SImode in call to arith_4096_operand. (subsi3): Use SImode in call to arith_4096_operand. * gcc.c-torture/execute/20001031-1.c: New test. From-SVN: r37274
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/sparc/sparc.md30
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20001031-1.c37
4 files changed, 70 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e7d8a0e..530cc60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2000-11-06 Jakub Jelinek <jakub@redhat.com>
+ * config/sparc/sparc.md (adddi3): If operands[2] is 4096 and
+ operands[1] is constant, calculate the sum and generate movdi.
+ (addsi3): Similarly. Use SImode in call to arith_4096_operand.
+ (subsi3): Use SImode in call to arith_4096_operand.
+
+2000-11-06 Jakub Jelinek <jakub@redhat.com>
+
* config/sparc/sparc.h (ASM_OUTPUT_MI_THUNK): On sparc64 we need to
adjust %o1, not %o0 if the return type is large structure.
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 3ec43ef..93734f9 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -5539,6 +5539,8 @@
""
"
{
+ HOST_WIDE_INT i;
+
if (! TARGET_ARCH64)
{
emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2,
@@ -5551,9 +5553,17 @@
}
if (arith_double_4096_operand(operands[2], DImode))
{
- emit_insn (gen_rtx_SET (VOIDmode, operands[0],
- gen_rtx_MINUS (DImode, operands[1],
- GEN_INT(-4096))));
+ switch (GET_CODE (operands[1]))
+ {
+ case CONST_INT: i = INTVAL (operands[1]); break;
+ case CONST_DOUBLE: i = CONST_DOUBLE_LOW (operands[1]); break;
+ default:
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0],
+ gen_rtx_MINUS (DImode, operands[1],
+ GEN_INT(-4096))));
+ DONE;
+ }
+ emit_insn (gen_movdi (operands[0], GEN_INT (i + 4096)));
DONE;
}
}")
@@ -5768,11 +5778,15 @@
""
"
{
- if (arith_4096_operand(operands[2], DImode))
+ if (arith_4096_operand(operands[2], SImode))
{
- emit_insn (gen_rtx_SET (VOIDmode, operands[0],
- gen_rtx_MINUS (SImode, operands[1],
- GEN_INT(-4096))));
+ if (GET_CODE (operands[1]) == CONST_INT)
+ emit_insn (gen_movsi (operands[0],
+ GEN_INT (INTVAL (operands[1]) + 4096)));
+ else
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0],
+ gen_rtx_MINUS (SImode, operands[1],
+ GEN_INT(-4096))));
DONE;
}
}")
@@ -5967,7 +5981,7 @@
""
"
{
- if (arith_4096_operand(operands[2], DImode))
+ if (arith_4096_operand(operands[2], SImode))
{
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_PLUS (SImode, operands[1],
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1793aca..46ec3b6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2000-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/execute/20001031-1.c: New test.
+
2000-11-04 Mark Mitchell <mark@codesourcery.com>
* g++.old-deja/g++.brendan/misc13.C: Put `strlen' in `std'
diff --git a/gcc/testsuite/gcc.c-torture/execute/20001031-1.c b/gcc/testsuite/gcc.c-torture/execute/20001031-1.c
new file mode 100644
index 0000000..a2a6c83
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20001031-1.c
@@ -0,0 +1,37 @@
+extern void abort (void);
+extern void exit (int);
+
+void t1 (int x)
+{
+ if (x != 4100)
+ abort ();
+}
+
+int t2 (void)
+{
+ int i;
+ t1 ((i = 4096) + 4);
+ return i;
+}
+
+void t3 (long long x)
+{
+ if (x != 0x80000fffULL)
+ abort ();
+}
+
+long long t4 (void)
+{
+ long long i;
+ t3 ((i = 4096) + 0x7fffffffULL);
+ return i;
+}
+
+main ()
+{
+ if (t2 () != 4096)
+ abort ();
+ if (t4 () != 4096)
+ abort ();
+ exit (0);
+}