Skip to content

Inconsistent truncation of -0.0 #617

Open
@tgross35

Description

@tgross35
#![feature(f128, f16)]

use core::hint::black_box;

extern "C" {
    fn __truncdfhf2(a: f64) -> f16;
}

fn main() {
    let a = -0_f64;
    let res_sys: f16 = unsafe { __truncdfhf2(a) };
    let res_llvm: f16 = black_box(a) as f16;
    let res_builtins: f16 = compiler_builtins::float::trunc::__truncdfhf2(a);
    dbg!(res_sys, res_llvm, res_builtins);
}
[src/lib.rs:108:1] res_sys = 0x0000
[src/lib.rs:108:1] res_llvm = 0x0000
[src/lib.rs:108:1] res_builtins = 0x8000

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvmThis issue needs to be fixed in LLVM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions