[Libclc-dev] [PATCH 2/2] Add r600 target
Tom Stellard
tom at stellard.net
Tue Dec 11 07:16:42 PST 2012
From: Tom Stellard <thomas.stellard at amd.com>
---
configure.py | 2 +-
r600/lib/OVERRIDES | 2 ++
r600/lib/SOURCES | 4 ++++
r600/lib/workitem/get_global_size.ll | 18 ++++++++++++++++++
r600/lib/workitem/get_group_id.ll | 18 ++++++++++++++++++
r600/lib/workitem/get_local_id.ll | 18 ++++++++++++++++++
r600/lib/workitem/get_local_size.ll | 18 ++++++++++++++++++
7 files changed, 79 insertions(+), 1 deletion(-)
create mode 100644 r600/lib/OVERRIDES
create mode 100644 r600/lib/SOURCES
create mode 100644 r600/lib/workitem/get_global_size.ll
create mode 100644 r600/lib/workitem/get_group_id.ll
create mode 100644 r600/lib/workitem/get_local_id.ll
create mode 100644 r600/lib/workitem/get_local_size.ll
diff --git a/configure.py b/configure.py
index 17bef95..ba87681 100755
--- a/configure.py
+++ b/configure.py
@@ -43,7 +43,7 @@ llvm_clang = os.path.join(llvm_bindir, 'clang')
llvm_link = os.path.join(llvm_bindir, 'llvm-link')
llvm_opt = os.path.join(llvm_bindir, 'opt')
-default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl']
+default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--']
targets = args
if not targets:
diff --git a/r600/lib/OVERRIDES b/r600/lib/OVERRIDES
new file mode 100644
index 0000000..3f941d8
--- /dev/null
+++ b/r600/lib/OVERRIDES
@@ -0,0 +1,2 @@
+workitem/get_group_id.cl
+workitem/get_global_size.cl
diff --git a/r600/lib/SOURCES b/r600/lib/SOURCES
new file mode 100644
index 0000000..af8c8c8
--- /dev/null
+++ b/r600/lib/SOURCES
@@ -0,0 +1,4 @@
+workitem/get_group_id.ll
+workitem/get_local_size.ll
+workitem/get_local_id.ll
+workitem/get_global_size.ll
diff --git a/r600/lib/workitem/get_global_size.ll b/r600/lib/workitem/get_global_size.ll
new file mode 100644
index 0000000..ac2d08d
--- /dev/null
+++ b/r600/lib/workitem/get_global_size.ll
@@ -0,0 +1,18 @@
+declare i32 @llvm.r600.read.global.size.x() nounwind readnone
+declare i32 @llvm.r600.read.global.size.y() nounwind readnone
+declare i32 @llvm.r600.read.global.size.z() nounwind readnone
+
+define i32 @get_global_size(i32 %dim) nounwind readnone alwaysinline {
+ switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim]
+x_dim:
+ %x = call i32 @llvm.r600.read.global.size.x() nounwind readnone
+ ret i32 %x
+y_dim:
+ %y = call i32 @llvm.r600.read.global.size.y() nounwind readnone
+ ret i32 %y
+z_dim:
+ %z = call i32 @llvm.r600.read.global.size.z() nounwind readnone
+ ret i32 %z
+default:
+ ret i32 0
+}
diff --git a/r600/lib/workitem/get_group_id.ll b/r600/lib/workitem/get_group_id.ll
new file mode 100644
index 0000000..5131648
--- /dev/null
+++ b/r600/lib/workitem/get_group_id.ll
@@ -0,0 +1,18 @@
+declare i32 @llvm.r600.read.local.size.x() nounwind readnone
+declare i32 @llvm.r600.read.local.size.y() nounwind readnone
+declare i32 @llvm.r600.read.local.size.z() nounwind readnone
+
+define i32 @get_group_id(i32 %dim) nounwind readnone alwaysinline {
+ switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim]
+x_dim:
+ %x = call i32 @llvm.r600.read.local.size.x() nounwind readnone
+ ret i32 %x
+y_dim:
+ %y = call i32 @llvm.r600.read.local.size.y() nounwind readnone
+ ret i32 %y
+z_dim:
+ %z = call i32 @llvm.r600.read.local.size.z() nounwind readnone
+ ret i32 %z
+default:
+ ret i32 0
+}
diff --git a/r600/lib/workitem/get_local_id.ll b/r600/lib/workitem/get_local_id.ll
new file mode 100644
index 0000000..ac5522a
--- /dev/null
+++ b/r600/lib/workitem/get_local_id.ll
@@ -0,0 +1,18 @@
+declare i32 @llvm.r600.read.tidig.x() nounwind readnone
+declare i32 @llvm.r600.read.tidig.y() nounwind readnone
+declare i32 @llvm.r600.read.tidig.z() nounwind readnone
+
+define i32 @get_local_id(i32 %dim) nounwind readnone alwaysinline {
+ switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim]
+x_dim:
+ %x = call i32 @llvm.r600.read.tidig.x() nounwind readnone
+ ret i32 %x
+y_dim:
+ %y = call i32 @llvm.r600.read.tidig.y() nounwind readnone
+ ret i32 %y
+z_dim:
+ %z = call i32 @llvm.r600.read.tidig.z() nounwind readnone
+ ret i32 %z
+default:
+ ret i32 0
+}
diff --git a/r600/lib/workitem/get_local_size.ll b/r600/lib/workitem/get_local_size.ll
new file mode 100644
index 0000000..6a71f75
--- /dev/null
+++ b/r600/lib/workitem/get_local_size.ll
@@ -0,0 +1,18 @@
+declare i32 @llvm.r600.read.tgid.x() nounwind readnone
+declare i32 @llvm.r600.read.tgid.y() nounwind readnone
+declare i32 @llvm.r600.read.tgid.z() nounwind readnone
+
+define i32 @get_local_size(i32 %dim) nounwind readnone alwaysinline {
+ switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim]
+x_dim:
+ %x = call i32 @llvm.r600.read.tgid.x() nounwind readnone
+ ret i32 %x
+y_dim:
+ %y = call i32 @llvm.r600.read.tgid.y() nounwind readnone
+ ret i32 %y
+z_dim:
+ %z = call i32 @llvm.r600.read.tgid.z() nounwind readnone
+ ret i32 %z
+default:
+ ret i32 0
+}
--
1.7.11.4
More information about the Libclc-dev
mailing list