mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: added some intrinsics to SSA back end
One intrinsic was needed to help get the very best performance out of a future GC; as long as that one was being added, I also added Bswap since that is sometimes a handy thing to have. I had intended to fill out the bit-scan intrinsic family, but the mismatch between the "scan forward" instruction and "count leading zeroes" was large enough to cause me to leave it out -- it poses a dilemma that I'd rather dodge right now. These intrinsics are not exposed for general use. That's a separate issue requiring an API proposal change ( https://github.com/golang/proposal ) All intrinsics are tested, both that they are substituted on the appropriate architecture, and that they produce the expected result. Change-Id: I5848037cfd97de4f75bdc33bdd89bba00af4a8ee Reviewed-on: https://go-review.googlesource.com/20564 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
2e90192b0e
commit
8eec2bbfbc
15 changed files with 1143 additions and 36 deletions
|
|
@ -120,6 +120,10 @@ type pass struct {
|
|||
// Run consistency checker between each phase
|
||||
var checkEnabled = false
|
||||
|
||||
// Debug output
|
||||
var IntrinsicsDebug int
|
||||
var IntrinsicsDisable bool
|
||||
|
||||
// PhaseOption sets the specified flag in the specified ssa phase,
|
||||
// returning empty string if this was successful or a string explaining
|
||||
// the error if it was not.
|
||||
|
|
@ -157,6 +161,20 @@ func PhaseOption(phase, flag string, val int) string {
|
|||
}
|
||||
}
|
||||
|
||||
if phase == "intrinsics" {
|
||||
switch flag {
|
||||
case "on":
|
||||
IntrinsicsDisable = val == 0
|
||||
case "off":
|
||||
IntrinsicsDisable = val != 0
|
||||
case "debug":
|
||||
IntrinsicsDebug = val
|
||||
default:
|
||||
return fmt.Sprintf("Did not find a flag matching %s in -d=ssa/%s debug option", flag, phase)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
underphase := strings.Replace(phase, "_", " ", -1)
|
||||
var re *regexp.Regexp
|
||||
if phase[0] == '~' {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue