cmd/asm: can't store float32 in odd-numbered registers s1,s3,s5,... on GOARCH=arm #33379
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
We lack the ability to store
float32
into odd-numbered single-precision floating pointsX
registers onGOARCH=arm
.The only way to access the floating-point registers is via the
F0, F1, ...
register names, and these correspond to the double-precisionfloat64
registersd0, d1, ...
. If you write a 32-bit value to these registers, the assembler will emit an opcode that writes to the single-precision floating point registersX
that aliases the correspondingdX
register, wheredX
==s(2*X)
.The only way to access the odd-numbered
sX
registers is to writeBYTE $0x....
statements and lay out the opcodes directly. But this has the unfortunate consequence of not being able to use virtual registers likeFP
, and thus extra instructions are required to work around this limitation.What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes; including tip as of July 25, 2019.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
[main.go]
[storeFloat.s]
Build the above project, for example to target the Raspberry Pi having
vfp
support:Disassemble the binary:
Observe the opcodes of the
MOVF
instructions instoreFloat
: they all reference even-numbered registerss0, s2, s4, s6, s8, s10
. I have appended the disassembly to the code above as line-comments.I did try to specify single-precision floating point registers using
S0, S1, S2, S3, ...
, however the assembler fails with errors:A quick look at the Go source code shows that only
REG_Rx
andREG_Fx
register types have been defined insrc/cmd/internal/obj/arm
.The text was updated successfully, but these errors were encountered: