[go-nuts] Re: instruction gen in amd64, it iseems not the best choice?

2020-08-26 Thread moehrmann via golang-nuts
As far as I am aware: A LEA with a scale of 3 does not exist on amd64. Scale can be 1,2,4,8. A LEA with 3 arguments LEAQ 4(AX)(AX*2) on many modern amd64 compatible machines will use 3 cycles instead of 2 for two simpler LEA. The newest generation of Intel CPUs seems to have gotten better again

[go-nuts] Re: instruction gen in amd64, it iseems not the best choice?

2020-08-25 Thread peterGo
Go has optimizing compilers and linkers which are constantly being improved. The following example of your program reduces the call to test3 to MOVQ $0x82, 0(SP) where 0x82 = 130 = 42 * 3 + 4 $ cat xiecui.go package main func test3(a int) int { return a*3 + 4 } func main() { a := 42