ispc/ispc — Issue #144: Implement more efficient shifts in sse4.h
Author: mmp
Created: 2012-01-05 00:12:38+00:00
State: open
Labels: performance

Currently shifts by a varying amount are all done via scalarization; there are some tricks that can be used to avoid this; for example llvm generates the following code for varying shift left, which is much more efficient than what we're doing now:

```

LCPI0_0:
.long 1065353216 ## 0x3f800000
.long 1065353216 ## 0x3f800000
.long 1065353216 ## 0x3f800000
.long 1065353216 ## 0x3f800000
.section __TEXT,__text,regular,pure_instructions
.globl _f___ii
.align 4, 0x90
_f___ii: ## @f___ii
## BB#0: ## %allocas
pslld $23, %xmm1
paddd LCPI0_0(%rip), %xmm1
cvttps2dq %xmm1, %xmm1
pmulld %xmm0, %xmm1
movdqa %xmm1, %xmm0
ret
```