Weiming Zhao | be380c7 | 2017-05-05 19:25:29 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple arm-apple-darwin -target-feature +vfp2 -verify -fsyntax-only |
| 2 | // RUN: %clang_cc1 %s -triple thumb-apple-darwin -target-feature +vfp3 -verify -fsyntax-only |
| 3 | // RUN: %clang_cc1 %s -triple armeb-none-eabi -target-feature +vfp4 -verify -fsyntax-only |
| 4 | // RUN: %clang_cc1 %s -triple thumbeb-none-eabi -target-feature +neon -verify -fsyntax-only |
| 5 | // RUN: %clang_cc1 %s -triple thumbeb-none-eabi -target-feature +neon -target-feature +soft-float -DSOFT -verify -fsyntax-only |
Tim Northover | a484bc0 | 2013-10-01 14:34:25 +0000 | [diff] [blame] | 6 | |
Aaron Ballman | 05e420a | 2014-01-02 21:26:14 +0000 | [diff] [blame] | 7 | __attribute__((interrupt(IRQ))) void foo() {} // expected-error {{'interrupt' attribute requires a string}} |
Tim Northover | a484bc0 | 2013-10-01 14:34:25 +0000 | [diff] [blame] | 8 | __attribute__((interrupt("irq"))) void foo1() {} // expected-warning {{'interrupt' attribute argument not supported: irq}} |
| 9 | |
Aaron Ballman | 05e420a | 2014-01-02 21:26:14 +0000 | [diff] [blame] | 10 | __attribute__((interrupt("IRQ", 1))) void foo2() {} // expected-error {{'interrupt' attribute takes no more than 1 argument}} |
Tim Northover | a484bc0 | 2013-10-01 14:34:25 +0000 | [diff] [blame] | 11 | |
| 12 | __attribute__((interrupt("IRQ"))) void foo3() {} |
| 13 | __attribute__((interrupt("FIQ"))) void foo4() {} |
| 14 | __attribute__((interrupt("SWI"))) void foo5() {} |
| 15 | __attribute__((interrupt("ABORT"))) void foo6() {} |
| 16 | __attribute__((interrupt("UNDEF"))) void foo7() {} |
| 17 | |
| 18 | __attribute__((interrupt)) void foo8() {} |
| 19 | __attribute__((interrupt())) void foo9() {} |
| 20 | __attribute__((interrupt(""))) void foo10() {} |
Jonathan Roelofs | 8277c41 | 2017-01-18 15:31:11 +0000 | [diff] [blame] | 21 | |
| 22 | void callee1(); |
| 23 | __attribute__((interrupt("IRQ"))) void callee2(); |
| 24 | void caller1() { |
| 25 | callee1(); |
| 26 | callee2(); |
| 27 | } |
Weiming Zhao | be380c7 | 2017-05-05 19:25:29 +0000 | [diff] [blame] | 28 | |
| 29 | #ifndef SOFT |
Jonathan Roelofs | 8277c41 | 2017-01-18 15:31:11 +0000 | [diff] [blame] | 30 | __attribute__((interrupt("IRQ"))) void caller2() { |
| 31 | callee1(); // expected-warning {{call to function without interrupt attribute could clobber interruptee's VFP registers}} |
| 32 | callee2(); |
| 33 | } |
Eli Friedman | f5f1762 | 2017-03-14 00:18:29 +0000 | [diff] [blame] | 34 | |
| 35 | void (*callee3)(); |
| 36 | __attribute__((interrupt("IRQ"))) void caller3() { |
| 37 | callee3(); // expected-warning {{call to function without interrupt attribute could clobber interruptee's VFP registers}} |
| 38 | } |
Weiming Zhao | be380c7 | 2017-05-05 19:25:29 +0000 | [diff] [blame] | 39 | #else |
| 40 | __attribute__((interrupt("IRQ"))) void caller2() { |
| 41 | callee1(); |
| 42 | callee2(); |
| 43 | } |
| 44 | |
| 45 | void (*callee3)(); |
| 46 | __attribute__((interrupt("IRQ"))) void caller3() { |
| 47 | callee3(); |
| 48 | } |
| 49 | #endif |