]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/arm64: add checks for incorrect use of REGTMP register
authorfanzha02 <fannie.zhang@arm.com>
Tue, 24 Aug 2021 04:46:54 +0000 (12:46 +0800)
committerfannie zhang <Fannie.Zhang@arm.com>
Thu, 9 Sep 2021 01:23:30 +0000 (01:23 +0000)
commit9cbc76bdf90752e21a2b3f05944552e1373ab433
tree9e7409d998fb2eb2f80f7156e0bb5baa3515a753
parent42563f89d7093ab22e1ac42351e66c4d03e0c80e
cmd/internal/obj/arm64: add checks for incorrect use of REGTMP register

The current assembler uses REGTMP as a temporary destination register,
when optimizing one instruction into a multi-instruction sequence. But
in some cases, when the source register is REGTMP, this behavior is
incorrect.

For example:
  ADD $0x1234567, R27, R3

The current assembler encodes it into
  MOVD $17767, R27
  MOVK $(291<<16), R27
  ADD R27, R27, R3

It is illegal to overwrite R27. This CL adds the related checks.

Add test cases.

Change-Id: I0af373d9fd23d8f067c093778dd4cc76748faf38
Reviewed-on: https://go-review.googlesource.com/c/go/+/344689
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: fannie zhang <Fannie.Zhang@arm.com>
src/cmd/asm/internal/asm/testdata/arm64error.s
src/cmd/internal/obj/arm64/asm7.go