• Michael Munday's avatar
    cmd/compile: fix uint64 to float casts on ppc64 · 1f4f2d0d
    Michael Munday authored
    Adds the FCFIDU instruction and uses it instead of the FCFID
    instruction for unsigned integer to float casts. This change means
    that unsigned integers do not have to be cast to signed integers
    before being cast to a floating point value. Therefore it is no
    longer necessary to insert instructions to detect and fix
    values that overflow int64.
    
    The previous code generating the uint64 to int64 cast handled
    overflow by truncating the uint64 value. This truncation can
    change the result of the rounding performed by the integer to
    float cast.
    
    The FCFIDU instruction was added in Power ISA 2.06B.
    
    Fixes #15539.
    
    Change-Id: Ia37a9631293eff91032d4cd9a9bec759d2142437
    Reviewed-on: https://go-review.googlesource.com/22772Reviewed-by: 's avatarDavid Chase <drchase@google.com>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    1f4f2d0d
prog.go 12.9 KB