1 |
voyageur 12/08/30 09:41:15 |
2 |
|
3 |
Added: clang-0001-Add-r600-TargetInfo.patch |
4 |
clang-0002-r600-Add-some-target-builtins.patch |
5 |
clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch |
6 |
llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch |
7 |
llvm-0001-r600-Add-some-intrinsic-definitions.patch |
8 |
Removed: 0002-r600-Add-some-target-builtins.patch |
9 |
0003-r600-Add-read_global_size-and-read_local_size-builti.patch |
10 |
0001-Add-r600-TargetInfo.patch |
11 |
Log: |
12 |
Also apply llvm r600 patches, should fix bug #427206 |
13 |
|
14 |
(Portage version: 2.2.0_alpha123/cvs/Linux x86_64) |
15 |
|
16 |
Revision Changes Path |
17 |
1.1 sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch |
18 |
|
19 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch?rev=1.1&view=markup |
20 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch?rev=1.1&content-type=text/plain |
21 |
|
22 |
Index: clang-0001-Add-r600-TargetInfo.patch |
23 |
=================================================================== |
24 |
From 70cae83ffd093f183dec07c464db3c0bb6b92c10 Mon Sep 17 00:00:00 2001 |
25 |
From: Tom Stellard <thomas.stellard@×××.com> |
26 |
Date: Fri, 2 Mar 2012 10:54:52 -0500 |
27 |
Subject: [PATCH 1/3] Add r600 TargetInfo |
28 |
|
29 |
--- |
30 |
lib/Basic/Targets.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ |
31 |
1 files changed, 70 insertions(+), 0 deletions(-) |
32 |
|
33 |
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp |
34 |
index 85dfd78..64dc01c 100644 |
35 |
--- a/lib/Basic/Targets.cpp |
36 |
+++ b/lib/Basic/Targets.cpp |
37 |
@@ -1068,6 +1068,73 @@ namespace { |
38 |
} |
39 |
|
40 |
namespace { |
41 |
+ |
42 |
+class AMDGPUTargetInfo : public TargetInfo { |
43 |
+public: |
44 |
+ |
45 |
+ AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { } |
46 |
+ |
47 |
+ virtual const char * getClobbers() const { |
48 |
+ return ""; |
49 |
+ } |
50 |
+ |
51 |
+ virtual void getGCCRegNames(const char * const *&Names, |
52 |
+ unsigned &numNames) const { |
53 |
+ Names = NULL; |
54 |
+ numNames = 0; |
55 |
+ } |
56 |
+ |
57 |
+ virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
58 |
+ unsigned &NumAliases) const { |
59 |
+ Aliases = NULL; |
60 |
+ NumAliases = 0; |
61 |
+ } |
62 |
+ |
63 |
+ virtual bool validateAsmConstraint(const char *&Name, |
64 |
+ TargetInfo::ConstraintInfo &info) const { |
65 |
+ return true; |
66 |
+ } |
67 |
+ |
68 |
+ virtual void getTargetBuiltins(const Builtin::Info *&Records, |
69 |
+ unsigned &NumRecords) const { |
70 |
+ Records = NULL; |
71 |
+ NumRecords = 0; |
72 |
+ } |
73 |
+}; |
74 |
+ |
75 |
+ |
76 |
+static const unsigned R600AddrSpaceMap[] = { |
77 |
+ 1, // opencl_global |
78 |
+ 3, // opencl_local |
79 |
+ 2 // opencl_constant |
80 |
+}; |
81 |
+ |
82 |
+class R600TargetInfo : public AMDGPUTargetInfo { |
83 |
+public: |
84 |
+ R600TargetInfo(const std::string& triple) : AMDGPUTargetInfo(triple) { |
85 |
+ DescriptionString = |
86 |
+ "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" |
87 |
+ "-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32" |
88 |
+ "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64" |
89 |
+ "-v96:128:128-v128:128:128-v192:256:256-v256:256:256" |
90 |
+ "-v512:512:512-v1024:1024:1024-v2048:2048:2048" |
91 |
+ "-n8:16:32:64"; |
92 |
+ AddrSpaceMap = &R600AddrSpaceMap; |
93 |
+ } |
94 |
+ |
95 |
+ virtual void getTargetDefines(const LangOptions &Opts, |
96 |
+ MacroBuilder &Builder) const { |
97 |
+ Builder.defineMacro("__R600__"); |
98 |
+ } |
99 |
+ |
100 |
+ virtual const char * getVAListDeclaration() const { |
101 |
+ return ""; |
102 |
+ } |
103 |
+}; |
104 |
+ |
105 |
+} // end anonymous namespace |
106 |
+ |
107 |
+namespace { |
108 |
// MBlaze abstract base class |
109 |
class MBlazeTargetInfo : public TargetInfo { |
110 |
static const char * const GCCRegNames[]; |
111 |
@@ -3963,6 +4030,9 @@ static TargetInfo *AllocateTarget(const std::string &T) { |
112 |
case llvm::Triple::mblaze: |
113 |
return new MBlazeTargetInfo(T); |
114 |
|
115 |
+ case llvm::Triple::r600: |
116 |
+ return new R600TargetInfo(T); |
117 |
+ |
118 |
case llvm::Triple::sparc: |
119 |
switch (os) { |
120 |
case llvm::Triple::Linux: |
121 |
-- |
122 |
1.7.7.6 |
123 |
|
124 |
|
125 |
|
126 |
|
127 |
1.1 sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch |
128 |
|
129 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch?rev=1.1&view=markup |
130 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch?rev=1.1&content-type=text/plain |
131 |
|
132 |
Index: clang-0002-r600-Add-some-target-builtins.patch |
133 |
=================================================================== |
134 |
From a014573ad193775b2301e39275a1ca0ac3bb5847 Mon Sep 17 00:00:00 2001 |
135 |
From: Tom Stellard <thomas.stellard@×××.com> |
136 |
Date: Tue, 13 Mar 2012 13:54:51 -0400 |
137 |
Subject: [PATCH 2/3] r600: Add some target builtins |
138 |
|
139 |
--- |
140 |
include/clang/Basic/BuiltinsR600.def | 32 ++++++++++++++++++++++++++++++++ |
141 |
include/clang/Basic/TargetBuiltins.h | 10 ++++++++++ |
142 |
lib/Basic/Targets.cpp | 12 ++++++++++-- |
143 |
3 files changed, 52 insertions(+), 2 deletions(-) |
144 |
create mode 100644 include/clang/Basic/BuiltinsR600.def |
145 |
|
146 |
diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def |
147 |
new file mode 100644 |
148 |
index 0000000..ce1f30e |
149 |
--- /dev/null |
150 |
+++ b/include/clang/Basic/BuiltinsR600.def |
151 |
@@ -0,0 +1,32 @@ |
152 |
+//===--- BuiltinsR600.def - R600 Builtin function database -- --*- C++ -*-===// |
153 |
+// |
154 |
+// The LLVM Compiler Infrastructure |
155 |
+// |
156 |
+// This file is distributed under the University of Illinois Open Source |
157 |
+// License. See LICENSE.TXT for details. |
158 |
+// |
159 |
+//===----------------------------------------------------------------------===// |
160 |
+// |
161 |
+// This file defines the R600-specific builtin function database. Users of |
162 |
+// this file must define the BUILTIN macro to make use of this information. |
163 |
+// |
164 |
+//===----------------------------------------------------------------------===// |
165 |
+// |
166 |
+// Authors: Tom Stellard <thomas.stellard@×××.com> |
167 |
+// |
168 |
+ |
169 |
+// The format of this database matches clang/Basic/Builtins.def. |
170 |
+ |
171 |
+BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc") |
172 |
+BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc") |
173 |
+BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc") |
174 |
+ |
175 |
+BUILTIN(__builtin_r600_read_tidig_x, "z", "nc") |
176 |
+BUILTIN(__builtin_r600_read_tidig_y, "z", "nc") |
177 |
+BUILTIN(__builtin_r600_read_tidig_z, "z", "nc") |
178 |
+ |
179 |
+BUILTIN(__builtin_r600_read_tgid_x, "z", "nc") |
180 |
+BUILTIN(__builtin_r600_read_tgid_y, "z", "nc") |
181 |
+BUILTIN(__builtin_r600_read_tgid_z, "z", "nc") |
182 |
+ |
183 |
+#undef BUILTIN |
184 |
diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h |
185 |
index 7c04bf7..3460cd5 100644 |
186 |
--- a/include/clang/Basic/TargetBuiltins.h |
187 |
+++ b/include/clang/Basic/TargetBuiltins.h |
188 |
@@ -45,6 +45,16 @@ namespace clang { |
189 |
}; |
190 |
} |
191 |
|
192 |
+ /// R600 builtins |
193 |
+ namespace R600 { |
194 |
+ enum { |
195 |
+ LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, |
196 |
+#define BUILTIN(ID, TYPE, ATTRS) BI##ID, |
197 |
+#include "clang/Basic/BuiltinsR600.def" |
198 |
+ LastTSBuiltin |
199 |
+ }; |
200 |
+ } |
201 |
+ |
202 |
|
203 |
/// X86 builtins |
204 |
namespace X86 { |
205 |
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp |
206 |
index 64dc01c..03f1a18 100644 |
207 |
--- a/lib/Basic/Targets.cpp |
208 |
+++ b/lib/Basic/Targets.cpp |
209 |
@@ -1070,6 +1070,7 @@ namespace { |
210 |
namespace { |
211 |
|
212 |
class AMDGPUTargetInfo : public TargetInfo { |
213 |
+ static const Builtin::Info BuiltinInfo[]; |
214 |
public: |
215 |
|
216 |
AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { } |
217 |
@@ -1097,8 +1098,8 @@ public: |
218 |
|
219 |
virtual void getTargetBuiltins(const Builtin::Info *&Records, |
220 |
unsigned &NumRecords) const { |
221 |
- Records = NULL; |
222 |
- NumRecords = 0; |
223 |
+ Records = BuiltinInfo; |
224 |
+ NumRecords = clang::R600::LastTSBuiltin-Builtin::FirstTSBuiltin; |
225 |
} |
226 |
}; |
227 |
|
228 |
@@ -1132,6 +1133,13 @@ public: |
229 |
} |
230 |
}; |
231 |
|
232 |
+const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = { |
233 |
+#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES }, |
234 |
+#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\ |
235 |
+ ALL_LANGUAGES }, |
236 |
+#include "clang/Basic/BuiltinsR600.def" |
237 |
+}; |
238 |
+ |
239 |
} // end anonymous namespace |
240 |
|
241 |
namespace { |
242 |
-- |
243 |
1.7.7.6 |
244 |
|
245 |
|
246 |
|
247 |
|
248 |
1.1 sys-devel/clang/files/cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch |
249 |
|
250 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch?rev=1.1&view=markup |
251 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch?rev=1.1&content-type=text/plain |
252 |
|
253 |
Index: clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch |
254 |
=================================================================== |
255 |
From 2881b8189dcacc8ab6a336f0e107d72752c8c47e Mon Sep 17 00:00:00 2001 |
256 |
From: Tom Stellard <thomas.stellard@×××.com> |
257 |
Date: Wed, 14 Mar 2012 11:20:08 -0400 |
258 |
Subject: [PATCH 3/3] r600: Add read_global_size and read_local_size builtins |
259 |
|
260 |
--- |
261 |
include/clang/Basic/BuiltinsR600.def | 8 ++++++++ |
262 |
1 files changed, 8 insertions(+), 0 deletions(-) |
263 |
|
264 |
diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def |
265 |
index ce1f30e..c81758e 100644 |
266 |
--- a/include/clang/Basic/BuiltinsR600.def |
267 |
+++ b/include/clang/Basic/BuiltinsR600.def |
268 |
@@ -17,6 +17,14 @@ |
269 |
|
270 |
// The format of this database matches clang/Basic/Builtins.def. |
271 |
|
272 |
+BUILTIN(__builtin_r600_read_global_size_x, "z", "nc") |
273 |
+BUILTIN(__builtin_r600_read_global_size_y, "z", "nc") |
274 |
+BUILTIN(__builtin_r600_read_global_size_z, "z", "nc") |
275 |
+ |
276 |
+BUILTIN(__builtin_r600_read_local_size_x, "z", "nc") |
277 |
+BUILTIN(__builtin_r600_read_local_size_y, "z", "nc") |
278 |
+BUILTIN(__builtin_r600_read_local_size_z, "z", "nc") |
279 |
+ |
280 |
BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc") |
281 |
BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc") |
282 |
BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc") |
283 |
-- |
284 |
1.7.7.6 |
285 |
|
286 |
|
287 |
|
288 |
|
289 |
1.1 sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch |
290 |
|
291 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch?rev=1.1&view=markup |
292 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch?rev=1.1&content-type=text/plain |
293 |
|
294 |
Index: llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch |
295 |
=================================================================== |
296 |
From 17667fa3450470f7c89fc2ba4631d908cf510749 Mon Sep 17 00:00:00 2001 |
297 |
From: Tom Stellard <thomas.stellard@×××.com> |
298 |
Date: Wed, 14 Mar 2012 11:19:35 -0400 |
299 |
Subject: [PATCH 2/2] r600: Add get_global_size and get_local_size intrinsics |
300 |
|
301 |
--- |
302 |
include/llvm/IntrinsicsR600.td | 4 ++++ |
303 |
1 files changed, 4 insertions(+), 0 deletions(-) |
304 |
|
305 |
diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td |
306 |
index 789fecb..0473acb 100644 |
307 |
--- a/include/llvm/IntrinsicsR600.td |
308 |
+++ b/include/llvm/IntrinsicsR600.td |
309 |
@@ -26,6 +26,10 @@ multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> { |
310 |
def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>; |
311 |
} |
312 |
|
313 |
+defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz < |
314 |
+ "__builtin_r600_read_global_size">; |
315 |
+defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz < |
316 |
+ "__builtin_r600_read_local_size">; |
317 |
defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz < |
318 |
"__builtin_r600_read_ngroups">; |
319 |
defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz < |
320 |
-- |
321 |
1.7.7.6 |
322 |
|
323 |
|
324 |
|
325 |
|
326 |
1.1 sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch |
327 |
|
328 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch?rev=1.1&view=markup |
329 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch?rev=1.1&content-type=text/plain |
330 |
|
331 |
Index: llvm-0001-r600-Add-some-intrinsic-definitions.patch |
332 |
=================================================================== |
333 |
From e25389b66b5ced3a2b5461077dcc9a505d334e3d Mon Sep 17 00:00:00 2001 |
334 |
From: Tom Stellard <thomas.stellard@×××.com> |
335 |
Date: Tue, 13 Mar 2012 14:12:21 -0400 |
336 |
Subject: [PATCH 1/2] r600: Add some intrinsic definitions |
337 |
|
338 |
--- |
339 |
include/llvm/Intrinsics.td | 1 + |
340 |
include/llvm/IntrinsicsR600.td | 35 +++++++++++++++++++++++++++++++++++ |
341 |
2 files changed, 36 insertions(+), 0 deletions(-) |
342 |
create mode 100644 include/llvm/IntrinsicsR600.td |
343 |
|
344 |
diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td |
345 |
index 069f907..e90dd85 100644 |
346 |
--- a/include/llvm/Intrinsics.td |
347 |
+++ b/include/llvm/Intrinsics.td |
348 |
@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td" |
349 |
include "llvm/IntrinsicsXCore.td" |
350 |
include "llvm/IntrinsicsPTX.td" |
351 |
include "llvm/IntrinsicsHexagon.td" |
352 |
+include "llvm/IntrinsicsR600.td" |
353 |
diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td |
354 |
new file mode 100644 |
355 |
index 0000000..789fecb |
356 |
--- /dev/null |
357 |
+++ b/include/llvm/IntrinsicsR600.td |
358 |
@@ -0,0 +1,35 @@ |
359 |
+//===- IntrinsicsR600.td - Defines R600 intrinsics ---------*- tablegen -*-===// |
360 |
+// |
361 |
+// The LLVM Compiler Infrastructure |
362 |
+// |
363 |
+// This file is distributed under the University of Illinois Open Source |
364 |
+// License. See LICENSE.TXT for details. |
365 |
+// |
366 |
+//===----------------------------------------------------------------------===// |
367 |
+// |
368 |
+// This file defines all of the R600-specific intrinsics. |
369 |
+// |
370 |
+//===----------------------------------------------------------------------===// |
371 |
+// |
372 |
+// Authors: Tom Stellard <thomas.stellard@×××.com> |
373 |
+// |
374 |
+ |
375 |
+let TargetPrefix = "r600" in { |
376 |
+ |
377 |
+class R600ReadPreloadRegisterIntrinsic<string name> |
378 |
+ : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>, |
379 |
+ GCCBuiltin<name>; |
380 |
+ |
381 |
+multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> { |
382 |
+ def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>; |
383 |
+ def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>; |
384 |
+ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>; |
385 |
+} |
386 |
+ |
387 |
+defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz < |
388 |
+ "__builtin_r600_read_ngroups">; |
389 |
+defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz < |
390 |
+ "__builtin_r600_read_tgid">; |
391 |
+defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz < |
392 |
+ "__builtin_r600_read_tidig">; |
393 |
+} // End TargetPrefix = "r600" |
394 |
-- |
395 |
1.7.7.6 |