Folks, To implement this bug: http://llvm.org/bugs/show_bug.cgi?id=19142 I need an LLVM intrinsic to communicate the need to lower the builtin wither to noop or a call or even a sequence of instructions. I thought about: void @llvm.clear_cache(i8 * begin, i8 * end) to simulate precisely GCC's builtin: void __builtin___clear_cache (char *begin, char *end) which will be, by default, nothing. On ARM and MIPS, it'll call __clear_cache. Is that a good plan? cheers, --renato
How does this overlap with: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140310/thread.html#208333 Committed in r203674? The bug mentions doing the mov r7 and svc, when the above code already does it, I'm somewhat confused. On Fri, Mar 14, 2014 at 9:11 AM, Renato Golin <renato.golin at linaro.org>wrote:> Folks, > > To implement this bug: > > http://llvm.org/bugs/show_bug.cgi?id=19142 > > I need an LLVM intrinsic to communicate the need to lower the builtin > wither to noop or a call or even a sequence of instructions. I thought > about: > > void @llvm.clear_cache(i8 * begin, i8 * end) > > to simulate precisely GCC's builtin: > > void __builtin___clear_cache (char *begin, char *end) > > which will be, by default, nothing. On ARM and MIPS, it'll call > __clear_cache. > > Is that a good plan? > > cheers, > --renato > _______________________________________________ > 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/20140314/378515ac/attachment.html>
On 14 March 2014 16:34, JF Bastien <jfb at google.com> wrote:> How does this overlap with: > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140310/thread.html#208333The builtin was created to call __clear_cache() on platforms that need it (like ARM and MIPS), but to be ignored on others (like x86_64). This builtin should call __clear_cache() from whatever library is available at the moment, so there is no overlap, just supporting the GCC builtin to avoid calling a noop function when not needed.> The bug mentions doing the mov r7 and svc, when the above code already does > it, I'm somewhat confused.That's an idea that might not be a good one. I was thinking if, in some occasions, we could emit directly the instructions, but that will have to deal with lower level stuff that we don't want on the intrinsic level. GCC just emits a call to __clear_cache() and, at the very least, we should do the same for now. That optimisation might come later, at a much lower level, but I have my doubts if that's relevant. We shouldn't be clearing the cache on a hot loop anyway. ;) cheers, --renato