summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Vesely <jan.vesely@rutgers.edu>2017-09-29 19:06:52 +0000
committerJan Vesely <jan.vesely@rutgers.edu>2017-09-29 19:06:52 +0000
commit2b7fa1c6f648f5c1d441bb3ff97f090afa275735 (patch)
tree450a5e3de5b4b8f332c6654654b0187ae9dfa9b5
parentaee030f284e2f8e59c5e35fd2aab526acee98d59 (diff)
downloadbcm5719-llvm-2b7fa1c6f648f5c1d441bb3ff97f090afa275735.tar.gz
bcm5719-llvm-2b7fa1c6f648f5c1d441bb3ff97f090afa275735.zip
Fix amdgcn-amdhsa on llvm-3.9
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Acked-by: Aaron Watry <awatry@gmail.com> llvm-svn: 314548
-rw-r--r--libclc/.travis.yml2
-rw-r--r--libclc/amdgcn-amdhsa/lib/OVERRIDES3
-rw-r--r--libclc/amdgcn-amdhsa/lib/OVERRIDES_3.93
-rw-r--r--libclc/amdgcn-amdhsa/lib/SOURCES_3.92
-rw-r--r--libclc/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll36
-rw-r--r--libclc/amdgcn-amdhsa/lib/workitem/get_local_size.39.ll35
6 files changed, 77 insertions, 4 deletions
diff --git a/libclc/.travis.yml b/libclc/.travis.yml
index dcd40be294f..2f058a75d70 100644
--- a/libclc/.travis.yml
+++ b/libclc/.travis.yml
@@ -13,7 +13,7 @@ matrix:
- LABEL="make gcc LLVM-3.9"
- LLVM_VERSION=3.9
- LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
- - CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc cypress-r600--.bc tahiti-amdgcn--.bc"
+ - CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc"
addons:
apt:
sources:
diff --git a/libclc/amdgcn-amdhsa/lib/OVERRIDES b/libclc/amdgcn-amdhsa/lib/OVERRIDES
index e4dfca11c8a..c9bd69b76eb 100644
--- a/libclc/amdgcn-amdhsa/lib/OVERRIDES
+++ b/libclc/amdgcn-amdhsa/lib/OVERRIDES
@@ -1,4 +1 @@
workitem/get_num_groups.ll
-workitem/get_global_size.39.ll
-workitem/get_local_size.39.ll
-workitem/get_num_groups.39.ll
diff --git a/libclc/amdgcn-amdhsa/lib/OVERRIDES_3.9 b/libclc/amdgcn-amdhsa/lib/OVERRIDES_3.9
new file mode 100644
index 00000000000..4c5c851aea3
--- /dev/null
+++ b/libclc/amdgcn-amdhsa/lib/OVERRIDES_3.9
@@ -0,0 +1,3 @@
+workitem/get_global_size.ll
+workitem/get_local_size.ll
+workitem/get_num_groups.39.ll
diff --git a/libclc/amdgcn-amdhsa/lib/SOURCES_3.9 b/libclc/amdgcn-amdhsa/lib/SOURCES_3.9
new file mode 100644
index 00000000000..a6a08af19fd
--- /dev/null
+++ b/libclc/amdgcn-amdhsa/lib/SOURCES_3.9
@@ -0,0 +1,2 @@
+workitem/get_global_size.39.ll
+workitem/get_local_size.39.ll
diff --git a/libclc/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll b/libclc/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll
new file mode 100644
index 00000000000..b5e7db2e42f
--- /dev/null
+++ b/libclc/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll
@@ -0,0 +1,36 @@
+declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0
+
+define i32 @get_global_size(i32 %dim) #1 {
+ %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr()
+ switch i32 %dim, label %default [
+ i32 0, label %x
+ i32 1, label %y
+ i32 2, label %z
+ ]
+
+x:
+ %ptr_x = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i32 12
+ %ptr_x32 = bitcast i8 addrspace(2)* %ptr_x to i32 addrspace(2)*
+ %x32 = load i32, i32 addrspace(2)* %ptr_x32, align 4, !invariant.load !0
+ ret i32 %x32
+
+y:
+ %ptr_y = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i32 16
+ %ptr_y32 = bitcast i8 addrspace(2)* %ptr_y to i32 addrspace(2)*
+ %y32 = load i32, i32 addrspace(2)* %ptr_y32, align 4, !invariant.load !0
+ ret i32 %y32
+
+z:
+ %ptr_z = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i32 20
+ %ptr_z32 = bitcast i8 addrspace(2)* %ptr_z to i32 addrspace(2)*
+ %z32 = load i32, i32 addrspace(2)* %ptr_z32, align 4, !invariant.load !0
+ ret i32 %z32
+
+default:
+ ret i32 1
+}
+
+attributes #0 = { nounwind readnone }
+attributes #1 = { alwaysinline norecurse nounwind readonly }
+
+!0 = !{}
diff --git a/libclc/amdgcn-amdhsa/lib/workitem/get_local_size.39.ll b/libclc/amdgcn-amdhsa/lib/workitem/get_local_size.39.ll
new file mode 100644
index 00000000000..ecb5e8f405e
--- /dev/null
+++ b/libclc/amdgcn-amdhsa/lib/workitem/get_local_size.39.ll
@@ -0,0 +1,35 @@
+declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0
+
+define i32 @get_local_size(i32 %dim) #1 {
+ %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr()
+ %dispatch_ptr_i32 = bitcast i8 addrspace(2)* %dispatch_ptr to i32 addrspace(2)*
+ %xy_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* %dispatch_ptr_i32, i32 1
+ %xy_size = load i32, i32 addrspace(2)* %xy_size_ptr, align 4, !invariant.load !0
+ switch i32 %dim, label %default [
+ i32 0, label %x_dim
+ i32 1, label %y_dim
+ i32 2, label %z_dim
+ ]
+
+x_dim:
+ %x_size = and i32 %xy_size, 65535
+ ret i32 %x_size
+
+y_dim:
+ %y_size = lshr i32 %xy_size, 16
+ ret i32 %y_size
+
+z_dim:
+ %z_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* %dispatch_ptr_i32, i32 2
+ %z_size = load i32, i32 addrspace(2)* %z_size_ptr, align 4, !invariant.load !0, !range !1
+ ret i32 %z_size
+
+default:
+ ret i32 1
+}
+
+attributes #0 = { nounwind readnone }
+attributes #1 = { alwaysinline norecurse nounwind readonly }
+
+!0 = !{}
+!1 = !{ i32 0, i32 257 }
OpenPOWER on IntegriCloud