diff options
| author | Nick Desaulniers <ndesaulniers@google.com> | 2018-09-07 20:58:57 +0000 |
|---|---|---|
| committer | Nick Desaulniers <ndesaulniers@google.com> | 2018-09-07 20:58:57 +0000 |
| commit | 287a3be3799738f66582a594210322cbe7c1e186 (patch) | |
| tree | 33ca7b898bd3fc631b366f4ead71bf91b84843dc /llvm/test/CodeGen/AArch64 | |
| parent | 5cbce81c915d122d6eddea767206506ad3b2fb91 (diff) | |
| download | bcm5719-llvm-287a3be3799738f66582a594210322cbe7c1e186.tar.gz bcm5719-llvm-287a3be3799738f66582a594210322cbe7c1e186.zip | |
[AArch64] Support reserving x1-7 registers.
Summary:
Reserving registers x1-7 is used to support CONFIG_ARM64_LSE_ATOMICS in Linux kernel. This change adds support for reserving registers x1 through x7.
Reviewers: javed.absar, phosek, srhines, nickdesaulniers, efriedma
Reviewed By: nickdesaulniers, efriedma
Subscribers: niravd, jfb, manojgupta, nickdesaulniers, jyknight, efriedma, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D48580
llvm-svn: 341706
Diffstat (limited to 'llvm/test/CodeGen/AArch64')
| -rw-r--r-- | llvm/test/CodeGen/AArch64/arm64-platform-reg.ll | 57 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/arm64-reserved-arg-reg-call-error.ll | 19 |
2 files changed, 76 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/arm64-platform-reg.ll b/llvm/test/CodeGen/AArch64/arm64-platform-reg.ll index 899759624c2..73fe36d7611 100644 --- a/llvm/test/CodeGen/AArch64/arm64-platform-reg.ll +++ b/llvm/test/CodeGen/AArch64/arm64-platform-reg.ll @@ -7,6 +7,49 @@ ; RUN: llc -mtriple=aarch64-fuchsia -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18 ; RUN: llc -mtriple=aarch64-windows -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18 +; Test reserve-x# options individually. +; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X1 +; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x2 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X2 +; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x3 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X3 +; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x4 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X4 +; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x5 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X5 +; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x6 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X6 +; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x7 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X7 + +; Test multiple of reserve-x# options together. +; RUN: llc -mtriple=arm64-linux-gnu \ +; RUN: -mattr=+reserve-x1 \ +; RUN: -mattr=+reserve-x2 \ +; RUN: -mattr=+reserve-x18 \ +; RUN: -o - %s | FileCheck %s \ +; RUN: --check-prefix=CHECK-RESERVE \ +; RUN: --check-prefix=CHECK-RESERVE-X1 \ +; RUN: --check-prefix=CHECK-RESERVE-X2 \ +; RUN: --check-prefix=CHECK-RESERVE-X18 + +; Test all reserve-x# options together. +; RUN: llc -mtriple=arm64-linux-gnu \ +; RUN: -mattr=+reserve-x1 \ +; RUN: -mattr=+reserve-x2 \ +; RUN: -mattr=+reserve-x3 \ +; RUN: -mattr=+reserve-x4 \ +; RUN: -mattr=+reserve-x5 \ +; RUN: -mattr=+reserve-x6 \ +; RUN: -mattr=+reserve-x7 \ +; RUN: -mattr=+reserve-x18 \ +; RUN: -mattr=+reserve-x20 \ +; RUN: -o - %s | FileCheck %s \ +; RUN: --check-prefix=CHECK-RESERVE \ +; RUN: --check-prefix=CHECK-RESERVE-X1 \ +; RUN: --check-prefix=CHECK-RESERVE-X2 \ +; RUN: --check-prefix=CHECK-RESERVE-X3 \ +; RUN: --check-prefix=CHECK-RESERVE-X4 \ +; RUN: --check-prefix=CHECK-RESERVE-X5 \ +; RUN: --check-prefix=CHECK-RESERVE-X6 \ +; RUN: --check-prefix=CHECK-RESERVE-X7 \ +; RUN: --check-prefix=CHECK-RESERVE-X18 \ +; RUN: --check-prefix=CHECK-RESERVE-X20 + ; x18 is reserved as a platform register on Darwin but not on other ; systems. Create loads of register pressure and make sure this is respected. @@ -23,10 +66,24 @@ define void @keep_live() { ; CHECK: str x18 ; CHECK-RESERVE-NOT: ldr fp +; CHECK-RESERVE-X1-NOT: ldr x1, +; CHECK-RESERVE-X2-NOT: ldr x2, +; CHECK-RESERVE-X3-NOT: ldr x3, +; CHECK-RESERVE-X4-NOT: ldr x4, +; CHECK-RESERVE-X5-NOT: ldr x5, +; CHECK-RESERVE-X6-NOT: ldr x6, +; CHECK-RESERVE-X7-NOT: ldr x7, ; CHECK-RESERVE-X18-NOT: ldr x18 ; CHECK-RESERVE-X20-NOT: ldr x20 ; CHECK-RESERVE: Spill ; CHECK-RESERVE-NOT: ldr fp +; CHECK-RESERVE-X1-NOT: ldr x1, +; CHECK-RESERVE-X2-NOT: ldr x2, +; CHECK-RESERVE-X3-NOT: ldr x3, +; CHECK-RESERVE-X4-NOT: ldr x4, +; CHECK-RESERVE-X5-NOT: ldr x5, +; CHECK-RESERVE-X6-NOT: ldr x6, +; CHECK-RESERVE-X7-NOT: ldr x7, ; CHECK-RESERVE-X18-NOT: ldr x18 ; CHECK-RESERVE-X20-NOT: ldr x20 ; CHECK-RESERVE: ret diff --git a/llvm/test/CodeGen/AArch64/arm64-reserved-arg-reg-call-error.ll b/llvm/test/CodeGen/AArch64/arm64-reserved-arg-reg-call-error.ll new file mode 100644 index 00000000000..b98b11e180e --- /dev/null +++ b/llvm/test/CodeGen/AArch64/arm64-reserved-arg-reg-call-error.ll @@ -0,0 +1,19 @@ +; RUN: not llc < %s -mtriple=arm64-linux-gnu -mattr=+reserve-x1 2>&1 | FileCheck %s +; RUN: not llc < %s -mtriple=arm64-linux-gnu -mattr=+reserve-x1 -fast-isel 2>&1 | FileCheck %s +; RUN: not llc < %s -mtriple=arm64-linux-gnu -mattr=+reserve-x1 -global-isel 2>&1 | FileCheck %s + +; CHECK: error: +; CHECK-SAME: AArch64 doesn't support function calls if any of the argument registers is reserved. +define void @call_function() { + call void @foo() + ret void +} +declare void @foo() + +; CHECK: error: +; CHECK-SAME: AArch64 doesn't support function calls if any of the argument registers is reserved. +define void @call_memcpy(i8* %out, i8* %in) { + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %out, i8* %in, i64 800, i1 false) + ret void +} +declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1) |

