2007-04-16 05:17:45 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
|
2007-08-15 21:36:28 +08:00
|
|
|
; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4
|
2007-04-16 05:17:45 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep rlwinm
|
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep rlwimi
|
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | \
|
2007-08-15 21:36:28 +08:00
|
|
|
; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4
|
2007-04-16 05:17:45 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep rlwinm
|
2006-12-02 12:23:10 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep rlwimi
|
2006-07-11 04:53:53 +08:00
|
|
|
|
|
|
|
void %STWBRX(uint %i, sbyte* %ptr, int %off) {
|
|
|
|
%tmp1 = getelementptr sbyte* %ptr, int %off
|
|
|
|
%tmp1 = cast sbyte* %tmp1 to uint*
|
2007-04-02 09:08:02 +08:00
|
|
|
%tmp13 = tail call uint %llvm.bswap.i32(uint %i)
|
2006-07-11 04:53:53 +08:00
|
|
|
store uint %tmp13, uint* %tmp1
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
uint %LWBRX(sbyte* %ptr, int %off) {
|
|
|
|
%tmp1 = getelementptr sbyte* %ptr, int %off
|
|
|
|
%tmp1 = cast sbyte* %tmp1 to uint*
|
|
|
|
%tmp = load uint* %tmp1
|
2007-04-02 09:08:02 +08:00
|
|
|
%tmp14 = tail call uint %llvm.bswap.i32( uint %tmp )
|
2006-07-11 04:53:53 +08:00
|
|
|
ret uint %tmp14
|
|
|
|
}
|
|
|
|
|
|
|
|
void %STHBRX(ushort %s, sbyte* %ptr, int %off) {
|
|
|
|
%tmp1 = getelementptr sbyte* %ptr, int %off
|
|
|
|
%tmp1 = cast sbyte* %tmp1 to ushort*
|
2007-04-02 09:08:02 +08:00
|
|
|
%tmp5 = call ushort %llvm.bswap.i16( ushort %s )
|
2006-07-11 04:53:53 +08:00
|
|
|
store ushort %tmp5, ushort* %tmp1
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
ushort %LHBRX(sbyte* %ptr, int %off) {
|
|
|
|
%tmp1 = getelementptr sbyte* %ptr, int %off
|
|
|
|
%tmp1 = cast sbyte* %tmp1 to ushort*
|
|
|
|
%tmp = load ushort* %tmp1
|
2007-04-02 09:08:02 +08:00
|
|
|
%tmp6 = call ushort %llvm.bswap.i16(ushort %tmp)
|
2006-07-11 04:53:53 +08:00
|
|
|
ret ushort %tmp6
|
|
|
|
}
|
|
|
|
|
2007-04-02 09:08:02 +08:00
|
|
|
declare uint %llvm.bswap.i32(uint)
|
2006-07-11 04:53:53 +08:00
|
|
|
|
2007-04-02 09:08:02 +08:00
|
|
|
declare ushort %llvm.bswap.i16(ushort)
|