mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/amd64: use appropriate NEG for div
Currently we generate NEGQ for DIV{Q,L,W}. By generating NEGL and NEGW,
we will reduce code size, because NEGL doesn't require rex prefix.
This also guarantees that upper 32 bits are zeroed, so we can revert CL 85736,
and remove zero-extensions of DIVL results.
Also adds test for redundant zero extend elimination.
Fixes #23310
Change-Id: Ic58c3104c255a71371a06e09d10a975bbe5df587
Reviewed-on: https://go-review.googlesource.com/96815
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
3b7ad1680f
commit
f4d9c30901
3 changed files with 44 additions and 6 deletions
|
|
@ -782,12 +782,8 @@ func zeroUpper32Bits(x *Value, depth int) bool {
|
|||
OpAMD64ANDL, OpAMD64ANDLconst, OpAMD64ORL, OpAMD64ORLconst,
|
||||
OpAMD64XORL, OpAMD64XORLconst, OpAMD64NEGL, OpAMD64NOTL:
|
||||
return true
|
||||
case OpArg:
|
||||
case OpArg, OpSelect0, OpSelect1:
|
||||
return x.Type.Width == 4
|
||||
case OpSelect0, OpSelect1:
|
||||
// Disabled for now. See issue 23305.
|
||||
// TODO: we could look into the arg of the Select to decide.
|
||||
return false
|
||||
case OpPhi:
|
||||
// Phis can use each-other as an arguments, instead of tracking visited values,
|
||||
// just limit recursion depth.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue