Skip to content

Commit d14e518

Browse files
committed
[PowerPC] Skip IEEE 128-bit FP type in FastISel
Vector types, quadword integers and f128 currently cannot be handled in FastISel. We did not skip f128 type in lowering arguments, which causes a crash. This patch will fix it. Reviewed By: steven.zhang Differential Revision: https://reviews.llvm.org/D90206
1 parent 3204ffe commit d14e518

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

llvm/lib/Target/PowerPC/PPCFastISel.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,10 @@ bool PPCFastISel::fastLowerCall(CallLoweringInfo &CLI) {
16261626
if (!isTypeLegal(ArgTy, ArgVT) && ArgVT != MVT::i16 && ArgVT != MVT::i8)
16271627
return false;
16281628

1629-
if (ArgVT.isVector())
1629+
// FIXME: FastISel cannot handle non-simple types yet, including 128-bit FP
1630+
// types, which is passed through vector register. Skip these types and
1631+
// fallback to default SelectionDAG based selection.
1632+
if (ArgVT.isVector() || ArgVT == MVT::f128)
16301633
return false;
16311634

16321635
unsigned Arg = getRegForValue(ArgValue);

llvm/test/CodeGen/PowerPC/f128-passByValue.ll

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,32 @@ entry:
266266
store double %conv1, double* %d1, align 8
267267
ret void
268268
}
269+
270+
; Function Attrs: noinline optnone
271+
define signext i32 @noopt_call_crash() #0 {
272+
; CHECK-LABEL: noopt_call_crash:
273+
; CHECK: # %bb.0: # %entry
274+
; CHECK-NEXT: mflr r0
275+
; CHECK-NEXT: std r0, 16(r1)
276+
; CHECK-NEXT: stdu r1, -96(r1)
277+
; CHECK-NEXT: .cfi_def_cfa_offset 96
278+
; CHECK-NEXT: .cfi_offset lr, 16
279+
; CHECK-NEXT: bl in
280+
; CHECK-NEXT: nop
281+
; CHECK-NEXT: bl out
282+
; CHECK-NEXT: nop
283+
; CHECK-NEXT: li r3, 0
284+
; CHECK-NEXT: addi r1, r1, 96
285+
; CHECK-NEXT: ld r0, 16(r1)
286+
; CHECK-NEXT: mtlr r0
287+
; CHECK-NEXT: blr
288+
entry:
289+
%call = call fp128 @in()
290+
call void @out(fp128 %call)
291+
ret i32 0
292+
}
293+
294+
declare void @out(fp128)
295+
declare fp128 @in()
296+
297+
attributes #0 = { noinline optnone }

0 commit comments

Comments
 (0)