aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-02-05 23:19:03 -0700
committerJeff Law <law@gcc.gnu.org>2015-02-05 23:19:03 -0700
commit9f9ab303f713366fd57c338802735b86dcebf110 (patch)
tree5cfc7f4da69207a8e4b9fc8e4803bf14c224f02b
parentd00f6ca670050d56c3ed5ef0c8ccdcce346e1cf2 (diff)
downloadgcc-9f9ab303f713366fd57c338802735b86dcebf110.zip
gcc-9f9ab303f713366fd57c338802735b86dcebf110.tar.gz
gcc-9f9ab303f713366fd57c338802735b86dcebf110.tar.bz2
re PR target/17306 (function_vector attribute in H8300H/H8S)
PR target/17306 * config/h8300/constraints.md (U): Correctly dectect "eightbit_data" memory addresses. * config/h8300/h8300.c (eightbit_constant_address_p): Also handle (const (plus (symbol_ref (x)))) where x is declared as an 8-bit data memory address. * config/h8300/h8300.md (call, call_value): Correctly detect "funcvec" functions. PR target/17306 * gcc.target/h8300/pr17306-1.c: New test. * gcc.target/h8300/pr17306-2.c: New test. From-SVN: r220472
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/h8300/constraints.md2
-rw-r--r--gcc/config/h8300/h8300.c6
-rw-r--r--gcc/config/h8300/h8300.md4
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/h8300/pr17306-1.c14
-rw-r--r--gcc/testsuite/gcc.target/h8300/pr17306-2.c23
7 files changed, 61 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2bbfeb3..4d84df7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2015-02-05 Jeff Law <law@redhat.com>
+ PR target/17306
+ * config/h8300/constraints.md (U): Correctly dectect
+ "eightbit_data" memory addresses.
+ * config/h8300/h8300.c (eightbit_constant_address_p): Also
+ handle (const (plus (symbol_ref (x)))) where x is declared
+ as an 8-bit data memory address.
+ * config/h8300/h8300.md (call, call_value): Correctly detect
+ "funcvec" functions.
+
PR target/43264
* config/h8300/h8300.c (get_shift_alg): Fix ASHIFTRT by
24 to 28 bits for the H8/300.
diff --git a/gcc/config/h8300/constraints.md b/gcc/config/h8300/constraints.md
index 15bfedb..9b509e7 100644
--- a/gcc/config/h8300/constraints.md
+++ b/gcc/config/h8300/constraints.md
@@ -188,7 +188,7 @@
(match_code "symbol_ref" "000")
(match_code "const_int" "001")
(ior (match_test "TARGET_H8300S")
- (match_test "SYMBOL_REF_FLAG (XEXP (XEXP (XEXP (op, 0), 0), 0))")))
+ (match_test "(SYMBOL_REF_FLAGS (XEXP (XEXP (XEXP (op, 0), 0), 0)) & SYMBOL_FLAG_EIGHTBIT_DATA) != 0")))
(and (match_code "mem")
(match_test "h8300_eightbit_constant_address_p (XEXP (op, 0))"))
(and (match_code "mem")
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 4bd4787..ea90052 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -5637,6 +5637,12 @@ h8300_eightbit_constant_address_p (rtx x)
if (GET_CODE (x) == SYMBOL_REF)
return (SYMBOL_REF_FLAGS (x) & SYMBOL_FLAG_EIGHTBIT_DATA) != 0;
+ if (GET_CODE (x) == CONST
+ && GET_CODE (XEXP (x, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
+ && (SYMBOL_REF_FLAGS (XEXP (XEXP (x, 0), 0)) & SYMBOL_FLAG_EIGHTBIT_DATA) != 0)
+ return 1;
+
if (GET_CODE (x) != CONST_INT)
return 0;
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index cec3530..dfd082c 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -2499,7 +2499,7 @@
""
{
if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
- && SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
+ && (SYMBOL_REF_FLAGS (XEXP (operands[0], 0)) & SYMBOL_FLAG_FUNCVEC_FUNCTION))
return "jsr\\t@%0:8";
else
return "jsr\\t%0";
@@ -2522,7 +2522,7 @@
""
{
if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
- && SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
+ && (SYMBOL_REF_FLAGS (XEXP (operands[1], 0)) & SYMBOL_FLAG_FUNCVEC_FUNCTION))
return "jsr\\t@%1:8";
else
return "jsr\\t%1";
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cf3a21e..55715ad 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-05 Jeff Law <law@redhat.com>
+
+ PR target/17306
+ * gcc.target/h8300/pr17306-1.c: New test.
+ * gcc.target/h8300/pr17306-2.c: New test.
+
2015-02-05 Tobias Burnus <burnus@net-b.de>
PR fortran/64943
diff --git a/gcc/testsuite/gcc.target/h8300/pr17306-1.c b/gcc/testsuite/gcc.target/h8300/pr17306-1.c
new file mode 100644
index 0000000..010492f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/h8300/pr17306-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-mh" } */
+/* { dg-final { scan-assembler-times "@@" 1 } } */
+
+
+void foo (void) __attribute__ ((function_vector));
+__attribute__((noinline)) void foo (void)
+{
+}
+
+void bar (void)
+{
+ foo();
+}
diff --git a/gcc/testsuite/gcc.target/h8300/pr17306-2.c b/gcc/testsuite/gcc.target/h8300/pr17306-2.c
new file mode 100644
index 0000000..a407c74
--- /dev/null
+++ b/gcc/testsuite/gcc.target/h8300/pr17306-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-mh -O2 -w" } */
+/* { dg-final { scan-assembler-times ":8" 2 } } */
+
+
+struct x {
+ char x;
+ char y;
+};
+
+struct x __attribute__ ((eightbit_data)) foo;
+
+int bar ()
+{
+ if ((foo.y & 0x80) != 0)
+ oof ();
+}
+
+int com ()
+{
+ if ((foo.x & 0x80) != 0)
+ oof ();
+}