]> Cypherpunks repositories - gostls13.git/commit
[dev.simd] cmd/compile: generate function body for bodyless intrinsics
authorCherry Mui <cherryyz@google.com>
Fri, 20 Jun 2025 20:28:14 +0000 (16:28 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 23 Jun 2025 14:27:39 +0000 (07:27 -0700)
commit88c013d6ff6740451e7d294f99206c98c7f23f70
tree34d180ff55c110783570b51d52e45cf3b0ef64c1
parenta8669c78f5547904f1771e5d1d2a515c0c97dc18
[dev.simd] cmd/compile: generate function body for bodyless intrinsics

For a compiler intrinsic, if it is used in a non-call context, e.g.
as a function pointer, currently it requires fallback
implementation (e.g. assembly code for atomic operations),
otherwise it will result in a build failure. The fallback
implementation needs to be maintained and tested, albeit rarely
used in practice.

Also, for SIMD, we're currently adding a large number of compiler
intrinsics without providing fallback implementations (we might in
the future). As methods, it is not unlikely that they are used in
a non-call context, e.g. referenced from the type descriptor.

This CL lets the compiler generate the function body for
bodyless intrinsics. The compiler already recognizes a call to
the function as an intrinsic and can directly generate code for it.
So we just fill in the body with a call to the same function.

Change-Id: I2636e3128f28301c9abaf2b48bc962ab56e7d1a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/683096
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/compile/internal/gc/compile.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ssagen/abi.go
src/cmd/compile/internal/ssagen/intrinsics.go