[llvm] c52ed5c - [InstCombine] add FMF tests for fneg-of-select; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 8 14:05:18 PDT 2021
Author: Sanjay Patel
Date: 2021-06-08T17:04:29-04:00
New Revision: c52ed5c4f1f2a2e54634226dc6bd305f98f0c541
URL: https://github.com/llvm/llvm-project/commit/c52ed5c4f1f2a2e54634226dc6bd305f98f0c541
DIFF: https://github.com/llvm/llvm-project/commit/c52ed5c4f1f2a2e54634226dc6bd305f98f0c541.diff
LOG: [InstCombine] add FMF tests for fneg-of-select; NFC
As noted in the post-commit comments for 3cdd05e519d,
we need to be more careful about FMF propagation.
Added:
Modified:
llvm/test/Transforms/InstCombine/fneg.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/fneg.ll b/llvm/test/Transforms/InstCombine/fneg.ll
index 50371f60932cd..6d507bdcd90a0 100644
--- a/llvm/test/Transforms/InstCombine/fneg.ll
+++ b/llvm/test/Transforms/InstCombine/fneg.ll
@@ -588,6 +588,30 @@ define <2 x float> @select_fneg_false(<2 x float> %x, <2 x float> %y, <2 x i1> %
ret <2 x float> %r
}
+define float @select_fneg_false_no_nsz(float %x, float %y, i1 %b) {
+; CHECK-LABEL: @select_fneg_false_no_nsz(
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
+; CHECK-NEXT: [[TMP1:%.*]] = select nnan ninf nsz i1 [[B:%.*]], float [[X_NEG]], float [[Y:%.*]]
+; CHECK-NEXT: ret float [[TMP1]]
+;
+ %ny = fneg float %y
+ %s = select i1 %b, float %x, float %ny
+ %r = fneg ninf nnan nsz float %s
+ ret float %r
+}
+
+define float @select_fneg_false_nsz(float %x, float %y, i1 %b) {
+; CHECK-LABEL: @select_fneg_false_nsz(
+; CHECK-NEXT: [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
+; CHECK-NEXT: [[TMP1:%.*]] = select nnan ninf nsz i1 [[B:%.*]], float [[X_NEG]], float [[Y:%.*]]
+; CHECK-NEXT: ret float [[TMP1]]
+;
+ %ny = fneg float %y
+ %s = select nsz i1 %b, float %x, float %ny
+ %r = fneg ninf nnan nsz float %s
+ ret float %r
+}
+
define float @select_fneg_both(float %x, float %y, i1 %b) {
; CHECK-LABEL: @select_fneg_both(
; CHECK-NEXT: [[S_V:%.*]] = select i1 [[B:%.*]], float [[X:%.*]], float [[Y:%.*]]
More information about the llvm-commits
mailing list