Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeGenOpenCL/printf.cl @ 236:c4bab56944e8 llvm-original
LLVM 16
author | kono |
---|---|
date | Wed, 09 Nov 2022 17:45:10 +0900 |
parents | 79ff65ed7e25 |
children | 1f2b6ac9f198 |
comparison
equal
deleted
inserted
replaced
232:70dce7da266c | 236:c4bab56944e8 |
---|---|
1 // RUN: %clang_cc1 -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 | 1 // RUN: %clang_cc1 -no-opaque-pointers -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 -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 | 2 // RUN: %clang_cc1 -no-opaque-pointers -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 -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 | 3 // RUN: %clang_cc1 -no-opaque-pointers -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 -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 | 4 // RUN: %clang_cc1 -no-opaque-pointers -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-opaque-pointers -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-opaque-pointers -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 | |
5 | 7 |
6 typedef __attribute__((ext_vector_type(2))) float float2; | 8 typedef __attribute__((ext_vector_type(2))) float float2; |
7 typedef __attribute__((ext_vector_type(2))) half half2; | 9 typedef __attribute__((ext_vector_type(2))) half half2; |
8 | 10 |
9 #if defined(cl_khr_fp64) || defined(__opencl_c_fp64) | 11 #if defined(cl_khr_fp64) || defined(__opencl_c_fp64) |
12 | 14 |
13 int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2))); | 15 int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2))); |
14 | 16 |
15 | 17 |
16 // ALL-LABEL: @test_printf_float2( | 18 // ALL-LABEL: @test_printf_float2( |
17 // FP64: %call = call spir_func i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* getelementptr inbounds ([7 x i8], [7 x i8] addrspace(2)* @.str, i32 0, i32 0), <2 x float> %0) | 19 // FP64: %call = call spir_func i32 (i8 addrspace(2)*, ...) @{{.*}}printf{{.*}}(i8 addrspace(2)* getelementptr inbounds ([7 x i8], [7 x i8] addrspace(2)* @.str, i32 0, i32 0), <2 x float> %0) |
18 | 20 |
19 | 21 // NOFP64: call spir_func i32 (i8 addrspace(2)*, ...) @{{.*}}printf{{.*}}(i8 addrspace(2)* getelementptr inbounds ([7 x i8], [7 x i8] addrspace(2)* @.str, i32 0, i32 0), <2 x float> %0) |
20 // NOFP64: call spir_func i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* getelementptr inbounds ([7 x i8], [7 x i8] addrspace(2)* @.str, i32 0, i32 0), <2 x float> %0) | |
21 kernel void test_printf_float2(float2 arg) { | 22 kernel void test_printf_float2(float2 arg) { |
22 printf("%v2hlf", arg); | 23 printf("%v2hlf", arg); |
23 } | 24 } |
24 | 25 |
25 // ALL-LABEL: @test_printf_half2( | 26 // ALL-LABEL: @test_printf_half2( |
26 // FP64: %call = call spir_func i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* getelementptr inbounds ([6 x i8], [6 x i8] addrspace(2)* @.str.1, i32 0, i32 0), <2 x half> %0) | 27 // FP64: %call = call spir_func i32 (i8 addrspace(2)*, ...) @{{.*}}printf{{.*}}(i8 addrspace(2)* getelementptr inbounds ([6 x i8], [6 x i8] addrspace(2)* @.str.1, i32 0, i32 0), <2 x half> %0) |
27 | 28 |
28 // NOFP64: %call = call spir_func i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* getelementptr inbounds ([6 x i8], [6 x i8] addrspace(2)* @.str.1, i32 0, i32 0), <2 x half> %0) | 29 // NOFP64: %call = call spir_func i32 (i8 addrspace(2)*, ...) @{{.*}}printf{{.*}}(i8 addrspace(2)* getelementptr inbounds ([6 x i8], [6 x i8] addrspace(2)* @.str.1, i32 0, i32 0), <2 x half> %0) |
29 kernel void test_printf_half2(half2 arg) { | 30 kernel void test_printf_half2(half2 arg) { |
30 printf("%v2hf", arg); | 31 printf("%v2hf", arg); |
31 } | 32 } |
32 | 33 |
33 #if defined(cl_khr_fp64) || defined(__opencl_c_fp64) | 34 #if defined(cl_khr_fp64) || defined(__opencl_c_fp64) |
34 // FP64-LABEL: @test_printf_double2( | 35 // FP64-LABEL: @test_printf_double2( |
35 // FP64: call spir_func i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* getelementptr inbounds ([6 x i8], [6 x i8] addrspace(2)* @.str.2, i32 0, i32 0), <2 x double> %0) | 36 // FP64: call spir_func i32 (i8 addrspace(2)*, ...) @{{.*}}printf{{.*}}(i8 addrspace(2)* getelementptr inbounds ([6 x i8], [6 x i8] addrspace(2)* @.str.2, i32 0, i32 0), <2 x double> %0) |
36 kernel void test_printf_double2(double2 arg) { | 37 kernel void test_printf_double2(double2 arg) { |
37 printf("%v2lf", arg); | 38 printf("%v2lf", arg); |
38 } | 39 } |
39 #endif | 40 #endif |