Skip to content

Commit 4b1ce3b

Browse files
committed
add tests
1 parent 9ceb7d3 commit 4b1ce3b

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8543,6 +8543,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
85438543
}
85448544
}
85458545

8546+
// Propagate -fcuda-short-ptr if compiling CUDA or SYCL for NVPTX
85468547
if (IsCuda || (IsSYCLDevice && Triple.isNVPTX())) {
85478548
if (Args.hasFlag(options::OPT_fcuda_short_ptr,
85488549
options::OPT_fno_cuda_short_ptr, false))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %clang_cc1 -fsycl-is-device -disable-llvm-passes \
2+
// RUN: -triple nvptx-nvidia-cuda -emit-llvm -fcuda-short-ptr -mllvm -nvptx-short-ptr %s -o - \
3+
// RUN: | FileCheck %s --check-prefix CHECK32
4+
5+
// RUN: %clang_cc1 -fsycl-is-device -disable-llvm-passes \
6+
// RUN: -triple nvptx64-nvidia-cuda -emit-llvm -fcuda-short-ptr -mllvm -nvptx-short-ptr %s -o - \
7+
// RUN: | FileCheck %s --check-prefix CHECK64
8+
9+
// CHECK32: target datalayout = "e-p:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64"
10+
// CHECK64: target datalayout = "e-p3:32:32-p4:32:32-p5:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// REQUIRES: nvptx-registered-target
2+
3+
// RUN: %clang -### -nocudalib \
4+
// RUN: -fsycl -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
5+
// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s
6+
7+
// RUN: %clang -### -nocudalib \
8+
// RUN: -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fcuda-short-ptr %s 2>&1 \
9+
// RUN: | FileCheck --check-prefix=CHECK-SHORT %s
10+
11+
12+
// CHECK-SHORT: "-mllvm" "--nvptx-short-ptr"
13+
// CHECK-SHORT: "-fcuda-short-ptr"
14+
15+
// CHECK-DEFAULT-NOT: "--nvptx-short-ptr"
16+
// CHECK-DEFAULT-NOT: "-fcuda-short-ptr"

0 commit comments

Comments
 (0)