Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8543,7 +8543,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
}

if (IsCuda) {
// Propagate -fcuda-short-ptr if compiling CUDA or SYCL for NVPTX
if (IsCuda || (IsSYCLDevice && Triple.isNVPTX())) {
if (Args.hasFlag(options::OPT_fcuda_short_ptr,
options::OPT_fno_cuda_short_ptr, false))
CmdArgs.push_back("-fcuda-short-ptr");
Expand Down
10 changes: 10 additions & 0 deletions clang/test/CodeGenSYCL/nvptx-short-ptr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %clang_cc1 -fsycl-is-device -disable-llvm-passes \
// RUN: -triple nvptx-nvidia-cuda -emit-llvm -fcuda-short-ptr -mllvm -nvptx-short-ptr %s -o - \
// RUN: | FileCheck %s --check-prefix CHECK32

// RUN: %clang_cc1 -fsycl-is-device -disable-llvm-passes \
// RUN: -triple nvptx64-nvidia-cuda -emit-llvm -fcuda-short-ptr -mllvm -nvptx-short-ptr %s -o - \
// RUN: | FileCheck %s --check-prefix CHECK64

// CHECK32: target datalayout = "e-p:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64"
// CHECK64: target datalayout = "e-p3:32:32-p4:32:32-p5:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64"
14 changes: 14 additions & 0 deletions clang/test/Driver/sycl-nvptx-short-ptr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %clang -### -nocudalib \
// RUN: -fsycl -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s

// RUN: %clang -### -nocudalib \
// RUN: -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fcuda-short-ptr %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-SHORT %s


// CHECK-SHORT: "-mllvm" "--nvptx-short-ptr"
// CHECK-SHORT: "-fcuda-short-ptr"

// CHECK-DEFAULT-NOT: "--nvptx-short-ptr"
// CHECK-DEFAULT-NOT: "-fcuda-short-ptr"
Loading