If a vr is already marked alive in a bb, then it has PHI uses that are visited earlie...
[oota-llvm.git] / test / CodeGen / PowerPC / bswap-load-store.ll
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
2 ; RUN:   grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep rlwinm
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep rlwimi
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | \
6 ; RUN:   grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep rlwinm
8 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep rlwimi
9
10 void %STWBRX(uint %i, sbyte* %ptr, int %off) {
11         %tmp1 = getelementptr sbyte* %ptr, int %off
12         %tmp1 = cast sbyte* %tmp1 to uint*
13         %tmp13 = tail call uint %llvm.bswap.i32(uint %i)
14         store uint %tmp13, uint* %tmp1
15         ret void
16 }
17
18 uint %LWBRX(sbyte* %ptr, int %off) {
19         %tmp1 = getelementptr sbyte* %ptr, int %off
20         %tmp1 = cast sbyte* %tmp1 to uint*              
21         %tmp = load uint* %tmp1         
22         %tmp14 = tail call uint %llvm.bswap.i32( uint %tmp )
23         ret uint %tmp14
24 }
25
26 void %STHBRX(ushort %s, sbyte* %ptr, int %off) {
27         %tmp1 = getelementptr sbyte* %ptr, int %off
28         %tmp1 = cast sbyte* %tmp1 to ushort*
29         %tmp5 = call ushort %llvm.bswap.i16( ushort %s )
30         store ushort %tmp5, ushort* %tmp1
31         ret void
32 }
33
34 ushort %LHBRX(sbyte* %ptr, int %off) {
35         %tmp1 = getelementptr sbyte* %ptr, int %off
36         %tmp1 = cast sbyte* %tmp1 to ushort*
37         %tmp = load ushort* %tmp1
38         %tmp6 = call ushort %llvm.bswap.i16(ushort %tmp)
39         ret ushort %tmp6
40 }
41
42 declare uint %llvm.bswap.i32(uint)
43
44 declare ushort %llvm.bswap.i16(ushort)