Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGen/pr87758.c
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

77 lines
2.6 KiB
C

// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
// precise mode
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fmath-errno -ffp-contract=on \
// RUN: -fno-rounding-math -emit-llvm -o - %s | FileCheck \
// RUN: --check-prefix=CHECK-PRECISE %s
// fast mode
// RUN: %clang_cc1 -triple x86_64-linux-gnu -ffast-math -ffp-contract=fast \
// RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-FAST %s
// Reproducer for issue #87758
// The testcase below verifies that the "fast" flag are set on the calls.
float sqrtf(float x); // unary fp builtin
float powf(float x, float y); // binary fp builtin
float fmaf(float x, float y, float z); // ternary fp builtin
char *rindex(const char *s, int c); // not a fp builtin
#pragma float_control(push)
#pragma float_control(precise, off)
// CHECK: define dso_local float @fp_precise_off_libm_calls(
// CHECK: call fast float @llvm.sqrt.f32(
// CHECK: call fast float @llvm.pow.f32(
// CHECK: call fast float @llvm.fma.f32(
// CHECK: call ptr @rindex(
// CHECK-PRECISE: define dso_local float @fp_precise_off_libm_calls(
// CHECK-PRECISE: call fast float @sqrtf(
// CHECK-PRECISE: call fast float @powf(
// CHECK-PRECISE: call fast float @llvm.fma.f32(
// CHECK-PRECISE: call ptr @rindex(
// CHECK-FAST: define dso_local nofpclass(nan inf) float @fp_precise_off_libm_calls(
// CHECK-FAST: call fast float @llvm.sqrt.f32(
// CHECK-FAST: call fast float @llvm.pow.f32(
// CHECK-FAST: call fast float @llvm.fma.f32(
// CHECK-FAST: call ptr @rindex(
float fp_precise_off_libm_calls(float a, float b, float c, const char *d, char *e, unsigned char f) {
a = sqrtf(a);
a = powf(a,b);
a = fmaf(a,b,c);
e = rindex(d, 75);
return a;
}
#pragma float_control(pop)
#pragma float_control(push)
#pragma float_control(precise, on)
// CHECK: define dso_local float @fp_precise_on_libm_calls(
// CHECK: call float @sqrtf(
// CHECK: call float @powf(
// CHECK: call float @llvm.fma.f32(
// CHECK: call ptr @rindex(
// CHECK-PRECISE: define dso_local float @fp_precise_on_libm_calls(
// CHECK-PRECISE: call float @sqrtf(
// CHECK-PRECISE: call float @powf(
// CHECK-PRECISE: call float @llvm.fma.f32(
// CHECK-PRECISE: call ptr @rindex(
// CHECK-FAST: define dso_local nofpclass(nan inf) float @fp_precise_on_libm_calls(
// CHECK-FAST: call nofpclass(nan inf) float @sqrtf(
// CHECK-FAST: call nofpclass(nan inf) float @powf(
// CHECK-FAST: call float @llvm.fma.f32(
// CHECK-FAST: call ptr @rindex(
float fp_precise_on_libm_calls(float a, float b, float c, const char *d, char *e, unsigned char f) {
a = sqrtf(a);
a = powf(a,b);
a = fmaf(a,b,c);
e = rindex(d, 75);
return a;
}
#pragma float_control(pop)