Jimborean Alexandra
2013-Apr-10 17:43 UTC
[LLVMdev] How to call the llvm.prefetch intrinsic ?
Hello, Can anyone please guide me how can I replace a load instruction with a prefetch. I was looking at the intrinsic creation methods of the IRBuilder, but I can only find functions corresponding to memset, memcpy and memmove intrinsics, not for prefetching. Also, I target x86-64 architectures. Is it sufficient to insert a call to the intrinsic in the LLVM IR to have the corresponding prefetch instruction generated for this target? Thank you for your help, Alexandra -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130410/c79950b2/attachment.html>
Alexandra, I'm not sure what you mean by "replace", but I have code that does this to insert prefetches: Type *I8Ptr = Type::getInt8PtrTy((*I)->getContext(), PtrAddrSpace); Value *PrefPtrValue = ... IRBuilder<> Builder(MemI); Module *M = (*I)->getParent()->getParent(); Type *I32 = Type::getInt32Ty((*I)->getContext()); Value *PrefetchFunc = Intrinsic::getDeclaration(M, Intrinsic::prefetch); Builder.CreateCall4(PrefetchFunc, PrefPtrValue, ConstantInt::get(I32, MemI->mayReadFromMemory() ? 0 : 1), ConstantInt::get(I32, 3), ConstantInt::get(I32, 1)); -Hal ----- Original Message -----> From: "Jimborean Alexandra" <xinfinity_a at yahoo.com> > To: llvmdev at cs.uiuc.edu > Sent: Wednesday, April 10, 2013 12:43:23 PM > Subject: [LLVMdev] How to call the llvm.prefetch intrinsic ? > > > > > Hello, > > > Can anyone please guide me how can I replace a load instruction with > a prefetch. I was looking at the intrinsic creation methods of the > IRBuilder, but I can only find functions corresponding to memset, > memcpy and memmove intrinsics, not for prefetching. > > > Also, I target x86-64 architectures. Is it sufficient to insert a > call to the intrinsic in the LLVM IR to have the corresponding > prefetch instruction generated for this target? > > > > Thank you for your help, > Alexandra > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Jimborean Alexandra
2013-Apr-10 18:00 UTC
[LLVMdev] How to call the llvm.prefetch intrinsic ?
Thank you, this is what I was looking for. Alexandra ________________________________ From: Hal Finkel <hfinkel at anl.gov> To: Jimborean Alexandra <xinfinity_a at yahoo.com> Cc: llvmdev at cs.uiuc.edu Sent: Wednesday, April 10, 2013 7:52 PM Subject: Re: [LLVMdev] How to call the llvm.prefetch intrinsic ? Alexandra, I'm not sure what you mean by "replace", but I have code that does this to insert prefetches: Type *I8Ptr = Type::getInt8PtrTy((*I)->getContext(), PtrAddrSpace); Value *PrefPtrValue = ... IRBuilder<> Builder(MemI); Module *M = (*I)->getParent()->getParent(); Type *I32 = Type::getInt32Ty((*I)->getContext()); Value *PrefetchFunc = Intrinsic::getDeclaration(M, Intrinsic::prefetch); Builder.CreateCall4(PrefetchFunc, PrefPtrValue, ConstantInt::get(I32, MemI->mayReadFromMemory() ? 0 : 1), ConstantInt::get(I32, 3), ConstantInt::get(I32, 1)); -Hal ----- Original Message -----> From: "Jimborean Alexandra" <xinfinity_a at yahoo.com> > To: llvmdev at cs.uiuc.edu > Sent: Wednesday, April 10, 2013 12:43:23 PM > Subject: [LLVMdev] How to call the llvm.prefetch intrinsic ? > > > > > Hello, > > > Can anyone please guide me how can I replace a load instruction with > a prefetch. I was looking at the intrinsic creation methods of the > IRBuilder, but I can only find functions corresponding to memset, > memcpy and memmove intrinsics, not for prefetching. > > > Also, I target x86-64 architectures. Is it sufficient to insert a > call to the intrinsic in the LLVM IR to have the corresponding > prefetch instruction generated for this target? > > > > Thank you for your help, > Alexandra > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130410/fc7d2bb3/attachment.html>
Maybe Matching Threads
- [LLVMdev] How to call the llvm.prefetch intrinsic ?
- [LLVMdev] LLVM-C: Calling functions contained in other libraries
- How to extract sets of rows (not sorted) from text file in R, do some methods on these rows, save the result in another text file, then pick others set of rows and do the same
- [LLVMdev] speculative parallelization in LLVM
- [LLVMdev] scalar evolution to determine access functions in arays