[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenOpenCL / printf.cl
blob2e11b8889d23f9964ffa92f265374cad8feeb513
1 // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=CL1.2 -cl-ext=-+cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=FP64,ALL %s
2 // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=CL1.2 -cl-ext=-cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
3 // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64,+cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=FP64,ALL %s
4 // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=CL3.0 -cl-ext=-__opencl_c_fp64,-cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
5 // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=clc++2021 -cl-ext=+__opencl_c_fp64,+cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=FP64,ALL %s
6 // RUN: %clang_cc1 -no-enable-noundef-analysis -cl-std=clc++2021 -cl-ext=-__opencl_c_fp64,-cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
8 typedef __attribute__((ext_vector_type(2))) float float2;
9 typedef __attribute__((ext_vector_type(2))) half half2;
11 #if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
12 typedef __attribute__((ext_vector_type(2))) double double2;
13 #endif
15 int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)));
18 // ALL-LABEL: @test_printf_float2(
19 // FP64: %call = call spir_func i32 (ptr addrspace(2), ...) @{{.*}}printf{{.*}}(ptr addrspace(2) @.str, <2 x float> %0)
21 // NOFP64: call spir_func i32 (ptr addrspace(2), ...) @{{.*}}printf{{.*}}(ptr addrspace(2) @.str, <2 x float> %0)
22 kernel void test_printf_float2(float2 arg) {
23 printf("%v2hlf", arg);
26 // ALL-LABEL: @test_printf_half2(
27 // FP64: %call = call spir_func i32 (ptr addrspace(2), ...) @{{.*}}printf{{.*}}(ptr addrspace(2) @.str.1, <2 x half> %0)
29 // NOFP64: %call = call spir_func i32 (ptr addrspace(2), ...) @{{.*}}printf{{.*}}(ptr addrspace(2) @.str.1, <2 x half> %0)
30 kernel void test_printf_half2(half2 arg) {
31 printf("%v2hf", arg);
34 #if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
35 // FP64-LABEL: @test_printf_double2(
36 // FP64: call spir_func i32 (ptr addrspace(2), ...) @{{.*}}printf{{.*}}(ptr addrspace(2) @.str.2, <2 x double> %0)
37 kernel void test_printf_double2(double2 arg) {
38 printf("%v2lf", arg);
40 #endif