[InstSimplify] add tests for constant folding fmin/fmax with undef op; NFC
authorSanjay Patel <spatel@rotateright.com>
Fri, 18 Sep 2020 14:36:24 +0000 (10:36 -0400)
committerSanjay Patel <spatel@rotateright.com>
Fri, 18 Sep 2020 20:09:44 +0000 (16:09 -0400)
llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll

index 9d90459..b77337a 100644 (file)
@@ -1,6 +1,11 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -instsimplify -S | FileCheck %s
 
+declare <2 x double> @llvm.minnum.v2f64(<2 x double>, <2 x double>)
+declare <2 x double> @llvm.maxnum.v2f64(<2 x double>, <2 x double>)
+declare <2 x double> @llvm.minimum.v2f64(<2 x double>, <2 x double>)
+declare <2 x double> @llvm.maximum.v2f64(<2 x double>, <2 x double>)
+
 ; Constant folding - undef undef.
 
 define double @fadd_undef_undef(double %x) {
@@ -533,3 +538,66 @@ define <2 x double> @frem_undef_op0_constant_vec(<2 x double> %x) {
   ret <2 x double> %r
 }
 
+define <2 x double> @maximum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
+; CHECK-LABEL: @maximum_nan_op0_vec_partial_undef_op1_undef(
+; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+;
+  %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
+  ret <2 x double> %r
+}
+
+define <2 x double> @maximum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
+; CHECK-LABEL: @maximum_nan_op1_vec_partial_undef_op0_undef(
+; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+;
+  %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
+  ret <2 x double> %r
+}
+
+define <2 x double> @minimum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
+; CHECK-LABEL: @minimum_nan_op0_vec_partial_undef_op1_undef(
+; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+;
+  %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
+  ret <2 x double> %r
+}
+
+define <2 x double> @minimum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
+; CHECK-LABEL: @minimum_nan_op1_vec_partial_undef_op0_undef(
+; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+;
+  %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
+  ret <2 x double> %r
+}
+
+define <2 x double> @maxnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
+; CHECK-LABEL: @maxnum_nan_op0_vec_partial_undef_op1_undef(
+; CHECK-NEXT:    ret <2 x double> undef
+;
+  %r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
+  ret <2 x double> %r
+}
+
+define <2 x double> @maxnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
+; CHECK-LABEL: @maxnum_nan_op1_vec_partial_undef_op0_undef(
+; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+;
+  %r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
+  ret <2 x double> %r
+}
+
+define <2 x double> @minnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
+; CHECK-LABEL: @minnum_nan_op0_vec_partial_undef_op1_undef(
+; CHECK-NEXT:    ret <2 x double> undef
+;
+  %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
+  ret <2 x double> %r
+}
+
+define <2 x double> @minnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
+; CHECK-LABEL: @minnum_nan_op1_vec_partial_undef_op0_undef(
+; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+;
+  %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
+  ret <2 x double> %r
+}