From: Ben Shi Date: Wed, 17 May 2017 07:00:27 +0000 (+0000) Subject: cmd/internal/obj/arm: report invalid .S/.P/.W suffix in ARM instructions X-Git-Tag: go1.9beta1~203 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5e797879350e749e49dc627d717ca069b6c833f3;p=gostls13.git cmd/internal/obj/arm: report invalid .S/.P/.W suffix in ARM instructions Many instructions can not have a .S suffix, such as MULS, SWI, CLZ, CMP, STREX and others. And so do .P and .W suffixes. Even wrong assembly code is generated for some instructions with invalid suffixes. This patch tries to simplify .S/.W/.P checks. And a wrong assembly test for arm is added. fixes #20377 Change-Id: Iba1c99d9e6b7b16a749b4d93ca2102e17c5822fe Reviewed-on: https://go-review.googlesource.com/43561 Reviewed-by: Cherry Zhang --- diff --git a/src/cmd/asm/internal/asm/endtoend_test.go b/src/cmd/asm/internal/asm/endtoend_test.go index 36aa4aedd8..7554a30b54 100644 --- a/src/cmd/asm/internal/asm/endtoend_test.go +++ b/src/cmd/asm/internal/asm/endtoend_test.go @@ -371,6 +371,10 @@ func TestARMEndToEnd(t *testing.T) { } } +func TestARMErrors(t *testing.T) { + testErrors(t, "arm", "armerror") +} + func TestARM64EndToEnd(t *testing.T) { testEndToEnd(t, "arm64", "arm64") } diff --git a/src/cmd/asm/internal/asm/testdata/arm.s b/src/cmd/asm/internal/asm/testdata/arm.s index 66fb207e3e..1e26075611 100644 --- a/src/cmd/asm/internal/asm/testdata/arm.s +++ b/src/cmd/asm/internal/asm/testdata/arm.s @@ -47,7 +47,7 @@ TEXT foo(SB), DUPOK|NOSPLIT, $0 // { // outcode($1, $2, &$3, 0, &$5); // } - CLZ.S R1, R2 + CLZ R1, R2 // // MOVW @@ -114,9 +114,9 @@ TEXT foo(SB), DUPOK|NOSPLIT, $0 // { // outcode($1, $2, &$3, $5, &nullgen); // } - CMP.S $1, R2 - CMP.S R1<