2006-01-14 11:14:10 +08:00
|
|
|
; bswap should be constant folded when it is passed a constant argument
|
|
|
|
|
2008-02-21 15:42:26 +08:00
|
|
|
; RUN: llvm-as < %s | llc -march=x86 | \
|
2007-08-15 21:36:28 +08:00
|
|
|
; RUN: grep bswapl | count 3
|
2008-02-21 15:42:26 +08:00
|
|
|
; RUN: llvm-as < %s | llc -march=x86 | grep rolw | count 1
|
2006-01-14 11:14:10 +08:00
|
|
|
|
2008-02-21 15:42:26 +08:00
|
|
|
declare i16 @llvm.bswap.i16(i16)
|
2006-01-14 11:14:10 +08:00
|
|
|
|
2008-02-21 15:42:26 +08:00
|
|
|
declare i32 @llvm.bswap.i32(i32)
|
|
|
|
|
|
|
|
declare i64 @llvm.bswap.i64(i64)
|
|
|
|
|
|
|
|
define i16 @W(i16 %A) {
|
|
|
|
%Z = call i16 @llvm.bswap.i16( i16 %A ) ; <i16> [#uses=1]
|
|
|
|
ret i16 %Z
|
2006-01-14 11:14:10 +08:00
|
|
|
}
|
|
|
|
|
2008-02-21 15:42:26 +08:00
|
|
|
define i32 @X(i32 %A) {
|
|
|
|
%Z = call i32 @llvm.bswap.i32( i32 %A ) ; <i32> [#uses=1]
|
|
|
|
ret i32 %Z
|
2006-01-14 11:14:10 +08:00
|
|
|
}
|
|
|
|
|
2008-02-21 15:42:26 +08:00
|
|
|
define i64 @Y(i64 %A) {
|
|
|
|
%Z = call i64 @llvm.bswap.i64( i64 %A ) ; <i64> [#uses=1]
|
|
|
|
ret i64 %Z
|
2006-01-14 11:14:10 +08:00
|
|
|
}
|
2008-02-21 15:42:26 +08:00
|
|
|
|