[llvm] r339142 - [InstSimplify] add tests for minnum/maxnum with shared op; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 7 07:13:40 PDT 2018
Author: spatel
Date: Tue Aug 7 07:13:40 2018
New Revision: 339142
URL: http://llvm.org/viewvc/llvm-project?rev=339142&view=rev
Log:
[InstSimplify] add tests for minnum/maxnum with shared op; NFC
Modified:
llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll?rev=339142&r1=339141&r2=339142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll Tue Aug 7 07:13:40 2018
@@ -601,3 +601,91 @@ define float @maxnum_same_args(float %x)
ret float %y
}
+define float @minnum_x_minnum_x_y(float %x, float %y) {
+; CHECK-LABEL: @minnum_x_minnum_x_y(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
+; CHECK-NEXT: [[B:%.*]] = call float @llvm.minnum.f32(float [[X]], float [[A]])
+; CHECK-NEXT: ret float [[B]]
+;
+ %a = call float @llvm.minnum.f32(float %x, float %y)
+ %b = call float @llvm.minnum.f32(float %x, float %a)
+ ret float %b
+}
+
+define float @minnum_y_minnum_x_y(float %x, float %y) {
+; CHECK-LABEL: @minnum_y_minnum_x_y(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
+; CHECK-NEXT: [[B:%.*]] = call float @llvm.minnum.f32(float [[Y]], float [[A]])
+; CHECK-NEXT: ret float [[B]]
+;
+ %a = call float @llvm.minnum.f32(float %x, float %y)
+ %b = call float @llvm.minnum.f32(float %y, float %a)
+ ret float %b
+}
+
+define float @minnum_x_y_minnum_x(float %x, float %y) {
+; CHECK-LABEL: @minnum_x_y_minnum_x(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
+; CHECK-NEXT: [[B:%.*]] = call float @llvm.minnum.f32(float [[A]], float [[X]])
+; CHECK-NEXT: ret float [[B]]
+;
+ %a = call float @llvm.minnum.f32(float %x, float %y)
+ %b = call float @llvm.minnum.f32(float %a, float %x)
+ ret float %b
+}
+
+define float @minnum_x_y_minnum_y(float %x, float %y) {
+; CHECK-LABEL: @minnum_x_y_minnum_y(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
+; CHECK-NEXT: [[B:%.*]] = call float @llvm.minnum.f32(float [[A]], float [[Y]])
+; CHECK-NEXT: ret float [[B]]
+;
+ %a = call float @llvm.minnum.f32(float %x, float %y)
+ %b = call float @llvm.minnum.f32(float %a, float %y)
+ ret float %b
+}
+
+define float @maxnum_x_maxnum_x_y(float %x, float %y) {
+; CHECK-LABEL: @maxnum_x_maxnum_x_y(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
+; CHECK-NEXT: [[B:%.*]] = call float @llvm.maxnum.f32(float [[X]], float [[A]])
+; CHECK-NEXT: ret float [[B]]
+;
+ %a = call float @llvm.maxnum.f32(float %x, float %y)
+ %b = call float @llvm.maxnum.f32(float %x, float %a)
+ ret float %b
+}
+
+define float @maxnum_y_maxnum_x_y(float %x, float %y) {
+; CHECK-LABEL: @maxnum_y_maxnum_x_y(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
+; CHECK-NEXT: [[B:%.*]] = call float @llvm.maxnum.f32(float [[Y]], float [[A]])
+; CHECK-NEXT: ret float [[B]]
+;
+ %a = call float @llvm.maxnum.f32(float %x, float %y)
+ %b = call float @llvm.maxnum.f32(float %y, float %a)
+ ret float %b
+}
+
+define float @maxnum_x_y_maxnum_x(float %x, float %y) {
+; CHECK-LABEL: @maxnum_x_y_maxnum_x(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
+; CHECK-NEXT: [[B:%.*]] = call float @llvm.maxnum.f32(float [[A]], float [[X]])
+; CHECK-NEXT: ret float [[B]]
+;
+ %a = call float @llvm.maxnum.f32(float %x, float %y)
+ %b = call float @llvm.maxnum.f32(float %a, float %x)
+ ret float %b
+}
+
+define float @maxnum_x_y_maxnum_y(float %x, float %y) {
+; CHECK-LABEL: @maxnum_x_y_maxnum_y(
+; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
+; CHECK-NEXT: [[B:%.*]] = call float @llvm.maxnum.f32(float [[A]], float [[Y]])
+; CHECK-NEXT: ret float [[B]]
+;
+ %a = call float @llvm.maxnum.f32(float %x, float %y)
+ %b = call float @llvm.maxnum.f32(float %a, float %y)
+ ret float %b
+}
+
More information about the llvm-commits
mailing list