Skip to content

False negative with the sign bit of nans #1037

@dtcxzyw

Description

@dtcxzyw

Alive2: https://alive2.llvm.org/ce/z/g8marn

----------------------------------------
define i1 @src1() {
#0:
  %x = sqrt float -2494298614702763169545800705376256.000000
  %y = bitcast float %x to i32
  %cmp = icmp slt i32 %y, 0
  ret i1 %cmp
}
=>
define i1 @tgt1() {
#0:
  ret i1 1
}
Transformation seems to be correct!


----------------------------------------
define i1 @src2() {
#0:
  %x = sqrt float -2494298614702763169545800705376256.000000
  %y = bitcast float %x to i32
  %cmp = icmp slt i32 %y, 0
  ret i1 %cmp
}
=>
define i1 @tgt2() {
#0:
  ret i1 0
}
Transformation seems to be correct!

Summary:
  2 correct transformations
  0 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors

sqrt with a negative value (except for -0) returns nan. But we cannot make assumptions about the sign bit of return values.

See also llvm/llvm-project#92217

cc @regehr @zhengyang92

Metadata

Metadata

Assignees

No one assigned

    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