From 9f9ab303f713366fd57c338802735b86dcebf110 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 5 Feb 2015 23:19:03 -0700 Subject: 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 --- gcc/ChangeLog | 9 +++++++++ gcc/config/h8300/constraints.md | 2 +- gcc/config/h8300/h8300.c | 6 ++++++ gcc/config/h8300/h8300.md | 4 ++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.target/h8300/pr17306-1.c | 14 ++++++++++++++ gcc/testsuite/gcc.target/h8300/pr17306-2.c | 23 +++++++++++++++++++++++ 7 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/h8300/pr17306-1.c create mode 100644 gcc/testsuite/gcc.target/h8300/pr17306-2.c 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 + 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 + + PR target/17306 + * gcc.target/h8300/pr17306-1.c: New test. + * gcc.target/h8300/pr17306-2.c: New test. + 2015-02-05 Tobias Burnus 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 (); +} -- cgit v1.1