1// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only 2// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL1.1 3 4// Test with a target not supporting fp64. 5// RUN: %clang_cc1 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -DNOFP64 6 7void f1(double da) { // expected-error {{type 'double' requires cl_khr_fp64 extension}} 8 double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} 9 (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}} 10} 11 12#pragma OPENCL EXTENSION cl_khr_fp64 : enable 13#ifdef NOFP64 14// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}} 15#endif 16 17void f2(void) { 18 double d; 19#ifdef NOFP64 20// expected-error@-2{{use of type 'double' requires cl_khr_fp64 extension to be enabled}} 21#endif 22 23 (void) 1.0; 24#ifdef NOFP64 25// expected-warning@-2{{double precision constant requires cl_khr_fp64, casting to single precision}} 26#endif 27} 28 29#pragma OPENCL EXTENSION cl_khr_fp64 : disable 30#ifdef NOFP64 31// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}} 32#endif 33 34void f3(void) { 35 double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} 36} 37