aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2025-02-20 22:54:34 +1100
committerJoel Sing <joel@sing.id.au>2025-04-03 04:37:34 -0700
commitc524db9ca8520d1e0f6fce79a9e937af901dff44 (patch)
tree1d1e8ae7ba28837fd13f54c106b0fba78418ae83 /src/cmd/internal/obj
parent0b31e6d4cc804ab76ae8ced151ee2f50657aec14 (diff)
downloadgo-c524db9ca8520d1e0f6fce79a9e937af901dff44.tar.xz
cmd/internal/obj/arm64: simplify conclass
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>
Diffstat (limited to 'src/cmd/internal/obj')
-rw-r--r--src/cmd/internal/obj/arm64/asm7.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go
index 0fc7815e41..529d4eda5d 100644
--- a/src/cmd/internal/obj/arm64/asm7.go
+++ b/src/cmd/internal/obj/arm64/asm7.go
@@ -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
}