]> Cypherpunks repositories - gostls13.git/commit
simd/archsimd: make IsNaN unary
authorCherry Mui <cherryyz@google.com>
Wed, 31 Dec 2025 07:42:30 +0000 (02:42 -0500)
committerCherry Mui <cherryyz@google.com>
Fri, 2 Jan 2026 20:13:40 +0000 (12:13 -0800)
commit13440fb51831bfde5804430596d2045a64fd2209
tree84196ec227a3ed45eee119c10a434169216e9516
parentc3550b3352ae283110c443576e1e62cdf8efaa72
simd/archsimd: make IsNaN unary

Currently, the IsNan API is defined as x.IsNan(y), which returns
a mask to represent, for each element, either x or y is NaN.
Albeit closer to the machine instruction, this is weird API, as
IsNaN is a unary operation. This CL changes it to unary, x.IsNaN().
It compiles to VCMPPS $3, x, x (or VCMPPD). For the two-operand
version, we can optimize x.IsNaN().Or(y.IsNaN()) to VCMPPS $3, x,
y (not done in this CL).

While here, change the name to IsNaN (uppercase both Ns), which
matches math.IsNaN.

Tests in the next CL.

Change-Id: Ib6e7afc2635e6c3c606db5ea16420ee673a6c6d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/733660
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
12 files changed:
src/cmd/compile/internal/ssa/_gen/AMD64.rules
src/cmd/compile/internal/ssa/_gen/genericOps.go
src/cmd/compile/internal/ssa/_gen/simdAMD64.rules
src/cmd/compile/internal/ssa/_gen/simdgenericOps.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/ssagen/intrinsics.go
src/cmd/compile/internal/ssagen/simdintrinsics.go
src/simd/archsimd/_gen/simdgen/ops/Compares/categories.yaml
src/simd/archsimd/_gen/simdgen/ops/Compares/go.yaml
src/simd/archsimd/extra_amd64.go
src/simd/archsimd/ops_amd64.go