summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2003-02-19 04:36:44 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2003-02-19 04:36:44 +0000
commit5b145e0c42451e7245048bc1228227f64c7b5224 (patch)
tree2820bc6f83bffee737ba2f7979ce799607133dd9
parentc6e46c013d67bfaf75658d36f5142c0d32cf06ff (diff)
downloadgcc-5b145e0c42451e7245048bc1228227f64c7b5224.tar.gz
* config/h8300/h8300.c (general_operand_src): Always check
MODE. (general_operand_dst): Likewise. * gcc.c-torture/execute/20030218-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63091 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/h8300/h8300.c8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030218-1.c25
4 files changed, 41 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8e5b2976a06..ae5510e82a6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-02-18 Kazu Hirata <kazu@cs.umass.edu>
+
+ * config/h8300/h8300.c (general_operand_src): Always check
+ MODE.
+ (general_operand_dst): Likewise.
+
2003-02-18 Roger Sayle <roger@eyesopen.com>
* convert.c (convert_to_real): Also optimize (float)log(x) into
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index ed5b3a08148..e8de91dd08e 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -723,7 +723,9 @@ general_operand_src (op, mode)
rtx op;
enum machine_mode mode;
{
- if (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == POST_INC)
+ if (GET_MODE (op) == mode
+ && GET_CODE (op) == MEM
+ && GET_CODE (XEXP (op, 0)) == POST_INC)
return 1;
return general_operand (op, mode);
}
@@ -736,7 +738,9 @@ general_operand_dst (op, mode)
rtx op;
enum machine_mode mode;
{
- if (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == PRE_DEC)
+ if (GET_MODE (op) == mode
+ && GET_CODE (op) == MEM
+ && GET_CODE (XEXP (op, 0)) == PRE_DEC)
return 1;
return general_operand (op, mode);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d38552d9ff1..9d41b1af62a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-18 Kazu Hirata <kazu@cs.umass.edu>
+
+ * gcc.c-torture/execute/20030218-1.c: New.
+
2003-02-18 Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/20030218-1.c: New.
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030218-1.c b/gcc/testsuite/gcc.c-torture/execute/20030218-1.c
new file mode 100644
index 00000000000..8dde79451fe
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030218-1.c
@@ -0,0 +1,25 @@
+/* On H8, the predicate general_operand_src(op,mode) used to ignore
+ mode when op is a (mem (post_inc ...)). As a result, the pattern
+ for extendhisi2 was recognized as extendqisi2. */
+
+extern void abort ();
+extern void exit (int);
+
+short *q;
+
+long
+foo (short *p)
+{
+ long b = *p;
+ q = p + 1;
+ return b;
+}
+
+int
+main ()
+{
+ short a = 0xff00;
+ if (foo (&a) != (long) (short) 0xff00)
+ abort ();
+ exit (0);
+}