From: Matt Turner Date: Fri, 9 Nov 2018 05:34:05 +0000 (-0800) Subject: glsl: Add "built-in" functions to do fmin/fmax(fp64) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=83762afa664bd491aa7e3009a598ffa10e52b386;p=mesa.git glsl: Add "built-in" functions to do fmin/fmax(fp64) Reviewed-by: Elie Tournier --- diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl index 1a434b1fd59..88ce0a74957 100644 --- a/src/compiler/glsl/float64.glsl +++ b/src/compiler/glsl/float64.glsl @@ -1425,3 +1425,23 @@ __fround64(uint64_t __a) a.y = aHi; return packUint2x32(a); } + +uint64_t +__fmin64(uint64_t a, uint64_t b) +{ + if (__is_nan(a)) return b; + if (__is_nan(b)) return a; + + if (__flt64_nonnan(a, b)) return a; + return b; +} + +uint64_t +__fmax64(uint64_t a, uint64_t b) +{ + if (__is_nan(a)) return b; + if (__is_nan(b)) return a; + + if (__flt64_nonnan(a, b)) return b; + return a; +}