nir: Update saturated float->int/uint conversion algorithm

The mantissa for a float doesn't contain enough data to accurately represent
the min/max values for some destination types. Instead of clamping before
converting, clamp after converting when coming from floats. This improves
conformance of CL conversions, specifically for float -> long/ulong with
int64 emulation enabled.

Refactors the limit determination from the clamp, so we can determine
limits for the dest type (int/uint) in both the source (float) and dest
type. The limit as a float is used for comparison, while the limit as a
dest type is used for bcsel.

Important note is that the comparison is inverted to fge instead of flt,
so the bcsel chooses the direct int/uint over the converted float in the
case where the comparison comes up equal, but the conversion can't produce
the exact min/max value.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <!8256>
92 jobs for !8256 with conversions-fixes in 19 minutes and 49 seconds (queued for 4 seconds)
detached
Status Job ID Name Coverage
  Sanity
passed #6477808
sanity

00:00:10

 
  Container
passed #6477813
aarch64
arm_build

00:00:21

passed #6477815
arm_test-base

00:00:15

passed #6477817
windows shell 1809 mesa
windows_build_vs2019

00:00:09

passed #6477810
x86_build-base

00:00:13

passed #6477811
x86_test-base

00:00:13

 
  Container 2
passed #6477832
android_build

00:00:19

passed #6477838
arm64_test

00:00:12

passed #6477839
armhf_test

00:00:13

passed #6477826
i386_build

00:00:14

passed #6477819
kernel+rootfs_amd64

00:00:19

passed #6477821
aarch64
kernel+rootfs_arm64

00:01:20

passed #6477823
aarch64
kernel+rootfs_armhf

00:00:17

passed #6477828
ppc64el_build

00:00:13

passed #6477830
s390x_build

00:00:11

passed #6477825
x86_build

00:00:18

passed #6477834
x86_test-gl

00:00:10

passed #6477836
x86_test-vk

00:00:11

 
  Meson X86 64
passed #6477845
meson-clang

00:03:06

passed #6477846
meson-clover

00:02:42

passed #6477842
meson-clover-testing

00:01:16

passed #6477843
meson-gallium

00:03:42

passed #6477844
meson-release

00:01:28

passed #6477840
meson-testing

00:01:19

passed #6477841
meson-testing-asan

00:01:53

passed #6477847
meson-vulkan

00:02:44

 
  Build Misc
passed #6477848
meson-android

00:01:14

passed #6477850
aarch64
meson-arm64

00:01:33

passed #6477851
aarch64
meson-arm64-build-test

00:01:23

passed #6477849
aarch64
meson-armhf

00:01:25

passed #6477854
meson-i386

00:01:38

passed #6477857
meson-mingw32-x86_64

00:00:52

passed #6477856
kvm
meson-ppc64el

00:02:57

passed #6477855
kvm
meson-s390x

00:03:18

passed #6477852
windows docker 1809 mesa
meson-windows-vs2019

00:03:55

passed #6477853
scons-win64

00:03:38

 
  Amd
passed #6477920
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles2:amd64

00:07:54

passed #6477860
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles31:amd64

00:13:04

passed #6477859
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles3:amd64

00:09:19

passed #6477861
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-traces:amd64

00:14:26

passed #6477862
radv-fossils

00:08:23

failed #6477858
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles2:amd64

00:07:02

 
  Arm
passed #6477868
mesa-ci-aarch64-lava-collabora
panfrost-g52-gles2:arm64

00:03:52

passed #6477863
mesa-ci-aarch64-lava-collabora
panfrost-t720-gles2:arm64

00:09:07

passed #6477864
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles2:arm64

00:05:22

passed #6477865
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles3:arm64 1/2

00:07:12

passed #6477866
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles3:arm64 2/2

00:12:01

passed #6477867
mesa-ci-aarch64-lava-collabora
panfrost-t860-traces:arm64

00:11:56

 
  Freedreno
passed #6477879
google-freedreno-db410c
arm64_a306_gles2

00:08:35

passed #6477880
google-freedreno-db410c
arm64_a306_gles3

00:07:55

passed #6477881
google-freedreno-db410c
arm64_a306_gles3_options

00:06:04

passed #6477882
google-freedreno-db820c
arm64_a530_gles2 1/2

00:08:53

passed #6477883
google-freedreno-db820c
arm64_a530_gles2 2/2

00:08:39

passed #6477884
google-freedreno-db820c
arm64_a530_gles3

00:05:22

passed #6477885
google-freedreno-db820c
arm64_a530_gles31

00:07:36

passed #6477886
google-freedreno-db820c
arm64_a530_piglit_shader

00:06:59

passed #6477873
google-freedreno-cheza
arm64_a630_gl

00:01:11

passed #6477870
google-freedreno-cheza
arm64_a630_gles2

00:01:41

passed #6477872
google-freedreno-cheza
arm64_a630_gles3

00:05:22

passed #6477871
google-freedreno-cheza
arm64_a630_gles31

00:04:18

passed #6477874
google-freedreno-cheza
arm64_a630_gles_others

00:03:02

passed #6477878
google-freedreno-cheza
arm64_a630_piglit_shader

00:03:05

passed #6477869
google-freedreno-cheza
arm64-a630-traces

00:06:17

passed #6477875
google-freedreno-cheza
arm64_a630_vk 1/2

00:06:24

passed #6477876
google-freedreno-cheza
arm64_a630_vk 2/2

00:07:28

passed #6477877
google-freedreno-cheza
arm64_a630_vk_sysmem

00:02:34

 
  Raspberrypi
passed #6477887
igalia-rpi3
vc4-rpi3-gles2:armhf 1/4

00:04:40

passed #6477888
igalia-rpi3
vc4-rpi3-gles2:armhf 2/4

00:04:25

passed #6477889
igalia-rpi3
vc4-rpi3-gles2:armhf 3/4

00:04:51

passed #6477890
igalia-rpi3
vc4-rpi3-gles2:armhf 4/4

00:05:02

 
  Software Renderer
passed #6477903
lavapipe-vk

00:07:00

passed #6477896
llvmpipe-gles2

00:02:11

passed #6477891
llvmpipe-piglit-cl

00:02:32

passed #6477893
llvmpipe-piglit-glslparser

00:03:32

passed #6477892
llvmpipe-piglit-quick_gl

00:05:39

passed #6477894
llvmpipe-piglit-quick_shader

00:05:50

passed #6477895
llvmpipe-traces

00:01:46

passed #6477902
softpipe-gl

00:00:56

passed #6477897
softpipe-gles2

00:00:44

passed #6477898
softpipe-gles3

00:02:50

passed #6477899
softpipe-gles31 1/2

00:04:22

passed #6477900
softpipe-gles31 2/2

00:02:09

passed #6477901
softpipe-piglit-quick

00:06:01

 
  Layered Backends
passed #6477904
windows docker 1809 mesa
test-d3d12-windows

00:03:47

passed #6477910
virgl-gl30-on-gl

00:00:25

passed #6477911
virgl-gl31-on-gl

00:01:05

passed #6477912
virgl-gl32-on-gl

00:01:16

passed #6477906
virgl-gles2-on-gl

00:02:12

passed #6477908
virgl-gles31-on-gl 1/2

00:03:57

passed #6477909
virgl-gles31-on-gl 2/2

00:03:46

passed #6477907
virgl-gles3-on-gl

00:04:22

passed #6477905
virgl-traces

00:00:39