Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ |
Dan Gohman | 8c89a50 | 2007-08-15 13:36:28 +0000 | [diff] [blame^] | 2 | ; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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 | \ |
Dan Gohman | 8c89a50 | 2007-08-15 13:36:28 +0000 | [diff] [blame^] | 6 | ; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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) |