Skip to content

Commit 054ee2f

Browse files
authored
[CSKY] Use softPromoteHalfType (#175138)
Follow suite from other targets. Fixes the C-SKY portion of #97975 Fixes the C-SKY portion of #97981
1 parent a06bf00 commit 054ee2f

4 files changed

Lines changed: 29 additions & 27 deletions

File tree

llvm/lib/Target/CSKY/CSKYISelLowering.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ class CSKYTargetLowering : public TargetLowering {
159159
SDValue C) const override;
160160
bool isCheapToSpeculateCttz(Type *Ty) const override;
161161
bool isCheapToSpeculateCtlz(Type *Ty) const override;
162+
163+
bool softPromoteHalfType() const override { return true; }
162164
};
163165

164166
} // namespace llvm

llvm/test/CodeGen/CSKY/fpu/fp16-promote.ll

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,16 @@ define void @test_fadd(ptr %p, ptr %q) nounwind {
181181
; CHECK-FPUV2-NEXT: st16.w l1, (sp, 8) # 4-byte Folded Spill
182182
; CHECK-FPUV2-NEXT: st16.w l0, (sp, 4) # 4-byte Folded Spill
183183
; CHECK-FPUV2-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
184-
; CHECK-FPUV2-NEXT: mov16 l0, a1
185-
; CHECK-FPUV2-NEXT: mov16 l1, a0
186-
; CHECK-FPUV2-NEXT: ld16.h a0, (a0, 0)
184+
; CHECK-FPUV2-NEXT: mov16 l0, a0
185+
; CHECK-FPUV2-NEXT: ld16.h l1, (a0, 0)
186+
; CHECK-FPUV2-NEXT: ld16.h a0, (a1, 0)
187187
; CHECK-FPUV2-NEXT: jsri32 [.LCPI5_0]
188188
; CHECK-FPUV2-NEXT: fmovs vr8, vr0
189-
; CHECK-FPUV2-NEXT: ld16.h a0, (l0, 0)
189+
; CHECK-FPUV2-NEXT: mov16 a0, l1
190190
; CHECK-FPUV2-NEXT: jsri32 [.LCPI5_0]
191-
; CHECK-FPUV2-NEXT: fadds vr0, vr8, vr0
191+
; CHECK-FPUV2-NEXT: fadds vr0, vr0, vr8
192192
; CHECK-FPUV2-NEXT: jsri32 [.LCPI5_1]
193-
; CHECK-FPUV2-NEXT: st16.h a0, (l1, 0)
193+
; CHECK-FPUV2-NEXT: st16.h a0, (l0, 0)
194194
; CHECK-FPUV2-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
195195
; CHECK-FPUV2-NEXT: ld16.w l0, (sp, 4) # 4-byte Folded Reload
196196
; CHECK-FPUV2-NEXT: ld16.w l1, (sp, 8) # 4-byte Folded Reload
@@ -212,16 +212,16 @@ define void @test_fadd(ptr %p, ptr %q) nounwind {
212212
; CHECK-FPUV3-NEXT: st16.w l1, (sp, 8) # 4-byte Folded Spill
213213
; CHECK-FPUV3-NEXT: st16.w l0, (sp, 4) # 4-byte Folded Spill
214214
; CHECK-FPUV3-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
215-
; CHECK-FPUV3-NEXT: mov16 l0, a1
216-
; CHECK-FPUV3-NEXT: mov16 l1, a0
217-
; CHECK-FPUV3-NEXT: ld16.h a0, (a0, 0)
215+
; CHECK-FPUV3-NEXT: mov16 l0, a0
216+
; CHECK-FPUV3-NEXT: ld16.h l1, (a0, 0)
217+
; CHECK-FPUV3-NEXT: ld16.h a0, (a1, 0)
218218
; CHECK-FPUV3-NEXT: jsri32 [.LCPI5_0]
219219
; CHECK-FPUV3-NEXT: fmov.32 vr8, vr0
220-
; CHECK-FPUV3-NEXT: ld16.h a0, (l0, 0)
220+
; CHECK-FPUV3-NEXT: mov16 a0, l1
221221
; CHECK-FPUV3-NEXT: jsri32 [.LCPI5_0]
222-
; CHECK-FPUV3-NEXT: fadd.32 vr0, vr8, vr0
222+
; CHECK-FPUV3-NEXT: fadd.32 vr0, vr0, vr8
223223
; CHECK-FPUV3-NEXT: jsri32 [.LCPI5_1]
224-
; CHECK-FPUV3-NEXT: st16.h a0, (l1, 0)
224+
; CHECK-FPUV3-NEXT: st16.h a0, (l0, 0)
225225
; CHECK-FPUV3-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
226226
; CHECK-FPUV3-NEXT: ld16.w l0, (sp, 4) # 4-byte Folded Reload
227227
; CHECK-FPUV3-NEXT: ld16.w l1, (sp, 8) # 4-byte Folded Reload
@@ -250,16 +250,16 @@ define void @test_fmul(ptr %p, ptr %q) nounwind {
250250
; CHECK-FPUV2-NEXT: st16.w l1, (sp, 8) # 4-byte Folded Spill
251251
; CHECK-FPUV2-NEXT: st16.w l0, (sp, 4) # 4-byte Folded Spill
252252
; CHECK-FPUV2-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
253-
; CHECK-FPUV2-NEXT: mov16 l0, a1
254-
; CHECK-FPUV2-NEXT: mov16 l1, a0
255-
; CHECK-FPUV2-NEXT: ld16.h a0, (a0, 0)
253+
; CHECK-FPUV2-NEXT: mov16 l0, a0
254+
; CHECK-FPUV2-NEXT: ld16.h l1, (a0, 0)
255+
; CHECK-FPUV2-NEXT: ld16.h a0, (a1, 0)
256256
; CHECK-FPUV2-NEXT: jsri32 [.LCPI6_0]
257257
; CHECK-FPUV2-NEXT: fmovs vr8, vr0
258-
; CHECK-FPUV2-NEXT: ld16.h a0, (l0, 0)
258+
; CHECK-FPUV2-NEXT: mov16 a0, l1
259259
; CHECK-FPUV2-NEXT: jsri32 [.LCPI6_0]
260-
; CHECK-FPUV2-NEXT: fmuls vr0, vr8, vr0
260+
; CHECK-FPUV2-NEXT: fmuls vr0, vr0, vr8
261261
; CHECK-FPUV2-NEXT: jsri32 [.LCPI6_1]
262-
; CHECK-FPUV2-NEXT: st16.h a0, (l1, 0)
262+
; CHECK-FPUV2-NEXT: st16.h a0, (l0, 0)
263263
; CHECK-FPUV2-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
264264
; CHECK-FPUV2-NEXT: ld16.w l0, (sp, 4) # 4-byte Folded Reload
265265
; CHECK-FPUV2-NEXT: ld16.w l1, (sp, 8) # 4-byte Folded Reload
@@ -281,16 +281,16 @@ define void @test_fmul(ptr %p, ptr %q) nounwind {
281281
; CHECK-FPUV3-NEXT: st16.w l1, (sp, 8) # 4-byte Folded Spill
282282
; CHECK-FPUV3-NEXT: st16.w l0, (sp, 4) # 4-byte Folded Spill
283283
; CHECK-FPUV3-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
284-
; CHECK-FPUV3-NEXT: mov16 l0, a1
285-
; CHECK-FPUV3-NEXT: mov16 l1, a0
286-
; CHECK-FPUV3-NEXT: ld16.h a0, (a0, 0)
284+
; CHECK-FPUV3-NEXT: mov16 l0, a0
285+
; CHECK-FPUV3-NEXT: ld16.h l1, (a0, 0)
286+
; CHECK-FPUV3-NEXT: ld16.h a0, (a1, 0)
287287
; CHECK-FPUV3-NEXT: jsri32 [.LCPI6_0]
288288
; CHECK-FPUV3-NEXT: fmov.32 vr8, vr0
289-
; CHECK-FPUV3-NEXT: ld16.h a0, (l0, 0)
289+
; CHECK-FPUV3-NEXT: mov16 a0, l1
290290
; CHECK-FPUV3-NEXT: jsri32 [.LCPI6_0]
291-
; CHECK-FPUV3-NEXT: fmul.32 vr0, vr8, vr0
291+
; CHECK-FPUV3-NEXT: fmul.32 vr0, vr0, vr8
292292
; CHECK-FPUV3-NEXT: jsri32 [.LCPI6_1]
293-
; CHECK-FPUV3-NEXT: st16.h a0, (l1, 0)
293+
; CHECK-FPUV3-NEXT: st16.h a0, (l0, 0)
294294
; CHECK-FPUV3-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
295295
; CHECK-FPUV3-NEXT: ld16.w l0, (sp, 4) # 4-byte Folded Reload
296296
; CHECK-FPUV3-NEXT: ld16.w l1, (sp, 8) # 4-byte Folded Reload

llvm/test/CodeGen/Generic/half-op.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
; RUN: %if arm-registered-target %{ llc %s -o - -mtriple=thumbv7em-none-eabi | FileCheck %s --check-prefixes=ALL,CHECK-NEG-ABS,CHECK-COPYSIGN,CHECK-FMA %}
1313
; RUN: %if avr-registered-target %{ llc %s -o - -mtriple=avr-none | FileCheck %s --check-prefixes=ALL,CHECK-NEG-ABS,CHECK-COPYSIGN,CHECK-FMA %}
1414
; FIXME: BPF has a compiler error
15-
; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 | FileCheck %s --check-prefixes=ALL,BAD-NEG-ABS,BAD-COPYSIGN,BAD-FMA %}
16-
; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 -mcpu=ck860fv -mattr=+hard-float | FileCheck %s --check-prefixes=ALL,BAD-NEG-ABS,BAD-COPYSIGN,BAD-FMA %}
15+
; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 | FileCheck %s --check-prefixes=ALL,CHECK-NEG-ABS,CHECK-COPYSIGN,CHECK-FMA %}
16+
; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 -mcpu=ck860fv -mattr=+hard-float | FileCheck %s --check-prefixes=ALL,CHECK-NEG-ABS,CHECK-COPYSIGN,CHECK-FMA %}
1717
; FIXME: directx has a compiler error
1818
; RUN: %if hexagon-registered-target %{ llc %s -o - -mtriple=hexagon-unknown-linux-musl | FileCheck %s --check-prefixes=ALL,CHECK-NEG-ABS,CHECK-COPYSIGN,CHECK-FMA %}
1919
; RUN: %if lanai-registered-target %{ llc %s -o - -mtriple=lanai-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK-NEG-ABS,CHECK-COPYSIGN,CHECK-FMA %}

llvm/test/CodeGen/Generic/half.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
; RUN: %if avr-registered-target %{ llc %s -o - -mtriple=avr-none | FileCheck %s --check-prefixes=ALL,CHECK %}
1616
; RUN: %if bpf-registered-target %{ llc %s -o - -mtriple=bpfel | FileCheck %s --check-prefixes=ALL,CHECK %}
1717
; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 | FileCheck %s --check-prefixes=ALL,CHECK %}
18-
; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 -mcpu=ck860fv -mattr=+hard-float | FileCheck %s --check-prefixes=ALL,BAD %}
18+
; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 -mcpu=ck860fv -mattr=+hard-float | FileCheck %s --check-prefixes=ALL,CHECK %}
1919
; RUN: %if directx-registered-target %{ llc %s -o - -mtriple=dxil-pc-shadermodel6.3-library | FileCheck %s --check-prefixes=NOCRASH %}
2020
; RUN: %if hexagon-registered-target %{ llc %s -o - -mtriple=hexagon-unknown-linux-musl | FileCheck %s --check-prefixes=ALL,CHECK %}
2121
; RUN: %if lanai-registered-target %{ llc %s -o - -mtriple=lanai-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK %}

0 commit comments

Comments
 (0)