go/src/cmd/compile/internal/walk
Cherry Zhang cf148f3d46 cmd/compile, runtime: use ABI-aware function converting float to interface
Currently, when converting a float (say float64), we use convT64
function. In the runtime convT64 expects a uint64 argument. In
the compiler, convT64 is defined as taking an "any" argument (so
it works with also uint64-like types such as [1]uint64). The "any"
type is instantiated with the concrete type in walk. So the
backend will see instances such as convT64([1]uint64).

Currently, float64 is treated as uint64-like. So the backend will
see convT64(float64). With a memory-based calling convention this
is fine. With a register-based calling convention, however, it
will pass the argument in a floating point register, whereas the
runtime expects the argument in an integer register (as it is
declared as uint64).

To fix this, this CL introduces runtime functions convT32F and
convT64F. They behave the same as convT32/convT64, but with a
float argument. In the compiler, use convT32F/convT64F to convert
float-like type to interface.

With this, "GOEXPERIMENT=regabi,regabiargs go test math fmt"
works.

Updates #40724.

Change-Id: I8b2e232096a95e4a7c4ab81795d77ef224ffaab3
Reviewed-on: https://go-review.googlesource.com/c/go/+/307232
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-05 18:22:47 +00:00
..
assign.go cmd/compile: use abiutils for all rcvr/in/out frame offsets. 2021-03-03 01:45:33 +00:00
builtin.go cmd/compile: be sure to wrap defer/go calls with arguments 2021-03-30 00:47:34 +00:00
closure.go cmd/compile: wrap/desugar defer calls for register abi 2021-03-23 23:08:19 +00:00
compare.go cmd/compile: set ir.Name.Func in more cases 2021-03-29 18:46:28 +00:00
complit.go cmd/compile, cmd/link: dynamically export writable static tmps 2021-03-16 23:14:54 +00:00
convert.go cmd/compile, runtime: use ABI-aware function converting float to interface 2021-04-05 18:22:47 +00:00
expr.go cmd/compile: be sure to wrap defer/go calls with arguments 2021-03-30 00:47:34 +00:00
order.go cmd/compile: wrap defer/go call with results 2021-03-30 00:49:14 +00:00
race.go cmd/compile: use getcallerpc for racefuncentry 2021-03-05 22:42:10 +00:00
range.go
select.go cmd/compile,runtime: make selectnbrecv return two values 2021-02-23 05:02:26 +00:00
stmt.go cmd/compile: wrap/desugar defer calls for register abi 2021-03-23 23:08:19 +00:00
switch.go
temp.go
walk.go cmd/compile/internal/walk: relocate a stray comment 2021-03-22 20:20:58 +00:00