mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
add a note
llvm-svn: 44638
This commit is contained in:
parent
011d2aab51
commit
e3f1487574
@ -463,5 +463,42 @@ entry:
|
||||
ret int %tmp3
|
||||
}
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
on this code:
|
||||
|
||||
unsigned array[4];
|
||||
unsigned foo(unsigned long x) {
|
||||
return array[(x>>2)&3ul];
|
||||
}
|
||||
|
||||
we should dag combine the left+right shift together. We currently get:
|
||||
|
||||
_foo:
|
||||
movl 4(%esp), %eax
|
||||
shrl $2, %eax
|
||||
andl $3, %eax
|
||||
movl _array(,%eax,4), %eax
|
||||
ret
|
||||
|
||||
similar on ppc:
|
||||
|
||||
_foo:
|
||||
lis r2, ha16(_array)
|
||||
srwi r3, r3, 2
|
||||
la r2, lo16(_array)(r2)
|
||||
rlwinm r3, r3, 2, 28, 29
|
||||
lwzx r3, r2, r3
|
||||
blr
|
||||
|
||||
similar on arm:
|
||||
|
||||
_foo:
|
||||
mov r3, #3
|
||||
and r3, r3, r0, lsr #2
|
||||
ldr r2, LCPI1_0
|
||||
ldr r0, [r2, +r3, lsl #2]
|
||||
bx lr
|
||||
|
||||
this is a trivial dag combine xform.
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user