Skip to content

4 tests from spec/testsuite/conversions.wast and spec/testsuite/simd_conversions.wast fail on ppc64le #8626

Closed

Description

@rathann

When running binaryen 129 testsuite on ppc64le, I get the following 4 failures:

/builddir/build/BUILD/binaryen-129-build/binaryen-version_129/redhat-linux-build/bin/wasm-shell /builddir/build/BUILD/binaryen-129-build/binaryen-version_129/test/spec/testsuite/simd_conversions.wast
...
485 CHECKING [line: 561]
expected arithmetic f64, got nan:0x4000000000000
486 CHECKING [line: 563]
expected arithmetic f64, got -nan:0x4000000000000

and

/builddir/build/BUILD/binaryen-129-build/binaryen-version_129/redhat-linux-build/bin/wasm-shell /builddir/build/BUILD/binaryen-129-build/binaryen-version_129/test/spec/testsuite/simd_conversions.wast
...
14 CHECKING [line: 63]
expected arithmetic f64, got i32x4 0x00000000 0x7ff40000 0x00000000 0x7ff40000 at lane 0
15 CHECKING [line: 67]
expected arithmetic f64, got i32x4 0x00000000 0xfff40000 0x00000000 0xfff40000 at lane 0

This is a regressions between 126 and 129, but I haven't tested 127 or 128 yet.

Activity

  1. rathann commented on Apr 20, 2026

    @rathann
    ContributorAuthor

    Looks like #8528 and #8472 are related to this.

  2. kripken commented on Apr 20, 2026

    @kripken
    Member

    cc @stevenfontanella based on the linked issues

  3. stevenfontanella commented on Apr 23, 2026

    @stevenfontanella
    Member

    Sent #8645 for this. Copying over my explanation:

    The bug is due to the fact that C++ doesn't guarantee a bitwise representation for NaNs that are casted from double -> float or vice versa. From https://en.cppreference.com/cpp/language/implicit_conversion:

    Floating-point promotion
    A prvalue of type float can be converted to a prvalue of type double. The value does not change.

    In the case of NaNs, the value (NaN) is preserved regardless of the particular NaN that is picked, so we have no guarantee of the bitwise representation. And for double -> float:

    If the conversion is listed under floating-point promotions, it is a promotion and not a conversion.

    • If the source value can be represented exactly in the destination type, it does not change.
    • If the source value is between two representable values of the destination type, the result is one of those two values (it is implementation-defined which one, although if IEEE arithmetic is supported, rounding defaults to nearest).
    • Otherwise, the behavior is undefined.

    I assume NaN conversions again fall under case 1 meaning that the "value" (NaN) is preserved but not the bitwise representation. Or if not, it must be case 3 in which case converting a double NaN to a float NaN is UB (!).

  4. added a commit that references this issue on Apr 27, 2026
    a7fd052
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions