comparison clang/test/CodeGenOpenCL/printf.cl @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900 (2021-06-15)
parents 1d019706d866
children c4bab56944e8
comparison
equal deleted inserted replaced
220:42394fc6a535 221:79ff65ed7e25
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 -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 -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
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
3 5
4 typedef __attribute__((ext_vector_type(2))) float float2; 6 typedef __attribute__((ext_vector_type(2))) float float2;
5 typedef __attribute__((ext_vector_type(2))) half half2; 7 typedef __attribute__((ext_vector_type(2))) half half2;
6 8
7 #ifdef cl_khr_fp64 9 #if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
8 typedef __attribute__((ext_vector_type(2))) double double2; 10 typedef __attribute__((ext_vector_type(2))) double double2;
9 #endif 11 #endif
10 12
11 int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2))); 13 int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)));
12 14
26 // 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) 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)
27 kernel void test_printf_half2(half2 arg) { 29 kernel void test_printf_half2(half2 arg) {
28 printf("%v2hf", arg); 30 printf("%v2hf", arg);
29 } 31 }
30 32
31 #ifdef cl_khr_fp64 33 #if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
32 // FP64-LABEL: @test_printf_double2( 34 // FP64-LABEL: @test_printf_double2(
33 // 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) 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)
34 kernel void test_printf_double2(double2 arg) { 36 kernel void test_printf_double2(double2 arg) {
35 printf("%v2lf", arg); 37 printf("%v2lf", arg);
36 } 38 }