[llvm] d3b0644 - [InstSimplify] add tests for constant folding fmin/fmax with undef op; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 13:09:58 PDT 2020


Author: Sanjay Patel
Date: 2020-09-18T16:09:44-04:00
New Revision: d3b0644e22a4ebe599d58d9d319d2403484fd88f

URL: https://github.com/llvm/llvm-project/commit/d3b0644e22a4ebe599d58d9d319d2403484fd88f
DIFF: https://github.com/llvm/llvm-project/commit/d3b0644e22a4ebe599d58d9d319d2403484fd88f.diff

LOG: [InstSimplify] add tests for constant folding fmin/fmax with undef op; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll b/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll
index 9d904595f2ca..b77337a63a3b 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll
@@ -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
+}


        


More information about the llvm-commits mailing list