Files
ww/test/lang/f32lit_test.ww
Hojun-Cho 60dec4a6bf test: migrate Fam11 float value tests to @test, keep ABI-conformance pins (#5-C4)
fold-2 chunk C4 (drew's Fam8-13 plan): 13 float value-row C drivers re-homed.
11 migrate to test/lang/*_test.ww @test row-tables (exact IEEE-bit asserts);
1 float-overflow reject row -> a runww //ww:error carrier. 956_tuprecv_f64
slims to a w6c_ww asserttyped pin (20 value rows -> @test; the stamp dimension
can't be a value/byte-id @test) -- mutation-proven non-vacuous (break #121
stamp -> RED 6/6 -> restore -> GREEN) + an in-test vacuity self-check.
946_structparam/structret stay whole: their SSE register-class .s-grep (SysV
ABI conformance, #165/#171a) is the genuine defect-guard, not @test-expressible.
Float was the predicted SSE-cursor byte-id hotspot -- zero fresh cs!=ww
surfaced; 951_f64cgen (cstage-only before) byte-ids clean. LANGBYTEID floor
82->93; test count 384->374 (10 deleted drivers; 956 + the 2 946 kept).
2026-06-24 03:25:47 +09:00

44 lines
1.3 KiB
Plaintext

// f32lit_test — f32-suffixed literal narrowing, migrated from
// test/wcc/964_f32lit_run.c (#5-C4, #104 fold-1). An f32-typed float literal
// must narrow to single precision (CVTSD2SS at the materialise site) before the
// f32 consumer reads it; pre-fix both stages materialised it as a 64-bit double
// in X0 and the downstream MOVSS read the low 4 bytes (garbage; 0.0f for clean
// values, which is why 0.0 coincidentally survived). Covers the f32 suffix
// (1.0f32) and the no-decimal N_INTLIT-float arm (8f32). Both stages emit
// byte-identical asm, so byte-id alone never catches a reintroduction — the T1
// cstage run is the live net; T2 byte-id rides along.
package f32lit_test;
fn g() f32 = { return 2.5f32; };
@test fn bare_value() void = {
let x: f32 = 1.0f32;
assert(x: f64 == 1.0);
};
@test fn arith() void = {
let a: f32 = 1.5f32;
let b: f32 = 2.5f32;
let s: f32 = a + b;
assert(s: f64 == 4.0);
};
@test fn return_arith() void = {
let r: f32 = g() + 1.5f32;
assert(r: i32 == 4);
};
@test fn intlit_f32_arm() void = {
let y: f32 = 8f32;
assert(y: i32 == 8);
};
// genuine single-rounding: 2^24 + 1 is NOT representable in f32 and rounds back
// to 2^24 (round-to-even); if the add ran in double it would be 16777217.0.
@test fn single_round() void = {
let big: f32 = 16777216.0f32;
let r: f32 = big + 1.0f32;
assert(r: f64 == 16777216.0);
};