diff options
| author | Keith Randall <khr@golang.org> | 2022-11-21 22:22:36 -0800 |
|---|---|---|
| committer | Keith Randall <khr@google.com> | 2023-01-19 22:43:12 +0000 |
| commit | f959fb3872a32d29c93f10deae31e4e6d79f2da9 (patch) | |
| tree | c8cb8b98189ced9718c0c83b0237e822554cf23c /test/codegen/logic.go | |
| parent | 47a0d467161c10f80bc3fcf7b0385b80d1194c7a (diff) | |
| download | go-git-f959fb3872a32d29c93f10deae31e4e6d79f2da9.tar.gz | |
cmd/compile: add anchored version of SP
The SPanchored opcode is identical to SP, except that it takes a memory
argument so that it (and more importantly, anything that uses it)
must be scheduled at or after that memory argument.
This opcode ensures that a LEAQ of a variable gets scheduled after the
corresponding VARDEF for that variable.
This may lead to less CSE of LEAQ operations. The effect is very small.
The go binary is only 80 bytes bigger after this CL. Usually LEAQs get
folded into load/store operations, so the effect is only for pointerful
types, large enough to need a duffzero, and have their address passed
somewhere. Even then, usually the CSEd LEAQs will be un-CSEd because
the two uses are on different sides of a function call and the LEAQ
ends up being rematerialized at the second use anyway.
Change-Id: Ib893562cd05369b91dd563b48fb83f5250950293
Reviewed-on: https://go-review.googlesource.com/c/go/+/452916
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Martin Möhrmann <martin@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'test/codegen/logic.go')
| -rw-r--r-- | test/codegen/logic.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/test/codegen/logic.go b/test/codegen/logic.go index 50ce5f0cca..f761e7bb9a 100644 --- a/test/codegen/logic.go +++ b/test/codegen/logic.go @@ -6,16 +6,12 @@ package codegen -var gx, gy int - // Test to make sure that (CMPQ (ANDQ x y) [0]) does not get rewritten to // (TESTQ x y) if the ANDQ has other uses. If that rewrite happens, then one // of the args of the ANDQ needs to be saved so it can be used as the arg to TESTQ. func andWithUse(x, y int) int { - // Load x,y into registers, so those MOVQ will not appear at the z := x&y line. - gx, gy = x, y - // amd64:-"MOVQ" z := x & y + // amd64:`TESTQ\s(AX, AX|BX, BX|CX, CX|DX, DX|SI, SI|DI, DI|R8, R8|R9, R9|R10, R10|R11, R11|R12, R12|R13, R13|R15, R15)` if z == 0 { return 77 } |
