Skip to content

Commit 9ed85d3

Browse files
committed
Updates per review.
1 parent 9f97d49 commit 9ed85d3

26 files changed

+499
-484
lines changed

compiler-rt/lib/builtins/extendhfdf2.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#define DST_DOUBLE
1111
#include "fp_extend_impl.inc"
1212

13-
// Use a forwarding definition and noinline to implement a poor man's alias,
14-
// as there isn't a good cross-platform way of defining one.
1513
COMPILER_RT_ABI NOINLINE dst_t __extendhfdf2(src_t a) {
1614
return __extendXfYf2__(a);
1715
}

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 228 additions & 108 deletions
Large diffs are not rendered by default.

llvm/lib/Target/SystemZ/SystemZISelLowering.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,9 @@ class SystemZTargetLowering : public TargetLowering {
627627
bool IsSigned, SDLoc DL, bool DoesNotReturn,
628628
bool IsReturnValueUsed) const;
629629

630+
SDValue useLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, MVT VT, SDValue Arg,
631+
SDLoc DL, SDValue Chain, bool IsStrict) const;
632+
630633
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
631634
bool isVarArg,
632635
const SmallVectorImpl<ISD::OutputArg> &Outs,
@@ -747,9 +750,7 @@ class SystemZTargetLowering : public TargetLowering {
747750
SDValue lowerFSHR(SDValue Op, SelectionDAG &DAG) const;
748751
SDValue lowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const;
749752
SDValue lower_FP_TO_INT(SDValue Op, SelectionDAG &DAG) const;
750-
SDValue lowerSTRICT_FP_TO_INT(SDValue Op, SelectionDAG &DAG) const;
751753
SDValue lower_INT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
752-
SDValue lowerSTRICT_INT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
753754
SDValue lowerLoadF16(SDValue Op, SelectionDAG &DAG) const;
754755
SDValue lowerStoreF16(SDValue Op, SelectionDAG &DAG) const;
755756

llvm/lib/Target/SystemZ/SystemZInstrVector.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ let Predicates = [FeatureVector] in {
142142
// LEY and LDY offer full 20-bit displacement fields. It's often better
143143
// to use those instructions rather than force a 20-bit displacement
144144
// into a GPR temporary.
145-
let mayLoad = 1, canFoldAsLoad = 1 in {
145+
let mayLoad = 1, SimpleBDXLoad = 1, canFoldAsLoad = 1 in {
146146
def VL16 : UnaryAliasVRX<z_load, v16hb, bdxaddr12pair>;
147147
def VL32 : UnaryAliasVRX<z_load, v32sb, bdxaddr12pair>;
148148
def VL64 : UnaryAliasVRX<z_load, v64db, bdxaddr12pair>;
@@ -240,7 +240,7 @@ let Predicates = [FeatureVector] in {
240240
// STEY and STDY offer full 20-bit displacement fields. It's often better
241241
// to use those instructions rather than force a 20-bit displacement
242242
// into a GPR temporary.
243-
let mayStore = 1 in {
243+
let mayStore = 1, SimpleBDXStore = 1 in {
244244
def VST16 : StoreAliasVRX<store, v16hb, bdxaddr12pair>;
245245
def VST32 : StoreAliasVRX<store, v32sb, bdxaddr12pair>;
246246
def VST64 : StoreAliasVRX<store, v64db, bdxaddr12pair>;

llvm/test/CodeGen/SystemZ/atomic-load-10.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
define half @f1(ptr %src) {
88
; CHECK-LABEL: f1:
99
; CHECK: # %bb.0:
10-
; CHECK-NEXT: lh %r0, 0(%r2)
10+
; CHECK-NEXT: lgh %r0, 0(%r2)
1111
; CHECK-NEXT: sllg %r0, %r0, 48
1212
; CHECK-NEXT: ldgr %f0, %r0
1313
; CHECK-NEXT: # kill: def $f0h killed $f0h killed $f0d

llvm/test/CodeGen/SystemZ/fp-abs-01.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
declare half @llvm.fabs.f16(half %f)
88
define half @f0(half %f) {
99
; CHECK-LABEL: f0:
10-
; CHECK: brasl %r14, __extendhfsf2@PLT
11-
; CHECK: lpdfr %f0, %f0
10+
; CHECK: brasl %r14, __extendhfsf2@PLT
11+
; CHECK-NEXT: lpdfr %f0, %f0
12+
; CHECK-NEXT: brasl %r14, __truncsfhf2@PLT
1213
; CHECK: br %r14
1314
%res = call half @llvm.fabs.f16(half %f)
1415
ret half %res

llvm/test/CodeGen/SystemZ/fp-abs-03.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
declare half @llvm.fabs.f16(half %f)
77
define half @f0(half %f) {
88
; CHECK-LABEL: f0:
9-
; CHECK: brasl %r14, __extendhfsf2@PLT
10-
; CHECK: lpdfr %f0, %f0
11-
; CHECK: brasl %r14, __truncsfhf2@PLT
9+
; CHECK: brasl %r14, __extendhfsf2@PLT
10+
; CHECK-NEXT: lpdfr %f0, %f0
11+
; CHECK-NEXT: brasl %r14, __truncsfhf2@PLT
1212
; CHECK: br %r14
1313
%res = call half @llvm.fabs.f16(half %f)
1414
ret half %res

llvm/test/CodeGen/SystemZ/fp-conv-08.ll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
; Test i64->f16. For z10, this results in just a single a libcall.
66
define half @f0(i64 %i) {
77
; CHECK-LABEL: f0:
8-
; CHECK: brasl %r14, __floatundihf@PLT
8+
; CHECK: cegbr
9+
; CHECK: aebr
10+
; CHECK: brasl %r14, __truncsfhf2@PLT
911
; CHECK: br %r14
1012
%conv = uitofp i64 %i to half
1113
ret half %conv

llvm/test/CodeGen/SystemZ/fp-conv-20.ll

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ define float @f3(i128 %i) {
3333
; Test signed i128->f16.
3434
define half @f4(i128 %i) {
3535
; CHECK-LABEL: f4:
36-
; CHECK: brasl %r14, __floattihf@PLT
36+
; CHECK: brasl %r14, __floattisf@PLT
37+
; CHECK: brasl %r14, __truncsfhf2@PLT
3738
; CHECK: br %r14
3839
%conv = sitofp i128 %i to half
3940
ret half %conv
@@ -69,7 +70,8 @@ define float @f7(i128 %i) {
6970
; Test unsigned i128->f16.
7071
define half @f8(i128 %i) {
7172
; CHECK-LABEL: f8:
72-
; CHECK: brasl %r14, __floatuntihf@PLT
73+
; CHECK: brasl %r14, __floatuntisf@PLT
74+
; CHECK: brasl %r14, __truncsfhf2@PLT
7375
; CHECK: br %r14
7476
%conv = uitofp i128 %i to half
7577
ret half %conv
@@ -105,7 +107,8 @@ define i128 @f11(float %f) {
105107
; Test signed f16->i128.
106108
define i128 @f12(half %f) {
107109
; CHECK-LABEL: f12:
108-
; CHECK: brasl %r14, __fixhfti@PLT
110+
; CHECK: brasl %r14, __extendhfsf2@PLT
111+
; CHECK: brasl %r14, __fixsfti@PLT
109112
; CHECK: br %r14
110113
%conv = fptosi half %f to i128
111114
ret i128 %conv
@@ -141,7 +144,8 @@ define i128 @f15(float %f) {
141144
; Test unsigned f16->i128.
142145
define i128 @f16(half %f) {
143146
; CHECK-LABEL: f16:
144-
; CHECK: brasl %r14, __fixunshfti@PLT
147+
; CHECK: brasl %r14, __extendhfsf2@PLT
148+
; CHECK: brasl %r14, __fixunssfti@PLT
145149
; CHECK: br %r14
146150
%conv = fptoui half %f to i128
147151
ret i128 %conv

llvm/test/CodeGen/SystemZ/fp-copysign-01.ll

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,11 @@
22
;
33
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
44

5-
declare half @copysignh(half, half) readnone
65
declare float @copysignf(float, float) readnone
76
declare double @copysign(double, double) readnone
87
; FIXME: not really the correct prototype for SystemZ.
98
declare fp128 @copysignl(fp128, fp128) readnone
109

11-
; Test f32 copies in which the sign comes from an f16.
12-
define float @f0(float %a, half %bh) {
13-
; CHECK-LABEL: f0:
14-
; CHECK: brasl %r14, __extendhfsf2@PLT
15-
; CHECK: cpsdr %f0, %f0, %f8
16-
; CHECK: br %r14
17-
%b = fpext half %bh to float
18-
%res = call float @copysignf(float %a, float %b) readnone
19-
ret float %res
20-
}
21-
2210
; Test f32 copies in which the sign comes from an f32.
2311
define float @f1(float %a, float %b) {
2412
; CHECK-LABEL: f1:
@@ -138,23 +126,3 @@ define void @f9(ptr %cptr, ptr %aptr, ptr %bptr) {
138126
store fp128 %c, ptr %cptr
139127
ret void
140128
}
141-
142-
; Test f16 copies in which the sign comes from an f16.
143-
define half @f10(half %a, half %b) {
144-
; CHECK-LABEL: f10:
145-
; CHECK: brasl %r14, copysignh@PLT
146-
; CHECK: br %r14
147-
%res = call half @copysignh(half %a, half %b) readnone
148-
ret half %res
149-
}
150-
151-
; Test f16 copies in which the sign comes from an f32.
152-
define half @f11(half %a, float %bf) {
153-
; CHECK-LABEL: f11:
154-
; CHECK: brasl %r14, __truncsfhf2@PLT
155-
; CHECK: brasl %r14, copysignh@PLT
156-
; CHECK: br %r14
157-
%b = fptrunc float %bf to half
158-
%res = call half @copysignh(half %a, half %b) readnone
159-
ret half %res
160-
}

0 commit comments

Comments
 (0)