Skip to content

Commit d40a99f

Browse files
authored
Merge pull request #24 from golang/master
[pull] master from golang:master
2 parents d9e8791 + e49b534 commit d40a99f

13 files changed

Lines changed: 168 additions & 28 deletions

File tree

src/cmd/asm/internal/asm/testdata/arm64.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
419419
PRFM 8(R12), PLIL3STRM // 8d0580f9
420420
PRFM (R8), $25 // 190180f9
421421
PRFM 8(R9), $30 // 3e0580f9
422+
RPRFM (R1), R2, PLDKEEP // 3848a2f8
423+
RPRFM (RSP), R4, PSTSTRM // fd4ba4f8
424+
RPRFM (R6), R12, $25 // d978acf8
422425
NOOP // 1f2003d5
423426
HINT $0 // 1f2003d5
424427
DMB $1

src/cmd/asm/internal/asm/testdata/arm64error.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ TEXT errors(SB),$0
462462
AUTIA1716 $45 // ERROR "illegal combination"
463463
AUTIB1716 R0 // ERROR "illegal combination"
464464
SB $1 // ERROR "illegal combination"
465+
RPRFM (R1), RSP, PLDKEEP // ERROR "illegal combination"
466+
RPRFM 2(RSP), R4, PSTSTRM // ERROR "illegal combination"
467+
RPRFM (R2), R3, $100 // ERROR "range prefetch immediate must be 0 to 63"
468+
RPRFM (R5), R6, PLDL1KEEP // ERROR "illegal range prefetch operand"
465469

466470
// VMUL family invalid arrangement tests
467471
VMUL V0.D2, V0.D2, V1.D2 // ERROR "invalid arrangement"

src/cmd/compile/internal/ssa/_gen/generic.rules

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@
407407
(Sub(64|32|16|8) <t> (Mul(64|32|16|8) x y) (Mul(64|32|16|8) x z))
408408
=> (Mul(64|32|16|8) x (Sub(64|32|16|8) <t> y z))
409409

410+
// Canonicalize x+x to x << 1.
411+
// This is often slower since most CPUs have more adders than shifters, but it can enable other optimizations.
412+
// Arches who care about this like AMD64 convert x << 1 back to x+x in their arch-specific rules which is useful anyhow.
413+
(Add(64|32|16|8) x x) => (Lsh(64|32|16|8)x64 x (Const64 <types.Types[types.TUINT64]> [1]))
414+
410415
// rewrite shifts of 8/16/32 bit consts into 64 bit consts to reduce
411416
// the number of the other rewrite rules for const shifts
412417
(Lsh64x32 <t> x (Const32 [c])) => (Lsh64x64 x (Const64 <t> [int64(uint32(c))]))

src/cmd/compile/internal/ssa/rewritegeneric.go

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/compile/internal/ssagen/intrinsics.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,10 @@ func branchTableN(s *state, idx *ssa.Value, intrinsicCall *ir.CallExpr, genOp fu
20422042
s.startBlock(bPanic)
20432043
s.rtcall(ir.Syms.PanicSimdImm, false, nil)
20442044
}
2045+
if s.curBlock != nil {
2046+
bb := s.endBlock()
2047+
bb.AddEdgeTo(jt)
2048+
}
20452049

20462050
s.startBlock(jt)
20472051
jt.Kind = ssa.BlockPlain

src/cmd/internal/obj/arm64/a.out.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,7 @@ const (
10061006
AREVW
10071007
AROR
10081008
ARORW
1009+
ARPRFM
10091010
ASB
10101011
ASBC
10111012
ASBCS
@@ -1482,5 +1483,11 @@ const (
14821483
SPOP_J
14831484
SPOP_JC
14841485

1486+
// Range PReFetch of Memory (RPRFM)
1487+
SPOP_PLDKEEP
1488+
SPOP_PSTKEEP
1489+
SPOP_PLDSTRM
1490+
SPOP_PSTSTRM
1491+
14851492
SPOP_END
14861493
)

src/cmd/internal/obj/arm64/anames.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/internal/obj/arm64/asm7.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,8 @@ var optab = []Optab{
901901
{AMSR, C_VCON, C_NONE, C_NONE, C_SPOP, C_NONE, 37, 4, 0, 0, 0},
902902
{APRFM, C_UOREG32K, C_NONE, C_NONE, C_SPOP, C_NONE, 91, 4, 0, 0, 0},
903903
{APRFM, C_UOREG32K, C_NONE, C_NONE, C_LCON, C_NONE, 91, 4, 0, 0, 0},
904+
{ARPRFM, C_ZOREG, C_REG, C_NONE, C_SPOP, C_NONE, 110, 4, 0, 0, 0},
905+
{ARPRFM, C_ZOREG, C_REG, C_NONE, C_LCON, C_NONE, 110, 4, 0, 0, 0},
904906
{ADMB, C_VCON, C_NONE, C_NONE, C_NONE, C_NONE, 51, 4, 0, 0, 0},
905907
{AHINT, C_VCON, C_NONE, C_NONE, C_NONE, C_NONE, 52, 4, 0, 0, 0},
906908
{ASYS, C_VCON, C_NONE, C_NONE, C_NONE, C_NONE, 50, 4, 0, 0, 0},
@@ -943,6 +945,13 @@ var pstatefield = []struct {
943945
{SPOP_DAIFClr, 3<<16 | 4<<12 | 7<<5},
944946
}
945947

948+
var rprfopfield = map[SpecialOperand]uint32{
949+
SPOP_PLDKEEP: 0,
950+
SPOP_PSTKEEP: 1,
951+
SPOP_PLDSTRM: 4,
952+
SPOP_PSTSTRM: 5,
953+
}
954+
946955
var prfopfield = map[SpecialOperand]uint32{
947956
SPOP_PLDL1KEEP: 0,
948957
SPOP_PLDL1STRM: 1,
@@ -3416,6 +3425,7 @@ func buildop(ctxt *obj.Link) {
34163425
AVDUP,
34173426
AVMOVI,
34183427
APRFM,
3428+
ARPRFM,
34193429
AVEXT,
34203430
AVXAR:
34213431
break
@@ -6088,6 +6098,43 @@ func (c *ctxt7) asmout(p *obj.Prog, out []uint32) (count int) {
60886098
rn := uint32(p.Reg & 31)
60896099
o1 |= Q<<30 | size<<22 | (rn << 5) | (rd)
60906100

6101+
case 110: /*rprfm (Rn), Rm, <rprfop/imm6>*/
6102+
rn := p.From.Reg
6103+
rm := p.Reg
6104+
var operation uint32
6105+
var ok bool
6106+
6107+
// Operation is either a 6-bit immediate or named prefetch operation.
6108+
if p.To.Type == obj.TYPE_CONST {
6109+
operation = uint32(p.To.Offset)
6110+
if operation > 63 {
6111+
c.ctxt.Diag("range prefetch immediate must be 0 to 63: %v", p)
6112+
}
6113+
} else {
6114+
operation, ok = rprfopfield[SpecialOperand(p.To.Offset)]
6115+
if !ok {
6116+
c.ctxt.Diag("illegal range prefetch operand, expected PLDKEEP, PSTKEEP, PLDSTRM or PSTSTRM: %v", p)
6117+
}
6118+
}
6119+
6120+
// 6-bit placement: the 6-bit value is scattered to match the
6121+
// architectural encoding (bits 15,13,12,2-0). This is because the
6122+
// instructions word reuses fields from the base load/store hint space.
6123+
// option2 (bit5) -> bit15
6124+
// option0 (bit4) -> bit13
6125+
// S (bit3) -> bit12
6126+
// Rt<2:0> (bits2-0) -> bits2-0
6127+
// Rt<4:3> are already set by c.opirr() and are fixed for RPRFM.
6128+
option2 := (operation & (1 << 5)) << 10
6129+
option0 := (operation & (1 << 4)) << 9
6130+
s := (operation & (1 << 3)) << 9
6131+
rt := (operation & 0x7)
6132+
6133+
encodedOperation := option2 | option0 | s | rt
6134+
6135+
o1 = c.opirr(p, p.As)
6136+
o1 |= (uint32(rm&31) << 16) | (uint32(rn&31) << 5) | uint32(encodedOperation)
6137+
60916138
case 127:
60926139
// Generic SVE instruction encoding
60936140
matched := false
@@ -7277,6 +7324,9 @@ func (c *ctxt7) opirr(p *obj.Prog, a obj.As) uint32 {
72777324

72787325
case APRFM:
72797326
return 0xf9<<24 | 2<<22
7327+
7328+
case ARPRFM:
7329+
return 0xf8<<24 | 5<<21 | 18<<10 | 3<<3
72807330
}
72817331

72827332
c.ctxt.Diag("%v: bad irr %v", p, a)

src/cmd/internal/obj/arm64/specialoperand_string.go

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/go/importer/importer.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ type Lookup func(path string) (io.ReadCloser, error)
4141
// it is assumed that the translation to canonical import paths is being
4242
// done by the client of the importer.
4343
//
44-
// A lookup function must be provided for correct module-aware operation.
45-
// Deprecated: If lookup is nil, for backwards-compatibility, the importer
46-
// will attempt to resolve imports in the $GOPATH workspace.
44+
// A lookup function must be provided for correct module-aware
45+
// operation. Providing a nil value for lookup is deprecated but, for
46+
// backwards-compatibility, the importer will in this case attempt to
47+
// resolve imports in the $GOPATH workspace.
4748
func ForCompiler(fset *token.FileSet, compiler string, lookup Lookup) types.Importer {
4849
switch compiler {
4950
case "gc":

0 commit comments

Comments
 (0)