[llvm-commits] [PATCH] RDRAND intrinsics

Eli Friedman eli.friedman at gmail.com
Fri Jul 6 14:30:09 PDT 2012


On Fri, Jul 6, 2012 at 2:03 PM, Benjamin Kramer <benny.kra at gmail.com> wrote:
>
> On 06.07.2012, at 22:52, Eli Friedman wrote:
>
>> On Fri, Jul 6, 2012 at 1:00 PM, Benjamin Kramer <benny.kra at gmail.com> wrote:
>>> The attached patch adds support for intel's rdrand intrinsics to LLVM.
>>>
>>> The tricky part is that the intrinsics have to return two values (the random value and the carry flag). This is solved with a pointer argument and a cmov to materialize CF, which matches GCC's output. This approach requires some custom lowering code, but I don't see a way to do it with tablegenerated patterns only.
>>
>> It would be much more friendly to the optimizer to use multiple return
>> values... but it might not be worth the hassle, considering that
>> rdrand is relatively slow.
>
> I tried this first as it also looks cleaner, but I couldn't find a way to smuggle it past legalization into the target specific lowering.

X86TargetLowering::ReplaceNodeResults?

-Eli




More information about the llvm-commits mailing list