aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorBen Shi <powerman1st@163.com>2017-05-23 11:15:41 +0000
committerCherry Zhang <cherryyz@google.com>2017-05-25 14:32:35 +0000
commitb8a4eb4bd8820ca50fee3aff4b8d5adb7a0a9b49 (patch)
tree1b6ffa051074c90456b8f093c85df092b2be7476 /src/cmd/asm
parent13ae3b3a8d345b71a5f424f9b61fa39393efccca (diff)
downloadgo-b8a4eb4bd8820ca50fee3aff4b8d5adb7a0a9b49.tar.xz
cmd/internal/obj/arm: fix illegal forms of ARM VFP instruction
"ADDF F0, R1, F2" is silently accepted by the arm assembler and assembled to the same binary code of "ADDF F0, F1, F2". So does "CMPF F0, R1". "ABSF F0, F1, F2" is also silently accepted and assembled to a different instruction. This patch reports those illegal forms and adds test cases. fix #20464 Change-Id: I88b80dc29de24c6266ac7bf7bce1578c5adbc68c Reviewed-on: https://go-review.googlesource.com/43931 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/endtoend_test.go2
-rw-r--r--src/cmd/asm/internal/asm/testdata/armerror.s13
2 files changed, 14 insertions, 1 deletions
diff --git a/src/cmd/asm/internal/asm/endtoend_test.go b/src/cmd/asm/internal/asm/endtoend_test.go
index 7554a30b54..7037e3fc4d 100644
--- a/src/cmd/asm/internal/asm/endtoend_test.go
+++ b/src/cmd/asm/internal/asm/endtoend_test.go
@@ -305,7 +305,7 @@ func testErrors(t *testing.T, goarch, file string) {
continue
}
fileline := m[1]
- if errors[fileline] != "" {
+ if errors[fileline] != "" && errors[fileline] != line {
t.Errorf("multiple errors on %s:\n\t%s\n\t%s", fileline, errors[fileline], line)
continue
}
diff --git a/src/cmd/asm/internal/asm/testdata/armerror.s b/src/cmd/asm/internal/asm/testdata/armerror.s
index 9ef276b40f..e37bd6e2e7 100644
--- a/src/cmd/asm/internal/asm/testdata/armerror.s
+++ b/src/cmd/asm/internal/asm/testdata/armerror.s
@@ -7,4 +7,17 @@ TEXT errors(SB),$0
ADD.P R1, R2, R3 // ERROR "invalid .P suffix"
SUB.W R2, R3 // ERROR "invalid .W suffix"
BL 4(R4) // ERROR "non-zero offset"
+ ADDF F0, R1, F2 // ERROR "illegal combination"
+ SWI (R0) // ERROR "illegal combination"
+ NEGF F0, F1, F2 // ERROR "illegal combination"
+ NEGD F0, F1, F2 // ERROR "illegal combination"
+ ABSF F0, F1, F2 // ERROR "illegal combination"
+ ABSD F0, F1, F2 // ERROR "illegal combination"
+ SQRTF F0, F1, F2 // ERROR "illegal combination"
+ SQRTD F0, F1, F2 // ERROR "illegal combination"
+ MOVF F0, F1, F2 // ERROR "illegal combination"
+ MOVD F0, F1, F2 // ERROR "illegal combination"
+ MOVDF F0, F1, F2 // ERROR "illegal combination"
+ MOVFD F0, F1, F2 // ERROR "illegal combination"
+
END