tgsi_exec: Fix NaN behavior of min and max

Modern shader APIs, like DX10 and GLSL 1.30, want min() and max() to
"cleanse" NaN.  If one source is NaN, the other value should be chosen.
If both sources are NaN, the result may be either.

There are many cases where TGSI is generate from NIR, and many
optimizations in NIR expect this behavior.  Not meeting these
expectations can lead to unexpected results.

Reviewed-by: Eric Anholt <eric@anholt.net>
Fixes: ffe58739 ("Softpipe: import TGSI tree. Not hooked-up yet.")
Part-of: <!10419>
120 jobs for !10419 with review/tgsi-vs-nan in 29 minutes and 32 seconds (queued for 7 seconds)
latest detached
Status Job ID Name Coverage
  Sanity
passed #9177183
sanity

00:00:11

 
  Container
passed #9177188
aarch64
arm_build

00:00:23

passed #9177190
windows shell 1809 mesa
windows_build_vs2019

00:00:09

passed #9177185
x86_build-base

00:00:14

passed #9177187
x86_test-base

00:00:14

 
  Container 2
passed #9177200
android_build

00:00:22

passed #9177195
i386_build

00:00:23

passed #9177205
kernel+rootfs_amd64

00:00:26

passed #9177207
aarch64
kernel+rootfs_arm64

00:00:10

passed #9177209
aarch64
kernel+rootfs_armhf

00:00:58

passed #9177196
ppc64el_build

00:00:22

passed #9177198
s390x_build

00:00:19

passed #9177193
x86_build

00:00:22

passed #9177202
x86_test-gl

00:00:23

passed #9177203
x86_test-vk

00:00:19

 
  Meson X86 64
passed #9177219
meson-clang

00:04:20

passed #9177221
meson-clover

00:02:40

passed #9177214
meson-clover-testing

00:01:47

passed #9177216
meson-gallium

00:07:54

passed #9177218
meson-release

00:03:43

passed #9177211
meson-testing

00:03:40

passed #9177213
meson-testing-asan

00:07:47

passed #9177223
meson-vulkan

00:02:40

 
  Build Misc
passed #9177225
arm_test

00:00:25

passed #9177226
meson-android

00:00:57

passed #9177230
aarch64
meson-arm64

00:01:25

passed #9177232
aarch64
meson-arm64-asan

00:03:36

passed #9177234
aarch64
meson-arm64-build-test

00:01:28

passed #9177228
aarch64
meson-armhf

00:01:47

passed #9177238
meson-i386

00:02:39

passed #9177244
meson-mingw32-x86_64

00:02:23

passed #9177242
meson-ppc64el

00:02:52

passed #9177240
kvm
meson-s390x

00:04:18

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

00:06:13

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

00:08:16

passed #9177252
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles31:amd64 1/2

00:15:37

passed #9177254
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles31:amd64 2/2

00:14:24

passed #9177248
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles3:amd64 1/2

00:10:37

passed #9177250
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles3:amd64 2/2

00:11:12

passed #9177258
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-piglit-gl:amd64

00:12:18

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

00:15:02

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

00:04:29

passed #9177280
mesa-ci-aarch64-lava-collabora
panfrost-g52-gles31:arm64

00:09:10

passed #9177278
mesa-ci-aarch64-lava-collabora
panfrost-g52-gles3:arm64

00:07:47

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

00:10:06

passed #9177262
mesa-ci-aarch64-lava-collabora
panfrost-t760-gles2:armhf

00:05:29

passed #9177264
mesa-ci-aarch64-lava-collabora
panfrost-t760-traces:armhf

00:05:54

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

00:05:15

passed #9177272
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles31:arm64

00:07:11

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

00:07:11

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

00:06:54

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

00:13:51

 
  Broadcom
passed #9177302
igalia-rpi4
v3d-rpi4-gles2:armhf

00:06:39

passed #9177290
igalia-rpi4
v3d-rpi4-gles31:armhf 1/2

00:09:32

passed #9177292
igalia-rpi4
v3d-rpi4-gles31:armhf 2/2

00:09:47

passed #9177294
igalia-rpi4
v3d-rpi4-gles3:armhf 1/4

00:08:58

passed #9177296
igalia-rpi4
v3d-rpi4-gles3:armhf 2/4

00:09:30

passed #9177298
igalia-rpi4
v3d-rpi4-gles3:armhf 3/4

00:07:46

passed #9177300
igalia-rpi4
v3d-rpi4-gles3:armhf 4/4

00:08:20

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

00:03:50

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

00:03:33

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

00:03:51

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

00:03:41

 
  Freedreno
passed #9177304
google-freedreno-db410c
a306_gles2

00:04:37

passed #9177306
google-freedreno-db410c
a306_gles3 1/3

00:10:06

passed #9177308
google-freedreno-db410c
a306_gles3 2/3

00:09:51

passed #9177310
google-freedreno-db410c
a306_gles3 3/3

00:09:54

passed #9177312
google-freedreno-db410c
a306_gles3_options

00:04:44

passed #9177314
google-freedreno-db410c
a306-traces

00:09:36

passed #9177316
google-freedreno-db820c
a530_gles2

00:06:28

passed #9177322
google-freedreno-db820c
a530_gles31 1/2

00:06:40

passed #9177318
google-freedreno-db820c
a530_gles3 1/2

00:09:23

passed #9177324
google-freedreno-db820c
a530_gles31 2/2

00:07:37

passed #9177320
google-freedreno-db820c
a530_gles3 2/2

00:08:08

passed #9177326
google-freedreno-db820c
a530_piglit_gl

00:10:08

passed #9177328
google-freedreno-db820c
a530_piglit_shader

00:09:00

passed #9177330
google-freedreno-db820c
a530-traces

00:13:45

passed #9177340
google-freedreno-cheza
a630_egl

00:04:36

passed #9177338
google-freedreno-cheza
a630_gl

00:02:36

passed #9177332
google-freedreno-cheza
a630_gles2

00:02:46

passed #9177336
google-freedreno-cheza
a630_gles3

00:05:56

passed #9177334
google-freedreno-cheza
a630_gles31

00:05:01

passed #9177342
google-freedreno-cheza
a630_gles_others

00:03:48

passed #9177350
google-freedreno-cheza
a630_piglit

00:09:04

passed #9177352
google-freedreno-cheza
a630-traces

00:07:45

passed #9177344
google-freedreno-cheza
a630_vk 1/2

00:10:47

passed #9177346
google-freedreno-cheza
a630_vk 2/2

00:10:28

passed #9177348
google-freedreno-cheza
a630_vk_sysmem

00:02:11

 
  Software Renderer
passed #9177389
lavapipe-vk

00:07:32

passed #9177368
llvmpipe-egl

00:01:06

passed #9177364
llvmpipe-gles2

00:02:29

passed #9177366
llvmpipe-khr-gles2

00:00:27

passed #9177354
llvmpipe-piglit-cl

00:01:51

passed #9177358
llvmpipe-piglit-glslparser

00:04:25

passed #9177356
llvmpipe-piglit-quick_gl

00:06:39

passed #9177360
llvmpipe-piglit-quick_shader

00:06:33

passed #9177362
llvmpipe-traces

00:01:59

passed #9177383
softpipe-asan-gles31

00:03:39

passed #9177387
softpipe-gl

00:00:30

passed #9177370
softpipe-gles2

00:01:40

passed #9177372
softpipe-gles3

00:03:17

passed #9177374
softpipe-gles31 1/2

00:02:58

passed #9177376
softpipe-gles31 2/2

00:03:35

passed #9177378
softpipe-khr-gles2

00:00:42

passed #9177380
softpipe-khr-gles3

00:00:27

passed #9177382
softpipe-khr-gles31

00:00:44

passed #9177385
softpipe-piglit-quick

00:05:09

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

00:03:50

passed #9177398
virgl-gl30-on-gl

00:00:30

passed #9177400
virgl-gl31-on-gl

00:01:06

passed #9177402
virgl-gl32-on-gl

00:01:08

passed #9177391
virgl-gles2-on-gl

00:02:53

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

00:02:35

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

00:03:36

passed #9177393
virgl-gles3-on-gl

00:02:17

passed #9177404
virgl-traces

00:00:54

passed #9177412
zink-lvp-gl

00:02:04

passed #9177408
zink-lvp-gles2

00:03:29

passed #9177410
zink-lvp-gles3

00:02:50

passed #9177406
zink-piglit-quick_gl

00:03:39