[AMDGPU] Temporarily change constant address space from 4 to 2 for the new address...
authorYaxun Liu <Yaxun.Liu@amd.com>
Thu, 6 Apr 2017 19:18:36 +0000 (19:18 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Thu, 6 Apr 2017 19:18:36 +0000 (19:18 +0000)
Change constant address space from 4 to 2 for the new address space mapping in Clang.

Differential Revision: https://reviews.llvm.org/D31771

llvm-svn: 299691

clang/lib/Basic/Targets.cpp
clang/test/CodeGenOpenCL/address-space-constant-initializers.cl
clang/test/CodeGenOpenCL/amdgpu-env-amdgiz.cl

index d80a8d5efee82ff895679c250412cf487db41a94..2970f76c5b180e76c787f9cea240b0aacd02453f 100644 (file)
@@ -2042,10 +2042,10 @@ static const LangAS::Map AMDGPUPrivateIsZeroMap = {
 static const LangAS::Map AMDGPUGenericIsZeroMap = {
     1,  // opencl_global
     3,  // opencl_local
-    4,  // opencl_constant
+    2,  // opencl_constant
     0,  // opencl_generic
     1,  // cuda_device
-    4,  // cuda_constant
+    2,  // cuda_constant
     3   // cuda_shared
 };
 
@@ -2062,7 +2062,7 @@ static const char *const DataLayoutStringSIPrivateIsZero =
   "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";
 
 static const char *const DataLayoutStringSIGenericIsZero =
-  "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32"
+  "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:32:32-p5:32:32"
   "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
   "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";
 
@@ -2077,7 +2077,7 @@ class AMDGPUTargetInfo final : public TargetInfo {
         Generic   = 0;
         Global    = 1;
         Local     = 3;
-        Constant  = 4;
+        Constant  = 2;
         Private   = 5;
       } else {
         Generic   = 4;
index 45c64c2f716b297f2ca53f0f016441d7567156fd..a03d939fae54cb425d305ea957c81ecae2d39ad4 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 %s -ffake-address-space-map -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple amdgcn-amd-amdhsa-opencl -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple amdgcn-amd-amdhsa-amdgizcl -emit-llvm -o - | FileCheck %s
 
 typedef struct {
     int i;
index d4e6e2577facbc8af1b757bc957c15f3ca28b278..d52fd5dff01a3d5cc0328d9ffaf8dbd00c28989b 100644 (file)
@@ -4,6 +4,6 @@
 // RUN: %clang_cc1 %s -O0 -triple amdgcn---amdgizcl -emit-llvm -o - | FileCheck -check-prefix=GIZ %s
 
 // CHECK: target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
-// GIZ: target datalayout = "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
+// GIZ: target datalayout = "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:32:32-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
 void foo(void) {}