From 553a8626ba04981d362ee5937583d2592b305eae Mon Sep 17 00:00:00 2001 From: "Ruixin(Peter) Bao" Date: Tue, 7 Apr 2020 09:20:08 -0400 Subject: [PATCH] cmd/internal: add MVCIN instruction to s390x assembler On s390x, we already have MVCIN opcode in asmz.go, but we did not use it. This CL uses that opcode and adds MVCIN instruction. MVCIN instruction can be used to move data from one storage location to another while reversing the order of bytes within the field. This could be useful when transforming data from little-endian to big-endian. Change-Id: Ifa1a911c0d3442f4a62f91f74ed25b196d01636b Reviewed-on: https://go-review.googlesource.com/c/go/+/227478 Reviewed-by: Michael Munday Run-TryBot: Michael Munday TryBot-Result: Gobot Gobot --- src/cmd/asm/internal/asm/testdata/s390x.s | 1 + src/cmd/internal/obj/s390x/a.out.go | 1 + src/cmd/internal/obj/s390x/anames.go | 1 + src/cmd/internal/obj/s390x/asmz.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/src/cmd/asm/internal/asm/testdata/s390x.s b/src/cmd/asm/internal/asm/testdata/s390x.s index 85adb476b7..1ae614ae17 100644 --- a/src/cmd/asm/internal/asm/testdata/s390x.s +++ b/src/cmd/asm/internal/asm/testdata/s390x.s @@ -259,6 +259,7 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16- NC $8, (R15), n-8(SP) // d407f010f000 OC $8, (R15), n-8(SP) // d607f010f000 MVC $8, (R15), n-8(SP) // d207f010f000 + MVCIN $8, (R15), n-8(SP) // e807f010f000 CLC $8, (R15), n-8(SP) // d507f000f010 XC $256, -8(R15), -8(R15) // b90400afc2a8fffffff8d7ffa000a000 MVC $256, 8192(R1), 8192(R2) // b90400a2c2a800002000b90400b1c2b800002000d2ffa000b000 diff --git a/src/cmd/internal/obj/s390x/a.out.go b/src/cmd/internal/obj/s390x/a.out.go index 3e83072aad..2605014e6d 100644 --- a/src/cmd/internal/obj/s390x/a.out.go +++ b/src/cmd/internal/obj/s390x/a.out.go @@ -441,6 +441,7 @@ const ( // storage-and-storage AMVC + AMVCIN ACLC AXC AOC diff --git a/src/cmd/internal/obj/s390x/anames.go b/src/cmd/internal/obj/s390x/anames.go index d8556d8645..8b2a76b2c9 100644 --- a/src/cmd/internal/obj/s390x/anames.go +++ b/src/cmd/internal/obj/s390x/anames.go @@ -179,6 +179,7 @@ var Anames = []string{ "CMPUBLT", "CMPUBNE", "MVC", + "MVCIN", "CLC", "XC", "OC", diff --git a/src/cmd/internal/obj/s390x/asmz.go b/src/cmd/internal/obj/s390x/asmz.go index ff7cc73fe4..dca9d990e0 100644 --- a/src/cmd/internal/obj/s390x/asmz.go +++ b/src/cmd/internal/obj/s390x/asmz.go @@ -925,6 +925,7 @@ func buildop(ctxt *obj.Link) { case ALA: opset(ALAY, r) case AMVC: + opset(AMVCIN, r) opset(ACLC, r) opset(AXC, r) opset(AOC, r) @@ -3807,6 +3808,8 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) { c.ctxt.Diag("unexpected opcode %v", p.As) case AMVC: opcode = op_MVC + case AMVCIN: + opcode = op_MVCIN case ACLC: opcode = op_CLC // swap operand order for CLC so that it matches CMP -- 2.50.0