================
@@ -0,0 +1,132 @@
+// REQUIRES: nvptx-registered-target
+
+// RUN: %if cir-enabled %{ %clang_cc1 -triple x86_64-unknown-linux-gnu
-fclangir -x cuda -emit-cir -target-sdk-version=12.3 %s -o %t.cir %}
+// RUN: %if cir-enabled %{ FileCheck --check-prefix=CIR-HOST
--input-file=%t.cir %s %}
+// RUN: %if cir-enabled %{ %clang_cc1 -triple nvptx64-nvidia-cuda -fclangir
-fcuda-is-device -emit-cir -target-sdk-version=12.3 %s -o %t.cir %}
+// RUN: %if cir-enabled %{ FileCheck --check-prefix=CIR-DEVICE
--input-file=%t.cir %s %}
+
+// RUN: %if cir-enabled %{ %clang_cc1 -triple x86_64-unknown-linux-gnu
-fclangir -x cuda -emit-llvm -target-sdk-version=12.3 %s -o %t.ll %}
+// RUN: %if cir-enabled %{ FileCheck --check-prefix=LLVM-HOST
--input-file=%t.ll %s %}
+// RUN: %if cir-enabled %{ %clang_cc1 -triple nvptx64-nvidia-cuda -fclangir
-fcuda-is-device -emit-llvm -target-sdk-version=12.3 %s -o %t.ll %}
+// RUN: %if cir-enabled %{ FileCheck --check-prefix=LLVM-DEVICE
--input-file=%t.ll %s %}
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -x cuda -emit-llvm
-target-sdk-version=12.3 %s -o %t.ll
+// RUN: FileCheck --check-prefix=OGCG-HOST --input-file=%t.ll %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -emit-llvm
-target-sdk-version=12.3 %s -o %t.ll
+// RUN: FileCheck --check-prefix=OGCG-DEVICE --input-file=%t.ll %s
+
+#include "Inputs/cuda.h"
+
+namespace ns {
+
+// CIR-HOST: cir.func {{.*}}
@_ZN2ns36__device_stub__cpp_global_function_1EiPif
+// CIR-DEVICE: cir.func {{.*}} @_ZN2ns21cpp_global_function_1EiPif
+// LLVM-HOST: define {{.*}} @_ZN2ns36__device_stub__cpp_global_function_1EiPif
+// LLVM-DEVICE: define {{.*}} @_ZN2ns21cpp_global_function_1EiPif
+// OGCG-HOST: define {{.*}} @_ZN2ns36__device_stub__cpp_global_function_1EiPif
+// OGCG-DEVICE: define {{.*}} @_ZN2ns21cpp_global_function_1EiPif
+ __global__ void cpp_global_function_1(int a, int* b, float c) {}
+
+// CIR-HOST: cir.func {{.*}}
@_ZN2ns36__device_stub__cpp_global_function_2EiPif
+// CIR-DEVICE: cir.func {{.*}} @_ZN2ns21cpp_global_function_2EiPif
+// LLVM-HOST: define {{.*}} @_ZN2ns36__device_stub__cpp_global_function_2EiPif
+// LLVM-DEVICE: define {{.*}} @_ZN2ns21cpp_global_function_2EiPif
+// OGCG-HOST: define {{.*}} @_ZN2ns36__device_stub__cpp_global_function_2EiPif
+// OGCG-DEVICE: define {{.*}} @_ZN2ns21cpp_global_function_2EiPif
+ __global__ void cpp_global_function_2(int a, int* b, float c) {}
+
+// CIR-HOST: cir.func {{.*}} @_ZN2ns19cpp_host_function_1EiPif
+// LLVM-HOST: define {{.*}} @_ZN2ns19cpp_host_function_1EiPif
+// OGCG-HOST: define {{.*}} @_ZN2ns19cpp_host_function_1EiPif
+ __host__ void cpp_host_function_1(int a, int* b, float c) {}
+
+// CIR-HOST: cir.func {{.*}} @_ZN2ns19cpp_host_function_2EiPif
+// LLVM-HOST: define {{.*}} @_ZN2ns19cpp_host_function_2EiPif
+// OGCG-HOST: define {{.*}} @_ZN2ns19cpp_host_function_2EiPif
+ __host__ void cpp_host_function_2(int a, int* b, float c) {}
+
+// CIR-DEVICE: cir.func {{.*}} @_ZN2ns21cpp_device_function_1EiPif
+// LLVM-DEVICE: define {{.*}} @_ZN2ns21cpp_device_function_1EiPif
+// OGCG-DEVICE: define {{.*}} @_ZN2ns21cpp_device_function_1EiPif
+ __device__ void cpp_device_function_1(int a, int* b, float c) {}
+
+// CIR-DEVICE: cir.func {{.*}} @_ZN2ns21cpp_device_function_2EiPif
+// LLVM-DEVICE: define {{.*}} @_ZN2ns21cpp_device_function_2EiPif
+// OGCG-DEVICE: define {{.*}} @_ZN2ns21cpp_device_function_2EiPif
+ __device__ void cpp_device_function_2(int a, int* b, float c) {}
+}
----------------
Men-cotton wrote:
ultra nit
```suggestion
} // namespace ns
```
https://github.com/llvm/llvm-project/pull/184444
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits