diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/i386')
40 files changed, 989 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/interrupt-1.c b/gcc/testsuite/gcc.target/i386/interrupt-1.c new file mode 100644 index 00000000000..56f070f13da --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-1.c @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-push-args -maccumulate-outgoing-args" } */ + +extern void foo (void *) __attribute__ ((interrupt)); +extern int bar (int); + +void foo (void *frame) +{ + int a,b,c,d,e,f,i; + a = bar (5); + b = bar (a); + c = bar (b); + d = bar (c); + e = bar (d); + f = bar (e); + for (i = 1; i < 10; i++) + { + a += bar (a + i) + bar (b + i) + + bar (c + i) + bar (d + i) + + bar (e + i) + bar (f + i); + } +} +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)dx" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)si" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%edi" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r8" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r9" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r10" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r11" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r12" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r13" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r14" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r15" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)dx" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)si" 1 } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%edi" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r8" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r9" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r10" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r11" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r12" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r13" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r14" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r15" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-10.c b/gcc/testsuite/gcc.target/i386/interrupt-10.c new file mode 100644 index 00000000000..b025a614c11 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-10.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld" } */ + +extern int check_int (int *i, void *, int align); +typedef int aligned __attribute__((aligned(64))); + +__attribute__((interrupt)) +void +foo (void *frame) +{ + aligned j; + if (check_int (frame, &j, __alignof__(j))) + __builtin_abort (); +} + +/* { dg-final { scan-assembler-times "and\[lq\]?\[^\\n\]*-64,\[^\\n\]*sp" 1 } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-11.c b/gcc/testsuite/gcc.target/i386/interrupt-11.c new file mode 100644 index 00000000000..4918e76358f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-11.c @@ -0,0 +1,41 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mno-sse4 -mno-popcnt -maccumulate-outgoing-args" } */ + +extern int i, cnt; + +void + __attribute__ ((interrupt)) +foo (void *frame) +{ + cnt = __builtin_popcount (i); +} + +/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "kmov.\[\\t \]*%k\[0-7\]+,\[\\t \]*\[\\-]?\[0-9\]*\\(%\[re\]?sp\\)" } } */ +/* { dg-final { scan-assembler-not "kmov.\[\\t \]*\[0-9\]*\\(%\[re\]?sp\\),\[\\t \]*%k\[0-7\]+" } } */ +/* { dg-final { scan-assembler-not "pushq\[\\t \]*%rbx" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "pushq\[\\t \]*%r1\[2-5\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "pushl\[\\t \]*%ebx" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "pushl\[\\t \]*%edi" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "pushl\[\\t \]*%esi" { target ia32 } } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)dx" 1 } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rsi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r8" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r9" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r10" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r11" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)dx" 1 } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%rsi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r8" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r9" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r10" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r11" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-12.c b/gcc/testsuite/gcc.target/i386/interrupt-12.c new file mode 100644 index 00000000000..4da81219578 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-12.c @@ -0,0 +1,30 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mpush-args -maccumulate-outgoing-args" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); +extern void bar (int) __attribute__ ((no_caller_saved_registers)); + +void + __attribute__ ((interrupt)) +fn1 (void *frame, uword_t error) +{ + bar (error); +} + +/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ +/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:r|e)bp" 1 } } */ +/* { dg-final { scan-assembler-times "leave" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-13.c b/gcc/testsuite/gcc.target/i386/interrupt-13.c new file mode 100644 index 00000000000..7e35c291442 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-13.c @@ -0,0 +1,30 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mno-push-args -maccumulate-outgoing-args" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); +extern void bar (int) __attribute__ ((no_caller_saved_registers)); + +void + __attribute__ ((interrupt)) +fn1 (void *frame, uword_t error) +{ + bar (error); +} + +/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ +/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:r|e)bp" 1 } } */ +/* { dg-final { scan-assembler-times "leave" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-14.c b/gcc/testsuite/gcc.target/i386/interrupt-14.c new file mode 100644 index 00000000000..fe0966d532b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-14.c @@ -0,0 +1,32 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mpush-args -mno-accumulate-outgoing-args" } */ + +extern void bar (int) __attribute__ ((no_caller_saved_registers)); + +void + __attribute__ ((interrupt)) +fn1 (void *frame) +{ + bar (3); +} + +void + __attribute__ ((interrupt)) +fn2 (void *frame) +{ + bar (3); +} + +/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[8-9\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r1\[0-5\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:r|e)bp" 2 } } */ +/* { dg-final { scan-assembler-times "leave" 2 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "iret" 2 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-15.c b/gcc/testsuite/gcc.target/i386/interrupt-15.c new file mode 100644 index 00000000000..754733ae904 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-15.c @@ -0,0 +1,37 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mpush-args -maccumulate-outgoing-args" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); +extern void bar (int) __attribute__ ((no_caller_saved_registers)); + +void + __attribute__ ((interrupt)) +fn1 (void *frame, uword_t error) +{ + bar (error); +} + +void + __attribute__ ((interrupt)) +fn2 (void *frame, uword_t error) +{ + bar (error); +} + +/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ +/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:r|e)bp" 2 } } */ +/* { dg-final { scan-assembler-times "leave" 2 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 2 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 2 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]*-8\\(%(?:r|e)bp\\),\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 2 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "iret" 2 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-16.c b/gcc/testsuite/gcc.target/i386/interrupt-16.c new file mode 100644 index 00000000000..28e3f43a990 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-16.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mno-push-args -maccumulate-outgoing-args" } */ + +extern int foo (int) __attribute__ ((no_caller_saved_registers)); +extern int bar (int) __attribute__ ((no_caller_saved_registers)); + +int +foo (int i) +{ + return bar (i); +} + +/* { dg-final { scan-assembler-not "movups\[\\t \]*%(x|y|z)mm\[0-9\]+,\[\\t \]-*\[0-9\]*\\(%\[re\]?bp\\)" } } */ +/* { dg-final { scan-assembler-not "movups\[\\t \]*-\[0-9\]*\\(%\[re\]?bp\\),\[\\t \]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bp" } } */ +/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-17.c b/gcc/testsuite/gcc.target/i386/interrupt-17.c new file mode 100644 index 00000000000..0125f41bb24 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-17.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O3 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mno-push-args" } */ + +extern int foo (int) __attribute__ ((no_caller_saved_registers)); +extern int bar (int) __attribute__ ((no_caller_saved_registers)); + +int +foo (int i) +{ + return bar (i + 1); +} + +/* { dg-final { scan-assembler-not "movups\[\\t \]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bp" } } */ +/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rdx" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "jmp" } }*/ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-18.c b/gcc/testsuite/gcc.target/i386/interrupt-18.c new file mode 100644 index 00000000000..77a554bd236 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-18.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -Wall -g" } */ + +void +__attribute__((interrupt)) +fn (void *frame) +{ +} + +/* { dg-final { scan-assembler-not "add(l|q)\[\\t \]*\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "\tcld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-19.c b/gcc/testsuite/gcc.target/i386/interrupt-19.c new file mode 100644 index 00000000000..4492f4b296b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-19.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu" } */ + +struct ret +{ + int i[8]; +}; + +extern struct ret bar (void); + +void + __attribute__ ((interrupt)) +fn (void *frame) +{ + bar (); +} /* { dg-message "sorry, unimplemented: Dynamic Realign Argument Pointer" } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-2.c b/gcc/testsuite/gcc.target/i386/interrupt-2.c new file mode 100644 index 00000000000..06b9a36f4c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -Wall -g" } */ + +void +__attribute__((interrupt)) +fn (void *frame) +{ +} + +typedef void (*fn_t) (void *) __attribute__((interrupt)); + +fn_t fns[] = +{ + fn, +}; + +/* { dg-final { scan-assembler-not "add(l|q)\[\\t \]*\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "\tcld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-20.c b/gcc/testsuite/gcc.target/i386/interrupt-20.c new file mode 100644 index 00000000000..6ef13b6be85 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-20.c @@ -0,0 +1,29 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -miamcu -maccumulate-outgoing-args" } */ + +struct interrupt_frame; + +void (*callback[1])(unsigned int id, unsigned int len); +unsigned int remaining; + +void +handler(int uart) +{ + while (1) { + if (remaining) { + callback[uart](0, 0); + break; + } + } +} + +int uart; + +void +__attribute__((interrupt)) +my_isr(struct interrupt_frame *frame) +{ + handler(uart); +} + +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-21.c b/gcc/testsuite/gcc.target/i386/interrupt-21.c new file mode 100644 index 00000000000..ddbaf61ca72 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-21.c @@ -0,0 +1,30 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -miamcu -maccumulate-outgoing-args" } */ + +struct interrupt_frame; + +void (*callback[1])(unsigned int id, unsigned int len); +unsigned int remaining; + +void +__attribute__((no_caller_saved_registers)) +handler(int uart) +{ + while (1) { + if (remaining) { + callback[uart](0, 0); + break; + } + } +} + +int uart; + +void +__attribute__((interrupt)) +my_isr(struct interrupt_frame *frame) +{ + handler(uart); +} + +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-22.c b/gcc/testsuite/gcc.target/i386/interrupt-22.c new file mode 100644 index 00000000000..5de2018961b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-22.c @@ -0,0 +1,29 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -miamcu -maccumulate-outgoing-args" } */ + +struct interrupt_frame; + +void (*callback) (unsigned int id, unsigned int len) + __attribute__((no_caller_saved_registers)); +unsigned int remaining; + +void +__attribute__((no_caller_saved_registers)) +handler(void) +{ + while (1) { + if (remaining) { + callback(0, 0); + break; + } + } +} + +void +__attribute__((interrupt)) +my_isr(struct interrupt_frame *frame) +{ + handler(); +} + +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-23.c b/gcc/testsuite/gcc.target/i386/interrupt-23.c new file mode 100644 index 00000000000..c42049c1280 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-23.c @@ -0,0 +1,46 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -miamcu -maccumulate-outgoing-args" } */ + +struct interrupt_frame; + +extern void callback0 (unsigned int id, unsigned int len) + __attribute__((no_caller_saved_registers)); +extern void callback1 (unsigned int id, unsigned int len) + __attribute__((no_caller_saved_registers)); +extern void callback2 (unsigned int id, unsigned int len) + __attribute__((no_caller_saved_registers)); + +typedef void (*callback_t) (unsigned int id, unsigned int len) + __attribute__((no_caller_saved_registers)); + +callback_t callback[] = +{ + callback0, + callback1, + callback2, +}; + +unsigned int remaining; + +void +__attribute__((no_caller_saved_registers)) +handler(int uart) +{ + while (1) { + if (remaining) { + callback[uart](0, 0); + break; + } + } +} + +int uart; + +void +__attribute__((interrupt)) +my_isr(struct interrupt_frame *frame) +{ + handler(uart); +} + +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-24.c b/gcc/testsuite/gcc.target/i386/interrupt-24.c new file mode 100644 index 00000000000..1669cda1736 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-24.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mno-push-args" } */ + +extern void bar (void) __attribute__ ((noreturn)); + +void +__attribute__ ((no_caller_saved_registers)) +foo (int i0, int i1, int i2, int i3, int i4, int i5, int i6, + int i7, int i8) +{ + if (i7) + bar (); +} + +/* { dg-final { scan-assembler-not "movups\[\\t \]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(d|s)i" } } */ +/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bp" } } */ +/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%r\[0-9\]+" { target { ! ia32 } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-25.c b/gcc/testsuite/gcc.target/i386/interrupt-25.c new file mode 100644 index 00000000000..30e3e7f92a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-25.c @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-push-args -maccumulate-outgoing-args" } */ + +extern int bar (int); + +__attribute__((no_caller_saved_registers)) +void +foo (void) +{ + int a,b,c,d,e,f,i; + a = bar (5); + b = bar (a); + c = bar (b); + d = bar (c); + e = bar (d); + f = bar (e); + for (i = 1; i < 10; i++) + { + a += bar (a + i) + bar (b + i) + + bar (c + i) + bar (d + i) + + bar (e + i) + bar (f + i); + } +} + +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)dx" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)si" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%edi" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r8" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r9" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r10" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r11" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r12" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r13" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r14" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r15" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)dx" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)si" 1 } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%edi" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r8" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r9" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r10" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r11" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r12" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r13" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r14" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r15" 1 { target { ! ia32 } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-26.c b/gcc/testsuite/gcc.target/i386/interrupt-26.c new file mode 100644 index 00000000000..14e43558c93 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-26.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld" } */ + + +extern void *a; +extern int b; + +__attribute__ ((interrupt)) +void +foo (void *frame) +{ + __builtin_memset (a, b, 40); +} + +/* { dg-final { scan-assembler "stosb" } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-27.c b/gcc/testsuite/gcc.target/i386/interrupt-27.c new file mode 100644 index 00000000000..5bed18f24b7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-27.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mcld" } */ + +extern void bar (void); + +void +__attribute__ ((interrupt)) +foo (void *frame) +{ + bar (); +} + +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "\tcld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-28.c b/gcc/testsuite/gcc.target/i386/interrupt-28.c new file mode 100644 index 00000000000..58c68c79673 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-28.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mcld" } */ + +__attribute__ ((interrupt)) +void +foo (void *frame) +{ +} + +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "\tcld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-3.c b/gcc/testsuite/gcc.target/i386/interrupt-3.c new file mode 100644 index 00000000000..ee7351e32e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-3.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -g" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +void +__attribute__((interrupt)) +fn (void* frame, uword_t error) +{ +} + +/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "\tcld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c b/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c new file mode 100644 index 00000000000..3dff0345a53 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-cld -mno-iamcu -m80387" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +void +__attribute__((interrupt)) +fn1 (void *frame, uword_t error) +{ /* { dg-message "80387 instructions aren't allowed in exception service routine" } */ +} + +void +__attribute__((interrupt)) +fn2 (void *frame) +{ /* { dg-message "80387 instructions aren't allowed in interrupt service routine" } */ +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-387-err-2.c b/gcc/testsuite/gcc.target/i386/interrupt-387-err-2.c new file mode 100644 index 00000000000..d7a54c8ec74 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-387-err-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-cld -m80387 -mlong-double-80 -mno-iamcu" } */ + +void +__attribute__((no_caller_saved_registers)) +fn1 (void) +{ /* { dg-message "80387 instructions aren't allowed in function with no_caller_saved_registers attribute" } */ +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-4.c b/gcc/testsuite/gcc.target/i386/interrupt-4.c new file mode 100644 index 00000000000..eb1195defd8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-4.c @@ -0,0 +1,32 @@ +/* { dg-do link } */ +/* { dg-options "-O -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -g" } */ + +#include <stdint.h> + +extern void link_error (void); + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +struct interrupt_frame +{ + uword_t ip; + uword_t cs; + uword_t flags; + uword_t sp; + uword_t ss; +}; + +__attribute__ ((used, interrupt)) +void +foo (struct interrupt_frame *frame) +{ + void *ra = __builtin_return_address (0); + if ((uintptr_t) ra != (uintptr_t) frame->ip) + link_error (); +} + +int +main (void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-5.c b/gcc/testsuite/gcc.target/i386/interrupt-5.c new file mode 100644 index 00000000000..21ffea3bc13 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-5.c @@ -0,0 +1,23 @@ +/* { dg-do link } */ +/* { dg-options "-O -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -g" } */ + +#include <stdint.h> + +extern void link_error (void); + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +__attribute__ ((used, interrupt)) +void +foo (void *frame, uword_t error) +{ + void *ra = __builtin_return_address (0); + if ((uintptr_t) ra != (uintptr_t) error) + link_error (); +} + +int +main (void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-6.c b/gcc/testsuite/gcc.target/i386/interrupt-6.c new file mode 100644 index 00000000000..3bbe0da7c39 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-6.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +extern int error; + +__attribute__((interrupt)) +void +fn1 (void *p, short error_code) +{ /* { dg-error "interrupt service routine should have unsigned \(long long |long |\)int as the second argument" } */ +} + +__attribute__((interrupt)) +void +fn2 (void) +{ /* { dg-error "interrupt service routine can only have a pointer argument and an optional integer argument" } */ +} + +__attribute__((interrupt)) +void +fn3 (uword_t error_code) +{ /* { dg-error "interrupt service routine should have a pointer as the first argument" } */ + error = error_code; +} + +__attribute__((interrupt)) +void +fn4 (uword_t error_code, void *frame) +{ /* { dg-error "interrupt service routine should have .* the .* argument" } */ + error = error_code; +} + +extern int fn5 (void *) __attribute__ ((interrupt)); /* { dg-error "interrupt service routine can't have non-void return value" } */ + +int +fn5 (void *frame) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-7.c b/gcc/testsuite/gcc.target/i386/interrupt-7.c new file mode 100644 index 00000000000..23c748871d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-7.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld" } */ + +extern int error; + +extern void fn (void *) __attribute__((interrupt)); + +void +foo (void) +{ + fn (&error); /* { dg-error "interrupt service routine can't be called directly" } */ +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-8.c b/gcc/testsuite/gcc.target/i386/interrupt-8.c new file mode 100644 index 00000000000..f0e16378f52 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-8.c @@ -0,0 +1,38 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -maccumulate-outgoing-args" } */ + +extern void bar (void); + +void + __attribute__ ((interrupt)) +foo (void *frame) +{ + bar (); +} + +/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */ +/* { dg-final { scan-assembler-not "kmov.\[\\t \]*%k\[0-7\]+,\[\\t \]*\[\\-]?\[0-9\]*\\(%\[re\]?sp\\)" } } */ +/* { dg-final { scan-assembler-not "kmov.\[\\t \]*\[0-9\]*\\(%\[re\]?sp\\),\[\\t \]*%k\[0-7\]+" } } */ +/* { dg-final { scan-assembler-not "pushq\[\\t \]*%rbx" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "pushq\[\\t \]*%r1\[2-5\]+" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "pushl\[\\t \]*%ebx" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "pushl\[\\t \]*%e(s|d)i" { target ia32 } } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ +/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)dx" 1 } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rsi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r8" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r9" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r10" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pushq\[\\t \]*%r11" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ +/* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)dx" 1 } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%rsi" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r8" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r9" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r10" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "popq\[\\t \]*%r11" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-9.c b/gcc/testsuite/gcc.target/i386/interrupt-9.c new file mode 100644 index 00000000000..827196ed100 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-9.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld" } */ + +extern int check_int (int *i, void *, int align); +typedef int aligned __attribute__((aligned(64))); +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +__attribute__((interrupt)) +void +foo (void *frame, uword_t error_code) +{ + aligned j; + if (check_int (frame, &j, __alignof__(j))) + __builtin_abort (); +} + +/* { dg-final { scan-assembler-times "and\[lq\]?\[^\\n\]*-64,\[^\\n\]*sp" 1 } } */ +/* { dg-final { scan-assembler-times "add(?:l|q)\[\\t \]*\\\$8,\[\\t \]*%\[re\]?sp" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "addl\[\\t \]*\\\$4,\[\\t \]*%esp" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-bnd-err-1.c b/gcc/testsuite/gcc.target/i386/interrupt-bnd-err-1.c new file mode 100644 index 00000000000..6fd811705fc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-bnd-err-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { ! x32 } } } */ +/* { dg-options "-O2 -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mmpx" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +void +__attribute__((interrupt)) +fn1 (void *frame) +{ /* { dg-message "MPX instructions aren't allowed in interrupt service routine" } */ +} + +void +__attribute__((interrupt)) +fn2 (void *frame, uword_t error) +{ /* { dg-message "MPX instructions aren't allowed in exception service routine" } */ +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-bnd-err-2.c b/gcc/testsuite/gcc.target/i386/interrupt-bnd-err-2.c new file mode 100644 index 00000000000..1bad58d65f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-bnd-err-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { ! x32 } } } */ +/* { dg-options "-O2 -mno-sse -mno-mmx -mno-80387 -mno-cld -mno-iamcu -mmpx" } */ + +void +__attribute__((no_caller_saved_registers)) +fn (void *frame) +{ /* { dg-message "MPX instructions aren't allowed in function with no_caller_saved_registers attribute" } */ +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-iamcu.c b/gcc/testsuite/gcc.target/i386/interrupt-iamcu.c new file mode 100644 index 00000000000..28c50fc1c14 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-iamcu.c @@ -0,0 +1,36 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -miamcu -maccumulate-outgoing-args" } */ + +extern void foo (void *) __attribute__ ((interrupt)); +extern int bar (int); + +void foo (void *frame) +{ + int a,b,c,d,e,f,i; + a = bar (5); + b = bar (a); + c = bar (b); + d = bar (c); + e = bar (d); + f = bar (e); + for (i = 1; i < 10; i++) + a += bar (a + i) + bar (b + i) + + bar (c + i) + bar (d + i) + + bar (e + i) + bar (f+i); +} + +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%ebx" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%ecx" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%edx" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%edi" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%esi" 1 } } */ +/* { dg-final { scan-assembler-times "pushl\[\\t \]*%ebp" 1 } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%eax" 1 } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%edx" 1 } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%edi" 1 } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%esi" 1 } } */ +/* { dg-final { scan-assembler-times "popl\[\\t \]*%ebp" 1 } } */ +/* { dg-final { scan-assembler-times "iret" 1 } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-mmx-err-1.c b/gcc/testsuite/gcc.target/i386/interrupt-mmx-err-1.c new file mode 100644 index 00000000000..d46b21d8653 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-mmx-err-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-80387 -mmmx -mno-cld -mno-iamcu" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +void +__attribute__((interrupt)) +fn1 (void *frame) +{ /* { dg-message "MMX/3Dnow instructions aren't allowed in interrupt service routine" } */ +} + +void +__attribute__((interrupt)) +fn2 (void *frame, uword_t error) +{ /* { dg-message "MMX/3Dnow instructions aren't allowed in exception service routine" } */ +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-mmx-err-2.c b/gcc/testsuite/gcc.target/i386/interrupt-mmx-err-2.c new file mode 100644 index 00000000000..e1d34e523bc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-mmx-err-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-80387 -mmmx -mno-cld -mno-iamcu" } */ + +void +__attribute__((no_caller_saved_registers)) +fn1 (void) +{ /* { dg-message "MMX/3Dnow instructions aren't allowed in function with no_caller_saved_registers attribute" } */ +} diff --git a/gcc/testsuite/gcc.target/i386/interrupt-redzone-1.c b/gcc/testsuite/gcc.target/i386/interrupt-redzone-1.c new file mode 100644 index 00000000000..e0ff18217be --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-redzone-1.c @@ -0,0 +1,32 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mred-zone" } */ + +void +__attribute__((interrupt)) +fn (void *frame) +{ + /* No need to adjust stack if less than 128 bytes are used on stack + with a 128-byte red zone. */ + long long int i0; + long long int i1; + long long int i2; + long long int i3; + long long int i4; + long long int i5; + long long int i6; + long long int i7; + long long int i8; + long long int i9; + long long int i10; + long long int i11; + long long int i12; + long long int i13; + asm ("# %0, %1, %2, %3, %4, %5, %6, %7" + : "=m" (i0), "=m" (i1), "=m" (i2), "=m" (i3), + "=m" (i4), "=m" (i5), "=m" (i6), "=m" (i7), + "=m" (i8), "=m" (i9), "=m" (i10), "=m" (i11), + "=m" (i12), "=m" (i13)); +} + +/* { dg-final { scan-assembler-not "(sub|add)(l|q)\[\\t \]*\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" } } */ +/* { dg-final { scan-assembler-not "\tcld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c b/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c new file mode 100644 index 00000000000..df916cad0da --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c @@ -0,0 +1,33 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mred-zone" } */ + +void +__attribute__((interrupt)) +fn (void *frame) +{ + /* Need to adjust stack if more than 128 bytes are used on stack + with a 128-byte red zone. */ + long long int i0; + long long int i1; + long long int i2; + long long int i3; + long long int i4; + long long int i5; + long long int i6; + long long int i7; + long long int i8; + long long int i9; + long long int i10; + long long int i11; + long long int i12; + long long int i13; + char c; + asm ("# %0, %1, %2, %3, %4, %5, %6, %7" + : "=m" (i0), "=m" (i1), "=m" (i2), "=m" (i3), + "=m" (i4), "=m" (i5), "=m" (i6), "=m" (i7), + "=m" (i8), "=m" (i9), "=m" (i10), "=m" (i11), + "=m" (i12), "=m" (i13), "=m" (c)); +} + +/* { dg-final { scan-assembler-times "(?:sub|add)(?:l|q)\[\\t \]*\\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" 2 } } */ +/* { dg-final { scan-assembler-not "\tcld" } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-sibcall-1.c b/gcc/testsuite/gcc.target/i386/interrupt-sibcall-1.c new file mode 100644 index 00000000000..7e20d5808c4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-sibcall-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld" } */ + +extern void foo (void *) __attribute__ ((interrupt)); +extern void bar (void); + +void foo (void *frame) +{ + bar (); +} +/* { dg-final { scan-assembler-not "jmp" } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-sibcall-2.c b/gcc/testsuite/gcc.target/i386/interrupt-sibcall-2.c new file mode 100644 index 00000000000..51c0478d2bc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-sibcall-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mpreferred-stack-boundary=3" { target { ! { ia32 } } } } */ +/* { dg-options "-O3 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld -mpreferred-stack-boundary=2" { target { ia32 } } } */ + +extern void foo (void *) __attribute__ ((interrupt)); +extern void bar (void) __attribute__ ((no_caller_saved_registers)); + +void foo (void *frame) +{ + bar (); +} +/* { dg-final { scan-assembler-not "jmp" } } */ +/* { dg-final { scan-assembler-times "iret" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/interrupt-switch-abi.c b/gcc/testsuite/gcc.target/i386/interrupt-switch-abi.c new file mode 100644 index 00000000000..f23e6f9870c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/interrupt-switch-abi.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-mpx -mno-sse -mno-mmx -mno-80387 -mno-cld" } */ + +extern void bar (int); + +void f1 (void){ bar (1); } +__attribute__((interrupt)) +void f2 (void *frame){ bar (2); } +void f3 (void){ bar (3); } +__attribute__((interrupt)) +void f4 (void *frame){ bar (4); } +void f5 (void){ bar (5); } + +/* { dg-final { scan-assembler-times "push.\t%.ax" 2 } } */ +/* { dg-final { scan-assembler-times "pop.\t%.ax" 2 } } */ +/* { dg-final { scan-assembler-times "iret" 2 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "iretq" 2 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "\tcld" 2 } } */ |