]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/ssa: emit IMUL3{L/Q} for MUL{L/Q}const on x86
authorisharipo <iskander.sharipov@intel.com>
Fri, 9 Mar 2018 20:09:46 +0000 (23:09 +0300)
committerIlya Tocar <ilya.tocar@intel.com>
Mon, 12 Mar 2018 19:02:36 +0000 (19:02 +0000)
commit85a8d25d535a9b70f6c908e44f8558c207366ff1
treeea05b89402d024cb8ad9a184fc831d43414f8068
parent080187f4f72bd6594e3c2efc35cf51bf61378552
cmd/compile/internal/ssa: emit IMUL3{L/Q} for MUL{L/Q}const on x86

cmd/asm now supports three-operand form of IMUL,
so instead of using IMUL with resultInArg0, emit IMUL3 instruction.

This results in less redundant MOVs where SSA assigns
different registers to input[0] and dst arguments.

Note: these have exactly the same encoding when reg0=reg1:
      IMUL3x $const, reg0, reg1
      IMULx $const, reg
Two-operand IMULx is like a crippled IMUL3x, with dst fixed to input[0].
This is why we don't bother to generate IMULx for the case where
dst is the same as input[0].

Change-Id: I4becda475b3dffdd07b6fdf1c75bacc82af654e4
Reviewed-on: https://go-review.googlesource.com/99656
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/amd64/ssa.go
src/cmd/compile/internal/ssa/gen/386Ops.go
src/cmd/compile/internal/ssa/gen/AMD64Ops.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/x86/ssa.go
test/codegen/arithmetic.go