[llvm] d14e518 - [PowerPC] Skip IEEE 128-bit FP type in FastISel

Qiu Chaofan via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 19:18:50 PST 2020


Author: Qiu Chaofan
Date: 2020-11-03T11:17:11+08:00
New Revision: d14e51806b0214560ec99b5d3ce797f5fa3f7522

URL: https://github.com/llvm/llvm-project/commit/d14e51806b0214560ec99b5d3ce797f5fa3f7522
DIFF: https://github.com/llvm/llvm-project/commit/d14e51806b0214560ec99b5d3ce797f5fa3f7522.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCFastISel.cpp
    llvm/test/CodeGen/PowerPC/f128-passByValue.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
index 9edbf5f68f32..85ae195e58e8 100644
--- a/llvm/lib/Target/PowerPC/PPCFastISel.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
@@ -1626,7 +1626,10 @@ bool PPCFastISel::fastLowerCall(CallLoweringInfo &CLI) {
     if (!isTypeLegal(ArgTy, ArgVT) && ArgVT != MVT::i16 && ArgVT != MVT::i8)
       return false;
 
-    if (ArgVT.isVector())
+    // FIXME: FastISel cannot handle non-simple types yet, including 128-bit FP
+    // types, which is passed through vector register. Skip these types and
+    // fallback to default SelectionDAG based selection.
+    if (ArgVT.isVector() || ArgVT == MVT::f128)
       return false;
 
     unsigned Arg = getRegForValue(ArgValue);

diff  --git a/llvm/test/CodeGen/PowerPC/f128-passByValue.ll b/llvm/test/CodeGen/PowerPC/f128-passByValue.ll
index f4bdd6008906..0a8fc1b0e777 100644
--- a/llvm/test/CodeGen/PowerPC/f128-passByValue.ll
+++ b/llvm/test/CodeGen/PowerPC/f128-passByValue.ll
@@ -266,3 +266,32 @@ entry:
   store double %conv1, double* %d1, align 8
   ret void
 }
+
+; Function Attrs: noinline optnone
+define signext i32 @noopt_call_crash() #0 {
+; CHECK-LABEL: noopt_call_crash:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    mflr r0
+; CHECK-NEXT:    std r0, 16(r1)
+; CHECK-NEXT:    stdu r1, -96(r1)
+; CHECK-NEXT:    .cfi_def_cfa_offset 96
+; CHECK-NEXT:    .cfi_offset lr, 16
+; CHECK-NEXT:    bl in
+; CHECK-NEXT:    nop
+; CHECK-NEXT:    bl out
+; CHECK-NEXT:    nop
+; CHECK-NEXT:    li r3, 0
+; CHECK-NEXT:    addi r1, r1, 96
+; CHECK-NEXT:    ld r0, 16(r1)
+; CHECK-NEXT:    mtlr r0
+; CHECK-NEXT:    blr
+entry:
+  %call = call fp128 @in()
+  call void @out(fp128 %call)
+  ret i32 0
+}
+
+declare void @out(fp128)
+declare fp128 @in()
+
+attributes #0 = { noinline optnone }


        


More information about the llvm-commits mailing list