]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm64: fix assemble fcmp/fcmpe bug
authorfanzha02 <fannie.zhang@arm.com>
Tue, 13 Jun 2017 12:24:19 +0000 (12:24 +0000)
committerCherry Zhang <cherryyz@google.com>
Wed, 23 Aug 2017 15:59:34 +0000 (15:59 +0000)
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>
src/cmd/asm/internal/arch/arm64.go
src/cmd/asm/internal/asm/testdata/arm64enc.s
src/cmd/internal/obj/arm64/asm7.go

index b46ae9d5f83b05d149a8bdd292f0a81a98542006..4320a299ff8b6113e5b5db02e9420f063d3ab7c5 100644 (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
index 5c218b50a2a6d965e997f10b389b7838277b7845..686ae0fa42cd4fac51e43a30ddae7c5164585394 100644 (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
index f05150c87a83f4a54ad4fc05b23a3593ab0337fe..8b976cae31458c32967ef501e7509ae204d2d436 100644 (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 {