Skip to content

[InstCombine] The sign bit of NaN is not preserved when folding (X <= +/-0.0) ? (0.0 - X) : X to fabs(X) #136646

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

Closed
dtcxzyw opened this issue Apr 22, 2025 · 0 comments · Fixed by #136648

Comments

@dtcxzyw
Copy link
Member

dtcxzyw commented Apr 22, 2025

Reproducer: https://alive2.llvm.org/ce/z/2JaLU9


----------------------------------------
define half @src(half %x) {
#0:
  %gtzero = fcmp ugt half %x, 0x0000
  %negx = fsub half 0x0000, %x
  %fabs = select i1 %gtzero, half %x, half %negx
  ret half %fabs
}
=>
define half @src(half %x) nofree willreturn memory(none) {
#0:
  %fabs = fabs half %x
  ret half %fabs
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
half %x = #xfd00 (SNaN)

Source:
i1 %gtzero = #x1 (1)
half %negx = #xff00 (QNaN)
half %fabs = #xfd00 (SNaN)

Target:
half %fabs = #x7d00 (SNaN)
Source value: #xfd00 (SNaN)
Target value: #x7d00 (SNaN)

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

Related issues:
AliveToolkit/alive2#1155
#59279

@dtcxzyw dtcxzyw self-assigned this Apr 22, 2025
jyli0116 pushed a commit to jyli0116/llvm-project that referenced this issue Apr 28, 2025
…vm#136648)

As per the LangRef and IEEE 754-2008 standard, the sign bit of NaN is
preserved if there is no floating-point operation being performed.
See also
llvm@862e35e
for reference.

Alive2: https://alive2.llvm.org/ce/z/QYtEGj
Closes llvm#136646
swift-ci pushed a commit to swiftlang/llvm-project that referenced this issue Apr 29, 2025
…vm#136648)

As per the LangRef and IEEE 754-2008 standard, the sign bit of NaN is
preserved if there is no floating-point operation being performed.
See also
llvm@862e35e
for reference.

Alive2: https://alive2.llvm.org/ce/z/QYtEGj
Closes llvm#136646

(cherry picked from commit 3e1e406)
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this issue May 6, 2025
…to fabs (#136648)

As per the LangRef and IEEE 754-2008 standard, the sign bit of NaN is
preserved if there is no floating-point operation being performed.
See also
llvm/llvm-project@862e35e
for reference.

Alive2: https://alive2.llvm.org/ce/z/QYtEGj
Closes llvm/llvm-project#136646
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
…vm#136648)

As per the LangRef and IEEE 754-2008 standard, the sign bit of NaN is
preserved if there is no floating-point operation being performed.
See also
llvm@862e35e
for reference.

Alive2: https://alive2.llvm.org/ce/z/QYtEGj
Closes llvm#136646
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
…vm#136648)

As per the LangRef and IEEE 754-2008 standard, the sign bit of NaN is
preserved if there is no floating-point operation being performed.
See also
llvm@862e35e
for reference.

Alive2: https://alive2.llvm.org/ce/z/QYtEGj
Closes llvm#136646
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
…vm#136648)

As per the LangRef and IEEE 754-2008 standard, the sign bit of NaN is
preserved if there is no floating-point operation being performed.
See also
llvm@862e35e
for reference.

Alive2: https://alive2.llvm.org/ce/z/QYtEGj
Closes llvm#136646
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this issue May 9, 2025
…vm#136648)

As per the LangRef and IEEE 754-2008 standard, the sign bit of NaN is
preserved if there is no floating-point operation being performed.
See also
llvm@862e35e
for reference.

Alive2: https://alive2.llvm.org/ce/z/QYtEGj
Closes llvm#136646
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this issue May 15, 2025
…to fabs (#136648)

As per the LangRef and IEEE 754-2008 standard, the sign bit of NaN is
preserved if there is no floating-point operation being performed.
See also
llvm/llvm-project@862e35e
for reference.

Alive2: https://alive2.llvm.org/ce/z/QYtEGj
Closes llvm/llvm-project#136646

(cherry picked from commit 3e1e406)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant