[LLVMdev] How to call the llvm.prefetch intrinsic ?
Hal Finkel
hfinkel at anl.gov
Wed Apr 10 10:52:11 PDT 2013
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
>
More information about the llvm-dev
mailing list