diff --git a/llvm/include/llvm/IR/IntrinsicsVEVL.gen.td b/llvm/include/llvm/IR/IntrinsicsVEVL.gen.td --- a/llvm/include/llvm/IR/IntrinsicsVEVL.gen.td +++ b/llvm/include/llvm/IR/IntrinsicsVEVL.gen.td @@ -78,3 +78,5 @@ let TargetPrefix = "ve" in def int_ve_vl_vstl2dot_vssml : GCCBuiltin<"__builtin_ve_vl_vstl2dot_vssml">, Intrinsic<[], [LLVMType, LLVMType, llvm_ptr_ty, LLVMType, LLVMType], [IntrWriteMem]>; let TargetPrefix = "ve" in def int_ve_vl_vstl2dncot_vssl : GCCBuiltin<"__builtin_ve_vl_vstl2dncot_vssl">, Intrinsic<[], [LLVMType, LLVMType, llvm_ptr_ty, LLVMType], [IntrWriteMem]>; let TargetPrefix = "ve" in def int_ve_vl_vstl2dncot_vssml : GCCBuiltin<"__builtin_ve_vl_vstl2dncot_vssml">, Intrinsic<[], [LLVMType, LLVMType, llvm_ptr_ty, LLVMType, LLVMType], [IntrWriteMem]>; +let TargetPrefix = "ve" in def int_ve_vl_pfchv_ssl : GCCBuiltin<"__builtin_ve_vl_pfchv_ssl">, Intrinsic<[], [LLVMType, llvm_ptr_ty, LLVMType], [IntrInaccessibleMemOrArgMemOnly]>; +let TargetPrefix = "ve" in def int_ve_vl_pfchvnc_ssl : GCCBuiltin<"__builtin_ve_vl_pfchvnc_ssl">, Intrinsic<[], [LLVMType, llvm_ptr_ty, LLVMType], [IntrInaccessibleMemOrArgMemOnly]>; diff --git a/llvm/lib/Target/VE/VEInstrIntrinsicVL.gen.td b/llvm/lib/Target/VE/VEInstrIntrinsicVL.gen.td --- a/llvm/lib/Target/VE/VEInstrIntrinsicVL.gen.td +++ b/llvm/lib/Target/VE/VEInstrIntrinsicVL.gen.td @@ -158,3 +158,7 @@ def : Pat<(int_ve_vl_vstl2dncot_vssl v256f64:$vx, simm7:$I, i64:$sz, i32:$vl), (VSTL2DNCOTirvl (LO7 $I), i64:$sz, v256f64:$vx, i32:$vl)>; def : Pat<(int_ve_vl_vstl2dncot_vssml v256f64:$vx, i64:$sy, i64:$sz, v256i1:$vm, i32:$vl), (VSTL2DNCOTrrvml i64:$sy, i64:$sz, v256f64:$vx, v256i1:$vm, i32:$vl)>; def : Pat<(int_ve_vl_vstl2dncot_vssml v256f64:$vx, simm7:$I, i64:$sz, v256i1:$vm, i32:$vl), (VSTL2DNCOTirvml (LO7 $I), i64:$sz, v256f64:$vx, v256i1:$vm, i32:$vl)>; +def : Pat<(int_ve_vl_pfchv_ssl i64:$sy, i64:$sz, i32:$vl), (PFCHVrrl i64:$sy, i64:$sz, i32:$vl)>; +def : Pat<(int_ve_vl_pfchv_ssl simm7:$I, i64:$sz, i32:$vl), (PFCHVirl (LO7 $I), i64:$sz, i32:$vl)>; +def : Pat<(int_ve_vl_pfchvnc_ssl i64:$sy, i64:$sz, i32:$vl), (PFCHVNCrrl i64:$sy, i64:$sz, i32:$vl)>; +def : Pat<(int_ve_vl_pfchvnc_ssl simm7:$I, i64:$sz, i32:$vl), (PFCHVNCirl (LO7 $I), i64:$sz, i32:$vl)>; diff --git a/llvm/test/CodeGen/VE/VELIntrinsics/pfchv.ll b/llvm/test/CodeGen/VE/VELIntrinsics/pfchv.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/VE/VELIntrinsics/pfchv.ll @@ -0,0 +1,60 @@ +; RUN: llc < %s -mtriple=ve -mattr=+vpu | FileCheck %s + +;;; Test prefetch vector intrinsic instructions +;;; +;;; Note: +;;; We test PFCHVrrl, PFCHVirl, PFCHVNCrrl, and PFCHVNCirl instructions. + +; Function Attrs: nounwind +define void @pfchv_vssl(i8* %0, i64 %1) { +; CHECK-LABEL: pfchv_vssl: +; CHECK: .LBB{{[0-9]+}}_2: +; CHECK-NEXT: lea %s2, 256 +; CHECK-NEXT: lvl %s2 +; CHECK-NEXT: pfchv %s1, %s0 +; CHECK-NEXT: or %s11, 0, %s9 + tail call void @llvm.ve.vl.pfchv.ssl(i64 %1, i8* %0, i32 256) + ret void +} + +; Function Attrs: inaccessiblemem_or_argmemonly nounwind +declare void @llvm.ve.vl.pfchv.ssl(i64, i8*, i32) + +; Function Attrs: nounwind +define void @pfchv_vssl_imm(i8* %0) { +; CHECK-LABEL: pfchv_vssl_imm: +; CHECK: .LBB{{[0-9]+}}_2: +; CHECK-NEXT: lea %s1, 256 +; CHECK-NEXT: lvl %s1 +; CHECK-NEXT: pfchv 8, %s0 +; CHECK-NEXT: or %s11, 0, %s9 + tail call void @llvm.ve.vl.pfchv.ssl(i64 8, i8* %0, i32 256) + ret void +} + +; Function Attrs: nounwind +define void @pfchvnc_vssl(i8* %0, i64 %1) { +; CHECK-LABEL: pfchvnc_vssl: +; CHECK: .LBB{{[0-9]+}}_2: +; CHECK-NEXT: lea %s2, 256 +; CHECK-NEXT: lvl %s2 +; CHECK-NEXT: pfchv.nc %s1, %s0 +; CHECK-NEXT: or %s11, 0, %s9 + tail call void @llvm.ve.vl.pfchvnc.ssl(i64 %1, i8* %0, i32 256) + ret void +} + +; Function Attrs: inaccessiblemem_or_argmemonly nounwind +declare void @llvm.ve.vl.pfchvnc.ssl(i64, i8*, i32) + +; Function Attrs: nounwind +define void @pfchvnc_vssl_imm(i8* %0) { +; CHECK-LABEL: pfchvnc_vssl_imm: +; CHECK: .LBB{{[0-9]+}}_2: +; CHECK-NEXT: lea %s1, 256 +; CHECK-NEXT: lvl %s1 +; CHECK-NEXT: pfchv.nc 8, %s0 +; CHECK-NEXT: or %s11, 0, %s9 + tail call void @llvm.ve.vl.pfchvnc.ssl(i64 8, i8* %0, i32 256) + ret void +}