(reply to assembly code for float32 lib)
probably best thing to do, would be to simply copy as much as possible the float64 std lib, so as to have the same hardware dependencies.
mostly what seems to be needed is:
amd64: ?????SD -> ?????SS
in x86; F???? -> F????S
and 8byes -> 4bytes in MOVes
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #include "../../cmd/ld/textflag.h"
6
7 // func Sqrt(x float64) float64
8 TEXT ·Sqrt(SB),NOSPLIT,$0
9 SQRTSD x+0(FP), X0
10 MOVSD X0, ret+8(FP)
11 RETneeds this diff
9 SQRTSS x+0(FP), X0
10 MOVSS X0, ret+4(FP)
and
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #include "../../cmd/ld/textflag.h"
6
7 // func Sqrt(x float64) float64
8 TEXT ·Sqrt(SB),NOSPLIT,$0
9 FMOVD x+0(FP),F0
10 FSQRT
11 FMOVDP F0,ret+8(FP)
12 RETdiff
9 FMOVS x+0(FP),F0
10 FSQRTS
11 FMOVSP F0,ret+4(FP)
BTW bear in mind i've only been looking at assembler since last week, so i could be missing something important.
and
the 386 is currently just guesses and is untested, but i hope to test and will report back.(i guess the 386 will actually work on amd64)