1
0
mirror of https://github.com/golang/go synced 2024-11-24 04:10:14 -07:00

cmd/internal/obj/arm64: fix assemble fcmp/fcmpe bug

The current code treats floating-point constant as integer
and does not treat fcmp/fcmpe as the comparison instrucitons
that requires special handling.

The fix corrects the type of immediate arguments and adds fcmp/fcmpe
in the special handing.

Uncomment the fcmp/fcmpe cases.

Fixes #21567
Change-Id: I6782520e2770f6ce70270b667dd5e68f71e2d5ad
Reviewed-on: https://go-review.googlesource.com/57852
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
fanzha02 2017-06-13 12:24:19 +00:00 committed by Cherry Zhang
parent e974f4fddf
commit 8f1e2a2610
3 changed files with 12 additions and 10 deletions

View File

@ -56,7 +56,9 @@ func jumpArm64(word string) bool {
func IsARM64CMP(op obj.As) bool {
switch op {
case arm64.ACMN, arm64.ACMP, arm64.ATST,
arm64.ACMNW, arm64.ACMPW, arm64.ATSTW:
arm64.ACMNW, arm64.ACMPW, arm64.ATSTW,
arm64.AFCMPS, arm64.AFCMPD,
arm64.AFCMPES, arm64.AFCMPED:
return true
}
return false

View File

@ -398,14 +398,14 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
FCCMPD HI, F11, F15, $15 // ef856b1e
FCCMPES HS, F28, F13, $13 // bd253c1e
FCCMPED LT, F20, F4, $9 // 99b4741e
// FCMPS F3, F17 // 2022231e
// FCMPS $(0.0), F8 // 0821201e
// FCMPD F11, F27 // 60236b1e
// FCMPD $(0.0), F25 // 2823601e
// FCMPES F16, F30 // d023301e
// FCMPES $(0.0), F29 // b823201e
// FCMPED F13, F10 // 50216d1e
// FCMPED $(0.0), F25 // 3823601e
FCMPS F3, F17 // 2022231e
FCMPS $(0.0), F8 // 0821201e
FCMPD F11, F27 // 60236b1e
FCMPD $(0.0), F25 // 2823601e
FCMPES F16, F30 // d023301e
FCMPES $(0.0), F29 // b823201e
FCMPED F13, F10 // 50216d1e
FCMPED $(0.0), F25 // 3823601e
// FCSELS EQ, F26, F27, F25 // 590f3b1e
// FCSELD PL, F8, F22, F7 // 075d761e
//TODO FCVTASW F21, R15 // af02241e

View File

@ -2882,7 +2882,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
o1 = c.oprrr(p, p.As)
var rf int
if p.From.Type == obj.TYPE_CONST {
if p.From.Type == obj.TYPE_FCONST {
o1 |= 8 /* zero */
rf = 0
} else {