diff options
| author | Paul E. Murphy <murp@ibm.com> | 2022-10-21 09:19:47 -0500 |
|---|---|---|
| committer | Paul Murphy <murp@ibm.com> | 2022-10-26 19:47:19 +0000 |
| commit | 4e6f90fecd377777b08a151e1712b6d9180630de (patch) | |
| tree | 8d71c70bec30bc3f6831b6921328664cd7e48ac8 /src/cmd/internal/obj/ppc64/obj9.go | |
| parent | f9ee56145bd8aa802b91db9465564cae5596966b (diff) | |
| download | go-4e6f90fecd377777b08a151e1712b6d9180630de.tar.xz | |
cmd/internal/obj/ppc64: generate big uint32 values in register
When using "MOVD $const, Rx", any 32b constant can be generated in
register quickly. Avoid transforming big uint32 values into a load.
And, fix the instance in runtime.usleep where I discovered this.
Change-Id: I46e156d7edf200f85b5b61162f00223c0ad81fe2
Reviewed-on: https://go-review.googlesource.com/c/go/+/444815
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/internal/obj/ppc64/obj9.go')
| -rw-r--r-- | src/cmd/internal/obj/ppc64/obj9.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/internal/obj/ppc64/obj9.go b/src/cmd/internal/obj/ppc64/obj9.go index 84ba28211d..47ad85e79c 100644 --- a/src/cmd/internal/obj/ppc64/obj9.go +++ b/src/cmd/internal/obj/ppc64/obj9.go @@ -78,9 +78,12 @@ func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) { } } - // Put >32-bit constants in memory and load them case AMOVD: - if p.From.Type == obj.TYPE_CONST && p.From.Name == obj.NAME_NONE && p.From.Reg == 0 && int64(int32(p.From.Offset)) != p.From.Offset { + // 32b constants (signed and unsigned) can be generated via 1 or 2 instructions. + // All others must be placed in memory and loaded. + isS32 := int64(int32(p.From.Offset)) == p.From.Offset + isU32 := uint64(uint32(p.From.Offset)) == uint64(p.From.Offset) + if p.From.Type == obj.TYPE_CONST && p.From.Name == obj.NAME_NONE && p.From.Reg == 0 && !isS32 && !isU32 { p.From.Type = obj.TYPE_MEM p.From.Sym = ctxt.Int64Sym(p.From.Offset) p.From.Name = obj.NAME_EXTERN |
