Skip to content

Commit a8dd0ca

Browse files
authored
Merge branch 'golang:master' into master
2 parents bfc0fe8 + f41fdd9 commit a8dd0ca

File tree

19 files changed

+319
-26
lines changed

19 files changed

+319
-26
lines changed

doc/go_mem.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ <h3 id="chan">Channel communication</h3>
453453
</p>
454454

455455
<p class="rule">
456-
The <i>k</i>th receive on a channel with capacity <i>C</i> is synchronized before the completion of the <i>k</i>+<i>C</i>th send from that channel completes.
456+
The <i>k</i>th receive from a channel with capacity <i>C</i> is synchronized before the completion of the <i>k</i>+<i>C</i>th send on that channel.
457457
</p>
458458

459459
<p>

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

+10
Original file line numberDiff line numberDiff line change
@@ -849,3 +849,13 @@ lable2:
849849
XVFRECIPD X2, X1 // 41f89c76
850850
XVFRSQRTF X2, X1 // 41049d76
851851
XVFRSQRTD X2, X1 // 41089d76
852+
853+
// [X]VNEG{B/H/W/V} instructions
854+
VNEGB V1, V2 // 22309c72
855+
VNEGH V1, V2 // 22349c72
856+
VNEGW V1, V2 // 22389c72
857+
VNEGV V1, V2 // 223c9c72
858+
XVNEGB X2, X1 // 41309c76
859+
XVNEGH X2, X1 // 41349c76
860+
XVNEGW X2, X1 // 41389c76
861+
XVNEGV X2, X1 // 413c9c76

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
419419
ssa.OpRISCV64FMVSX, ssa.OpRISCV64FMVDX,
420420
ssa.OpRISCV64FCVTSW, ssa.OpRISCV64FCVTSL, ssa.OpRISCV64FCVTWS, ssa.OpRISCV64FCVTLS,
421421
ssa.OpRISCV64FCVTDW, ssa.OpRISCV64FCVTDL, ssa.OpRISCV64FCVTWD, ssa.OpRISCV64FCVTLD, ssa.OpRISCV64FCVTDS, ssa.OpRISCV64FCVTSD,
422-
ssa.OpRISCV64NOT, ssa.OpRISCV64NEG, ssa.OpRISCV64NEGW:
422+
ssa.OpRISCV64NOT, ssa.OpRISCV64NEG, ssa.OpRISCV64NEGW, ssa.OpRISCV64CTZ, ssa.OpRISCV64CTZW:
423423
p := s.Prog(v.Op.Asm())
424424
p.From.Type = obj.TYPE_REG
425425
p.From.Reg = v.Args[0].Reg()

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

+11
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@
218218
(RotateLeft32 ...) => (ROLW ...)
219219
(RotateLeft64 ...) => (ROL ...)
220220

221+
// Count trailing zeros (note that these will only be emitted for rva22u64 and above).
222+
(Ctz(64|32|16|8)NonZero ...) => (Ctz64 ...)
223+
(Ctz64 ...) => (CTZ ...)
224+
(Ctz32 ...) => (CTZW ...)
225+
(Ctz16 x) => (CTZW (ORI <typ.UInt32> [1<<16] x))
226+
(Ctz8 x) => (CTZW (ORI <typ.UInt32> [1<<8] x))
227+
221228
(Less64 ...) => (SLT ...)
222229
(Less32 x y) => (SLT (SignExt32to64 x) (SignExt32to64 y))
223230
(Less16 x y) => (SLT (SignExt16to64 x) (SignExt16to64 y))
@@ -589,6 +596,9 @@
589596
(MOVHUreg (ANDI [c] x)) && c < 0 => (ANDI [int64(uint16(c))] x)
590597
(MOVWUreg (ANDI [c] x)) && c < 0 => (AND (MOVDconst [int64(uint32(c))]) x)
591598

599+
// Combine negation and sign extension.
600+
(MOVWreg (NEG x)) => (NEGW x)
601+
592602
// Avoid sign/zero extension for consts.
593603
(MOVBreg (MOVDconst [c])) => (MOVDconst [int64(int8(c))])
594604
(MOVHreg (MOVDconst [c])) => (MOVDconst [int64(int16(c))])
@@ -732,6 +742,7 @@
732742

733743
// Double negation.
734744
(NEG (NEG x)) => x
745+
(NEG <t> s:(ADDI [val] (NEG x))) && s.Uses == 1 && is32Bit(-val) => (ADDI [-val] x)
735746

736747
// Addition of zero or two constants.
737748
(ADDI [0] x) => x

src/cmd/compile/internal/ssa/_gen/RISCV64Ops.go

+2
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ func init() {
229229
{name: "AND", argLength: 2, reg: gp21, asm: "AND", commutative: true}, // arg0 & arg1
230230
{name: "ANDN", argLength: 2, reg: gp21, asm: "ANDN"}, // ^arg0 & arg1
231231
{name: "ANDI", argLength: 1, reg: gp11, asm: "ANDI", aux: "Int64"}, // arg0 & auxint
232+
{name: "CTZ", argLength: 1, reg: gp11, asm: "CTZ"}, // count trailing zeros
233+
{name: "CTZW", argLength: 1, reg: gp11, asm: "CTZW"}, // count trailing zeros of least significant word
232234
{name: "NOT", argLength: 1, reg: gp11, asm: "NOT"}, // ^arg0
233235
{name: "OR", argLength: 2, reg: gp21, asm: "OR", commutative: true}, // arg0 | arg1
234236
{name: "ORN", argLength: 2, reg: gp21, asm: "ORN"}, // ^arg0 | arg1

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

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+87
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

+24
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,30 @@ func initIntrinsics(cfg *intrinsicBuildConfig) {
900900
return s.newValue1(ssa.OpCtz8, types.Types[types.TINT], args[0])
901901
},
902902
sys.AMD64, sys.ARM, sys.ARM64, sys.I386, sys.MIPS, sys.Loong64, sys.PPC64, sys.S390X, sys.Wasm)
903+
904+
if cfg.goriscv64 >= 22 {
905+
addF("math/bits", "TrailingZeros64",
906+
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
907+
return s.newValue1(ssa.OpCtz64, types.Types[types.TINT], args[0])
908+
},
909+
sys.RISCV64)
910+
addF("math/bits", "TrailingZeros32",
911+
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
912+
return s.newValue1(ssa.OpCtz32, types.Types[types.TINT], args[0])
913+
},
914+
sys.RISCV64)
915+
addF("math/bits", "TrailingZeros16",
916+
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
917+
return s.newValue1(ssa.OpCtz16, types.Types[types.TINT], args[0])
918+
},
919+
sys.RISCV64)
920+
addF("math/bits", "TrailingZeros8",
921+
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
922+
return s.newValue1(ssa.OpCtz8, types.Types[types.TINT], args[0])
923+
},
924+
sys.RISCV64)
925+
}
926+
903927
alias("math/bits", "ReverseBytes64", "internal/runtime/sys", "Bswap64", all...)
904928
alias("math/bits", "ReverseBytes32", "internal/runtime/sys", "Bswap32", all...)
905929
addF("math/bits", "ReverseBytes16",

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,9 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{
11061106
{"riscv64", "internal/runtime/sys", "GetCallerPC"}: struct{}{},
11071107
{"riscv64", "internal/runtime/sys", "GetCallerSP"}: struct{}{},
11081108
{"riscv64", "internal/runtime/sys", "GetClosurePtr"}: struct{}{},
1109+
{"riscv64", "internal/runtime/sys", "TrailingZeros32"}: struct{}{},
1110+
{"riscv64", "internal/runtime/sys", "TrailingZeros64"}: struct{}{},
1111+
{"riscv64", "internal/runtime/sys", "TrailingZeros8"}: struct{}{},
11091112
{"riscv64", "math", "Abs"}: struct{}{},
11101113
{"riscv64", "math", "Copysign"}: struct{}{},
11111114
{"riscv64", "math", "FMA"}: struct{}{},
@@ -1122,6 +1125,10 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{
11221125
{"riscv64", "math/bits", "RotateLeft8"}: struct{}{},
11231126
{"riscv64", "math/bits", "Sub"}: struct{}{},
11241127
{"riscv64", "math/bits", "Sub64"}: struct{}{},
1128+
{"riscv64", "math/bits", "TrailingZeros16"}: struct{}{},
1129+
{"riscv64", "math/bits", "TrailingZeros32"}: struct{}{},
1130+
{"riscv64", "math/bits", "TrailingZeros64"}: struct{}{},
1131+
{"riscv64", "math/bits", "TrailingZeros8"}: struct{}{},
11251132
{"riscv64", "runtime", "KeepAlive"}: struct{}{},
11261133
{"riscv64", "runtime", "publicationBarrier"}: struct{}{},
11271134
{"riscv64", "runtime", "slicebytetostringtmp"}: struct{}{},
@@ -1308,7 +1315,8 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{
13081315

13091316
func TestIntrinsics(t *testing.T) {
13101317
cfg := &intrinsicBuildConfig{
1311-
goppc64: 10,
1318+
goppc64: 10,
1319+
goriscv64: 23,
13121320
}
13131321
initIntrinsics(cfg)
13141322

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

+10
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,16 @@ const (
950950
AXVFRSQRTF
951951
AXVFRSQRTD
952952

953+
// LSX and LASX integer neg instructions
954+
AVNEGB
955+
AVNEGH
956+
AVNEGW
957+
AVNEGV
958+
AXVNEGB
959+
AXVNEGH
960+
AXVNEGW
961+
AXVNEGV
962+
953963
ALAST
954964

955965
// aliases

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

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/internal/obj/loong64/asm.go

+24
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,10 @@ func buildop(ctxt *obj.Link) {
16591659
opset(AVFRECIPD, r0)
16601660
opset(AVFRSQRTF, r0)
16611661
opset(AVFRSQRTD, r0)
1662+
opset(AVNEGB, r0)
1663+
opset(AVNEGH, r0)
1664+
opset(AVNEGW, r0)
1665+
opset(AVNEGV, r0)
16621666

16631667
case AXVPCNTB:
16641668
opset(AXVPCNTH, r0)
@@ -1670,6 +1674,10 @@ func buildop(ctxt *obj.Link) {
16701674
opset(AXVFRECIPD, r0)
16711675
opset(AXVFRSQRTF, r0)
16721676
opset(AXVFRSQRTD, r0)
1677+
opset(AXVNEGB, r0)
1678+
opset(AXVNEGH, r0)
1679+
opset(AXVNEGW, r0)
1680+
opset(AXVNEGV, r0)
16731681

16741682
case AVADDB:
16751683
opset(AVADDH, r0)
@@ -3366,6 +3374,22 @@ func (c *ctxt0) oprr(a obj.As) uint32 {
33663374
return 0x1da741 << 10 // xvfrsqrt.s
33673375
case AXVFRSQRTD:
33683376
return 0x1da742 << 10 // xvfrsqrt.d
3377+
case AVNEGB:
3378+
return 0x1ca70c << 10 // vneg.b
3379+
case AVNEGH:
3380+
return 0x1ca70d << 10 // vneg.h
3381+
case AVNEGW:
3382+
return 0x1ca70e << 10 // vneg.w
3383+
case AVNEGV:
3384+
return 0x1ca70f << 10 // vneg.d
3385+
case AXVNEGB:
3386+
return 0x1da70c << 10 // xvneg.b
3387+
case AXVNEGH:
3388+
return 0x1da70d << 10 // xvneg.h
3389+
case AXVNEGW:
3390+
return 0x1da70e << 10 // xvneg.w
3391+
case AXVNEGV:
3392+
return 0x1da70f << 10 // xvneg.d
33693393
}
33703394

33713395
c.ctxt.Diag("bad rr opcode %v", a)

src/html/template/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ that would have been produced if {{.}} was a regular string.
210210
211211
# Security Model
212212
213-
https://rawgit.com/mikesamuel/sanitized-jquery-templates/trunk/safetemplate.html#problem_definition defines "safe" as used by this package.
213+
https://web.archive.org/web/20160501113828/http://js-quasis-libraries-and-repl.googlecode.com/svn/trunk/safetemplate.html#problem_definition defines "safe" as used by this package.
214214
215215
This package assumes that template authors are trusted, that Execute's data
216216
parameter is not, and seeks to preserve the properties below in the face

src/os/root.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func splitPathInRoot(s string, prefix, suffix []string) (_ []string, err error)
223223
suffix = nil
224224
}
225225

226-
parts := append([]string{}, prefix...)
226+
parts := slices.Clone(prefix)
227227
i, j := 0, 1
228228
for {
229229
if j < len(s) && !IsPathSeparator(s[j]) {

0 commit comments

Comments
 (0)