summaryrefslogtreecommitdiffstats
path: root/test/Transforms/ConstProp/bswap.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/ConstProp/bswap.ll')
-rw-r--r--test/Transforms/ConstProp/bswap.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Transforms/ConstProp/bswap.ll b/test/Transforms/ConstProp/bswap.ll
new file mode 100644
index 0000000..9fce309
--- /dev/null
+++ b/test/Transforms/ConstProp/bswap.ll
@@ -0,0 +1,25 @@
+; bswap should be constant folded when it is passed a constant argument
+
+; RUN: opt < %s -constprop -S | not grep call
+
+declare i16 @llvm.bswap.i16(i16)
+
+declare i32 @llvm.bswap.i32(i32)
+
+declare i64 @llvm.bswap.i64(i64)
+
+define i16 @W() {
+ %Z = call i16 @llvm.bswap.i16( i16 1 ) ; <i16> [#uses=1]
+ ret i16 %Z
+}
+
+define i32 @X() {
+ %Z = call i32 @llvm.bswap.i32( i32 1 ) ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i64 @Y() {
+ %Z = call i64 @llvm.bswap.i64( i64 1 ) ; <i64> [#uses=1]
+ ret i64 %Z
+}
+