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 // RUN
: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std
=CL1.2 -DFP64
5 // Test with a target not supporting fp64.
6 // RUN
: %clang_cc1 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -DNOFP64 -DNOFP16
8 // Test with some extensions enabled or disabled by cmd-line args
10 // Target does not support fp64 and fp16 - override it
11 // RUN
: %clang_cc1 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext
=+cl_khr_fp64
,+cl_khr_fp16
13 // Disable or enable all extensions
14 // RUN
: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext
=-all -DNOFP64 -DNOFP16
15 // RUN
: %clang_cc1 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext
=+all
16 // RUN
: %clang_cc1 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext
=+all
,-cl_khr_fp64 -DNOFP64
17 // RUN
: %clang_cc1 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -cl-ext
=-all
,+cl_khr_fp64 -DNOFP16
20 // RUN
: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext
=-cl_khr_fp64 -cl-ext
=+cl_khr_fp64
21 // RUN
: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext
=-cl_khr_fp64
,+cl_khr_fp64
22 // RUN
: %clang_cc1 %s -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 -DNOFP64
23 // 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 -DNOFP64
25 // Test with -finclude-default-header
, which includes opencl-c.h. opencl-c.h
26 // disables all extensions by default
, but supported core extensions for a
27 // particular OpenCL version must be re-enabled
(for example
, cl_khr_fp64 is
28 // enabled by default with -cl-std
=CL2.0
).
30 // RUN
: %clang_cc1 %s -triple amdgcn-unknown-unknown -verify -pedantic -fsyntax-only -cl-std
=CL2.0 -finclude-default-header
31 // RUN
: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std
=clc
++
34 // expected-no-diagnostics
38 // expected-no-diagnostics
41 #ifdef __OPENCL_CPP_VERSION__
42 // expected-no-diagnostics
45 #if
(defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__
< 120)
46 void f1
(double da
) { // expected-error
{{type
'double
' requires cl_khr_fp64 extension
}}
47 double d
; // expected-error {{type 'double' requires cl_khr_fp64 extension}}
48 (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}}
54 return __builtin_isnan
(x);
57 int isfinite
(float x
) {
58 return __builtin_isfinite
(x);
62 #pragma OPENCL EXTENSION cl_khr_fp64
: enable
64 // expected-warning
@-
2{{unsupported OpenCL extension
'cl_khr_fp64
' - ignoring
}}
67 #pragma OPENCL EXTENSION cl_khr_fp16
: enable
69 // expected-warning
@-
2{{unsupported OpenCL extension
'cl_khr_fp16
' - ignoring
}}
75 // expected-error
@-
2{{use of type
'double
' requires cl_khr_fp64 extension to be enabled
}}
78 typedef double double4 __attribute__
((ext_vector_type(4)));
79 double4 d4
= {0.0f
, 2.0f
, 3.0f
, 1.0f
};
81 // expected-error
@-
3 {{use of type
'double
' requires cl_khr_fp64 extension to be enabled
}}
82 // expected-error
@-
3 {{use of type
'double4
' (vector of
4 'double
' values
) requires cl_khr_fp64 extension to be enabled
}}
88 // expected-warning
@-
3{{double precision constant requires cl_khr_fp64
, casting to single precision
}}
92 #pragma OPENCL EXTENSION cl_khr_fp64
: disable
94 // expected-warning
@-
2{{unsupported OpenCL extension
'cl_khr_fp64
' - ignoring
}}
97 #if
(defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__
< 120)
99 double d
; // expected-error {{type 'double' requires cl_khr_fp64 extension}}