"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/cmd/compile/internal/ssa/rewrite.go" between
go1.19.src.tar.gz and go1.19.1.src.tar.gz

About: Google’s Go is a compiled, garbage-collected, concurrent programming language.
Latest stable release (1.19).

rewrite.go  (go1.19.src):rewrite.go  (go1.19.1.src)
skipping to change at line 1365 skipping to change at line 1365
} }
} }
return true return true
} }
return false return false
} }
// isInlinableMemmove reports whether the given arch performs a Move of the give n size // isInlinableMemmove reports whether the given arch performs a Move of the give n size
// faster than memmove. It will only return true if replacing the memmove with a Move is // faster than memmove. It will only return true if replacing the memmove with a Move is
// safe, either because Move is small or because the arguments are disjoint. // safe, either because Move will do all of its loads before any of its stores,
or
// because the arguments are known to be disjoint.
// This is used as a check for replacing memmove with Move ops. // This is used as a check for replacing memmove with Move ops.
func isInlinableMemmove(dst, src *Value, sz int64, c *Config) bool { func isInlinableMemmove(dst, src *Value, sz int64, c *Config) bool {
// It is always safe to convert memmove into Move when its arguments are disjoint. // It is always safe to convert memmove into Move when its arguments are disjoint.
// Move ops may or may not be faster for large sizes depending on how the platform // Move ops may or may not be faster for large sizes depending on how the platform
// lowers them, so we only perform this optimization on platforms that we know to // lowers them, so we only perform this optimization on platforms that we know to
// have fast Move ops. // have fast Move ops.
switch c.arch { switch c.arch {
case "amd64": case "amd64":
return sz <= 16 || (sz < 1024 && disjoint(dst, sz, src, sz)) return sz <= 16 || (sz < 1024 && disjoint(dst, sz, src, sz))
case "386", "arm64": case "386", "arm64":
return sz <= 8 return sz <= 8
case "s390x", "ppc64", "ppc64le": case "s390x", "ppc64", "ppc64le":
return sz <= 8 || disjoint(dst, sz, src, sz) return sz <= 8 || disjoint(dst, sz, src, sz)
case "arm", "loong64", "mips", "mips64", "mipsle", "mips64le": case "arm", "loong64", "mips", "mips64", "mipsle", "mips64le":
return sz <= 4 return sz <= 4
} }
return false return false
} }
func IsInlinableMemmove(dst, src *Value, sz int64, c *Config) bool {
return isInlinableMemmove(dst, src, sz, c)
}
// logLargeCopy logs the occurrence of a large copy. // logLargeCopy logs the occurrence of a large copy.
// The best place to do this is in the rewrite rules where the size of the move is easy to find. // The best place to do this is in the rewrite rules where the size of the move is easy to find.
// "Large" is arbitrarily chosen to be 128 bytes; this may change. // "Large" is arbitrarily chosen to be 128 bytes; this may change.
func logLargeCopy(v *Value, s int64) bool { func logLargeCopy(v *Value, s int64) bool {
if s < 128 { if s < 128 {
return true return true
} }
if logopt.Enabled() { if logopt.Enabled() {
logopt.LogOpt(v.Pos, "copy", "lower", v.Block.Func.Name, fmt.Spri ntf("%d bytes", s)) logopt.LogOpt(v.Pos, "copy", "lower", v.Block.Func.Name, fmt.Spri ntf("%d bytes", s))
} }
return true return true
} }
func LogLargeCopy(funcName string, pos src.XPos, s int64) {
if s < 128 {
return
}
if logopt.Enabled() {
logopt.LogOpt(pos, "copy", "lower", funcName, fmt.Sprintf("%d byt
es", s))
}
}
// hasSmallRotate reports whether the architecture has rotate instructions // hasSmallRotate reports whether the architecture has rotate instructions
// for sizes < 32-bit. This is used to decide whether to promote some rotations . // for sizes < 32-bit. This is used to decide whether to promote some rotations .
func hasSmallRotate(c *Config) bool { func hasSmallRotate(c *Config) bool {
switch c.arch { switch c.arch {
case "amd64", "386": case "amd64", "386":
return true return true
default: default:
return false return false
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)