Skip to content

Commit 51d554e

Browse files
committed
use 9 for program AS, enable function ptr ext by default
Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 82ff676 commit 51d554e

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

clang/lib/Basic/Targets/SPIR.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ class LLVM_LIBRARY_VISIBILITY SPIRV64IntelTargetInfo final
477477
assert(Triple.getVendor() == llvm::Triple::VendorType::Intel &&
478478
"64-bit Intel SPIR-V target must use Intel vendor");
479479
resetDataLayout("e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-"
480-
"v256:256-v512:512-v1024:1024-n8:16:32:64-G1-P4-A0");
480+
"v256:256-v512:512-v1024:1024-n8:16:32:64-G1-P9-A0");
481481
}
482482
};
483483
} // namespace targets

clang/test/CodeGenSPIRV/spirv-intel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %clang_cc1 -triple spir-intel %s -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITHOUT %s
44
// RUN: %clang_cc1 -triple spir64-intel %s -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITHOUT %s
55

6-
// CHECK-WITH-64: spir_func void @foo(ptr addrspace(4) noundef %param) addrspace(4) #0 {
6+
// CHECK-WITH-64: spir_func void @foo(ptr addrspace(4) noundef %param) addrspace(9) #0 {
77
// CHECK-WITH-32: spir_func void @foo(ptr addrspace(4) noundef %param) #0 {
88

99
// CHECK-WITHOUT: spir_func void @foo(ptr noundef %param) #0 {

clang/test/OpenMP/spirv_variant_match.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int foo() { return 1; }
3535

3636
// CHECK-DAG: define{{.*}} @{{"_Z[0-9]+foo\$ompvariant\$.*"}}()
3737

38-
// CHECK-DAG: call spir_func noundef addrspace(4) i32 @{{"_Z[0-9]+foo\$ompvariant\$.*"}}()
38+
// CHECK-DAG: call spir_func noundef addrspace(9) i32 @{{"_Z[0-9]+foo\$ompvariant\$.*"}}()
3939

4040
int main() {
4141
int res;

llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ SPIRVSubtarget::SPIRVSubtarget(const Triple &TT, const std::string &CPU,
9090
else
9191
Env = Unknown;
9292

93+
// Set the default extensions based on the target triple.
94+
if (TargetTriple.getVendor() == Triple::Intel)
95+
Extensions.insert(SPIRV::Extension::SPV_INTEL_function_pointers);
96+
9397
// The order of initialization is important.
9498
initAvailableExtensions(Extensions);
9599
initAvailableExtInstSets();

llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static std::string computeDataLayout(const Triple &TT) {
7979
"v512:512-v1024:1024-n32:64-S32-G1-P4-A0";
8080
if (TT.getVendor() == Triple::VendorType::Intel)
8181
return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
82-
"v512:512-v1024:1024-n8:16:32:64-G1-P4-A0";
82+
"v512:512-v1024:1024-n8:16:32:64-G1-P9-A0";
8383
return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
8484
"v512:512-v1024:1024-n8:16:32:64-G1";
8585
}

0 commit comments

Comments
 (0)