diff options
author | denisc <denisc@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-28 17:35:27 +0000 |
---|---|---|
committer | denisc <denisc@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-28 17:35:27 +0000 |
commit | 8c1cab24c7ef8ec53c374bcfe2286250155f1db3 (patch) | |
tree | a95df8b1a41358fb5dd2000d81813deb758900bb | |
parent | 93182daeb14e34045324299014949ebfd7c160cb (diff) | |
download | gcc-8c1cab24c7ef8ec53c374bcfe2286250155f1db3.tar.gz |
gcc/ChangeLog
PR target/67839
* config/avr/predicates.md (low_io_address_operand): Don't
consider MODE when computing upper bound.
(io_address_operand): Likewise.
gcc/testsuite/ChangeLog
PR target/67839
* gcc.target/avr/pr67839.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229495 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/avr/predicates.md | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/avr/pr67839.c | 29 |
4 files changed, 43 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dfe2bad37fe..791aaf8fb65 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-10-05 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> + + PR target/67839 + * config/avr/predicates.md (low_io_address_operand): Don't + consider MODE when computing upper bound. + (io_address_operand): Likewise. + 2015-10-28 Jan Hubicka <hubicka@ucw.cz> * fold-const.c (operand_equal_p): Do not verify that types are diff --git a/gcc/config/avr/predicates.md b/gcc/config/avr/predicates.md index 2d12bc69016..622bc0b0831 100644 --- a/gcc/config/avr/predicates.md +++ b/gcc/config/avr/predicates.md @@ -46,7 +46,7 @@ (define_special_predicate "low_io_address_operand" (ior (and (match_code "const_int") (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset, - 0, 0x20 - GET_MODE_SIZE (mode))")) + 0, 0x1F)")) (and (match_code "symbol_ref") (match_test "SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_IO_LOW")))) @@ -60,7 +60,7 @@ (define_special_predicate "io_address_operand" (ior (and (match_code "const_int") (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset, - 0, 0x40 - GET_MODE_SIZE (mode))")) + 0, 0x3F)")) (and (match_code "symbol_ref") (match_test "SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_IO")))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5b0c237e320..cc04c43bfef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-05 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> + + PR target/67839 + * gcc.target/avr/pr67839.c: New test. + 2015-10-28 Richard Biener <rguenther@suse.de> * gcc.dg/tree-ssa/operand-equal-2.c: Adjust. diff --git a/gcc/testsuite/gcc.target/avr/pr67839.c b/gcc/testsuite/gcc.target/avr/pr67839.c new file mode 100644 index 00000000000..604ab4b7592 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/pr67839.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-final { scan-assembler "sbi 0x1f,0" } } */ +/* { dg-final { scan-assembler "cbi 0x1f,0" } } */ +/* { dg-final { scan-assembler-not "sbi 0x20,0" } } */ +/* { dg-final { scan-assembler-not "cbi 0x20,0" } } */ +/* { dg-final { scan-assembler "in r\\d+,__SREG__" } } */ +/* { dg-final { scan-assembler "out __SREG__,r\\d+" } } */ +/* { dg-final { scan-assembler-not "in r\\d+,0x40" } } */ +/* { dg-final { scan-assembler-not "out 0x40, r\\d+" } } */ + +/* This testcase verifies that SBI/CBI/SBIS/SBIC + and IN/OUT instructions are not generated for + an IO addresses outside the valid range. +*/ +#define IO_ADDR(x) (*((volatile char *)x + __AVR_SFR_OFFSET__)) +int main () +{ + IO_ADDR(0x1f) |= 1; + IO_ADDR(0x1f) &= 0xFE; + + IO_ADDR(0x20) |= 1; + IO_ADDR(0x20) &= 0xFE; + + IO_ADDR(0x3f) = IO_ADDR(0x3f); + + IO_ADDR(0x40) = IO_ADDR(0x40); + return 0; +} |