[llvm] r345722 - [InstSimplify] add tests for fcmp and known positive; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 31 07:29:21 PDT 2018
Author: spatel
Date: Wed Oct 31 07:29:21 2018
New Revision: 345722
URL: http://llvm.org/viewvc/llvm-project?rev=345722&view=rev
Log:
[InstSimplify] add tests for fcmp and known positive; NFC
Modified:
llvm/trunk/test/Transforms/InstSimplify/floating-point-compare.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/floating-point-compare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/floating-point-compare.ll?rev=345722&r1=345721&r2=345722&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/floating-point-compare.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/floating-point-compare.ll Wed Oct 31 07:29:21 2018
@@ -234,44 +234,84 @@ define i1 @orderedLessZeroPowi(double,do
ret i1 %olt
}
-define i1 @orderedLessZeroUIToFP(i32 %x) {
-; CHECK-LABEL: @orderedLessZeroUIToFP(
+define i1 @UIToFP_is_nan_or_positive_or_zero(i32 %x) {
+; CHECK-LABEL: @UIToFP_is_nan_or_positive_or_zero(
; CHECK-NEXT: ret i1 true
;
%a = uitofp i32 %x to float
- %uge = fcmp uge float %a, 0.000000e+00
- ret i1 %uge
+ %r = fcmp uge float %a, 0.000000e+00
+ ret i1 %r
}
-define <2 x i1> @orderedLessZeroUIToFP_vec(<2 x i32> %x) {
-; CHECK-LABEL: @orderedLessZeroUIToFP_vec(
+define <2 x i1> @UIToFP_is_nan_or_positive_or_zero_vec(<2 x i32> %x) {
+; CHECK-LABEL: @UIToFP_is_nan_or_positive_or_zero_vec(
; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
;
%a = uitofp <2 x i32> %x to <2 x float>
- %uge = fcmp uge <2 x float> %a, zeroinitializer
- ret <2 x i1> %uge
+ %r = fcmp uge <2 x float> %a, zeroinitializer
+ ret <2 x i1> %r
}
-define i1 @orderedLessZeroUIToFP_nnan(i32 %x) {
-; CHECK-LABEL: @orderedLessZeroUIToFP_nnan(
+define i1 @UIToFP_nnan_is_positive_or_zero(i32 %x) {
+; CHECK-LABEL: @UIToFP_nnan_is_positive_or_zero(
; CHECK-NEXT: [[A:%.*]] = uitofp i32 [[X:%.*]] to float
-; CHECK-NEXT: [[UGE:%.*]] = fcmp nnan oge float [[A]], 0.000000e+00
-; CHECK-NEXT: ret i1 [[UGE]]
+; CHECK-NEXT: [[R:%.*]] = fcmp nnan oge float [[A]], 0.000000e+00
+; CHECK-NEXT: ret i1 [[R]]
;
%a = uitofp i32 %x to float
- %uge = fcmp nnan oge float %a, 0.000000e+00
- ret i1 %uge
+ %r = fcmp nnan oge float %a, 0.000000e+00
+ ret i1 %r
}
-define <2 x i1> @orderedLessZeroUIToFP_nnan_vec(<2 x i32> %x) {
-; CHECK-LABEL: @orderedLessZeroUIToFP_nnan_vec(
+define <2 x i1> @UIToFP_nnan_is_positive_or_zero_vec(<2 x i32> %x) {
+; CHECK-LABEL: @UIToFP_nnan_is_positive_or_zero_vec(
; CHECK-NEXT: [[A:%.*]] = uitofp <2 x i32> [[X:%.*]] to <2 x float>
-; CHECK-NEXT: [[UGE:%.*]] = fcmp nnan oge <2 x float> [[A]], zeroinitializer
-; CHECK-NEXT: ret <2 x i1> [[UGE]]
+; CHECK-NEXT: [[R:%.*]] = fcmp nnan oge <2 x float> [[A]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[R]]
;
%a = uitofp <2 x i32> %x to <2 x float>
- %uge = fcmp nnan oge <2 x float> %a, zeroinitializer
- ret <2 x i1> %uge
+ %r = fcmp nnan oge <2 x float> %a, zeroinitializer
+ ret <2 x i1> %r
+}
+
+define i1 @UIToFP_is_not_negative(i32 %x) {
+; CHECK-LABEL: @UIToFP_is_not_negative(
+; CHECK-NEXT: ret i1 false
+;
+ %a = uitofp i32 %x to float
+ %r = fcmp olt float %a, 0.000000e+00
+ ret i1 %r
+}
+
+define <2 x i1> @UIToFP_is_not_negative_vec(<2 x i32> %x) {
+; CHECK-LABEL: @UIToFP_is_not_negative_vec(
+; CHECK-NEXT: ret <2 x i1> zeroinitializer
+;
+ %a = uitofp <2 x i32> %x to <2 x float>
+ %r = fcmp olt <2 x float> %a, zeroinitializer
+ ret <2 x i1> %r
+}
+
+define i1 @UIToFP_nnan_is_not_negative(i32 %x) {
+; CHECK-LABEL: @UIToFP_nnan_is_not_negative(
+; CHECK-NEXT: [[A:%.*]] = uitofp i32 [[X:%.*]] to float
+; CHECK-NEXT: [[R:%.*]] = fcmp nnan ult float [[A]], 0.000000e+00
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %a = uitofp i32 %x to float
+ %r = fcmp nnan ult float %a, 0.000000e+00
+ ret i1 %r
+}
+
+define <2 x i1> @UIToFP_nnan_is_not_negative_vec(<2 x i32> %x) {
+; CHECK-LABEL: @UIToFP_nnan_is_not_negative_vec(
+; CHECK-NEXT: [[A:%.*]] = uitofp <2 x i32> [[X:%.*]] to <2 x float>
+; CHECK-NEXT: [[R:%.*]] = fcmp nnan ult <2 x float> [[A]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %a = uitofp <2 x i32> %x to <2 x float>
+ %r = fcmp nnan ult <2 x float> %a, zeroinitializer
+ ret <2 x i1> %r
}
define i1 @fabs_is_nan_or_positive_or_zero(double %x) {
@@ -314,6 +354,46 @@ define <2 x i1> @fabs_nnan_is_positive_o
ret <2 x i1> %cmp
}
+define i1 @fabs_is_not_negative(double %x) {
+; CHECK-LABEL: @fabs_is_not_negative(
+; CHECK-NEXT: ret i1 false
+;
+ %fabs = tail call double @llvm.fabs.f64(double %x)
+ %cmp = fcmp olt double %fabs, 0.0
+ ret i1 %cmp
+}
+
+define <2 x i1> @fabs_is_not_negative_vec(<2 x double> %x) {
+; CHECK-LABEL: @fabs_is_not_negative_vec(
+; CHECK-NEXT: ret <2 x i1> zeroinitializer
+;
+ %fabs = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
+ %cmp = fcmp olt <2 x double> %fabs, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
+define i1 @fabs_nnan_is_not_negative(double %x) {
+; CHECK-LABEL: @fabs_nnan_is_not_negative(
+; CHECK-NEXT: [[FABS:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
+; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ult double [[FABS]], 0.000000e+00
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %fabs = tail call double @llvm.fabs.f64(double %x)
+ %cmp = fcmp nnan ult double %fabs, 0.0
+ ret i1 %cmp
+}
+
+define <2 x i1> @fabs_nnan_is_not_negative_vec(<2 x double> %x) {
+; CHECK-LABEL: @fabs_nnan_is_not_negative_vec(
+; CHECK-NEXT: [[FABS:%.*]] = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> [[X:%.*]])
+; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ult <2 x double> [[FABS]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %fabs = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
+ %cmp = fcmp nnan ult <2 x double> %fabs, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
define i1 @orderedLessZeroSelect(float, float) {
; CHECK-LABEL: @orderedLessZeroSelect(
; CHECK-NEXT: ret i1 true
More information about the llvm-commits
mailing list