blob: 272964ac46b1000c512c06e2f2d83116808d0a86 [file] [log] [blame]
Reid Spencerc58ef012007-04-15 21:17:45 +00001; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
Dan Gohman28beeea2007-08-15 13:36:28 +00002; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4
Reid Spencerc58ef012007-04-15 21:17:45 +00003; 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 | \
Dan Gohman28beeea2007-08-15 13:36:28 +00006; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4
Reid Spencerc58ef012007-04-15 21:17:45 +00007; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep rlwinm
Reid Spencer69ccadd2006-12-02 04:23:10 +00008; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep rlwimi
Chris Lattner5895a132006-07-10 20:53:53 +00009
10void %STWBRX(uint %i, sbyte* %ptr, int %off) {
11 %tmp1 = getelementptr sbyte* %ptr, int %off
12 %tmp1 = cast sbyte* %tmp1 to uint*
Reid Spencer2b35c152007-04-02 01:08:02 +000013 %tmp13 = tail call uint %llvm.bswap.i32(uint %i)
Chris Lattner5895a132006-07-10 20:53:53 +000014 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
Reid Spencer2b35c152007-04-02 01:08:02 +000022 %tmp14 = tail call uint %llvm.bswap.i32( uint %tmp )
Chris Lattner5895a132006-07-10 20:53:53 +000023 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*
Reid Spencer2b35c152007-04-02 01:08:02 +000029 %tmp5 = call ushort %llvm.bswap.i16( ushort %s )
Chris Lattner5895a132006-07-10 20:53:53 +000030 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
Reid Spencer2b35c152007-04-02 01:08:02 +000038 %tmp6 = call ushort %llvm.bswap.i16(ushort %tmp)
Chris Lattner5895a132006-07-10 20:53:53 +000039 ret ushort %tmp6
40}
41
Reid Spencer2b35c152007-04-02 01:08:02 +000042declare uint %llvm.bswap.i32(uint)
Chris Lattner5895a132006-07-10 20:53:53 +000043
Reid Spencer2b35c152007-04-02 01:08:02 +000044declare ushort %llvm.bswap.i16(ushort)