nir/opt_algebraic: optimize fmax(-fmin(b, a), b) -> fmax(fabs(b), -a)

and fmin(-fmax(b, a)) to fmin(-fabs(b), -a).

fossils-db (Sienna Cichlid):
Totals from 34 (0.02% of 150170) affected shaders:
CodeSize: 388540 -> 387748 (-0.20%)
Instrs: 74621 -> 74423 (-0.27%)
Latency: 1039407 -> 1039011 (-0.04%)
InvThroughput: 208364 -> 208150 (-0.10%)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <!12519>
140 jobs for !12519 with nir_opt_min_max in 18 minutes and 10 seconds (queued for 15 seconds)
latest detached
Status Name Job ID Coverage
  Sanity
passed sanity #13080628

00:00:08

 
  Container
passed debian/arm_build #13080631
aarch64

00:00:17

passed debian/x86_build-base #13080629

00:00:17

passed debian/x86_test-base #13080630

00:00:22

passed fedora/x86_build #13080632

00:00:11

passed windows_build_vs2019 #13080633
windows shell 1809 mesa

00:00:11

 
  Container 2
passed debian/android_build #13080638

00:00:17

passed debian/i386_build #13080635

00:00:16

passed debian/ppc64el_build #13080636

00:00:17

passed debian/s390x_build #13080637

00:00:17

passed debian/x86_build #13080634

00:00:15

passed debian/x86_test-gl #13080639

00:00:18

passed debian/x86_test-vk #13080640

00:00:19

passed kernel+rootfs_amd64 #13080641

00:00:23

passed kernel+rootfs_arm64 #13080642
aarch64

00:00:54

passed kernel+rootfs_armhf #13080643
aarch64

00:00:11

 
  Build X86 64
passed debian-clang #13080650

00:09:32

passed debian-clover #13080651

00:02:34

passed debian-clover-testing #13080646

00:01:55

passed debian-gallium #13080647

00:05:43

passed debian-release #13080648

00:04:02

passed debian-testing #13080644

00:02:03

passed debian-testing-asan #13080645

00:02:24

passed debian-vulkan #13080652

00:01:33

passed fedora-release #13080649

00:01:54

 
  Build Misc
passed debian-android #13080654

00:01:20

passed debian-arm64 #13080656
aarch64

00:01:25

passed debian-arm64-asan #13080657
aarch64

00:03:01

passed debian-arm64-build-test #13080658
aarch64

00:01:35

passed debian-armhf #13080655
aarch64

00:01:46

passed debian/arm_test #13080653

00:00:16

passed debian-i386 #13080660

00:01:53

passed debian-mingw32-x86_64 #13080663

00:01:59

passed debian-ppc64el #13080662

00:01:53

passed debian-s390x #13080661
kvm

00:03:35

passed windows-vs2019 #13080659
windows docker 1809 mesa

00:05:14

 
  Amd
passed radeonsi-stoney-gles2:amd64 #13080668
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:06:11

passed radeonsi-stoney-gles31:amd64 1/2 #13080671
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:10:40

passed radeonsi-stoney-gles31:amd64 2/2 #13080672
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:10:18

passed radeonsi-stoney-gles3:amd64 1/2 #13080669
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:08:20

passed radeonsi-stoney-gles3:amd64 2/2 #13080670
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:07:19

passed radeonsi-stoney-piglit-gl:amd64 #13080674
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:14:10

passed radeonsi-stoney-traces:amd64 #13080673
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:13:58

passed radv-fossils #13080667

00:07:04

passed radv_stoney_vkcts:amd64 1/3 #13080664
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:11:22

passed radv_stoney_vkcts:amd64 2/3 #13080665
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:13:37

passed radv_stoney_vkcts:amd64 3/3 #13080666
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt

00:13:38

 
  Intel
passed iris-apl-egl #13080678
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral

00:09:38

passed iris-apl-gles2 #13080675
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral

00:03:55

passed iris-apl-gles3 #13080676
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral

00:05:49

passed iris-apl-gles31 #13080677
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral

00:09:15

passed iris-apl-traces #13080679
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral

00:11:32

 
  Arm
passed lima-mali450-test:arm64 #13080680
mesa-ci-x86-64-lava-lima

00:06:26

passed panfrost-g52-gl:arm64 1/3 #13080688
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3

00:09:21

passed panfrost-g52-gl:arm64 2/3 #13080689
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3

00:11:06

passed panfrost-g52-gl:arm64 3/3 #13080690
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3

00:10:45

passed panfrost-t720-gles2:arm64 #13080681
mesa-ci-x86-64-lava-sun50i-h6-pine-h64

00:09:08

passed panfrost-t760-gles2:armhf #13080682
mesa-ci-x86-64-lava-rk3288-veyron-jaq

00:05:18

passed panfrost-t760-traces:armhf #13080683
mesa-ci-x86-64-lava-rk3288-veyron-jaq

00:02:54

passed panfrost-t860-gl:arm64 1/3 #13080684
mesa-ci-x86-64-lava-rk3399-gru-kevin

00:07:00

passed panfrost-t860-gl:arm64 2/3 #13080685
mesa-ci-x86-64-lava-rk3399-gru-kevin

00:07:02

passed panfrost-t860-gl:arm64 3/3 #13080686
mesa-ci-x86-64-lava-rk3399-gru-kevin

00:06:40

passed panfrost-t860-traces:arm64 #13080687
mesa-ci-x86-64-lava-rk3399-gru-kevin

00:04:57

 
  Broadcom
passed v3d-rpi4-egl:armhf #13080702
igalia-rpi4

00:07:24

passed v3d-rpi4-gles:armhf 1/8 #13080694
igalia-rpi4

00:08:50

passed v3d-rpi4-gles:armhf 2/8 #13080695
igalia-rpi4

00:09:28

passed v3d-rpi4-gles:armhf 3/8 #13080696
igalia-rpi4

00:08:41

passed v3d-rpi4-gles:armhf 4/8 #13080697
igalia-rpi4

00:08:35

passed v3d-rpi4-gles:armhf 5/8 #13080698
igalia-rpi4

00:09:22

passed v3d-rpi4-gles:armhf 6/8 #13080699
igalia-rpi4

00:09:23

passed v3d-rpi4-gles:armhf 7/8 #13080700
igalia-rpi4

00:08:52

passed v3d-rpi4-gles:armhf 8/8 #13080701
igalia-rpi4

00:08:40

passed v3d-rpi4-piglit:armhf 1/4 #13080703
igalia-rpi4

00:09:24

passed v3d-rpi4-piglit:armhf 2/4 #13080704
igalia-rpi4

00:09:56

passed v3d-rpi4-piglit:armhf 3/4 #13080705
igalia-rpi4

00:09:28

passed v3d-rpi4-piglit:armhf 4/4 #13080706
igalia-rpi4

00:09:55

passed v3dv-rpi4-vk:arm64 1/8 #13080707
igalia-rpi4

00:08:22

passed v3dv-rpi4-vk:arm64 2/8 #13080708
igalia-rpi4

00:08:12

passed v3dv-rpi4-vk:arm64 3/8 #13080709
igalia-rpi4

00:08:02

passed v3dv-rpi4-vk:arm64 4/8 #13080710
igalia-rpi4

00:08:51

passed v3dv-rpi4-vk:arm64 5/8 #13080711
igalia-rpi4

00:08:14

passed v3dv-rpi4-vk:arm64 6/8 #13080712
igalia-rpi4

00:08:25

passed v3dv-rpi4-vk:arm64 7/8 #13080713
igalia-rpi4

00:07:59

passed v3dv-rpi4-vk:arm64 8/8 #13080714
igalia-rpi4

00:09:12

passed vc4-rpi3-egl:armhf #13080693
igalia-rpi3

00:07:35

passed vc4-rpi3-gles:armhf 1/2 #13080691
igalia-rpi3

00:07:20

passed vc4-rpi3-gles:armhf 2/2 #13080692
igalia-rpi3

00:07:31

 
  Freedreno
passed a306_gl 1/5 #13080715
google-freedreno-db410c

00:08:12

passed a306_gl 2/5 #13080716
google-freedreno-db410c

00:08:26

passed a306_gl 3/5 #13080717
google-freedreno-db410c

00:08:26

passed a306_gl 4/5 #13080718
google-freedreno-db410c

00:07:43

passed a306_gl 5/5 #13080719
google-freedreno-db410c

00:08:09

passed a306-traces #13080720
google-freedreno-db410c

00:03:36

passed a530_gl 1/5 #13080721
google-freedreno-db820c

00:08:24

passed a530_gl 2/5 #13080722
google-freedreno-db820c

00:08:39

passed a530_gl 3/5 #13080723
google-freedreno-db820c

00:08:29

passed a530_gl 4/5 #13080724
google-freedreno-db820c

00:08:40

passed a530_gl 5/5 #13080725
google-freedreno-db820c

00:08:14

passed a530_piglit_shader 1/2 #13080726
google-freedreno-db820c

00:09:01

passed a530_piglit_shader 2/2 #13080727
google-freedreno-db820c

00:08:56

passed a530-traces #13080728
google-freedreno-db820c

00:07:31

passed a630_egl #13080733
google-freedreno-cheza

00:02:28

passed a630_gl 1/4 #13080729
google-freedreno-cheza

00:05:26

passed a630_gl 2/4 #13080730
google-freedreno-cheza

00:06:21

passed a630_gl 3/4 #13080731
google-freedreno-cheza

00:04:54

passed a630_gl 4/4 #13080732
google-freedreno-cheza

00:05:42

passed a630_piglit #13080737
google-freedreno-cheza

00:08:32

passed a630-traces #13080738
google-freedreno-cheza

00:04:06

passed a630-traces-performance #13080740
google-freedreno-cheza manual

00:07:23

passed a630-traces-restricted #13080739
google-freedreno-cheza

00:03:12

passed a630_vk 1/3 #13080734
google-freedreno-cheza

00:07:37

passed a630_vk 2/3 #13080735
google-freedreno-cheza

00:09:00

passed a630_vk 3/3 #13080736
google-freedreno-cheza

00:09:01

 
  Software Renderer
passed lavapipe-nir-stress #13080754

00:01:02

passed lavapipe-vk #13080753

00:06:18

passed lavapipe-vk-asan #13080755

00:03:52

passed llvmpipe-deqp 1/2 #13080746

00:04:17

passed llvmpipe-deqp 2/2 #13080747

00:08:27

passed llvmpipe-egl #13080748

00:01:16

passed llvmpipe-piglit-cl #13080741

00:02:32

passed llvmpipe-piglit-glslparser #13080743

00:04:13

passed llvmpipe-piglit-quick_gl #13080742

00:05:22

passed llvmpipe-piglit-quick_shader #13080744

00:04:42

passed llvmpipe-traces #13080745

00:01:56

passed softpipe-asan-gles31 #13080751

00:03:27

passed softpipe-deqp 1/2 #13080749

00:03:41

passed softpipe-deqp 2/2 #13080750

00:09:28

passed softpipe-piglit-quick #13080752

00:05:45

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

00:03:37

passed virgl-on-gl 1/6 #13080756
kvm

00:12:19

passed virgl-on-gl 2/6 #13080757
kvm

00:14:01

passed virgl-on-gl 3/6 #13080758
kvm

00:13:23

passed virgl-on-gl 4/6 #13080759
kvm

00:13:38

passed virgl-on-gl 5/6 #13080760
kvm

00:14:52

passed virgl-on-gl 6/6 #13080761
kvm

00:14:44

passed virgl-traces #13080762
kvm

00:03:27

passed zink-lvp-deqp 1/2 #13080765

00:03:04

passed zink-lvp-deqp 2/2 #13080766

00:02:36

passed zink-piglit-no_timelines #13080764

00:04:35

passed zink-piglit-timelines #13080763

00:05:46