From 50257f1a7acc9c9ea20bfc52bf7414ea691d1b06 Mon Sep 17 00:00:00 2001 From: Ahsan Saghir Date: Mon, 29 Apr 2019 23:25:33 +0000 Subject: [PATCH] Add __builtin_dcbf support for PPC Summary: This patch adds support for __builtin_dcbf for PPC. __builtin_dcbf copies the contents of a modified block from the data cache to main memory and flushes the copy from the data cache. Differential revision: https://reviews.llvm.org/D59843 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359517 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/IntrinsicsPowerPC.td | 3 ++- test/CodeGen/PowerPC/dcbf.ll | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/CodeGen/PowerPC/dcbf.ll diff --git a/include/llvm/IR/IntrinsicsPowerPC.td b/include/llvm/IR/IntrinsicsPowerPC.td index 530ad43a25c..f8731744575 100644 --- a/include/llvm/IR/IntrinsicsPowerPC.td +++ b/include/llvm/IR/IntrinsicsPowerPC.td @@ -18,7 +18,8 @@ let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.". // dcba/dcbf/dcbi/dcbst/dcbt/dcbz/dcbzl(PPC970) instructions. def int_ppc_dcba : Intrinsic<[], [llvm_ptr_ty], []>; - def int_ppc_dcbf : Intrinsic<[], [llvm_ptr_ty], []>; + def int_ppc_dcbf : GCCBuiltin<"__builtin_dcbf">, + Intrinsic<[], [llvm_ptr_ty], []>; def int_ppc_dcbi : Intrinsic<[], [llvm_ptr_ty], []>; def int_ppc_dcbst : Intrinsic<[], [llvm_ptr_ty], []>; def int_ppc_dcbt : Intrinsic<[], [llvm_ptr_ty], diff --git a/test/CodeGen/PowerPC/dcbf.ll b/test/CodeGen/PowerPC/dcbf.ll new file mode 100644 index 00000000000..7dd0dee0ee6 --- /dev/null +++ b/test/CodeGen/PowerPC/dcbf.ll @@ -0,0 +1,15 @@ +; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s \ +; RUN: -verify-machineinstrs -ppc-asm-full-reg-names \ +; RUN: -ppc-vsr-nums-as-vr | FileCheck %s + +; Function Attrs: nounwind +define void @dcbf_test(i8* %a) { +entry: + tail call void @llvm.ppc.dcbf(i8* %a) +; CHECK-LABEL: @dcbf_test +; CHECK: dcbf 0, r3 +; CHECK-NEXT: blr +ret void +} + +declare void @llvm.ppc.dcbf(i8*) -- 2.50.1