[llvm] 5ad67df - [SystemZ] Add llvm.minimum / llvm.maximum tests
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 08:01:36 PST 2019
Author: Ulrich Weigand
Date: 2019-12-11T17:01:13+01:00
New Revision: 5ad67df988f12f38b50f720c0fc4f1fa3b94a311
URL: https://github.com/llvm/llvm-project/commit/5ad67df988f12f38b50f720c0fc4f1fa3b94a311
DIFF: https://github.com/llvm/llvm-project/commit/5ad67df988f12f38b50f720c0fc4f1fa3b94a311.diff
LOG: [SystemZ] Add llvm.minimum / llvm.maximum tests
The backend already supports the @llvm.minimum and @llvm.maximum
intrinsics, but we had no test cases for those. Add tests.
Added:
Modified:
llvm/test/CodeGen/SystemZ/vec-max-05.ll
llvm/test/CodeGen/SystemZ/vec-min-05.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/SystemZ/vec-max-05.ll b/llvm/test/CodeGen/SystemZ/vec-max-05.ll
index 1fe0db350b74..8ad5e0e9b83a 100644
--- a/llvm/test/CodeGen/SystemZ/vec-max-05.ll
+++ b/llvm/test/CodeGen/SystemZ/vec-max-05.ll
@@ -5,13 +5,18 @@
declare double @fmax(double, double)
declare double @llvm.maxnum.f64(double, double)
declare <2 x double> @llvm.maxnum.v2f64(<2 x double>, <2 x double>)
+declare double @llvm.maximum.f64(double, double)
+declare <2 x double> @llvm.maximum.v2f64(<2 x double>, <2 x double>)
declare float @fmaxf(float, float)
declare float @llvm.maxnum.f32(float, float)
declare <4 x float> @llvm.maxnum.v4f32(<4 x float>, <4 x float>)
+declare float @llvm.maximum.f32(float, float)
+declare <4 x float> @llvm.maximum.v4f32(<4 x float>, <4 x float>)
declare fp128 @fmaxl(fp128, fp128)
declare fp128 @llvm.maxnum.f128(fp128, fp128)
+declare fp128 @llvm.maximum.f128(fp128, fp128)
; Test the fmax library function.
define double @f1(double %dummy, double %val1, double %val2) {
@@ -31,9 +36,18 @@ define double @f2(double %dummy, double %val1, double %val2) {
ret double %ret
}
-; Test a f64 constant compare/select resulting in maxnum.
-define double @f3(double %dummy, double %val) {
+; Test the f64 maximum intrinsic.
+define double @f3(double %dummy, double %val1, double %val2) {
; CHECK-LABEL: f3:
+; CHECK: wfmaxdb %f0, %f2, %f4, 1
+; CHECK: br %r14
+ %ret = call double @llvm.maximum.f64(double %val1, double %val2)
+ ret double %ret
+}
+
+; Test a f64 constant compare/select resulting in maxnum.
+define double @f4(double %dummy, double %val) {
+; CHECK-LABEL: f4:
; CHECK: lzdr [[REG:%f[0-9]+]]
; CHECK: wfmaxdb %f0, %f2, [[REG]], 4
; CHECK: br %r14
@@ -43,8 +57,8 @@ define double @f3(double %dummy, double %val) {
}
; Test a f64 constant compare/select resulting in maximum.
-define double @f4(double %dummy, double %val) {
-; CHECK-LABEL: f4:
+define double @f5(double %dummy, double %val) {
+; CHECK-LABEL: f5:
; CHECK: lzdr [[REG:%f[0-9]+]]
; CHECK: wfmaxdb %f0, %f2, [[REG]], 1
; CHECK: br %r14
@@ -54,15 +68,25 @@ define double @f4(double %dummy, double %val) {
}
; Test the v2f64 maxnum intrinsic.
-define <2 x double> @f5(<2 x double> %dummy, <2 x double> %val1,
+define <2 x double> @f6(<2 x double> %dummy, <2 x double> %val1,
<2 x double> %val2) {
-; CHECK-LABEL: f5:
+; CHECK-LABEL: f6:
; CHECK: vfmaxdb %v24, %v26, %v28, 4
; CHECK: br %r14
%ret = call <2 x double> @llvm.maxnum.v2f64(<2 x double> %val1, <2 x double> %val2)
ret <2 x double> %ret
}
+; Test the v2f64 maximum intrinsic.
+define <2 x double> @f7(<2 x double> %dummy, <2 x double> %val1,
+ <2 x double> %val2) {
+; CHECK-LABEL: f7:
+; CHECK: vfmaxdb %v24, %v26, %v28, 1
+; CHECK: br %r14
+ %ret = call <2 x double> @llvm.maximum.v2f64(<2 x double> %val1, <2 x double> %val2)
+ ret <2 x double> %ret
+}
+
; Test the fmaxf library function.
define float @f11(float %dummy, float %val1, float %val2) {
; CHECK-LABEL: f11:
@@ -81,9 +105,18 @@ define float @f12(float %dummy, float %val1, float %val2) {
ret float %ret
}
-; Test a f32 constant compare/select resulting in maxnum.
-define float @f13(float %dummy, float %val) {
+; Test the f32 maximum intrinsic.
+define float @f13(float %dummy, float %val1, float %val2) {
; CHECK-LABEL: f13:
+; CHECK: wfmaxsb %f0, %f2, %f4, 1
+; CHECK: br %r14
+ %ret = call float @llvm.maximum.f32(float %val1, float %val2)
+ ret float %ret
+}
+
+; Test a f32 constant compare/select resulting in maxnum.
+define float @f14(float %dummy, float %val) {
+; CHECK-LABEL: f14:
; CHECK: lzer [[REG:%f[0-9]+]]
; CHECK: wfmaxsb %f0, %f2, [[REG]], 4
; CHECK: br %r14
@@ -93,8 +126,8 @@ define float @f13(float %dummy, float %val) {
}
; Test a f32 constant compare/select resulting in maximum.
-define float @f14(float %dummy, float %val) {
-; CHECK-LABEL: f14:
+define float @f15(float %dummy, float %val) {
+; CHECK-LABEL: f15:
; CHECK: lzer [[REG:%f[0-9]+]]
; CHECK: wfmaxsb %f0, %f2, [[REG]], 1
; CHECK: br %r14
@@ -104,15 +137,25 @@ define float @f14(float %dummy, float %val) {
}
; Test the v4f32 maxnum intrinsic.
-define <4 x float> @f15(<4 x float> %dummy, <4 x float> %val1,
+define <4 x float> @f16(<4 x float> %dummy, <4 x float> %val1,
<4 x float> %val2) {
-; CHECK-LABEL: f15:
+; CHECK-LABEL: f16:
; CHECK: vfmaxsb %v24, %v26, %v28, 4
; CHECK: br %r14
%ret = call <4 x float> @llvm.maxnum.v4f32(<4 x float> %val1, <4 x float> %val2)
ret <4 x float> %ret
}
+; Test the v4f32 maximum intrinsic.
+define <4 x float> @f17(<4 x float> %dummy, <4 x float> %val1,
+ <4 x float> %val2) {
+; CHECK-LABEL: f17:
+; CHECK: vfmaxsb %v24, %v26, %v28, 1
+; CHECK: br %r14
+ %ret = call <4 x float> @llvm.maximum.v4f32(<4 x float> %val1, <4 x float> %val2)
+ ret <4 x float> %ret
+}
+
; Test the fmaxl library function.
define void @f21(fp128 *%ptr1, fp128 *%ptr2, fp128 *%dst) {
; CHECK-LABEL: f21:
@@ -143,10 +186,25 @@ define void @f22(fp128 *%ptr1, fp128 *%ptr2, fp128 *%dst) {
ret void
}
-; Test a f128 constant compare/select resulting in maxnum.
-define void @f23(fp128 *%ptr, fp128 *%dst) {
+; Test the f128 maximum intrinsic.
+define void @f23(fp128 *%ptr1, fp128 *%ptr2, fp128 *%dst) {
; CHECK-LABEL: f23:
; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
+; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
+; CHECK: wfmaxxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], 1
+; CHECK: vst [[RES]], 0(%r4)
+; CHECK: br %r14
+ %val1 = load fp128, fp128* %ptr1
+ %val2 = load fp128, fp128* %ptr2
+ %res = call fp128 @llvm.maximum.f128(fp128 %val1, fp128 %val2)
+ store fp128 %res, fp128* %dst
+ ret void
+}
+
+; Test a f128 constant compare/select resulting in maxnum.
+define void @f24(fp128 *%ptr, fp128 *%dst) {
+; CHECK-LABEL: f24:
+; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
; CHECK-DAG: vzero [[REG2:%v[0-9]+]]
; CHECK: wfmaxxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], 4
; CHECK: vst [[RES]], 0(%r3)
@@ -159,8 +217,8 @@ define void @f23(fp128 *%ptr, fp128 *%dst) {
}
; Test a f128 constant compare/select resulting in maximum.
-define void @f24(fp128 *%ptr, fp128 *%dst) {
-; CHECK-LABEL: f24:
+define void @f25(fp128 *%ptr, fp128 *%dst) {
+; CHECK-LABEL: f25:
; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
; CHECK-DAG: vzero [[REG2:%v[0-9]+]]
; CHECK: wfmaxxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], 1
diff --git a/llvm/test/CodeGen/SystemZ/vec-min-05.ll b/llvm/test/CodeGen/SystemZ/vec-min-05.ll
index 6417e5ed7508..9e1e816029e1 100644
--- a/llvm/test/CodeGen/SystemZ/vec-min-05.ll
+++ b/llvm/test/CodeGen/SystemZ/vec-min-05.ll
@@ -5,13 +5,18 @@
declare double @fmin(double, double)
declare double @llvm.minnum.f64(double, double)
declare <2 x double> @llvm.minnum.v2f64(<2 x double>, <2 x double>)
+declare double @llvm.minimum.f64(double, double)
+declare <2 x double> @llvm.minimum.v2f64(<2 x double>, <2 x double>)
declare float @fminf(float, float)
declare float @llvm.minnum.f32(float, float)
declare <4 x float> @llvm.minnum.v4f32(<4 x float>, <4 x float>)
+declare float @llvm.minimum.f32(float, float)
+declare <4 x float> @llvm.minimum.v4f32(<4 x float>, <4 x float>)
declare fp128 @fminl(fp128, fp128)
declare fp128 @llvm.minnum.f128(fp128, fp128)
+declare fp128 @llvm.minimum.f128(fp128, fp128)
; Test the fmin library function.
define double @f1(double %dummy, double %val1, double %val2) {
@@ -31,9 +36,18 @@ define double @f2(double %dummy, double %val1, double %val2) {
ret double %ret
}
-; Test a f64 constant compare/select resulting in minnum.
-define double @f3(double %dummy, double %val) {
+; Test the f64 minimum intrinsic.
+define double @f3(double %dummy, double %val1, double %val2) {
; CHECK-LABEL: f3:
+; CHECK: wfmindb %f0, %f2, %f4, 1
+; CHECK: br %r14
+ %ret = call double @llvm.minimum.f64(double %val1, double %val2)
+ ret double %ret
+}
+
+; Test a f64 constant compare/select resulting in minnum.
+define double @f4(double %dummy, double %val) {
+; CHECK-LABEL: f4:
; CHECK: lzdr [[REG:%f[0-9]+]]
; CHECK: wfmindb %f0, %f2, [[REG]], 4
; CHECK: br %r14
@@ -43,8 +57,8 @@ define double @f3(double %dummy, double %val) {
}
; Test a f64 constant compare/select resulting in minimum.
-define double @f4(double %dummy, double %val) {
-; CHECK-LABEL: f4:
+define double @f5(double %dummy, double %val) {
+; CHECK-LABEL: f5:
; CHECK: lzdr [[REG:%f[0-9]+]]
; CHECK: wfmindb %f0, %f2, [[REG]], 1
; CHECK: br %r14
@@ -54,15 +68,25 @@ define double @f4(double %dummy, double %val) {
}
; Test the v2f64 minnum intrinsic.
-define <2 x double> @f5(<2 x double> %dummy, <2 x double> %val1,
+define <2 x double> @f6(<2 x double> %dummy, <2 x double> %val1,
<2 x double> %val2) {
-; CHECK-LABEL: f5:
+; CHECK-LABEL: f6:
; CHECK: vfmindb %v24, %v26, %v28, 4
; CHECK: br %r14
%ret = call <2 x double> @llvm.minnum.v2f64(<2 x double> %val1, <2 x double> %val2)
ret <2 x double> %ret
}
+; Test the v2f64 minimum intrinsic.
+define <2 x double> @f7(<2 x double> %dummy, <2 x double> %val1,
+ <2 x double> %val2) {
+; CHECK-LABEL: f7:
+; CHECK: vfmindb %v24, %v26, %v28, 1
+; CHECK: br %r14
+ %ret = call <2 x double> @llvm.minimum.v2f64(<2 x double> %val1, <2 x double> %val2)
+ ret <2 x double> %ret
+}
+
; Test the fminf library function.
define float @f11(float %dummy, float %val1, float %val2) {
; CHECK-LABEL: f11:
@@ -81,9 +105,18 @@ define float @f12(float %dummy, float %val1, float %val2) {
ret float %ret
}
-; Test a f32 constant compare/select resulting in minnum.
-define float @f13(float %dummy, float %val) {
+; Test the f32 minimum intrinsic.
+define float @f13(float %dummy, float %val1, float %val2) {
; CHECK-LABEL: f13:
+; CHECK: wfminsb %f0, %f2, %f4, 1
+; CHECK: br %r14
+ %ret = call float @llvm.minimum.f32(float %val1, float %val2)
+ ret float %ret
+}
+
+; Test a f32 constant compare/select resulting in minnum.
+define float @f14(float %dummy, float %val) {
+; CHECK-LABEL: f14:
; CHECK: lzer [[REG:%f[0-9]+]]
; CHECK: wfminsb %f0, %f2, [[REG]], 4
; CHECK: br %r14
@@ -93,8 +126,8 @@ define float @f13(float %dummy, float %val) {
}
; Test a f32 constant compare/select resulting in minimum.
-define float @f14(float %dummy, float %val) {
-; CHECK-LABEL: f14:
+define float @f15(float %dummy, float %val) {
+; CHECK-LABEL: f15:
; CHECK: lzer [[REG:%f[0-9]+]]
; CHECK: wfminsb %f0, %f2, [[REG]], 1
; CHECK: br %r14
@@ -104,15 +137,25 @@ define float @f14(float %dummy, float %val) {
}
; Test the v4f32 minnum intrinsic.
-define <4 x float> @f15(<4 x float> %dummy, <4 x float> %val1,
+define <4 x float> @f16(<4 x float> %dummy, <4 x float> %val1,
<4 x float> %val2) {
-; CHECK-LABEL: f15:
+; CHECK-LABEL: f16:
; CHECK: vfminsb %v24, %v26, %v28, 4
; CHECK: br %r14
%ret = call <4 x float> @llvm.minnum.v4f32(<4 x float> %val1, <4 x float> %val2)
ret <4 x float> %ret
}
+; Test the v4f32 minimum intrinsic.
+define <4 x float> @f17(<4 x float> %dummy, <4 x float> %val1,
+ <4 x float> %val2) {
+; CHECK-LABEL: f17:
+; CHECK: vfminsb %v24, %v26, %v28, 1
+; CHECK: br %r14
+ %ret = call <4 x float> @llvm.minimum.v4f32(<4 x float> %val1, <4 x float> %val2)
+ ret <4 x float> %ret
+}
+
; Test the fminl library function.
define void @f21(fp128 *%ptr1, fp128 *%ptr2, fp128 *%dst) {
; CHECK-LABEL: f21:
@@ -143,10 +186,25 @@ define void @f22(fp128 *%ptr1, fp128 *%ptr2, fp128 *%dst) {
ret void
}
-; Test a f128 constant compare/select resulting in minnum.
-define void @f23(fp128 *%ptr, fp128 *%dst) {
+; Test the f128 minimum intrinsic.
+define void @f23(fp128 *%ptr1, fp128 *%ptr2, fp128 *%dst) {
; CHECK-LABEL: f23:
; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
+; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
+; CHECK: wfminxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], 1
+; CHECK: vst [[RES]], 0(%r4)
+; CHECK: br %r14
+ %val1 = load fp128, fp128* %ptr1
+ %val2 = load fp128, fp128* %ptr2
+ %res = call fp128 @llvm.minimum.f128(fp128 %val1, fp128 %val2)
+ store fp128 %res, fp128* %dst
+ ret void
+}
+
+; Test a f128 constant compare/select resulting in minnum.
+define void @f24(fp128 *%ptr, fp128 *%dst) {
+; CHECK-LABEL: f24:
+; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
; CHECK-DAG: vzero [[REG2:%v[0-9]+]]
; CHECK: wfminxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], 4
; CHECK: vst [[RES]], 0(%r3)
@@ -159,8 +217,8 @@ define void @f23(fp128 *%ptr, fp128 *%dst) {
}
; Test a f128 constant compare/select resulting in minimum.
-define void @f24(fp128 *%ptr, fp128 *%dst) {
-; CHECK-LABEL: f24:
+define void @f25(fp128 *%ptr, fp128 *%dst) {
+; CHECK-LABEL: f25:
; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
; CHECK-DAG: vzero [[REG2:%v[0-9]+]]
; CHECK: wfminxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], 1
More information about the llvm-commits
mailing list