aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorPaul E. Murphy <murp@ibm.com>2021-01-05 16:44:43 -0600
committerLynn Boger <laboger@linux.vnet.ibm.com>2021-03-09 20:35:41 +0000
commit48ddf7012875014d3cab4a02002799a520b087a1 (patch)
tree91e66413a8cd6f13f2bb48d619fe3b6fe3ed2d1f /src/cmd/asm
parent18510ae88ffcb9c4a914805fde3e613539f9b6dc (diff)
downloadgo-48ddf7012875014d3cab4a02002799a520b087a1.tar.gz
go-48ddf7012875014d3cab4a02002799a520b087a1.zip
cmd/asm,cmd/compile: support 5 operand RLWNM/RLWMI on ppc64
These instructions are actually 5 argument opcodes as specified by the ISA. Prior to this patch, the MB and ME arguments were merged into a single bitmask operand to workaround the limitations of the ppc64 assembler backend. This limitation no longer exists. Thus, we can pass operands for these opcodes without having to merge the MB and ME arguments in the assembler frontend or compiler backend. Likewise, support for 4 operand variants is unchanged. Change-Id: Ib086774f3581edeaadfd2190d652aaaa8a90daeb Reviewed-on: https://go-review.googlesource.com/c/go/+/298750 Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org> Trust: Carlos Eduardo Seo <carlos.seo@linaro.org>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/asm.go14
-rw-r--r--src/cmd/asm/internal/asm/testdata/ppc64.s6
2 files changed, 9 insertions, 11 deletions
diff --git a/src/cmd/asm/internal/asm/asm.go b/src/cmd/asm/internal/asm/asm.go
index 06867cd507..340f188924 100644
--- a/src/cmd/asm/internal/asm/asm.go
+++ b/src/cmd/asm/internal/asm/asm.go
@@ -799,19 +799,11 @@ func (p *Parser) asmInstruction(op obj.As, cond string, a []obj.Addr) {
p.errorf("can't handle %s instruction with 4 operands", op)
return
case 5:
- if p.arch.Family == sys.PPC64 && arch.IsPPC64RLD(op) {
- // Always reg, reg, con, con, reg. (con, con is a 'mask').
+ if p.arch.Family == sys.PPC64 {
prog.From = a[0]
+ // Second arg is always a register type on ppc64.
prog.Reg = p.getRegister(prog, op, &a[1])
- mask1 := p.getConstant(prog, op, &a[2])
- mask2 := p.getConstant(prog, op, &a[3])
- var mask uint32
- if mask1 < mask2 {
- mask = (^uint32(0) >> uint(mask1)) & (^uint32(0) << uint(31-mask2))
- } else {
- mask = (^uint32(0) >> uint(mask2+1)) & (^uint32(0) << uint(31-(mask1-1)))
- }
- prog.SetFrom3Const(int64(mask))
+ prog.SetRestArgs([]obj.Addr{a[2], a[3]})
prog.To = a[4]
break
}
diff --git a/src/cmd/asm/internal/asm/testdata/ppc64.s b/src/cmd/asm/internal/asm/testdata/ppc64.s
index 8f6eb14f73..a818c0e789 100644
--- a/src/cmd/asm/internal/asm/testdata/ppc64.s
+++ b/src/cmd/asm/internal/asm/testdata/ppc64.s
@@ -280,11 +280,17 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
ROTLW R3, R4, R5 // 5c85183e
EXTSWSLI $3, R4, R5 // 7c851ef4
RLWMI $7, R3, $65535, R6 // 50663c3e
+ RLWMI $7, R3, $16, $31, R6 // 50663c3e
RLWMICC $7, R3, $65535, R6 // 50663c3f
+ RLWMICC $7, R3, $16, $31, R6 // 50663c3f
RLWNM $3, R4, $7, R6 // 54861f7e
+ RLWNM $3, R4, $29, $31, R6 // 54861f7e
RLWNM R3, R4, $7, R6 // 5c861f7e
+ RLWNM R3, R4, $29, $31, R6 // 5c861f7e
RLWNMCC $3, R4, $7, R6 // 54861f7f
+ RLWNMCC $3, R4, $29, $31, R6 // 54861f7f
RLWNMCC R3, R4, $7, R6 // 5c861f7f
+ RLWNMCC R3, R4, $29, $31, R6 // 5c861f7f
RLDMI $0, R4, $7, R6 // 7886076c
RLDMICC $0, R4, $7, R6 // 7886076d
RLDIMI $0, R4, $7, R6 // 788601cc