1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2015 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.c -- |
---|
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 15 12:44:35 2016 |
---|
13 | // Update Count : 5 |
---|
14 | // |
---|
15 | |
---|
16 | extern int x asm( "xx" ); |
---|
17 | |
---|
18 | int main(int argc, char const *argv[]) { |
---|
19 | asm( "nop" ); |
---|
20 | __asm( "nop" ); |
---|
21 | __asm__( "nop" ); |
---|
22 | |
---|
23 | static int y asm( "yy" ); |
---|
24 | // static * int z asm( "zz" ); // CFA declaration |
---|
25 | |
---|
26 | int src; |
---|
27 | int dst; |
---|
28 | |
---|
29 | asm volatile ( "mov %1, %0\n\t" |
---|
30 | "add $1, %0" : : : ); |
---|
31 | |
---|
32 | asm volatile ( "mov %1, %0\n\t" |
---|
33 | "add $1, %0" |
---|
34 | : "=" "r" (dst)); |
---|
35 | |
---|
36 | asm volatile ( "mov %1, %0\n\t" |
---|
37 | "add $1, %0" |
---|
38 | : "=r" (dst) |
---|
39 | : "r" (src)); |
---|
40 | |
---|
41 | asm ( "mov %1, %0\n\t" |
---|
42 | "add $1, %0" |
---|
43 | : "=r" (dst), "=r" (src) |
---|
44 | : [src] "r" (dst) |
---|
45 | : "r0"); |
---|
46 | |
---|
47 | L1: L2: |
---|
48 | asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5" |
---|
49 | : /* No outputs. */ |
---|
50 | : "r"(src), "r"(&dst) |
---|
51 | : "r5", "memory" |
---|
52 | : L1, L2 ); |
---|
53 | |
---|
54 | __complex__ c1; |
---|
55 | _Complex c2; |
---|
56 | |
---|
57 | const int i1; |
---|
58 | __const int i2; |
---|
59 | __const__ int i3; |
---|
60 | |
---|
61 | __extension__ const int ex; |
---|
62 | struct S { |
---|
63 | __extension__ int a, b, c; |
---|
64 | }; |
---|
65 | int i = __extension__ 3; |
---|
66 | __extension__ int a, b, c; |
---|
67 | __extension__ a, __extension__ b, __extension__ c; |
---|
68 | __extension__ a = __extension__ b + __extension__ c; |
---|
69 | __extension__ a = __extension__ ( __extension__ b + __extension__ c ); |
---|
70 | |
---|
71 | __inline int f1() {} |
---|
72 | __inline__ int f2() {} |
---|
73 | |
---|
74 | __signed s1; |
---|
75 | __signed s2; |
---|
76 | |
---|
77 | __typeof(s1) t1; |
---|
78 | __typeof__(s1) t2; |
---|
79 | |
---|
80 | __volatile int v1; |
---|
81 | __volatile__ int v2; |
---|
82 | |
---|
83 | __attribute__(()) int a1; |
---|
84 | const __attribute(()) int a2; |
---|
85 | const static __attribute(()) int a3; |
---|
86 | const static int __attribute(()) a4; |
---|
87 | const static int a5 __attribute(()); |
---|
88 | const static int a6, __attribute(()) a7; |
---|
89 | |
---|
90 | int * __attribute(()) p1; |
---|
91 | int (* __attribute(()) p2); |
---|
92 | // int (__attribute(()) (p3)); |
---|
93 | // int ( __attribute(()) (* __attribute(()) p4)); |
---|
94 | |
---|
95 | struct __attribute(()) s1; |
---|
96 | struct __attribute(()) s2 { int i; }; |
---|
97 | struct __attribute(()) s3 { int i; } x1, __attribute(()) y1; |
---|
98 | struct __attribute(()) s4 { int i; } x2, y2 __attribute(()); |
---|
99 | |
---|
100 | int m1 [10] __attribute(()); |
---|
101 | int m2 [10][10] __attribute(()); |
---|
102 | int __attribute(()) m3 [10][10]; |
---|
103 | // int ( __attribute(()) m4 [10] )[10]; |
---|
104 | |
---|
105 | return 0; |
---|
106 | } |
---|
107 | |
---|
108 | // Local Variables: // |
---|
109 | // tab-width: 4 // |
---|
110 | // compile-command: "cfa gccExtensions.c" // |
---|
111 | // End: // |
---|