forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249046 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Jonas Paulsson
committed
Oct 1, 2015
1 parent
3fffb69
commit 89b44df
Showing
12 changed files
with
132 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters