Commit 43bdfa93 authored by Michael Munday's avatar Michael Munday

cmd/asm, cmd/internal/obj/s390x: add new s390x instructions for SSA

This commit adds the following instructions to support the new SSA
backend for s390x:

32-bit operations:
ADDW
SUBW
NEGW
FNEGS

Conditional moves:
MOVDEQ
MOVDGE
MOVDGT
MOVDLE
MOVDLT
MOVDNE

Unordered branches (for floating point comparisons):
BLEU
BLTU

Modulo operations:
MODW
MODWU
MODD
MODDU

The modulo operations might be removed in a future commit because
I'd like to change DIV to produce a tuple once the old backend is
removed.

This commit also removes uses of REGZERO from the assembler. They
aren't necessary and R0 will be used as a GPR by SSA.

Change-Id: I05756c1cbb74bf4a35fc492f8f0cd34b50763dc9
Reviewed-on: https://go-review.googlesource.com/29075
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent dfc56a4c
......@@ -13,6 +13,13 @@ TEXT main·foo(SB),7,$16-0 // TEXT main.foo(SB), 7, $16-0
MOVDBR R1, R2 // b90f0021
MOVWBR R3, R4 // b91f0043
MOVDEQ R0, R1 // b9e28010
MOVDGE R2, R3 // b9e2a032
MOVDGT R4, R5 // b9e22054
MOVDLE R6, R7 // b9e2c076
MOVDLT R8, R9 // b9e24098
MOVDNE R10, R11 // b9e270ba
MOVD (R15), R1 // e310f0000004
MOVW (R15), R2 // e320f0000014
MOVH (R15), R3 // e330f0000015
......@@ -50,6 +57,10 @@ TEXT main·foo(SB),7,$16-0 // TEXT main.foo(SB), 7, $16-0
ADDC R1, R2 // b9ea1022
ADDC $1, R1, R2 // b9040021c22a00000001
ADDC R1, R2, R3 // b9ea1032
ADDW R1, R2 // 1a21
ADDW R1, R2, R3 // b9f81032
ADDW $8192, R1 // c21900002000
ADDW $8192, R1, R2 // ec21200000d8
SUB R3, R4 // b9090043
SUB R3, R4, R5 // b9e93054
SUB $8192, R3 // c238ffffe000
......@@ -57,6 +68,10 @@ TEXT main·foo(SB),7,$16-0 // TEXT main.foo(SB), 7, $16-0
SUBC R1, R2 // b90b0021
SUBC $1, R1, R2 // b9040021c22affffffff
SUBC R2, R3, R4 // b9eb2043
SUBW R3, R4 // 1b43
SUBW R3, R4, R5 // b9f93054
SUBW $8192, R1 // c21500002000
SUBW $8192, R1, R2 // 1821c22500002000
MULLW R6, R7 // b91c0076
MULLW R6, R7, R8 // b9040087b91c0086
MULLW $8192, R6 // a76d2000
......@@ -73,10 +88,22 @@ TEXT main·foo(SB),7,$16-0 // TEXT main.foo(SB), 7, $16-0
DIVD R1, R2, R3 // b90400b2b90d00a1b904003b
DIVW R4, R5 // b90400b5b91d00a4b904005b
DIVW R4, R5, R6 // b90400b5b91d00a4b904006b
DIVDU R7, R8 // b90400a0b90400b8b98700a7b904008b
DIVDU R7, R8, R9 // b90400a0b90400b8b98700a7b904009b
DIVWU R1, R2 // b90400a0b90400b2b99700a1b904002b
DIVWU R1, R2, R3 // b90400a0b90400b2b99700a1b904003b
DIVDU R7, R8 // a7a90000b90400b8b98700a7b904008b
DIVDU R7, R8, R9 // a7a90000b90400b8b98700a7b904009b
DIVWU R1, R2 // a7a90000b90400b2b99700a1b904002b
DIVWU R1, R2, R3 // a7a90000b90400b2b99700a1b904003b
MODD R1, R2 // b90400b2b90d00a1b904002a
MODD R1, R2, R3 // b90400b2b90d00a1b904003a
MODW R4, R5 // b90400b5b91d00a4b904005a
MODW R4, R5, R6 // b90400b5b91d00a4b904006a
MODDU R7, R8 // a7a90000b90400b8b98700a7b904008a
MODDU R7, R8, R9 // a7a90000b90400b8b98700a7b904009a
MODWU R1, R2 // a7a90000b90400b2b99700a1b904002a
MODWU R1, R2, R3 // a7a90000b90400b2b99700a1b904003a
NEG R1 // b9030011
NEG R1, R2 // b9030021
NEGW R1 // b9130011
NEGW R1, R2 // b9130021
LAA R1, R2, 524287(R3) // eb213fff7ff8
LAAG R4, R5, -524288(R6) // eb54600080e8
......
......@@ -212,10 +212,15 @@ const (
AADDME
AADDE
AADDZE
AADDW
ADIVW
ADIVWU
ADIVD
ADIVDU
AMODW
AMODWU
AMODD
AMODDU
AMULLW
AMULLD
AMULHD
......@@ -226,7 +231,9 @@ const (
ASUBV
ASUBE
ASUBZE
ASUBW
ANEG
ANEGW
// integer moves
AMOVWBR
......@@ -240,6 +247,14 @@ const (
AMOVD
AMOVDBR
// conditional moves
AMOVDEQ
AMOVDGE
AMOVDGT
AMOVDLE
AMOVDLT
AMOVDNE
// integer bitwise
AAND
AANDN
......@@ -276,6 +291,7 @@ const (
AFMULS
AFNABS
AFNEG
AFNEGS
AFNMADD
AFNMADDS
AFNMSUB
......@@ -334,6 +350,8 @@ const (
ABGT
ABLE
ABLT
ABLEU
ABLTU
ABNE
ABVC
ABVS
......
......@@ -11,10 +11,15 @@ var Anames = []string{
"ADDME",
"ADDE",
"ADDZE",
"ADDW",
"DIVW",
"DIVWU",
"DIVD",
"DIVDU",
"MODW",
"MODWU",
"MODD",
"MODDU",
"MULLW",
"MULLD",
"MULHD",
......@@ -25,7 +30,9 @@ var Anames = []string{
"SUBV",
"SUBE",
"SUBZE",
"SUBW",
"NEG",
"NEGW",
"MOVWBR",
"MOVB",
"MOVBZ",
......@@ -36,6 +43,12 @@ var Anames = []string{
"MOVWZ",
"MOVD",
"MOVDBR",
"MOVDEQ",
"MOVDGE",
"MOVDGT",
"MOVDLE",
"MOVDLT",
"MOVDNE",
"AND",
"ANDN",
"NAND",
......@@ -69,6 +82,7 @@ var Anames = []string{
"FMULS",
"FNABS",
"FNEG",
"FNEGS",
"FNMADD",
"FNMADDS",
"FNMSUB",
......@@ -111,6 +125,8 @@ var Anames = []string{
"BGT",
"BLE",
"BLT",
"BLEU",
"BLTU",
"BNE",
"BVC",
"BVS",
......
This diff is collapsed.
......@@ -109,13 +109,13 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
// Rewrite SUB constants into ADD.
switch p.As {
case ASUBC:
if p.From.Type == obj.TYPE_CONST {
if p.From.Type == obj.TYPE_CONST && isint32(-p.From.Offset) {
p.From.Offset = -p.From.Offset
p.As = AADDC
}
case ASUB:
if p.From.Type == obj.TYPE_CONST {
if p.From.Type == obj.TYPE_CONST && isint32(-p.From.Offset) {
p.From.Offset = -p.From.Offset
p.As = AADD
}
......@@ -258,14 +258,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
p.Link.Mark |= LABEL
}
case ANOR:
q = p
if p.To.Type == obj.TYPE_REG {
if p.To.Reg == REGZERO {
p.Mark |= LABEL | SYNC
}
}
case ASYNC,
AWORD:
q = p
......@@ -312,6 +304,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
ABGT,
ABLE,
ABLT,
ABLEU,
ABLTU,
ABNE,
ABR,
ABVC,
......@@ -401,7 +395,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
q = p
if p.From3.Offset&obj.NOSPLIT == 0 {
if p.From3.Offset&obj.NOSPLIT == 0 && p.From3.Offset&obj.NOFRAME == 0 {
p, pPreempt = stacksplitPre(ctxt, p, autosize) // emit pre part of split check
pPre = p
wasSplit = true //need post part of split
......@@ -440,7 +434,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
// if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
//
// MOVD g_panic(g), R3
// CMP R0, R3
// CMP R3, $0
// BEQ end
// MOVD panic_argp(R3), R4
// ADD $(autosize+8), R1, R5
......@@ -466,9 +460,9 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
q = obj.Appendp(ctxt, q)
q.As = ACMP
q.From.Type = obj.TYPE_REG
q.From.Reg = REG_R0
q.To.Type = obj.TYPE_REG
q.To.Reg = REG_R3
q.From.Reg = REG_R3
q.To.Type = obj.TYPE_CONST
q.To.Offset = 0
q = obj.Appendp(ctxt, q)
q.As = ABEQ
......@@ -993,6 +987,7 @@ var unaryDst = map[obj.As]bool{
ASTCKE: true,
ASTCKF: true,
ANEG: true,
ANEGW: true,
AVONE: true,
AVZERO: true,
}
......
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