Displaying 3 results from an estimated 3 matches for "_rotl16".
2012 Jul 29
3
[LLVMdev] rotate
...n't tried it on a recent
clang version) and what I wondered was whether there was mileage in having
an explicit intrinsic for rotation (like there is for bit counting, as in
__builtin_clz and __builtin_ctz and so on). Microsoft's compiler has an
explicit intrinsic in the form of _rotl8 and _rotl16 (IIRC -- this is from
memory!). It would be nice to have a __builtin_rotl family in clang, in
my opinion, but it would need back-end support from llvm. I would expect
it to find use in code relating to hashing and cryptology. I know that
the compiler *should* optimise
uint32_t ror(uint32_t inpu...
2012 Jul 29
0
[LLVMdev] rotate
*NOTE* IIRC compiling this with -O0 on x86-64 can yield the wrong result since clang will emit shifts and on intel shifts are mod the register size:
=====
.section __TEXT,__text,regular,pure_instructions
.globl _ror
.align 4, 0x90
_ror: ## @ror
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp2:
.cfi_def_cfa_offset 16
Ltmp3:
.cfi_offset %rbp, -16
movq %rsp, %rbp
2012 Jul 29
3
[LLVMdev] rotate
Nice!
Clever compiler..
On 07/28/2012 08:55 PM, Michael Gottesman wrote:
> I can get clang/llvm to emit a rotate instruction on x86-64 when compiling C by just using -Os and the rotate from Hacker's Delight i.e.,
>
> ======
> #include<stdlib.h>
> #include<stdint.h>
>
> uint32_t ror(uint32_t input, size_t rot_bits)
> {
> return (input>>