[llvm] r312578 - [InstCombine] add nnan tests; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 14:20:35 PDT 2017


Author: spatel
Date: Tue Sep  5 14:20:35 2017
New Revision: 312578

URL: http://llvm.org/viewvc/llvm-project?rev=312578&view=rev
Log:
[InstCombine] add nnan tests; NFC

As suggested in D37427, we could have a value tracking function and folds that use
it to simplify these cases. 

Modified:
    llvm/trunk/test/Transforms/InstCombine/fcmp-special.ll

Modified: llvm/trunk/test/Transforms/InstCombine/fcmp-special.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fcmp-special.ll?rev=312578&r1=312577&r2=312578&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fcmp-special.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fcmp-special.ll Tue Sep  5 14:20:35 2017
@@ -144,3 +144,33 @@ define <2 x i1> @uno_vec_with_nan(<2 x d
   ret <2 x i1> %f
 }
 
+; TODO: This could be handled in InstSimplify.
+
+define i1 @nnan_ops_to_fcmp_ord(float %x, float %y) {
+; CHECK-LABEL: @nnan_ops_to_fcmp_ord(
+; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan float %x, %y
+; CHECK-NEXT:    [[DIV:%.*]] = fdiv nnan float %x, %y
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp ord float [[MUL]], [[DIV]]
+; CHECK-NEXT:    ret i1 [[CMP]]
+;
+  %mul = fmul nnan float %x, %y
+  %div = fdiv nnan float %x, %y
+  %cmp = fcmp ord float %mul, %div
+  ret i1 %cmp
+}
+
+; TODO: This could be handled in InstSimplify.
+
+define i1 @nnan_ops_to_fcmp_uno(float %x, float %y) {
+; CHECK-LABEL: @nnan_ops_to_fcmp_uno(
+; CHECK-NEXT:    [[MUL:%.*]] = fmul nnan float %x, %y
+; CHECK-NEXT:    [[DIV:%.*]] = fdiv nnan float %x, %y
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp uno float [[MUL]], [[DIV]]
+; CHECK-NEXT:    ret i1 [[CMP]]
+;
+  %mul = fmul nnan float %x, %y
+  %div = fdiv nnan float %x, %y
+  %cmp = fcmp uno float %mul, %div
+  ret i1 %cmp
+}
+




More information about the llvm-commits mailing list