diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-09-05 21:20:35 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-09-05 21:20:35 +0000 |
| commit | 18e126e5d4c3ecc47267f0e88a75defa45b0cdbc (patch) | |
| tree | 01311aca4fe38d784fc5b8ab233706da1331744c /llvm/test | |
| parent | 2ea27186b4bac2a124aaef7788707d3b48c719a8 (diff) | |
| download | bcm5719-llvm-18e126e5d4c3ecc47267f0e88a75defa45b0cdbc.tar.gz bcm5719-llvm-18e126e5d4c3ecc47267f0e88a75defa45b0cdbc.zip | |
[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.
llvm-svn: 312578
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fcmp-special.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fcmp-special.ll b/llvm/test/Transforms/InstCombine/fcmp-special.ll index dcb88832323..faf153a8b96 100644 --- a/llvm/test/Transforms/InstCombine/fcmp-special.ll +++ b/llvm/test/Transforms/InstCombine/fcmp-special.ll @@ -144,3 +144,33 @@ define <2 x i1> @uno_vec_with_nan(<2 x double> %x) { 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 +} + |

