aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2003-12-16 07:50:31 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2003-12-16 07:50:31 +0000
commit91f8389c1b40190eee416a559f99a9e767698c11 (patch)
treedf19e512684786a7c142dbc4c1613405ad3a5069 /gcc
parentcbefa3c9a2b880ccab4954e7e0f8c8d571d89d31 (diff)
downloadgcc-91f8389c1b40190eee416a559f99a9e767698c11.zip
gcc-91f8389c1b40190eee416a559f99a9e767698c11.tar.gz
gcc-91f8389c1b40190eee416a559f99a9e767698c11.tar.bz2
re PR rtl-optimization/13313 (Wrong code generated)
PR optimization/13313 * combine.c (make_extraction) [REG]: Do not use gen_lowpart_for_combine when POS is non-zero. From-SVN: r74676
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/combine.c7
-rw-r--r--gcc/testsuite/ChangeLog12
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20031216-1.c23
4 files changed, 41 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 45e05a8..733c289f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-16 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ PR optimization/13313
+ * combine.c (make_extraction) [REG]: Do not use
+ gen_lowpart_for_combine when POS is non-zero.
+
2003-12-16 Hartmut Penner <hpenner@de.ibm.com>
* altivec.h (vec_cmple, vec_all_numeric): Fix typo.
diff --git a/gcc/combine.c b/gcc/combine.c
index 02a92c1..2c92d24 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6043,10 +6043,11 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
{
if (tmode != inner_mode)
{
- if (in_dest)
+ /* We can't call gen_lowpart_for_combine in a DEST since we
+ always want a SUBREG (see below) and it would sometimes
+ return a new hard register. */
+ if (pos || in_dest)
{
- /* We can't call gen_lowpart_for_combine here since we always want
- a SUBREG and it would sometimes return a new hard register. */
HOST_WIDE_INT final_word = pos / BITS_PER_WORD;
if (WORDS_BIG_ENDIAN
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6e1f126..3dd3a02 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2003-12-16 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.c-torture/execute/20031216-1.c: New test.
+
2003-12-16 Giovanni Bajo <giovannibajo@gcc.gnu.org>
* g++.dg/template/ptrmem7.C: Simplified the test case to not hit
@@ -134,10 +138,10 @@
* g++.dg/ext/visibility-5.C: Likewise.
* g++.dg/ext/visibility-6.C: Likewise.
-2003-12-07 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-
- * g++.dg/lookup/java1.C: New test.
- * g++.dg/lookup/java2.C: New test.
+2003-12-07 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ * g++.dg/lookup/java1.C: New test.
+ * g++.dg/lookup/java2.C: New test.
2003-12-07 Falk Hueffner <falk@debian.org>
diff --git a/gcc/testsuite/gcc.c-torture/execute/20031216-1.c b/gcc/testsuite/gcc.c-torture/execute/20031216-1.c
new file mode 100644
index 0000000..709f016
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20031216-1.c
@@ -0,0 +1,23 @@
+/* PR optimization/13313 */
+/* Origin: Mike Lerwill <mike@ml-solutions.co.uk> */
+
+extern void abort(void);
+
+void DisplayNumber (unsigned long v)
+{
+ if (v != 0x9aL)
+ abort();
+}
+
+unsigned long ReadNumber (void)
+{
+ return 0x009a0000L;
+}
+
+int main (void)
+{
+ unsigned long tmp;
+ tmp = (ReadNumber() & 0x00ff0000L) >> 16;
+ DisplayNumber (tmp);
+ return 0;
+}