Daily bump.
[official-gcc.git] / libgomp / oacc-ptx.h
blob13ff86fb4af34a6b6793028aa81650424ac3cd57
1 /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
3 Contributed by Mentor Embedded.
5 This file is part of the GNU Offloading and Multi Processing Library
6 (libgomp).
8 Libgomp is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
27 #define ABORT_PTX \
28 ".version 3.1\n" \
29 ".target sm_30\n" \
30 ".address_size 64\n" \
31 ".visible .func abort;\n" \
32 ".visible .func abort\n" \
33 "{\n" \
34 "trap;\n" \
35 "ret;\n" \
36 "}\n" \
37 ".visible .func _gfortran_abort;\n" \
38 ".visible .func _gfortran_abort\n" \
39 "{\n" \
40 "trap;\n" \
41 "ret;\n" \
42 "}\n" \
44 /* Generated with:
46 $ echo 'int acc_on_device(int d) { return __builtin_acc_on_device(d); } int acc_on_device_h_(int *d) { return acc_on_device(*d); }' | accel-gcc/xgcc -Baccel-gcc -x c - -o - -S -m64 -O3 -fno-builtin-acc_on_device -fno-inline
48 #define ACC_ON_DEVICE_PTX \
49 " .version 3.1\n" \
50 " .target sm_30\n" \
51 " .address_size 64\n" \
52 ".visible .func (.param.u32 %out_retval)acc_on_device(.param.u32 %in_ar1);\n" \
53 ".visible .func (.param.u32 %out_retval)acc_on_device(.param.u32 %in_ar1)\n" \
54 "{\n" \
55 " .reg.u32 %ar1;\n" \
56 ".reg.u32 %retval;\n" \
57 " .reg.u64 %hr10;\n" \
58 " .reg.u32 %r24;\n" \
59 " .reg.u32 %r25;\n" \
60 " .reg.pred %r27;\n" \
61 " .reg.u32 %r30;\n" \
62 " ld.param.u32 %ar1, [%in_ar1];\n" \
63 " mov.u32 %r24, %ar1;\n" \
64 " setp.ne.u32 %r27,%r24,4;\n" \
65 " set.u32.eq.u32 %r30,%r24,5;\n" \
66 " neg.s32 %r25, %r30;\n" \
67 " @%r27 bra $L3;\n" \
68 " mov.u32 %r25, 1;\n" \
69 "$L3:\n" \
70 " mov.u32 %retval, %r25;\n" \
71 " st.param.u32 [%out_retval], %retval;\n" \
72 " ret;\n" \
73 " }\n" \
74 ".visible .func (.param.u32 %out_retval)acc_on_device_h_(.param.u64 %in_ar1);\n" \
75 ".visible .func (.param.u32 %out_retval)acc_on_device_h_(.param.u64 %in_ar1)\n" \
76 "{\n" \
77 " .reg.u64 %ar1;\n" \
78 ".reg.u32 %retval;\n" \
79 " .reg.u64 %hr10;\n" \
80 " .reg.u64 %r25;\n" \
81 " .reg.u32 %r26;\n" \
82 " .reg.u32 %r27;\n" \
83 " ld.param.u64 %ar1, [%in_ar1];\n" \
84 " mov.u64 %r25, %ar1;\n" \
85 " ld.u32 %r26, [%r25];\n" \
86 " {\n" \
87 " .param.u32 %retval_in;\n" \
88 " {\n" \
89 " .param.u32 %out_arg0;\n" \
90 " st.param.u32 [%out_arg0], %r26;\n" \
91 " call (%retval_in), acc_on_device, (%out_arg0);\n" \
92 " }\n" \
93 " ld.param.u32 %r27, [%retval_in];\n" \
94 "}\n" \
95 " mov.u32 %retval, %r27;\n" \
96 " st.param.u32 [%out_retval], %retval;\n" \
97 " ret;\n" \
98 " }"
100 #define GOACC_INTERNAL_PTX \
101 ".version 3.1\n" \
102 ".target sm_30\n" \
103 ".address_size 64\n" \
104 ".visible .func (.param .u32 %out_retval) GOACC_get_num_threads;\n" \
105 ".visible .func (.param .u32 %out_retval) GOACC_get_thread_num;\n" \
106 ".extern .func abort;\n" \
107 ".visible .func (.param .u32 %out_retval) GOACC_get_num_threads\n" \
108 "{\n" \
109 ".reg .u32 %retval;\n" \
110 ".reg .u64 %hr10;\n" \
111 ".reg .u32 %r22;\n" \
112 ".reg .u32 %r23;\n" \
113 ".reg .u32 %r24;\n" \
114 ".reg .u32 %r25;\n" \
115 ".reg .u32 %r26;\n" \
116 ".reg .u32 %r27;\n" \
117 ".reg .u32 %r28;\n" \
118 ".reg .u32 %r29;\n" \
119 "mov.u32 %r26,0;\n" \
120 "{\n" \
121 ".param .u32 %retval_in;\n" \
122 "{\n" \
123 ".param .u32 %out_arg0;\n" \
124 "st.param.u32 [%out_arg0],%r26;\n" \
125 "call (%retval_in),GOACC_ntid,(%out_arg0);\n" \
126 "}\n" \
127 "ld.param.u32 %r27,[%retval_in];\n" \
128 "}\n" \
129 "mov.u32 %r22,%r27;\n" \
130 "mov.u32 %r28,0;\n" \
131 "{\n" \
132 ".param .u32 %retval_in;\n" \
133 "{\n" \
134 ".param .u32 %out_arg0;\n" \
135 "st.param.u32 [%out_arg0],%r28;\n" \
136 "call (%retval_in),GOACC_nctaid,(%out_arg0);\n" \
137 "}\n" \
138 "ld.param.u32 %r29,[%retval_in];\n" \
139 "}\n" \
140 "mov.u32 %r23,%r29;\n" \
141 "mul.lo.u32 %r24,%r22,%r23;\n" \
142 "mov.u32 %r25,%r24;\n" \
143 "mov.u32 %retval,%r25;\n" \
144 "st.param.u32 [%out_retval],%retval;\n" \
145 "ret;\n" \
146 "}\n" \
147 ".visible .func (.param .u32 %out_retval) GOACC_get_thread_num\n" \
148 "{\n" \
149 ".reg .u32 %retval;\n" \
150 ".reg .u64 %hr10;\n" \
151 ".reg .u32 %r22;\n" \
152 ".reg .u32 %r23;\n" \
153 ".reg .u32 %r24;\n" \
154 ".reg .u32 %r25;\n" \
155 ".reg .u32 %r26;\n" \
156 ".reg .u32 %r27;\n" \
157 ".reg .u32 %r28;\n" \
158 ".reg .u32 %r29;\n" \
159 ".reg .u32 %r30;\n" \
160 ".reg .u32 %r31;\n" \
161 ".reg .u32 %r32;\n" \
162 ".reg .u32 %r33;\n" \
163 "mov.u32 %r28,0;\n" \
164 "{\n" \
165 ".param .u32 %retval_in;\n" \
166 "{\n" \
167 ".param .u32 %out_arg0;\n" \
168 "st.param.u32 [%out_arg0],%r28;\n" \
169 "call (%retval_in),GOACC_ntid,(%out_arg0);\n" \
170 "}\n" \
171 "ld.param.u32 %r29,[%retval_in];\n" \
172 "}\n" \
173 "mov.u32 %r22,%r29;\n" \
174 "mov.u32 %r30,0;\n" \
175 "{\n" \
176 ".param .u32 %retval_in;\n" \
177 "{\n" \
178 ".param .u32 %out_arg0;\n" \
179 "st.param.u32 [%out_arg0],%r30;\n" \
180 "call (%retval_in),GOACC_ctaid,(%out_arg0);\n" \
181 "}\n" \
182 "ld.param.u32 %r31,[%retval_in];\n" \
183 "}\n" \
184 "mov.u32 %r23,%r31;\n" \
185 "mul.lo.u32 %r24,%r22,%r23;\n" \
186 "mov.u32 %r32,0;\n" \
187 "{\n" \
188 ".param .u32 %retval_in;\n" \
189 "{\n" \
190 ".param .u32 %out_arg0;\n" \
191 "st.param.u32 [%out_arg0],%r32;\n" \
192 "call (%retval_in),GOACC_tid,(%out_arg0);\n" \
193 "}\n" \
194 "ld.param.u32 %r33,[%retval_in];\n" \
195 "}\n" \
196 "mov.u32 %r25,%r33;\n" \
197 "add.u32 %r26,%r24,%r25;\n" \
198 "mov.u32 %r27,%r26;\n" \
199 "mov.u32 %retval,%r27;\n" \
200 "st.param.u32 [%out_retval],%retval;\n" \
201 "ret;\n" \
202 "}\n"