Skip to content
  • Roland Scheidegger's avatar
    gallivm: use llvm.nearbyint instead of llvm.round. · cb438d8b
    Roland Scheidegger authored
    We used to use sse roundps intrinsic directly, but switched to use the llvm
    intrinsics for rounding with e4f01da1.
    However, llvm semantics follows standard math lib round function which is
    specced to do roundNearestAwayFromZero but we really want roundNearestEven
    (moreoever, using round generates atrocious code since the cpu can't do it
    directly and it results in scalar calls to libm __roundf).
    So, use llvm.nearbyint instead, which does exactly the right thing, and even
    has the advantage of being available with llvm 3.3 too. (I've verified it
    actually generates a roundps instruction with llvm 3.3.)
    
    This fixes https://bugs.freedesktop.org/show_bug.cgi?id=94909
    
    
    
    Reviewed-by: default avatarJose Fonseca <jfonseca@vmware.com>
    cb438d8b