[InstSimplify] move minnum/maxnum with same arg fold from instcombine

llvm-svn: 338652
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
index afd375f..ca9226d 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
@@ -463,14 +463,15 @@
   ret float %fabs
 }
 
+declare float @llvm.minnum.f32(float, float)
+declare float @llvm.maxnum.f32(float, float)
 declare double @llvm.minnum.f64(double, double)
 declare double @llvm.maxnum.f64(double, double)
 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>)
 
 ; From the LangRef for minnum/maxnum:
-; "follows the IEEE-754 semantics for maxNum, which also match for libm’s fmax.
-; If either operand is a NaN, returns the other non-NaN operand."
+; "If either operand is a NaN, returns the other non-NaN operand."
 
 define double @maxnum_nan_op0(double %x) {
 ; CHECK-LABEL: @maxnum_nan_op0(
@@ -536,3 +537,19 @@
   ret <2 x double> %r
 }
 
+define float @minnum_same_args(float %x) {
+; CHECK-LABEL: @minnum_same_args(
+; CHECK-NEXT:    ret float [[X:%.*]]
+;
+  %y = call float @llvm.minnum.f32(float %x, float %x)
+  ret float %y
+}
+
+define float @maxnum_same_args(float %x) {
+; CHECK-LABEL: @maxnum_same_args(
+; CHECK-NEXT:    ret float [[X:%.*]]
+;
+  %y = call float @llvm.maxnum.f32(float %x, float %x)
+  ret float %y
+}
+