summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2011-12-20 23:58:36 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2011-12-20 23:58:36 +0000
commitcf966cb0c363d1820b50a88beecfd3c6779d6823 (patch)
tree04040f8041eaf97af57faca9248a6d8f66000602
parentc0ea04389c9fc0b73d0cbd90ec3a5bc076d25d7b (diff)
Test case for r147017.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147018 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGen/Mips/bswap.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/bswap.ll b/test/CodeGen/Mips/bswap.ll
new file mode 100644
index 00000000000..a8fc2cdc743
--- /dev/null
+++ b/test/CodeGen/Mips/bswap.ll
@@ -0,0 +1,25 @@
+; RUN: llc < %s -march=mipsel -mcpu=mips32r2 | FileCheck %s -check-prefix=MIPS32
+; RUN: llc < %s -march=mips64el -mcpu=mips64r2 | FileCheck %s -check-prefix=MIPS64
+
+define i32 @bswap32(i32 %x) nounwind readnone {
+entry:
+; MIPS32: bswap32:
+; MIPS32: wsbh $[[R0:[0-9]+]]
+; MIPS32: rotr ${{[0-9]+}}, $[[R0]], 16
+ %or.3 = call i32 @llvm.bswap.i32(i32 %x)
+ ret i32 %or.3
+}
+
+define i64 @bswap64(i64 %x) nounwind readnone {
+entry:
+; MIPS64: bswap64:
+; MIPS64: dsbh $[[R0:[0-9]+]]
+; MIPS64: dshd ${{[0-9]+}}, $[[R0]]
+ %or.7 = call i64 @llvm.bswap.i64(i64 %x)
+ ret i64 %or.7
+}
+
+declare i32 @llvm.bswap.i32(i32) nounwind readnone
+
+declare i64 @llvm.bswap.i64(i64) nounwind readnone
+