| [777bfcf] | 1 | // 
 | 
|---|
| [0da3e2c] | 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
 | 
|---|
| [777bfcf] | 3 | //
 | 
|---|
 | 4 | // The contents of this file are covered under the licence agreement in the
 | 
|---|
 | 5 | // file "LICENCE" distributed with Cforall.
 | 
|---|
 | 6 | // 
 | 
|---|
| [dc8511c] | 7 | // gccExtensions.cfa -- 
 | 
|---|
| [777bfcf] | 8 | // 
 | 
|---|
 | 9 | // Author           : Peter A. Buhr
 | 
|---|
 | 10 | // Created On       : Sun Aug 14 17:28:17 2016
 | 
|---|
 | 11 | // Last Modified By : Peter A. Buhr
 | 
|---|
| [c63d48f] | 12 | // Last Modified On : Mon Aug  5 18:04:37 2019
 | 
|---|
 | 13 | // Update Count     : 28
 | 
|---|
| [777bfcf] | 14 | // 
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | extern int x asm( "xx" );
 | 
|---|
 | 17 | 
 | 
|---|
| [10dc7491] | 18 | int main(int argc, char const *argv[]) {
 | 
|---|
| [926af74] | 19 |         // asm extensions
 | 
|---|
 | 20 | 
 | 
|---|
| [10dc7491] | 21 |         asm( "nop" );
 | 
|---|
 | 22 |         __asm( "nop" );
 | 
|---|
 | 23 |         __asm__( "nop" );
 | 
|---|
 | 24 | 
 | 
|---|
| [777bfcf] | 25 |         static int y asm( "yy" );
 | 
|---|
| [5ead9f9] | 26 | #ifdef __CFA__
 | 
|---|
 | 27 |         static * int z asm( "zz" );                                                     // CFA declaration
 | 
|---|
 | 28 | #endif // __CFA__
 | 
|---|
| [777bfcf] | 29 | 
 | 
|---|
 | 30 |         int src;
 | 
|---|
 | 31 |         int dst;
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 |         asm volatile ( "mov %1, %0\n\t"
 | 
|---|
 | 34 |                                    "add $1, %0" : : : );
 | 
|---|
 | 35 | 
 | 
|---|
 | 36 |         asm volatile ( "mov %1, %0\n\t"
 | 
|---|
 | 37 |                                    "add $1, %0"
 | 
|---|
 | 38 |                                    : "=" "r" (dst));
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 |         asm volatile ( "mov %1, %0\n\t"
 | 
|---|
 | 41 |                                    "add $1, %0"
 | 
|---|
 | 42 |                                    : "=r" (dst)
 | 
|---|
 | 43 |                                    : "r" (src));
 | 
|---|
 | 44 | 
 | 
|---|
 | 45 |         asm ( "mov %1, %0\n\t"
 | 
|---|
 | 46 |                   "add $1, %0"
 | 
|---|
 | 47 |                   : "=r" (dst), "=r" (src)
 | 
|---|
 | 48 |                   : [src] "r" (dst)
 | 
|---|
 | 49 |                   : "r0");
 | 
|---|
| [e82aa9df] | 50 | 
 | 
|---|
| [777bfcf] | 51 |   L1: L2:
 | 
|---|
| [c63d48f] | 52 |         asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5"
 | 
|---|
 | 53 |                            : /* No outputs. */
 | 
|---|
 | 54 |                            : "r"(src), "r"(&dst)
 | 
|---|
 | 55 |                            : "r5", "memory"
 | 
|---|
 | 56 |                            : L1, L2 );
 | 
|---|
| [e82aa9df] | 57 | 
 | 
|---|
| [926af74] | 58 |         // alternative type/qualifer names
 | 
|---|
 | 59 | 
 | 
|---|
| [10dc7491] | 60 |         __complex__ c1;
 | 
|---|
 | 61 |         _Complex c2;
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 |         const int i1;
 | 
|---|
 | 64 |         __const int i2;
 | 
|---|
 | 65 |         __const__ int i3;
 | 
|---|
 | 66 | 
 | 
|---|
| [926af74] | 67 |         __inline int f1() {}
 | 
|---|
 | 68 |         __inline__ int f2() {}
 | 
|---|
 | 69 | 
 | 
|---|
 | 70 |         __signed s1;
 | 
|---|
 | 71 |         __signed s2;
 | 
|---|
 | 72 | 
 | 
|---|
 | 73 |         __volatile int v1;
 | 
|---|
 | 74 |         __volatile__ int v2;
 | 
|---|
 | 75 | 
 | 
|---|
 | 76 |         // symbol table attributes
 | 
|---|
 | 77 | 
 | 
|---|
 | 78 |         __typeof(s1) t1;
 | 
|---|
 | 79 |         __typeof__(s1) t2;
 | 
|---|
 | 80 | 
 | 
|---|
 | 81 |         // strange extension qualifier
 | 
|---|
 | 82 | 
 | 
|---|
| [10dc7491] | 83 |         __extension__ const int ex;
 | 
|---|
 | 84 |         struct S {
 | 
|---|
 | 85 |                 __extension__ int a, b, c;
 | 
|---|
 | 86 |         };
 | 
|---|
 | 87 |         int i = __extension__ 3;
 | 
|---|
 | 88 |         __extension__ int a, b, c;
 | 
|---|
 | 89 |         __extension__ a, __extension__ b, __extension__ c;
 | 
|---|
 | 90 |         __extension__ a = __extension__ b + __extension__ c;
 | 
|---|
 | 91 |         __extension__ a = __extension__ ( __extension__ b + __extension__ c );
 | 
|---|
 | 92 | 
 | 
|---|
| [926af74] | 93 |         // attributes
 | 
|---|
| [10dc7491] | 94 | 
 | 
|---|
 | 95 |         __attribute__(()) int a1;
 | 
|---|
 | 96 |         const __attribute(()) int a2;
 | 
|---|
 | 97 |         const static __attribute(()) int a3;
 | 
|---|
 | 98 |         const static int __attribute(()) a4;
 | 
|---|
 | 99 |         const static int a5 __attribute(());
 | 
|---|
 | 100 |         const static int a6, __attribute(()) a7;
 | 
|---|
 | 101 | 
 | 
|---|
 | 102 |         int * __attribute(()) p1;
 | 
|---|
 | 103 |         int (* __attribute(()) p2);
 | 
|---|
 | 104 | //      int (__attribute(()) (p3));
 | 
|---|
 | 105 | //      int ( __attribute(()) (* __attribute(()) p4));
 | 
|---|
 | 106 | 
 | 
|---|
 | 107 |         struct __attribute(()) s1;
 | 
|---|
 | 108 |         struct __attribute(()) s2 { int i; };
 | 
|---|
 | 109 |         struct __attribute(()) s3 { int i; } x1, __attribute(()) y1;
 | 
|---|
 | 110 |         struct __attribute(()) s4 { int i; } x2, y2 __attribute(());
 | 
|---|
 | 111 | 
 | 
|---|
| [c63d48f] | 112 |         int m1[10] __attribute(());
 | 
|---|
 | 113 |         int m2[10][10] __attribute(());
 | 
|---|
| [10dc7491] | 114 |         int __attribute(()) m3 [10][10];
 | 
|---|
 | 115 | //      int ( __attribute(()) m4 [10] )[10];
 | 
|---|
| [62edde5] | 116 | 
 | 
|---|
| [c63d48f] | 117 |         // int128
 | 
|---|
 | 118 | 
 | 
|---|
 | 119 | #if defined( __SIZEOF_INT128__ )
 | 
|---|
 | 120 |         void f128( __int128 i );
 | 
|---|
 | 121 |         void f128( __uint128_t );
 | 
|---|
 | 122 | 
 | 
|---|
 | 123 |         __int128 i128_0;
 | 
|---|
 | 124 |         f128( i128_0 );
 | 
|---|
 | 125 |         unsigned __int128 i128_1;
 | 
|---|
 | 126 |         f128( i128_1 );
 | 
|---|
 | 127 |         __int128_t i128_2;
 | 
|---|
 | 128 |         f128( i128_2 );
 | 
|---|
 | 129 |         __uint128_t i128_3;
 | 
|---|
 | 130 |         f128( i128_3 );
 | 
|---|
 | 131 | #endif
 | 
|---|
| [62edde5] | 132 | }
 | 
|---|
| [777bfcf] | 133 | 
 | 
|---|
 | 134 | // Local Variables: //
 | 
|---|
 | 135 | // tab-width: 4 //
 | 
|---|
| [dc8511c] | 136 | // compile-command: "cfa gccExtensions.cfa" //
 | 
|---|
| [777bfcf] | 137 | // End: //
 | 
|---|