summaryrefslogtreecommitdiff
path: root/tgsi
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2016-01-26 12:19:32 +0100
committerHans de Goede <hdegoede@redhat.com>2016-06-27 08:32:50 +0200
commit95bf81a06266b195997428a1179265993661683b (patch)
treec0d9387204465940b0263615bab7e9d26aee6682 /tgsi
parent802a4a1513f22701259588e11ba83cc3c85a62c7 (diff)
Add initial tgsi support to libclc
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'tgsi')
-rw-r--r--tgsi/lib/OVERRIDES0
-rw-r--r--tgsi/lib/SOURCES1
-rw-r--r--tgsi/lib/workitem/get_local_id.ll18
3 files changed, 19 insertions, 0 deletions
diff --git a/tgsi/lib/OVERRIDES b/tgsi/lib/OVERRIDES
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tgsi/lib/OVERRIDES
diff --git a/tgsi/lib/SOURCES b/tgsi/lib/SOURCES
new file mode 100644
index 0000000..c116b86
--- /dev/null
+++ b/tgsi/lib/SOURCES
@@ -0,0 +1 @@
+workitem/get_local_id.ll
diff --git a/tgsi/lib/workitem/get_local_id.ll b/tgsi/lib/workitem/get_local_id.ll
new file mode 100644
index 0000000..4f807b3
--- /dev/null
+++ b/tgsi/lib/workitem/get_local_id.ll
@@ -0,0 +1,18 @@
+declare i32 @llvm.tgsi.read.threadid.x() nounwind readnone
+declare i32 @llvm.tgsi.read.threadid.y() nounwind readnone
+declare i32 @llvm.tgsi.read.threadid.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.tgsi.read.threadid.x() nounwind readnone
+ ret i32 %x
+y_dim:
+ %y = call i32 @llvm.tgsi.read.threadid.y() nounwind readnone
+ ret i32 %y
+z_dim:
+ %z = call i32 @llvm.tgsi.read.threadid.z() nounwind readnone
+ ret i32 %z
+default:
+ ret i32 0
+}