mirror of
https://github.com/golang/go
synced 2024-11-17 20:54:48 -07:00
cmd/asm: add 'insert program mask' instruction for s390x
This CL adds the 'insert program mask' (IPM) instruction to s390x. IPM stores the current program mask (which contains the condition code) into a general purpose register. This instruction will be useful when implementing intrinsics for the arithmetic functions in the math/bits package. We can also potentially use it to convert some condition codes into bool values. The condition code can be saved and restored using an instruction sequence such as: IPM R4 // save condition code to R4 ... TMLH R4, $0x3000 // restore condition code from R4 We can also use IPM to save the carry bit to a register using an instruction sequence such as: IPM R4 // save condition code to R4 RISBLGZ $31, $31, $3, R4, R4 // isolate carry bit in R4 Change-Id: I169d450b6ea1a7ff8c0286115ddc42618da8a2f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/165997 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
95f18757a0
commit
6966b67510
3
src/cmd/asm/internal/asm/testdata/s390x.s
vendored
3
src/cmd/asm/internal/asm/testdata/s390x.s
vendored
@ -219,6 +219,9 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16-
|
||||
TMLH R3, $0 // a7300000
|
||||
TMLL R4, $32768 // a7418000
|
||||
|
||||
IPM R3 // b2220030
|
||||
IPM R12 // b22200c0
|
||||
|
||||
BNE 0(PC) // a7740000
|
||||
BEQ 0(PC) // a7840000
|
||||
BLT 0(PC) // a7440000
|
||||
|
@ -366,6 +366,9 @@ const (
|
||||
ATMLH
|
||||
ATMLL
|
||||
|
||||
// insert program mask
|
||||
AIPM
|
||||
|
||||
// compare and swap
|
||||
ACS
|
||||
ACSG
|
||||
|
@ -120,6 +120,7 @@ var Anames = []string{
|
||||
"TMHL",
|
||||
"TMLH",
|
||||
"TMLL",
|
||||
"IPM",
|
||||
"CS",
|
||||
"CSG",
|
||||
"SYNC",
|
||||
|
@ -260,6 +260,9 @@ var optab = []Optab{
|
||||
// test under mask
|
||||
Optab{ATMHH, C_REG, C_NONE, C_NONE, C_ANDCON, 91, 0},
|
||||
|
||||
// insert program mask
|
||||
Optab{AIPM, C_REG, C_NONE, C_NONE, C_NONE, 92, 0},
|
||||
|
||||
// 32-bit access registers
|
||||
Optab{AMOVW, C_AREG, C_NONE, C_NONE, C_REG, 68, 0},
|
||||
Optab{AMOVWZ, C_AREG, C_NONE, C_NONE, C_REG, 68, 0},
|
||||
@ -3766,6 +3769,9 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) {
|
||||
}
|
||||
zRI(opcode, uint32(p.From.Reg), uint32(c.vregoff(&p.To)), asm)
|
||||
|
||||
case 92: // insert program mask
|
||||
zRRE(op_IPM, uint32(p.From.Reg), 0, asm)
|
||||
|
||||
case 93: // GOT lookup
|
||||
v := c.vregoff(&p.To)
|
||||
if v != 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user