aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorisharipo <iskander.sharipov@intel.com>2018-03-19 23:07:18 +0300
committerIlya Tocar <ilya.tocar@intel.com>2018-03-21 20:51:04 +0000
commitff5cf43df5b1614f940157b21ca6ed64791b8a1f (patch)
tree7ce052bcf4b4c33efa32c7207f15cadd77a27168 /src/cmd/asm
parent65727ab59d20663a76692fea7b8444dbb349080b (diff)
downloadgo-ff5cf43df5b1614f940157b21ca6ed64791b8a1f.tar.xz
runtime,sync/atomic: replace asm BYTEs with insts for x86
For each replacement, test case is added to new 386enc.s file with exception of EMMS, SYSENTER, MFENCE and LFENCE as they are already covered in amd64enc.s (same on amd64 and 386). The replacement became less obvious after go vet suggested changes Before: BYTE $0x0f; BYTE $0x7f; BYTE $0x44; BYTE $0x24; BYTE $0x08 Changed to MOVQ (this form is being tested): MOVQ M0, 8(SP) Refactored to FP-relative access (go vet advice): MOVQ M0, val+4(FP) Change-Id: I56b87cf3371b6ad81ad0cd9db2033aee407b5818 Reviewed-on: https://go-review.googlesource.com/101475 Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/endtoend_test.go4
-rw-r--r--src/cmd/asm/internal/asm/testdata/386enc.s16
2 files changed, 20 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/asm/endtoend_test.go b/src/cmd/asm/internal/asm/endtoend_test.go
index 093d5c40ed..999464e49e 100644
--- a/src/cmd/asm/internal/asm/endtoend_test.go
+++ b/src/cmd/asm/internal/asm/endtoend_test.go
@@ -393,6 +393,10 @@ func TestAMD64EndToEnd(t *testing.T) {
testEndToEnd(t, "amd64", "amd64")
}
+func Test386Encoder(t *testing.T) {
+ testEndToEnd(t, "386", "386enc")
+}
+
func TestAMD64Encoder(t *testing.T) {
testEndToEnd(t, "amd64", "amd64enc")
testEndToEnd(t, "amd64", "amd64enc_extra")
diff --git a/src/cmd/asm/internal/asm/testdata/386enc.s b/src/cmd/asm/internal/asm/testdata/386enc.s
new file mode 100644
index 0000000000..94a06de69c
--- /dev/null
+++ b/src/cmd/asm/internal/asm/testdata/386enc.s
@@ -0,0 +1,16 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "../../../../../runtime/textflag.h"
+
+TEXT asmtest(SB),DUPOK|NOSPLIT,$0
+ // Instructions that were encoded with BYTE sequences.
+ // Included to simplify validation of CL that fixed that.
+ MOVQ (AX), M0 // 0f6f00
+ MOVQ M0, 8(SP) // 0f7f442408
+ MOVQ 8(SP), M0 // 0f6f442408
+ MOVQ M0, (AX) // 0f7f00
+ MOVQ M0, (BX) // 0f7f03
+ // End of tests.
+ RET