2006-01-14 09:25:24 +08:00
|
|
|
; bswap should be constant folded when it is passed a constant argument
|
|
|
|
|
2011-11-24 05:33:37 +08:00
|
|
|
; RUN: opt < %s -constprop -S | FileCheck %s
|
2006-01-14 09:25:24 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
declare i16 @llvm.bswap.i16(i16)
|
2006-01-14 09:25:24 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
declare i32 @llvm.bswap.i32(i32)
|
|
|
|
|
|
|
|
declare i64 @llvm.bswap.i64(i64)
|
|
|
|
|
2011-11-24 05:33:37 +08:00
|
|
|
declare i80 @llvm.bswap.i80(i80)
|
|
|
|
|
2013-07-14 09:50:49 +08:00
|
|
|
; CHECK-LABEL: define i16 @W(
|
2008-03-01 17:15:35 +08:00
|
|
|
define i16 @W() {
|
2011-11-24 05:33:37 +08:00
|
|
|
; CHECK: ret i16 256
|
2008-03-01 17:15:35 +08:00
|
|
|
%Z = call i16 @llvm.bswap.i16( i16 1 ) ; <i16> [#uses=1]
|
|
|
|
ret i16 %Z
|
2006-01-14 09:25:24 +08:00
|
|
|
}
|
|
|
|
|
2013-07-14 09:50:49 +08:00
|
|
|
; CHECK-LABEL: define i32 @X(
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @X() {
|
2011-11-24 05:33:37 +08:00
|
|
|
; CHECK: ret i32 16777216
|
2008-03-01 17:15:35 +08:00
|
|
|
%Z = call i32 @llvm.bswap.i32( i32 1 ) ; <i32> [#uses=1]
|
|
|
|
ret i32 %Z
|
2006-01-14 09:25:24 +08:00
|
|
|
}
|
|
|
|
|
2013-07-14 09:50:49 +08:00
|
|
|
; CHECK-LABEL: define i64 @Y(
|
2008-03-01 17:15:35 +08:00
|
|
|
define i64 @Y() {
|
2011-11-24 05:33:37 +08:00
|
|
|
; CHECK: ret i64 72057594037927936
|
2008-03-01 17:15:35 +08:00
|
|
|
%Z = call i64 @llvm.bswap.i64( i64 1 ) ; <i64> [#uses=1]
|
|
|
|
ret i64 %Z
|
2006-01-14 09:25:24 +08:00
|
|
|
}
|
2008-03-01 17:15:35 +08:00
|
|
|
|
2013-07-14 09:50:49 +08:00
|
|
|
; CHECK-LABEL: define i80 @Z(
|
2011-11-24 05:33:37 +08:00
|
|
|
define i80 @Z() {
|
|
|
|
; CHECK: ret i80 -450681596205739728166896
|
|
|
|
; 0xA0908070605040302010
|
|
|
|
%Z = call i80 @llvm.bswap.i80( i80 76151636403560493650080 )
|
|
|
|
; 0x102030405060708090A0
|
|
|
|
ret i80 %Z
|
|
|
|
}
|