mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44638 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -463,5 +463,42 @@ entry:
|
|||||||
ret int %tmp3
|
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.
|
||||||
|
|
||||||
|
//===---------------------------------------------------------------------===//
|
||||||
|
Reference in New Issue
Block a user