• David Chase's avatar
    [dev.ssa] cmd/compile: add complex arithmetic · 3a9d0ac3
    David Chase authored
    Still to do:
    details, more testing corner cases. (e.g. negative zero)
    Includes small cleanups for previous CL.
    
    Note: complex division is currently done in the runtime,
    so the division code here is apparently not yet necessary
    and also not tested.  Seems likely better to open code
    division and expose the widening/narrowing to optimization.
    
    Complex64 multiplication and division is done in wide
    format to avoid cancellation errors; for division, this
    also happens to be compatible with pre-SSA practice
    (which uses a single complex128 division function).
    
    It would-be-nice to widen for complex128 multiplication
    intermediates as well, but that is trickier to implement
    without a handy wider-precision format.
    
    Change-Id: I595a4300f68868fb7641852a54674c6b2b78855e
    Reviewed-on: https://go-review.googlesource.com/14028
    
    Reviewed-by: default avatarKeith Randall <khr@golang.org>
    3a9d0ac3
genericOps.go 11 KB