source: tests/gccExtensions.cfa @ b0fcd0e

Last change on this file since b0fcd0e was db19e1d, checked in by Andrew Beach <ajbeach@…>, 2 months ago

Changed the interpritation of () to be no parameters instead of any parameters. This had a lot of little changes because of this and some nearby clean-up. This includes some changes, including changing some generated functions to be fixed-args instead of variable-args, stripping out the place holder void parameter earlier, but it still shows up earlier in some cases that examine the parser directly. Also had to update the function generation tools. Have only tested with one --arch. Hopefully this all works out.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// gccExtensions.cfa --
8//
9// Author           : Peter A. Buhr
10// Created On       : Sun Aug 14 17:28:17 2016
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Mon Aug  5 18:04:37 2019
13// Update Count     : 28
14//
15
16extern int x asm( "xx" );
17
18int main(int argc, char const *argv[]) {
19        // asm extensions
20
21        asm( "nop" );
22        __asm( "nop" );
23        __asm__( "nop" );
24
25        static int y asm( "yy" );
26#ifdef __CFA__
27        static * int z asm( "zz" );                                                     // CFA declaration
28#endif // __CFA__
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");
50
51  L1: L2:
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 );
57
58        // alternative type/qualifer names
59
60        __complex__ c1;
61        _Complex c2;
62
63        const int i1;
64        __const int i2;
65        __const__ int i3;
66
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
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
93        // attributes
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
112        int m1[10] __attribute(());
113        int m2[10][10] __attribute(());
114        int __attribute(()) m3 [10][10];
115//      int ( __attribute(()) m4 [10] )[10];
116
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
132}
133
134// Local Variables: //
135// tab-width: 4 //
136// compile-command: "cfa gccExtensions.cfa" //
137// End: //
Note: See TracBrowser for help on using the repository browser.