From: Jonas Paulsson Date: Tue, 12 Sep 2017 12:11:29 +0000 (+0000) Subject: [SystemZ] Add the CoveredBySubRegs bit to GPR64, GPR128 and FPR128 registers. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1043ae059e6e743ffce41d8d5feb0b312b86a425;p=llvm [SystemZ] Add the CoveredBySubRegs bit to GPR64, GPR128 and FPR128 registers. This bit is needed in order for the CalleeSavedRegs list to automatically include the super registers if all of their subregs are present. Thanks to Wei Mi for initially indicating this deficiency in the SystemZ backend. Review: Ulrich Weigand. https://bugs.llvm.org/show_bug.cgi?id=34550 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313023 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/SystemZ/SystemZRegisterInfo.td b/lib/Target/SystemZ/SystemZRegisterInfo.td index 52ba1a58401..a1cfaf69940 100644 --- a/lib/Target/SystemZ/SystemZRegisterInfo.td +++ b/lib/Target/SystemZ/SystemZRegisterInfo.td @@ -65,6 +65,7 @@ class GPR64 num, string n, GPR32 low, GPR32 high> : SystemZRegWithSubregs { let HWEncoding = num; let SubRegIndices = [subreg_l32, subreg_h32]; + let CoveredBySubRegs = 1; } // 8 even-odd pairs of GPR64s. @@ -72,6 +73,7 @@ class GPR128 num, string n, GPR64 low, GPR64 high> : SystemZRegWithSubregs { let HWEncoding = num; let SubRegIndices = [subreg_l64, subreg_h64]; + let CoveredBySubRegs = 1; } // General-purpose registers @@ -194,6 +196,7 @@ class FPR128 num, string n, FPR64 low, FPR64 high> : SystemZRegWithSubregs { let HWEncoding = num; let SubRegIndices = [subreg_l64, subreg_h64]; + let CoveredBySubRegs = 1; } // Floating-point registers. Registers 16-31 require the vector facility. diff --git a/test/CodeGen/SystemZ/loop-03.ll b/test/CodeGen/SystemZ/loop-03.ll new file mode 100644 index 00000000000..b95e1ae2dcc --- /dev/null +++ b/test/CodeGen/SystemZ/loop-03.ll @@ -0,0 +1,126 @@ +; Test that loops with sufficient registers do not reload or spill on +; stack. These cases include calls and it is necessary to have the GR128 / +; FP128 registers part of the callee saved registers list in order to avoid +; spilling / reloading. +; +; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s + +%0 = type { %0*, %0*, %0*, i32, %1*, i64, i64, i64, i64, i64, i64, %2, %5, %7 } +%1 = type { i32, i32, i32 (%1*, i64, i32)*, i32 (%1*, i64, i64, i32, i8**)*, i32 (%1*, i64, i64, i64, i32)*, i32 (%1*)*, void (i8*)*, i8*, i8* } +%2 = type { i64, i64, %3** } +%3 = type { %4*, i64 } +%4 = type { i64, i8* } +%5 = type { i64, i64, %6** } +%6 = type { i64, %4*, i32, i64, i8* } +%7 = type { i64, i64, %8** } +%8 = type { i64, i64*, i64*, %4*, i64, i32*, %5, i32, i64, i64 } + +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32, i1) + +define void @fun0(%0*) { +; CHECK-LABEL: .LBB0_4 +; CHECK: => This Inner Loop Header: Depth=2 +; CHECK-NOT: 16-byte Folded Spill +; CHECK-NOT: 16-byte Folded Reload + + %2 = load i64, i64* undef, align 8 + %3 = udiv i64 128, %2 + %4 = mul i64 %3, %2 + %5 = load i64, i64* undef, align 8 + switch i32 undef, label %36 [ + i32 1, label %6 + i32 2, label %7 + i32 3, label %8 + i32 4, label %9 + i32 5, label %10 + i32 6, label %11 + ] + +;