]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm64: simplify conclass
authorJoel Sing <joel@sing.id.au>
Thu, 20 Feb 2025 11:54:34 +0000 (22:54 +1100)
committerJoel Sing <joel@sing.id.au>
Thu, 3 Apr 2025 11:37:34 +0000 (04:37 -0700)
Reduce repetition by pulling some common conversions into variables.

Change-Id: I8c1cc806236b5ecdadf90f4507923718fa5de9b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/650937
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/internal/obj/arm64/asm7.go

index 0fc7815e4195b457f899a34593bea6920d8836fe..529d4eda5da3f71ff97df26674ed4c80794c0f1b 100644 (file)
@@ -1904,45 +1904,45 @@ func rclass(r int16) int {
 
 // conclass classifies a constant.
 func conclass(v int64) int {
+       vbitcon := uint64(v)
+       vnotcon := ^v
+
        if v == 0 {
                return C_ZCON
        }
        if isaddcon(v) {
                if v <= 0xFFF {
-                       if isbitcon(uint64(v)) {
+                       if isbitcon(vbitcon) {
                                return C_ABCON0
                        }
                        return C_ADDCON0
                }
-               if isbitcon(uint64(v)) {
+               if isbitcon(vbitcon) {
                        return C_ABCON
                }
                if movcon(v) >= 0 {
                        return C_AMCON
                }
-               if movcon(^v) >= 0 {
+               if movcon(vnotcon) >= 0 {
                        return C_AMCON
                }
                return C_ADDCON
        }
 
-       t := movcon(v)
-       if t >= 0 {
-               if isbitcon(uint64(v)) {
+       if t := movcon(v); t >= 0 {
+               if isbitcon(vbitcon) {
                        return C_MBCON
                }
                return C_MOVCON
        }
-
-       t = movcon(^v)
-       if t >= 0 {
-               if isbitcon(uint64(v)) {
+       if t := movcon(vnotcon); t >= 0 {
+               if isbitcon(vbitcon) {
                        return C_MBCON
                }
                return C_MOVCON
        }
 
-       if isbitcon(uint64(v)) {
+       if isbitcon(vbitcon) {
                return C_BITCON
        }