1
0
mirror of https://github.com/golang/go synced 2024-11-20 09:14:46 -07:00

cmd/internal/obj/arm: support more ARM VFP instructions

Add support of more ARM VFP instructions in the assembler.
They were introduced in ARM VFPv4.

"FMULAF/FMULAD   Fm, Fn, Fd": Fd = Fd + Fn*Fm
"FNMULAF/FNMULAD Fm, Fn, Fd": Fd = -(Fd + Fn*Fm)
"FMULSF/FMULSD   Fm, Fn, Fd": Fd = Fd - Fn*Fm
"FNMULSF/FNMULSD Fm, Fn, Fd": Fd = -(Fd - Fn*Fm)

The multiplication results are not rounded.

Change-Id: Id9cc52fd8e1b9a708103cd1e514c85a9e1cb3f47
Reviewed-on: https://go-review.googlesource.com/62550
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ben Shi 2017-09-09 14:17:05 +00:00 committed by Cherry Zhang
parent 2899c3e8cb
commit f727fa7939
5 changed files with 58 additions and 1 deletions

View File

@ -43,6 +43,14 @@ TEXT errors(SB),$0
NMULAF F0, F1 // ERROR "illegal combination"
NMULSD F0, F1 // ERROR "illegal combination"
NMULSF F0, F1 // ERROR "illegal combination"
FMULAD F0, F1 // ERROR "illegal combination"
FMULAF F0, F1 // ERROR "illegal combination"
FMULSD F0, F1 // ERROR "illegal combination"
FMULSF F0, F1 // ERROR "illegal combination"
FNMULAD F0, F1 // ERROR "illegal combination"
FNMULAF F0, F1 // ERROR "illegal combination"
FNMULSD F0, F1 // ERROR "illegal combination"
FNMULSF F0, F1 // ERROR "illegal combination"
NEGF F0, F1, F2 // ERROR "illegal combination"
NEGD F0, F1, F2 // ERROR "illegal combination"
ABSF F0, F1, F2 // ERROR "illegal combination"

View File

@ -30,6 +30,14 @@ TEXT foo(SB), DUPOK|NOSPLIT, $0
NMULAD F5, F6, F7 // 057b16ee
NMULSF F5, F6, F7 // 457a16ee
NMULSD F5, F6, F7 // 457b16ee
FMULAF F5, F6, F7 // 057aa6ee
FMULAD F5, F6, F7 // 057ba6ee
FMULSF F5, F6, F7 // 457aa6ee
FMULSD F5, F6, F7 // 457ba6ee
FNMULAF F5, F6, F7 // 457a96ee
FNMULAD F5, F6, F7 // 457b96ee
FNMULSF F5, F6, F7 // 057a96ee
FNMULSD F5, F6, F7 // 057b96ee
DIVF F0, F1, F2 // 002a81ee
DIVD.EQ F3, F4, F5 // 035b840e
DIVF.NE F0, F2 // 002a821e

View File

@ -240,6 +240,14 @@ const (
AMULSD
ANMULSF
ANMULSD
AFMULAF
AFMULAD
AFNMULAF
AFNMULAD
AFMULSF
AFMULSD
AFNMULSF
AFNMULSD
ADIVF
ADIVD
ASQRTF

View File

@ -63,6 +63,14 @@ var Anames = []string{
"MULSD",
"NMULSF",
"NMULSD",
"FMULAF",
"FMULAD",
"FNMULAF",
"FNMULAD",
"FMULSF",
"FMULSD",
"FNMULSF",
"FNMULSD",
"DIVF",
"DIVD",
"SQRTF",

View File

@ -1661,6 +1661,14 @@ func buildop(ctxt *obj.Link) {
opset(ANMULAD, r0)
opset(ANMULSF, r0)
opset(ANMULSD, r0)
opset(AFMULAF, r0)
opset(AFMULAD, r0)
opset(AFMULSF, r0)
opset(AFMULSD, r0)
opset(AFNMULAF, r0)
opset(AFNMULAD, r0)
opset(AFNMULSF, r0)
opset(AFNMULSD, r0)
opset(ADIVF, r0)
opset(ADIVD, r0)
@ -2270,7 +2278,8 @@ func (c *ctxt5) asmout(p *obj.Prog, o *Optab, out []uint32) {
r := int(p.Reg)
if r == 0 {
switch p.As {
case AMULAD, AMULAF, AMULSF, AMULSD, ANMULAF, ANMULAD, ANMULSF, ANMULSD:
case AMULAD, AMULAF, AMULSF, AMULSD, ANMULAF, ANMULAD, ANMULSF, ANMULSD,
AFMULAD, AFMULAF, AFMULSF, AFMULSD, AFNMULAF, AFNMULAD, AFNMULSF, AFNMULSD:
c.ctxt.Diag("illegal combination: %v", p)
default:
r = rt
@ -2905,6 +2914,22 @@ func (c *ctxt5) oprrr(p *obj.Prog, a obj.As, sc int) uint32 {
return o | 0xe<<24 | 0x1<<20 | 0xb<<8 | 0x4<<4
case ANMULSF:
return o | 0xe<<24 | 0x1<<20 | 0xa<<8 | 0x4<<4
case AFMULAD:
return o | 0xe<<24 | 0xa<<20 | 0xb<<8
case AFMULAF:
return o | 0xe<<24 | 0xa<<20 | 0xa<<8
case AFMULSD:
return o | 0xe<<24 | 0xa<<20 | 0xb<<8 | 0x4<<4
case AFMULSF:
return o | 0xe<<24 | 0xa<<20 | 0xa<<8 | 0x4<<4
case AFNMULAD:
return o | 0xe<<24 | 0x9<<20 | 0xb<<8 | 0x4<<4
case AFNMULAF:
return o | 0xe<<24 | 0x9<<20 | 0xa<<8 | 0x4<<4
case AFNMULSD:
return o | 0xe<<24 | 0x9<<20 | 0xb<<8
case AFNMULSF:
return o | 0xe<<24 | 0x9<<20 | 0xa<<8
case ADIVD:
return o | 0xe<<24 | 0x8<<20 | 0xb<<8 | 0<<4
case ADIVF: