Displaying 3 results from an estimated 3 matches for "test_cmov".
2019 Sep 14
2
Side-channel resistant values
I’m struggling to find cases where __builtin_unpredictable() works at all. Even if we ignore cmp/br into switch conversion, it still doesn’t work:
int test_cmov(int left, int right, int *alt) {
return __builtin_unpredictable(left < right) ? *alt : 999;
}
Should generate:
test_cmov:
movl $999, %eax
cmpl %esi, %edi
cmovll (%rdx), %eax
retq
But currently generates:
test_cmov:
movl $999, %eax
cmpl %esi, %edi
jge .LBB0_2
movl (%rdx), %eax
.LBB0_...
2019 Sep 14
2
Side-channel resistant values
...e forced stall in the cmov.
>
>> On Fri, Sep 13, 2019 at 11:19 PM David Zarzycki <dave at znu.io> wrote:
>> I’m struggling to find cases where __builtin_unpredictable() works at all. Even if we ignore cmp/br into switch conversion, it still doesn’t work:
>>
>> int test_cmov(int left, int right, int *alt) {
>> return __builtin_unpredictable(left < right) ? *alt : 999;
>> }
>>
>> Should generate:
>>
>> test_cmov:
>> movl $999, %eax
>> cmpl %esi, %edi
>> cmovll (%rdx), %eax...
2019 Sep 13
3
Side-channel resistant values
> On Sep 13, 2019, at 10:45 AM, Chandler Carruth <chandlerc at gmail.com> wrote:
>
> On Fri, Sep 13, 2019 at 1:33 AM David Zarzycki via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
> Hi Chandler,
>
> The data-invariant feature sounds great but what about the general case? When performance tuning code, people sometimes need