• Kevin Burke's avatar
    cmd/compile: precompute constant square roots · 8e24a98a
    Kevin Burke authored
    If a program wants to evaluate math.Sqrt for any constant value
    (for example, math.Sqrt(3)), we can replace that expression with
    its evaluation (1.7320508075688772) at compile time, instead of
    generating a SQRT assembly command or equivalent.
    
    Adds tests that math.Sqrt generates the correct values. I also
    compiled a short program and verified that the Sqrt expression was
    replaced by a constant value in the "after opt" step.
    
    Adds a short doc to the top of generic.rules explaining what the file
    does and how other files interact with it.
    
    Fixes #15543.
    
    Change-Id: I6b6e63ac61cec50763a09ba581024adeee03d4fa
    Reviewed-on: https://go-review.googlesource.com/27457Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    8e24a98a
Name
Last commit
Last update
..
gen Loading commit data...
addressed_ssa.go Loading commit data...
append_ssa.go Loading commit data...
arithBoundary_ssa.go Loading commit data...
arithConst_ssa.go Loading commit data...
arith_ssa.go Loading commit data...
array_ssa.go Loading commit data...
assert_ssa.go Loading commit data...
break_ssa.go Loading commit data...
chan_ssa.go Loading commit data...
closure_ssa.go Loading commit data...
cmp_ssa.go Loading commit data...
compound_ssa.go Loading commit data...
copy_ssa.go Loading commit data...
ctl_ssa.go Loading commit data...
deferNoReturn_ssa.go Loading commit data...
divbyzero_ssa.go Loading commit data...
dupLoad.go Loading commit data...
fp_ssa.go Loading commit data...
loadstore_ssa.go Loading commit data...
map_ssa.go Loading commit data...
namedReturn.go Loading commit data...
phi_ssa.go Loading commit data...
regalloc_ssa.go Loading commit data...
short_ssa.go Loading commit data...
slice.go Loading commit data...
sqrt_const.go Loading commit data...
string_ssa.go Loading commit data...
unsafe_ssa.go Loading commit data...
zero_ssa.go Loading commit data...