Commit 8f1e2a26 authored by fanzha02's avatar fanzha02 Committed by Cherry Zhang

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: 's avatarCherry Zhang <cherryyz@google.com>
parent e974f4fd
......@@ -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
......
......@@ -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
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment