1 /* { dg-do compile } */
2 /* { dg-options "-Os" } */
3 /* { dg-final { scan-assembler "sbi 0x1f,0" } } */
4 /* { dg-final { scan-assembler "cbi 0x1f,0" } } */
5 /* { dg-final { scan-assembler-not "sbi 0x20,0" } } */
6 /* { dg-final { scan-assembler-not "cbi 0x20,0" } } */
7 /* { dg-final { scan-assembler "in r\\d+,__SREG__" } } */
8 /* { dg-final { scan-assembler "out __SREG__,r\\d+" } } */
9 /* { dg-final { scan-assembler-not "in r\\d+,0x40" } } */
10 /* { dg-final { scan-assembler-not "out 0x40, r\\d+" } } */
11
12 /* This testcase verifies that SBI/CBI/SBIS/SBIC
13 and IN/OUT instructions are not generated for
14 an IO addresses outside the valid range.
15 */
16 #define IO_ADDR(x) (*((volatile char *)x + __AVR_SFR_OFFSET__))
main()17 int main ()
18 {
19 IO_ADDR(0x1f) |= 1;
20 IO_ADDR(0x1f) &= 0xFE;
21
22 IO_ADDR(0x20) |= 1;
23 IO_ADDR(0x20) &= 0xFE;
24
25 IO_ADDR(0x3f) = IO_ADDR(0x3f);
26
27 IO_ADDR(0x40) = IO_ADDR(0x40);
28 return 0;
29 }
30