Commit 11c2411c authored by Ruixin(Peter) Bao's avatar Ruixin(Peter) Bao Committed by Michael Munday

cmd/compile/internal/s390x: replace 4-byte NOP with a 2-byte NOP on s390x

Added a new instruction, NOPH, with the encoding [0x0700](i.e: bcr 0, 0) and
replace the current 4-byte nop that was encoded using the WORD instruction.

This reduces the size of .text section in go binary by around 17KB and make
generated code easier to read.

Change-Id: I6a756df39e93c4415ea6d038ba4af001b8ccb286
Reviewed-on: https://go-review.googlesource.com/c/go/+/194344Reviewed-by: default avatarMichael Munday <mike.munday@ibm.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent b25ec50b
...@@ -329,6 +329,9 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16- ...@@ -329,6 +329,9 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16-
TCEB F5, $8 // ed5000080010 TCEB F5, $8 // ed5000080010
TCDB F15, $4095 // edf00fff0011 TCDB F15, $4095 // edf00fff0011
UNDEF // 00000000
NOPH // 0700
VL (R15), V1 // e710f0000006 VL (R15), V1 // e710f0000006
VST V1, (R15) // e710f000000e VST V1, (R15) // e710f000000e
VL (R15), V31 // e7f0f0000806 VL (R15), V31 // e7f0f0000806
......
...@@ -105,8 +105,5 @@ func zeroAuto(pp *gc.Progs, n *gc.Node) { ...@@ -105,8 +105,5 @@ func zeroAuto(pp *gc.Progs, n *gc.Node) {
} }
func ginsnop(pp *gc.Progs) *obj.Prog { func ginsnop(pp *gc.Progs) *obj.Prog {
p := pp.Prog(s390x.AWORD) return pp.Prog(s390x.ANOPH)
p.From.Type = obj.TYPE_CONST
p.From.Offset = 0x47000000 // nop 0
return p
} }
...@@ -966,6 +966,8 @@ const ( ...@@ -966,6 +966,8 @@ const (
AVMSLOG AVMSLOG
AVMSLEOG AVMSLEOG
ANOPH // NOP
// binary // binary
ABYTE ABYTE
AWORD AWORD
......
...@@ -696,6 +696,7 @@ var Anames = []string{ ...@@ -696,6 +696,7 @@ var Anames = []string{
"VMSLEG", "VMSLEG",
"VMSLOG", "VMSLOG",
"VMSLEOG", "VMSLEOG",
"NOPH",
"BYTE", "BYTE",
"WORD", "WORD",
"DWORD", "DWORD",
......
...@@ -314,6 +314,9 @@ var optab = []Optab{ ...@@ -314,6 +314,9 @@ var optab = []Optab{
// undefined (deliberate illegal instruction) // undefined (deliberate illegal instruction)
{i: 78, as: obj.AUNDEF}, {i: 78, as: obj.AUNDEF},
// 2 byte no-operation
{i: 66, as: ANOPH},
// vector instructions // vector instructions
// VRX store // VRX store
...@@ -3394,6 +3397,9 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) { ...@@ -3394,6 +3397,9 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) {
d2 := c.regoff(&p.To) d2 := c.regoff(&p.To)
zRXE(opcode, uint32(p.From.Reg), 0, 0, uint32(d2), 0, asm) zRXE(opcode, uint32(p.From.Reg), 0, 0, uint32(d2), 0, asm)
case 66:
zRR(op_BCR, 0, 0, asm)
case 67: // fmov $0 freg case 67: // fmov $0 freg
var opcode uint32 var opcode uint32
switch p.As { switch p.As {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment