1 /* Functional tests for the "target" attribute and pragma. */ 2 3 /* { dg-do compile } */ 4 /* { dg-require-effective-target target_attribute } */ 5 /* { dg-options "-mno-packed-stack" } */ 6 7 extern void foo(void); 8 9 #pragma GCC target("packed-stack") p1(void)10int p1(void) 11 { 12 foo(); 13 return 1; 14 } 15 #pragma GCC reset_options 16 17 #pragma GCC target("no-packed-stack") p0(void)18int p0(void) 19 { 20 foo(); 21 return 2; 22 } p0b(void)23int p0b(void) 24 { 25 foo(); 26 return 2; 27 } 28 #pragma GCC reset_options 29 30 __attribute__ ((target("packed-stack"))) a1(void)31int a1(void) 32 { 33 foo(); 34 return 4; 35 } 36 37 __attribute__ ((target("packed-stack"))) a1b(void)38int a1b(void) 39 { 40 foo(); 41 return 4; 42 } 43 44 __attribute__ ((target("packed-stack"))) a1c(void)45int a1c(void) 46 { 47 foo(); 48 return 4; 49 } 50 51 __attribute__ ((target("packed-stack"))) a1d(void)52int a1d(void) 53 { 54 foo(); 55 return 4; 56 } 57 58 __attribute__ ((target("no-packed-stack"))) a0(void)59int a0(void) 60 { 61 foo(); 62 return 8; 63 } 64 65 __attribute__ ((target("no-packed-stack"))) a0b(void)66int a0b(void) 67 { 68 foo(); 69 return 8; 70 } 71 72 __attribute__ ((target("no-packed-stack"))) a0c(void)73int a0c(void) 74 { 75 foo(); 76 return 8; 77 } 78 79 __attribute__ ((target("no-packed-stack"))) a0d(void)80int a0d(void) 81 { 82 foo(); 83 return 8; 84 } 85 86 __attribute__ ((target("no-packed-stack"))) a0e(void)87int a0e(void) 88 { 89 foo(); 90 return 8; 91 } 92 93 __attribute__ ((target("no-packed-stack"))) a0f(void)94int a0f(void) 95 { 96 foo(); 97 return 8; 98 } 99 100 __attribute__ ((target("no-packed-stack"))) a0g(void)101int a0g(void) 102 { 103 foo(); 104 return 8; 105 } 106 107 __attribute__ ((target("no-packed-stack"))) a0h(void)108int a0h(void) 109 { 110 foo(); 111 return 8; 112 } 113 114 /* { dg-final { scan-assembler-times "\t.cfi_offset 15, -40" 10 { target { lp64 } } } } */ 115 /* { dg-final { scan-assembler-times "\t.cfi_offset 15, -8" 5 { target { lp64 } } } } */ 116 /* { dg-final { scan-assembler-times "\t.cfi_offset 15, -36" 10 { target { ! lp64 } } } } */ 117 /* { dg-final { scan-assembler-times "\t.cfi_offset 15, -4" 5 { target { ! lp64 } } } } */ 118