@@ -855,6 +855,66 @@ define float @v_test_canonicalize_amdgcn_exp2(float %a) {
855
855
ret float %canonicalized
856
856
}
857
857
858
+ ; GCN-LABEL: {{^}}v_test_canonicalize_minimum:
859
+ ; GCN: s_waitcnt
860
+ ; GCN-NEXT: v_min_f32_e32 [[MIN:v[0-9]+]], v0, v1
861
+ ; GCN-NEXT: v_mov_b32_e32 [[K:v[0-9]+]], 0x7fc00000
862
+ ; GCN-NEXT: v_cmp_o_f32_e32 vcc, v0, v1
863
+ ; GCN-NEXT: v_cndmask_b32_e32 v0, [[K]], [[MIN]], vcc
864
+ ; VI-FLUSH-NEXT: v_mul_f32_e32 v0, 1.0, v0
865
+ ; GCN-NEXT: s_setpc_b64
866
+ define float @v_test_canonicalize_minimum (float %a , float %b ) {
867
+ %min = call float @llvm.minimum.f32 (float %a , float %b )
868
+ %canonicalized = call float @llvm.canonicalize.f32 (float %min )
869
+ ret float %canonicalized
870
+ }
871
+
872
+ ; GCN-LABEL: {{^}}v_test_canonicalize_maximum:
873
+ ; GCN: s_waitcnt
874
+ ; GCN-NEXT: v_max_f32_e32 [[MIN:v[0-9]+]], v0, v1
875
+ ; GCN-NEXT: v_mov_b32_e32 [[K:v[0-9]+]], 0x7fc00000
876
+ ; GCN-NEXT: v_cmp_o_f32_e32 vcc, v0, v1
877
+ ; GCN-NEXT: v_cndmask_b32_e32 v0, [[K]], [[MIN]], vcc
878
+ ; VI-FLUSH-NEXT: v_mul_f32_e32 v0, 1.0, v0
879
+ ; GCN-NEXT: s_setpc_b64
880
+ define float @v_test_canonicalize_maximum (float %a , float %b ) {
881
+ %min = call float @llvm.maximum.f32 (float %a , float %b )
882
+ %canonicalized = call float @llvm.canonicalize.f32 (float %min )
883
+ ret float %canonicalized
884
+ }
885
+
886
+ ; GCN-LABEL: {{^}}v_test_canonicalize_minimumnum:
887
+ ; GCN: s_waitcnt
888
+ ; VI-NEXT: v_mul_f32_e32 v1, 1.0, v1
889
+ ; VI-NEXT: v_mul_f32_e32 v0, 1.0, v0
890
+
891
+ ; GFX9-NEXT: v_max_f32_e32 v1, v1, v1
892
+ ; GFX9-NEXT: v_max_f32_e32 v0, v0, v0
893
+
894
+ ; GCN-NEXT: v_min_f32_e32 v0, v0, v1
895
+ ; GCN-NEXT: s_setpc_b64
896
+ define float @v_test_canonicalize_minimumnum (float %a , float %b ) {
897
+ %min = call float @llvm.minimumnum.f32 (float %a , float %b )
898
+ %canonicalized = call float @llvm.canonicalize.f32 (float %min )
899
+ ret float %canonicalized
900
+ }
901
+
902
+ ; GCN-LABEL: {{^}}v_test_canonicalize_maximumnum:
903
+ ; GCN: s_waitcnt
904
+ ; VI-NEXT: v_mul_f32_e32 v1, 1.0, v1
905
+ ; VI-NEXT: v_mul_f32_e32 v0, 1.0, v0
906
+
907
+ ; GFX9-NEXT: v_max_f32_e32 v1, v1, v1
908
+ ; GFX9-NEXT: v_max_f32_e32 v0, v0, v0
909
+
910
+ ; GCN-NEXT: v_max_f32_e32 v0, v0, v1
911
+ ; GCN-NEXT: s_setpc_b64
912
+ define float @v_test_canonicalize_maximumnum (float %a , float %b ) {
913
+ %min = call float @llvm.maximumnum.f32 (float %a , float %b )
914
+ %canonicalized = call float @llvm.canonicalize.f32 (float %min )
915
+ ret float %canonicalized
916
+ }
917
+
858
918
; Avoid failing the test on FreeBSD11.0 which will match the GCN-NOT: 1.0
859
919
; in the .amd_amdgpu_isa "amdgcn-unknown-freebsd11.0--gfx802" directive
860
920
; GCN: .amd_amdgpu_isa
0 commit comments