blob: 0c4a1172732c2750c2f73f29d02b6ff8d736a926 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
2; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | wc -l | grep 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} | wc -l | grep 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
10void %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
18uint %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
26void %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
34ushort %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
42declare uint %llvm.bswap.i32(uint)
43
44declare ushort %llvm.bswap.i16(ushort)