CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
98 lines
2.8 KiB
C++
98 lines
2.8 KiB
C++
// RUN: %clang_cc1 -fexperimental-strict-floating-point \
|
|
// RUN: -triple x86_64-linux-gnu -emit-llvm -o - -verify %s
|
|
//
|
|
// RUN: %clang_cc1 -fexperimental-strict-floating-point \
|
|
// RUN: -triple x86_64-linux-gnu -emit-llvm -o - -verify %s \
|
|
// RUN: -ffp-eval-method=source
|
|
//
|
|
// RUN: %clang_cc1 -fexperimental-strict-floating-point \
|
|
// RUN: -triple x86_64-linux-gnu -emit-llvm -o - -verify %s \
|
|
// RUN: -ffp-eval-method=double
|
|
|
|
extern "C" int printf(const char *, ...);
|
|
|
|
void foo1() {
|
|
printf("FP: %d\n", __FLT_EVAL_METHOD__);
|
|
}
|
|
|
|
void apply_pragma() {
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(double)
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
printf("FP: %d\n", __FLT_EVAL_METHOD__);
|
|
}
|
|
|
|
int foo2() {
|
|
apply_pragma();
|
|
return 0;
|
|
}
|
|
|
|
void apply_pragma_with_wrong_value() {
|
|
// expected-error@+1{{unexpected argument 'value' to '#pragma clang fp eval_method'; expected 'source', 'double' or 'extended'}}
|
|
#pragma clang fp eval_method(value)
|
|
}
|
|
|
|
int foo3() {
|
|
apply_pragma_with_wrong_value();
|
|
return 0;
|
|
}
|
|
|
|
void foo() {
|
|
auto a = __FLT_EVAL_METHOD__;
|
|
{
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(double)
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
auto b = __FLT_EVAL_METHOD__;
|
|
}
|
|
auto c = __FLT_EVAL_METHOD__;
|
|
}
|
|
|
|
void func() {
|
|
{
|
|
{
|
|
#pragma clang fp eval_method(source)
|
|
}
|
|
int i = __FLT_EVAL_METHOD__; // ok, not in a scope changed by the pragma
|
|
}
|
|
{
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(source)
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
int i = __FLT_EVAL_METHOD__;
|
|
}
|
|
}
|
|
|
|
float G;
|
|
|
|
int f(float x, float y, float z) {
|
|
G = x * y + z;
|
|
return __FLT_EVAL_METHOD__;
|
|
}
|
|
|
|
int foo(int flag, float x, float y, float z) {
|
|
if (flag) {
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(double)
|
|
G = x + y + z;
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
return __FLT_EVAL_METHOD__;
|
|
} else {
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(extended)
|
|
G = x + y + z;
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
return __FLT_EVAL_METHOD__;
|
|
}
|
|
}
|
|
|
|
#if __FLT_EVAL_METHOD__ == 1
|
|
#endif
|
|
#pragma clang fp eval_method(source)
|
|
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(double)
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
#if __FLT_EVAL_METHOD__ == 1
|
|
#endif
|