Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserializer masks out signaling nans #2027

Closed
jrmuizel opened this issue Nov 11, 2017 · 7 comments
Closed

Deserializer masks out signaling nans #2027

jrmuizel opened this issue Nov 11, 2017 · 7 comments

Comments

@jrmuizel
Copy link
Collaborator

When @gankro and I were looking at the deserialization code we noticed that it's masking out signaling NaNs. We don't need this protection. We don't know how to convince the byteorder crate of this.

@jrmuizel
Copy link
Collaborator Author

Here are the issues that caused this behaviour: BurntSushi/byteorder#71 and rust-lang/rust#39271

@Gankra
Copy link
Contributor

Gankra commented Nov 11, 2017

I am working on submitting a patch to fix the very incorrect piece of llvm documentation that originally motivated this.

@jrmuizel
Copy link
Collaborator Author

Great. It might also be valuable for us to make sure there are tests in llvm that ensure that behaviour around signalling NaNs is sane.

@jrmuizel
Copy link
Collaborator Author

Here's the beginnings of some tests that show that signaling NaNs don't turn immediately into undef

; RUN: opt < %s -O2 -S | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.13.0"

; Function Attrs: norecurse nounwind readnone ssp uwtable
define float @f(float, float) {
  %3 = fdiv float %0, %1
  ret float %3
}

define float @f2(float, float) {
  %3 = fdiv float 0x7FF8000000000000, %1
  ret float %3
}

define float @f3(float, float) {
  %3 = fdiv float 0x7FF4000000000000, %1
  ret float %3
}

define float @f4(float, float) {
  %3 = fdiv float 5.000000e+00, %1
  ret float %3
}

define float @f6(float, float) {
  %3 = fdiv float %0, 0x7FF4000000000000 
  ret float %3
}

define float @f7(float, float) {
  %3 = fdiv float 5.0000e+000, 0x7FF4000000000000 
  ret float %3
}

define float @f8(float, float) {
  %3 = fdiv float 0x7FF8000000000000, 0x7FF4000000000000 
  ret float %3
}

define float @f9(float, float) {
  %3 = fdiv float 0x7FF4000000000000, 0x7FF8000000000000 
  ret float %3
}

@Gankra
Copy link
Contributor

Gankra commented Nov 17, 2017

rust-lang/rust#46012

@glennw
Copy link
Member

glennw commented Dec 19, 2017

@gankro Is this bug still relevant to be open in the WR repo?

@jrmuizel
Copy link
Collaborator Author

Nope. We can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants