2009-11-22 19:45:44 +08:00
|
|
|
; RUN: llc < %s -march=ppc32 | FileCheck %s -check-prefix=X32
|
|
|
|
; RUN: llc < %s -march=ppc64 | FileCheck %s -check-prefix=X64
|
|
|
|
|
2006-07-11 04:53:53 +08:00
|
|
|
|
2008-03-25 12:26:08 +08:00
|
|
|
define void @STWBRX(i32 %i, i8* %ptr, i32 %off) {
|
|
|
|
%tmp1 = getelementptr i8* %ptr, i32 %off ; <i8*> [#uses=1]
|
|
|
|
%tmp1.upgrd.1 = bitcast i8* %tmp1 to i32* ; <i32*> [#uses=1]
|
|
|
|
%tmp13 = tail call i32 @llvm.bswap.i32( i32 %i ) ; <i32> [#uses=1]
|
|
|
|
store i32 %tmp13, i32* %tmp1.upgrd.1
|
|
|
|
ret void
|
2006-07-11 04:53:53 +08:00
|
|
|
}
|
|
|
|
|
2008-03-25 12:26:08 +08:00
|
|
|
define i32 @LWBRX(i8* %ptr, i32 %off) {
|
|
|
|
%tmp1 = getelementptr i8* %ptr, i32 %off ; <i8*> [#uses=1]
|
|
|
|
%tmp1.upgrd.2 = bitcast i8* %tmp1 to i32* ; <i32*> [#uses=1]
|
|
|
|
%tmp = load i32* %tmp1.upgrd.2 ; <i32> [#uses=1]
|
|
|
|
%tmp14 = tail call i32 @llvm.bswap.i32( i32 %tmp ) ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp14
|
2006-07-11 04:53:53 +08:00
|
|
|
}
|
|
|
|
|
2008-03-25 12:26:08 +08:00
|
|
|
define void @STHBRX(i16 %s, i8* %ptr, i32 %off) {
|
|
|
|
%tmp1 = getelementptr i8* %ptr, i32 %off ; <i8*> [#uses=1]
|
|
|
|
%tmp1.upgrd.3 = bitcast i8* %tmp1 to i16* ; <i16*> [#uses=1]
|
|
|
|
%tmp5 = call i16 @llvm.bswap.i16( i16 %s ) ; <i16> [#uses=1]
|
|
|
|
store i16 %tmp5, i16* %tmp1.upgrd.3
|
|
|
|
ret void
|
2006-07-11 04:53:53 +08:00
|
|
|
}
|
|
|
|
|
2008-03-25 12:26:08 +08:00
|
|
|
define i16 @LHBRX(i8* %ptr, i32 %off) {
|
|
|
|
%tmp1 = getelementptr i8* %ptr, i32 %off ; <i8*> [#uses=1]
|
|
|
|
%tmp1.upgrd.4 = bitcast i8* %tmp1 to i16* ; <i16*> [#uses=1]
|
|
|
|
%tmp = load i16* %tmp1.upgrd.4 ; <i16> [#uses=1]
|
|
|
|
%tmp6 = call i16 @llvm.bswap.i16( i16 %tmp ) ; <i16> [#uses=1]
|
|
|
|
ret i16 %tmp6
|
2006-07-11 04:53:53 +08:00
|
|
|
}
|
|
|
|
|
2008-03-25 12:26:08 +08:00
|
|
|
declare i32 @llvm.bswap.i32(i32)
|
|
|
|
|
|
|
|
declare i16 @llvm.bswap.i16(i16)
|
2006-07-11 04:53:53 +08:00
|
|
|
|
2009-11-22 19:45:44 +08:00
|
|
|
|
|
|
|
; X32: stwbrx 3, 4, 5
|
|
|
|
; X32: lwbrx 3, 3, 4
|
|
|
|
; X32: sthbrx 3, 4, 5
|
|
|
|
; X32: lhbrx 3, 3, 4
|
|
|
|
; X32-NOT: rlwinm
|
|
|
|
; X32-NOT: rlwimi
|
|
|
|
|
|
|
|
; X32: stwbrx 3, 4, 5
|
|
|
|
; X32: lwbrx 3, 3, 4
|
|
|
|
; X32: sthbrx 3, 4, 5
|
|
|
|
; X32: lhbrx 3, 3, 4
|
|
|
|
; X64-NOT: rlwinm
|
|
|
|
; X64-NOT: rlwimi
|
|
|
|
|