Skip to content

Erroneous test in julia/test /float16.jl? #56582

@stensmo

Description

@stensmo

I am testing Julia on RISC-V, and hit a small snag, but the test could perhaps be removed?

@test unsafe_trunc(Int16, NaN16) === Int16(0) #18771

Is on line 82. Julia will issue this code (Both on X86 and Risc-V)

define i16 @julia_unsafe_trunc_1513(half %"x::Float16") #0 {
top:
  %0 = fptosi half %"x::Float16" to i16
  %1 = freeze i16 %0
  ret i16 %1
}

When you check the LLVM Language Reference for fptosi https://llvm.org/docs/LangRef.html#fptosi-to-instruction you see that if the value does not fit, it's a poison value, and it's ok to replace the value with any value of that type.

On x86 the poison value is 0 and on Risc-V the posion value is -1 for this case. Why does Julia need the poison value to be 0?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions