summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ
diff options
context:
space:
mode:
authorJonas Paulsson <jonas.paulsson@ericsson.com>2015-10-01 18:12:28 +0000
committerJonas Paulsson <jonas.paulsson@ericsson.com>2015-10-01 18:12:28 +0000
commit12629324a4e97e9619848826c80314a88f9eae85 (patch)
tree781f9369d937094e77272dd967951e1cd28a3337 /llvm/test/CodeGen/SystemZ
parent2696bbeb93acf67734fe1310ef3d643ab377deba (diff)
downloadbcm5719-llvm-12629324a4e97e9619848826c80314a88f9eae85.tar.gz
bcm5719-llvm-12629324a4e97e9619848826c80314a88f9eae85.zip
[SystemZ] Add some generic (floating point support) load instructions.
Add generic instructions for load complement, load negative and load positive for fp32 and fp64, and let isel prefer them. They do not clobber CC, and so give scheduler more freedom. SystemZElimCompare pass will convert them when it can to the CC-setting variants. Regression tests updated to expect the new opcodes in places where the old ones where used. New test case SystemZ/fp-cmp-05.ll checks that SystemZCompareElim.cpp can handle the new opcodes. README.txt updated (bullet removed). Note that fp128 is not yet handled, because it is relatively rare, and is a bit trickier, because of the fact that l.dfr would operate on the sign bit of one of the subregisters of a fp128, but we would not want to copy the other sub-reg in case src and dst regs are not the same. Reviewed by Ulrich Weigand. llvm-svn: 249046
Diffstat (limited to 'llvm/test/CodeGen/SystemZ')
-rw-r--r--llvm/test/CodeGen/SystemZ/args-01.ll4
-rw-r--r--llvm/test/CodeGen/SystemZ/args-02.ll4
-rw-r--r--llvm/test/CodeGen/SystemZ/args-03.ll4
-rw-r--r--llvm/test/CodeGen/SystemZ/fp-abs-01.ll4
-rw-r--r--llvm/test/CodeGen/SystemZ/fp-abs-02.ll4
-rw-r--r--llvm/test/CodeGen/SystemZ/fp-cmp-05.ll81
-rw-r--r--llvm/test/CodeGen/SystemZ/fp-const-02.ll4
-rw-r--r--llvm/test/CodeGen/SystemZ/fp-neg-01.ll4
8 files changed, 95 insertions, 14 deletions
diff --git a/llvm/test/CodeGen/SystemZ/args-01.ll b/llvm/test/CodeGen/SystemZ/args-01.ll
index 3105503eda5..113110faf34 100644
--- a/llvm/test/CodeGen/SystemZ/args-01.ll
+++ b/llvm/test/CodeGen/SystemZ/args-01.ll
@@ -30,12 +30,12 @@ define void @foo() {
;
; CHECK-FLOAT-LABEL: foo:
; CHECK-FLOAT: lzer %f0
-; CHECK-FLOAT: lcebr %f4, %f0
+; CHECK-FLOAT: lcdfr %f4, %f0
; CHECK-FLOAT: brasl %r14, bar@PLT
;
; CHECK-DOUBLE-LABEL: foo:
; CHECK-DOUBLE: lzdr %f2
-; CHECK-DOUBLE: lcdbr %f6, %f2
+; CHECK-DOUBLE: lcdfr %f6, %f2
; CHECK-DOUBLE: brasl %r14, bar@PLT
;
; CHECK-FP128-1-LABEL: foo:
diff --git a/llvm/test/CodeGen/SystemZ/args-02.ll b/llvm/test/CodeGen/SystemZ/args-02.ll
index 8686df88e67..89b080e821b 100644
--- a/llvm/test/CodeGen/SystemZ/args-02.ll
+++ b/llvm/test/CodeGen/SystemZ/args-02.ll
@@ -31,12 +31,12 @@ define void @foo() {
;
; CHECK-FLOAT-LABEL: foo:
; CHECK-FLOAT: lzer %f0
-; CHECK-FLOAT: lcebr %f4, %f0
+; CHECK-FLOAT: lcdfr %f4, %f0
; CHECK-FLOAT: brasl %r14, bar@PLT
;
; CHECK-DOUBLE-LABEL: foo:
; CHECK-DOUBLE: lzdr %f2
-; CHECK-DOUBLE: lcdbr %f6, %f2
+; CHECK-DOUBLE: lcdfr %f6, %f2
; CHECK-DOUBLE: brasl %r14, bar@PLT
;
; CHECK-FP128-1-LABEL: foo:
diff --git a/llvm/test/CodeGen/SystemZ/args-03.ll b/llvm/test/CodeGen/SystemZ/args-03.ll
index d7d3ea105df..a52782f4c18 100644
--- a/llvm/test/CodeGen/SystemZ/args-03.ll
+++ b/llvm/test/CodeGen/SystemZ/args-03.ll
@@ -31,12 +31,12 @@ define void @foo() {
;
; CHECK-FLOAT-LABEL: foo:
; CHECK-FLOAT: lzer %f0
-; CHECK-FLOAT: lcebr %f4, %f0
+; CHECK-FLOAT: lcdfr %f4, %f0
; CHECK-FLOAT: brasl %r14, bar@PLT
;
; CHECK-DOUBLE-LABEL: foo:
; CHECK-DOUBLE: lzdr %f2
-; CHECK-DOUBLE: lcdbr %f6, %f2
+; CHECK-DOUBLE: lcdfr %f6, %f2
; CHECK-DOUBLE: brasl %r14, bar@PLT
;
; CHECK-FP128-1-LABEL: foo:
diff --git a/llvm/test/CodeGen/SystemZ/fp-abs-01.ll b/llvm/test/CodeGen/SystemZ/fp-abs-01.ll
index 3b143d93315..3bb3ede457f 100644
--- a/llvm/test/CodeGen/SystemZ/fp-abs-01.ll
+++ b/llvm/test/CodeGen/SystemZ/fp-abs-01.ll
@@ -7,7 +7,7 @@
declare float @llvm.fabs.f32(float %f)
define float @f1(float %f) {
; CHECK-LABEL: f1:
-; CHECK: lpebr %f0, %f0
+; CHECK: lpdfr %f0, %f0
; CHECK: br %r14
%res = call float @llvm.fabs.f32(float %f)
ret float %res
@@ -17,7 +17,7 @@ define float @f1(float %f) {
declare double @llvm.fabs.f64(double %f)
define double @f2(double %f) {
; CHECK-LABEL: f2:
-; CHECK: lpdbr %f0, %f0
+; CHECK: lpdfr %f0, %f0
; CHECK: br %r14
%res = call double @llvm.fabs.f64(double %f)
ret double %res
diff --git a/llvm/test/CodeGen/SystemZ/fp-abs-02.ll b/llvm/test/CodeGen/SystemZ/fp-abs-02.ll
index e831ddb86fe..b2d2cfd52b6 100644
--- a/llvm/test/CodeGen/SystemZ/fp-abs-02.ll
+++ b/llvm/test/CodeGen/SystemZ/fp-abs-02.ll
@@ -7,7 +7,7 @@
declare float @llvm.fabs.f32(float %f)
define float @f1(float %f) {
; CHECK-LABEL: f1:
-; CHECK: lnebr %f0, %f0
+; CHECK: lndfr %f0, %f0
; CHECK: br %r14
%abs = call float @llvm.fabs.f32(float %f)
%res = fsub float -0.0, %abs
@@ -18,7 +18,7 @@ define float @f1(float %f) {
declare double @llvm.fabs.f64(double %f)
define double @f2(double %f) {
; CHECK-LABEL: f2:
-; CHECK: lndbr %f0, %f0
+; CHECK: lndfr %f0, %f0
; CHECK: br %r14
%abs = call double @llvm.fabs.f64(double %f)
%res = fsub double -0.0, %abs
diff --git a/llvm/test/CodeGen/SystemZ/fp-cmp-05.ll b/llvm/test/CodeGen/SystemZ/fp-cmp-05.ll
new file mode 100644
index 00000000000..1d71a0fcec5
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/fp-cmp-05.ll
@@ -0,0 +1,81 @@
+; Test that floating-point instructions that set cc are used to
+; eliminate compares for load complement, load negative and load
+; positive. Right now, the WFL.DB (vector) instructions are not
+; handled by SystemZElimcompare, so for Z13 this is currently
+; unimplemented.
+;
+; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s -check-prefix=CHECK-Z10
+
+; Load complement (sign-bit flipped).
+; Test f32
+define float @f1(float %a, float %b, float %f) {
+; CHECK-LABEL: f1:
+; CHECK-Z10: lcebr
+; CHECK-Z10-NEXT: je
+ %neg = fsub float -0.0, %f
+ %cond = fcmp oeq float %neg, 0.0
+ %res = select i1 %cond, float %a, float %b
+ ret float %res
+}
+
+; Test f64
+define double @f2(double %a, double %b, double %f) {
+; CHECK-LABEL: f2:
+; CHECK-Z10: lcdbr
+; CHECK-Z10-NEXT: je
+ %neg = fsub double -0.0, %f
+ %cond = fcmp oeq double %neg, 0.0
+ %res = select i1 %cond, double %a, double %b
+ ret double %res
+}
+
+; Negation of floating-point absolute.
+; Test f32
+declare float @llvm.fabs.f32(float %f)
+define float @f3(float %a, float %b, float %f) {
+; CHECK-LABEL: f3:
+; CHECK-Z10: lnebr
+; CHECK-Z10-NEXT: je
+ %abs = call float @llvm.fabs.f32(float %f)
+ %neg = fsub float -0.0, %abs
+ %cond = fcmp oeq float %neg, 0.0
+ %res = select i1 %cond, float %a, float %b
+ ret float %res
+}
+
+; Test f64
+declare double @llvm.fabs.f64(double %f)
+define double @f4(double %a, double %b, double %f) {
+; CHECK-LABEL: f4:
+; CHECK-Z10: lndbr
+; CHECK-Z10-NEXT: je
+ %abs = call double @llvm.fabs.f64(double %f)
+ %neg = fsub double -0.0, %abs
+ %cond = fcmp oeq double %neg, 0.0
+ %res = select i1 %cond, double %a, double %b
+ ret double %res
+}
+
+; Absolute floating-point value.
+; Test f32
+define float @f5(float %a, float %b, float %f) {
+; CHECK-LABEL: f5:
+; CHECK-Z10: lpebr
+; CHECK-Z10-NEXT: je
+ %abs = call float @llvm.fabs.f32(float %f)
+ %cond = fcmp oeq float %abs, 0.0
+ %res = select i1 %cond, float %a, float %b
+ ret float %res
+}
+
+; Test f64
+define double @f6(double %a, double %b, double %f) {
+; CHECK-LABEL: f6:
+; CHECK-Z10: lpdbr
+; CHECK-Z10-NEXT: je
+ %abs = call double @llvm.fabs.f64(double %f)
+ %cond = fcmp oeq double %abs, 0.0
+ %res = select i1 %cond, double %a, double %b
+ ret double %res
+}
+
diff --git a/llvm/test/CodeGen/SystemZ/fp-const-02.ll b/llvm/test/CodeGen/SystemZ/fp-const-02.ll
index 96f857895ec..942465c0660 100644
--- a/llvm/test/CodeGen/SystemZ/fp-const-02.ll
+++ b/llvm/test/CodeGen/SystemZ/fp-const-02.ll
@@ -6,7 +6,7 @@
define float @f1() {
; CHECK-LABEL: f1:
; CHECK: lzer [[REGISTER:%f[0-5]+]]
-; CHECK: lcebr %f0, [[REGISTER]]
+; CHECK: lcdfr %f0, [[REGISTER]]
; CHECK: br %r14
ret float -0.0
}
@@ -15,7 +15,7 @@ define float @f1() {
define double @f2() {
; CHECK-LABEL: f2:
; CHECK: lzdr [[REGISTER:%f[0-5]+]]
-; CHECK: lcdbr %f0, [[REGISTER]]
+; CHECK: lcdfr %f0, [[REGISTER]]
; CHECK: br %r14
ret double -0.0
}
diff --git a/llvm/test/CodeGen/SystemZ/fp-neg-01.ll b/llvm/test/CodeGen/SystemZ/fp-neg-01.ll
index fe2e5f67cf5..b9810f9f34d 100644
--- a/llvm/test/CodeGen/SystemZ/fp-neg-01.ll
+++ b/llvm/test/CodeGen/SystemZ/fp-neg-01.ll
@@ -6,7 +6,7 @@
; Test f32.
define float @f1(float %f) {
; CHECK-LABEL: f1:
-; CHECK: lcebr %f0, %f0
+; CHECK: lcdfr %f0, %f0
; CHECK: br %r14
%res = fsub float -0.0, %f
ret float %res
@@ -15,7 +15,7 @@ define float @f1(float %f) {
; Test f64.
define double @f2(double %f) {
; CHECK-LABEL: f2:
-; CHECK: lcdbr %f0, %f0
+; CHECK: lcdfr %f0, %f0
; CHECK: br %r14
%res = fsub double -0.0, %f
ret double %res
OpenPOWER on IntegriCloud