diff options
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/avr/torture/builtins-1.c | 38 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/avr/torture/builtins-error.c | 11 |
3 files changed, 54 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fab88d9..d1365a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-02-28 Georg-Johann Lay <avr@gjlay.de> + + * gcc.target/avr/torture/builtins-1.c: New test. + * gcc.target/avr/torture/builtins-error.c: New test. + 2012-02-28 Kai Tietz <ktietz@redhat.com> * gcc.target/i386/pr46939.c (long): Fix LP64 vs LLP64 diff --git a/gcc/testsuite/gcc.target/avr/torture/builtins-1.c b/gcc/testsuite/gcc.target/avr/torture/builtins-1.c new file mode 100644 index 0000000..1fa3aaa --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/builtins-1.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ + +void nop (void) { __builtin_avr_nop (); } +void sei (void) { __builtin_avr_sei (); } +void cli (void) { __builtin_avr_cli (); } +void wdr (void) { __builtin_avr_wdr (); } +void sleep (void) { __builtin_avr_sleep (); } + +char fmul (char a, char b) { return __builtin_avr_fmul (a, b); } +char fmuls (char a, char b) { return __builtin_avr_fmuls (a, b); } +char fmulsu (char a, char b) { return __builtin_avr_fmulsu (a, b); } + +char swap1 (char a) +{ + return __builtin_avr_swap (a+1); +} + +char swap2 (char a) +{ + return __builtin_avr_swap (__builtin_avr_swap (a+1)); +} + +char swap15 (void) +{ + return __builtin_avr_swap (15); +} + +void delay0 (void) { __builtin_avr_delay_cycles (0); } +void delay1 (void) { __builtin_avr_delay_cycles (1); } +void delay2 (void) { __builtin_avr_delay_cycles (2); } +void delay3 (void) { __builtin_avr_delay_cycles (3); } + +void delay_1 (void) { __builtin_avr_delay_cycles (44); } +void delay_2 (void) { __builtin_avr_delay_cycles (0x1234); } +void delay_3 (void) { __builtin_avr_delay_cycles (0x123456); } +void delay_4 (void) { __builtin_avr_delay_cycles (-1ul); } + +/* { dg-final { scan-assembler-not "__builtin_avr_" } } */ diff --git a/gcc/testsuite/gcc.target/avr/torture/builtins-error.c b/gcc/testsuite/gcc.target/avr/torture/builtins-error.c new file mode 100644 index 0000000..692b8af --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/builtins-error.c @@ -0,0 +1,11 @@ +/* { dg-do assemble } */ + +char insert (long a) +{ + return __builtin_avr_insert_bits (15.3f+a, 0, 0); /* { dg-error "expects a compile time" } */ +} + +void delay (long a) +{ + __builtin_avr_delay_cycles (a); /* { dg-error "expects a compile time" } */ +} |