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
66 lines
2.5 KiB
C++
66 lines
2.5 KiB
C++
// RUN: %clang_cc1 -emit-llvm -triple i386-linux -Wno-unknown-pragmas -frounding-math %s -o - | FileCheck %s
|
|
|
|
constexpr float func_01(float x, float y) {
|
|
return x + y;
|
|
}
|
|
|
|
float V1 = func_01(1.0F, 0x0.000001p0F);
|
|
float V2 = 1.0F + 0x0.000001p0F;
|
|
float V3 = func_01(1.0F, 2.0F);
|
|
|
|
// CHECK: @V1 = {{.*}}global float 1.000000e+00, align 4
|
|
// CHECK: @V2 = {{.*}}global float 1.000000e+00, align 4
|
|
// CHECK: @V3 = {{.*}}global float 3.000000e+00, align 4
|
|
|
|
void test_builtin_elementwise_fma_round_upward() {
|
|
#pragma STDC FENV_ACCESS ON
|
|
#pragma STDC FENV_ROUND FE_UPWARD
|
|
|
|
// CHECK: store float f0x40C00008, ptr %f1
|
|
// CHECK: store float f0x40C00008, ptr %f2
|
|
constexpr float f1 = __builtin_elementwise_fma(2.0F, 3.000001F, 0.000001F);
|
|
constexpr float f2 = 2.0F * 3.000001F + 0.000001F;
|
|
static_assert(f1 == f2);
|
|
static_assert(f1 == 6.00000381F);
|
|
// CHECK: store double f0x40180000C9539B89, ptr %d1
|
|
// CHECK: store double f0x40180000C9539B89, ptr %d2
|
|
constexpr double d1 = __builtin_elementwise_fma(2.0, 3.000001, 0.000001);
|
|
constexpr double d2 = 2.0 * 3.000001 + 0.000001;
|
|
static_assert(d1 == d2);
|
|
static_assert(d1 == 6.0000030000000004);
|
|
}
|
|
|
|
void test_builtin_elementwise_fma_round_downward() {
|
|
#pragma STDC FENV_ACCESS ON
|
|
#pragma STDC FENV_ROUND FE_DOWNWARD
|
|
|
|
// CHECK: store float f0x40C00006, ptr %f3
|
|
// CHECK: store float f0x40C00006, ptr %f4
|
|
constexpr float f3 = __builtin_elementwise_fma(2.0F, 3.000001F, 0.000001F);
|
|
constexpr float f4 = 2.0F * 3.000001F + 0.000001F;
|
|
static_assert(f3 == f4);
|
|
// CHECK: store double f0x40180000C9539B87, ptr %d3
|
|
// CHECK: store double f0x40180000C9539B87, ptr %d4
|
|
constexpr double d3 = __builtin_elementwise_fma(2.0, 3.000001, 0.000001);
|
|
constexpr double d4 = 2.0 * 3.000001 + 0.000001;
|
|
static_assert(d3 == d4);
|
|
}
|
|
|
|
void test_builtin_elementwise_fma_round_nearest() {
|
|
#pragma STDC FENV_ACCESS ON
|
|
#pragma STDC FENV_ROUND FE_TONEAREST
|
|
|
|
// CHECK: store float f0x40C00006, ptr %f5
|
|
// CHECK: store float f0x40C00006, ptr %f6
|
|
constexpr float f5 = __builtin_elementwise_fma(2.0F, 3.000001F, 0.000001F);
|
|
constexpr float f6 = 2.0F * 3.000001F + 0.000001F;
|
|
static_assert(f5 == f6);
|
|
static_assert(f5 == 6.00000286F);
|
|
// CHECK: store double f0x40180000C9539B89, ptr %d5
|
|
// CHECK: store double f0x40180000C9539B89, ptr %d6
|
|
constexpr double d5 = __builtin_elementwise_fma(2.0, 3.000001, 0.000001);
|
|
constexpr double d6 = 2.0 * 3.000001 + 0.000001;
|
|
static_assert(d5 == d6);
|
|
static_assert(d5 == 6.0000030000000004);
|
|
}
|