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