]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/arm64: refactor the handling of shifted RSP
authoreric fang <eric.fang@arm.com>
Tue, 20 Apr 2021 02:46:33 +0000 (02:46 +0000)
committerEric Fang <eric.fang@arm.com>
Tue, 15 Mar 2022 01:00:36 +0000 (01:00 +0000)
commit44a0da4ff11a5447dcfe2b62ac46bca134736d81
tree6cbcfa8a4abcffdb943d61f16da9597cd93dab26
parent41a82aa9c36bffab2593d50aa55a462fef4e5bd4
cmd/internal/obj/arm64: refactor the handling of shifted RSP

Some arithmetic operation instructions such as ADD and SUB support two
formats of left shift (<<) operation, namely shifted register format and
extended register format. And the encoding, supported registers and shifted
amount are both different.

The assembly parser doesn't distinguish them and parses them into TYPE_SHIFT
type, because the parser can't tell them apart and in most cases extended
left-shift can be replaced by shifted left-shift. The only exception is
when the second source register or the destination register is RSP.

This CL converts this case into the extended format in the preprocess stage,
which helps to simplify some of the logic of the new assembler implementation
and also makes this situation look more reasonable.

Change-Id: I2cd7d2d663b38a7ba77a9fef1092708b8cb9bc3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/311709
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/asm/internal/asm/testdata/arm64error.s
src/cmd/internal/obj/arm64/asm7.go
src/cmd/internal/obj/arm64/obj7.go