From: Jeff Law Date: Fri, 6 Feb 2015 06:19:03 +0000 (-0700) Subject: re PR target/17306 (function_vector attribute in H8300H/H8S) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9f9ab303f713366fd57c338802735b86dcebf110;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2bbfeb3fdd1..4d84df7a1e0 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 15bfedb5a9a..9b509e720c9 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 4bd4787fcdc..ea900525b66 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 cec35300e21..dfd082ce0df 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 cf3a21e282e..55715adca66 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 00000000000..010492f1cbd --- /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 00000000000..a407c74b4cd --- /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 (); +}