golang/go

cmd/compile: mips/mips64 floating point negation does not handle NaN correctly

Open

#58,466 opened on Feb 10, 2023

View on GitHub
 (5 comments) (0 reactions) (1 assignee)Go (19,008 forks)batch import
NeedsDecisionarch-mipscompiler/runtimehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

As discussed on https://github.com/golang/go/issues/56491#issuecomment-1426492508, on MIPS the gc compiler uses neg.d (which it calls NEGD) to negate a floating-point value. However, that instruction does not actually negate a NaN. That suggests that we should not use neg.d for floating point negation, but should instead xor with the high bit.

CC @randall77 @golang/mips @golang/runtime

Contributor guide