]> granicus.if.org Git - llvm/commitdiff
Add __builtin_dcbf support for PPC
authorAhsan Saghir <saghir.ibm@gmail.com>
Mon, 29 Apr 2019 23:25:33 +0000 (23:25 +0000)
committerAhsan Saghir <saghir.ibm@gmail.com>
Mon, 29 Apr 2019 23:25:33 +0000 (23:25 +0000)
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
test/CodeGen/PowerPC/dcbf.ll [new file with mode: 0644]

index 530ad43a25c65be5d09d69185723dea33ac0f2d4..f8731744575335c243c88cf566031319c3f1a9a7 100644 (file)
@@ -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 (file)
index 0000000..7dd0dee
--- /dev/null
@@ -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*)