brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.5 KiB · cee430c Raw
144 lines · plain
1// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL1.02// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL1.13// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL1.1 -DNOPEDANTIC4// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL1.2 -DFP645 6// Test with a target not supporting fp64.7// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -DNOFP64 -DNOFP168// RUN: %clang_cc1 -cl-std=CL3.0 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -DNOFP64 -DNOFP169// RUN: %clang_cc1 -cl-std=clc++2021 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -DNOFP64 -DNOFP1610 11// Test with some extensions enabled or disabled by cmd-line args12//13// Target does not support fp64 and fp16 - override it14// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext=+cl_khr_fp64,+cl_khr_fp1615//16// Disable or enable all extensions17// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-all -DNOFP64 -DNOFP1618// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext=+all19// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext=+all,-cl_khr_fp64 -DNOFP6420// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext=-all,+cl_khr_fp64 -DNOFP1621// RUN: %clang_cc1 -cl-std=CL3.0 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-all -DNOFP64 -DNOFP1622// RUN: %clang_cc1 -cl-std=CL3.0 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext=+all -DFP6423// RUN: %clang_cc1 -cl-std=CL3.0 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext=+all,-__opencl_c_fp64,-cl_khr_fp64 -DNOFP6424// RUN: %clang_cc1 -cl-std=clc++2021 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-all -DNOFP64 -DNOFP1625// RUN: %clang_cc1 -cl-std=clc++2021 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext=+all -DFP6426// RUN: %clang_cc1 -cl-std=clc++2021 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext=+all,-__opencl_c_fp64,-cl_khr_fp64 -DNOFP6427//28// Concatenating29// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-cl_khr_fp64 -cl-ext=+cl_khr_fp6430// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-cl_khr_fp64,+cl_khr_fp6431// RUN: %clang_cc1 %s -cl-std=CL1.0 -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-all -cl-ext=+cl_khr_fp64 -cl-ext=+cl_khr_fp16 -cl-ext=-cl_khr_fp64 -DNOFP6432// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-all -cl-ext=+cl_khr_fp64,-cl_khr_fp64,+cl_khr_fp16 -DNOFP6433// RUN: %clang_cc1 -cl-std=CL3.0 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-__opencl_c_fp64,-cl_khr_fp64 -cl-ext=+__opencl_c_fp64,+cl_khr_fp64 -DFP6434// RUN: %clang_cc1 -cl-std=CL3.0 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-__opencl_c_fp64,+__opencl_c_fp64,+cl_khr_fp64 -DFP6435// RUN: %clang_cc1 -cl-std=CL3.0 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-__opencl_c_fp64,-cl_khr_fp64 -DNOFP6436// RUN: %clang_cc1 -cl-std=clc++2021 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-__opencl_c_fp64,-cl_khr_fp64 -cl-ext=+__opencl_c_fp64,+cl_khr_fp64 -DFP6437// RUN: %clang_cc1 -cl-std=clc++2021 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-__opencl_c_fp64,+__opencl_c_fp64,+cl_khr_fp64 -DFP6438// RUN: %clang_cc1 -cl-std=clc++2021 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-__opencl_c_fp64,-cl_khr_fp64 -DNOFP6439 40// Test with -finclude-default-header, which includes opencl-c.h. opencl-c.h41// disables all extensions by default, but supported core extensions for a42// particular OpenCL version must be re-enabled (for example, cl_khr_fp64 is43// enabled by default with -cl-std=CL2.0).44//45// RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL2.0 -finclude-default-header46// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=clc++1.047 48#ifdef _OPENCL_H_49// expected-no-diagnostics50#endif51 52#ifdef FP6453// expected-no-diagnostics54#endif55 56#if __OPENCL_CPP_VERSION__ == 10057// expected-no-diagnostics58#endif59 60#if (defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 120)61void f1(double da) {62#ifdef NOFP6463// expected-error@-2 {{type 'double' requires cl_khr_fp64 support}}64#elif !defined(NOPEDANTIC)65// expected-warning@-4{{Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is supported}}66#endif67  double d;68#ifdef NOFP6469// expected-error@-2 {{type 'double' requires cl_khr_fp64 support}}70#elif !defined(NOPEDANTIC)71// expected-warning@-4{{Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is supported}}72#endif73  // FIXME: this diagnostic depends on the extension pragma in the earlier versions.74  // There is no indication that this behavior is expected.75  (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}}76}77#endif78 79#ifndef _OPENCL_H_80int isnan(float x) {81    return __builtin_isnan(x);82}83 84int isfinite(float x) {85    return __builtin_isfinite(x);86}87#endif88 89#pragma OPENCL EXTENSION cl_khr_fp64 : enable90#ifdef NOFP6491// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}}92#endif93 94#pragma OPENCL EXTENSION cl_khr_fp16 : enable95#ifdef NOFP1696// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp16' - ignoring}}97#endif98 99void f2(void) {100  double d;101#ifdef NOFP64102#if ((defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ >= 300) || __OPENCL_CPP_VERSION__ >= 202100)103// expected-error@-3{{use of type 'double' requires cl_khr_fp64 and __opencl_c_fp64 support}}104#else105// expected-error@-5{{use of type 'double' requires cl_khr_fp64 support}}106#endif107#endif108 109  typedef double double4 __attribute__((ext_vector_type(4)));110  double4 d4 = {0.0f, 2.0f, 3.0f, 1.0f};111#ifdef NOFP64112#if ((defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ >= 300) || __OPENCL_CPP_VERSION__ >= 202100)113// expected-error@-4 {{use of type 'double' requires cl_khr_fp64 and __opencl_c_fp64 support}}114#else115// expected-error@-6 {{use of type 'double' requires cl_khr_fp64 support}}116#endif117#endif118 119  (void) 1.0;120#ifdef NOFP64121#if ((defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ >= 300) || __OPENCL_CPP_VERSION__ >= 202100)122// expected-warning@-3{{double precision constant requires cl_khr_fp64 and __opencl_c_fp64, casting to single precision}}123#else124// expected-warning@-5{{double precision constant requires cl_khr_fp64, casting to single precision}}125#endif126#endif127}128 129#pragma OPENCL EXTENSION cl_khr_fp64 : disable130#ifdef NOFP64131// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}}132#endif133 134#if (defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 120)135void f3(void) {136  double d;137#ifdef NOFP64138// expected-error@-2 {{type 'double' requires cl_khr_fp64 support}}139#elif !defined(NOPEDANTIC)140// expected-warning@-4 {{Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is supported}}141#endif142}143#endif144