blob: 0da2d2b7c28e596318c7c38e7344eda9c6ff7f20 [file] [log] [blame]
Akira Hatanakabd952752011-12-20 23:58:36 +00001; RUN: llc < %s -march=mipsel -mcpu=mips32r2 | FileCheck %s -check-prefix=MIPS32
2; RUN: llc < %s -march=mips64el -mcpu=mips64r2 | FileCheck %s -check-prefix=MIPS64
3
4define i32 @bswap32(i32 %x) nounwind readnone {
5entry:
Stephen Lind24ab202013-07-14 06:24:09 +00006; MIPS32-LABEL: bswap32:
Akira Hatanakabd952752011-12-20 23:58:36 +00007; MIPS32: wsbh $[[R0:[0-9]+]]
8; MIPS32: rotr ${{[0-9]+}}, $[[R0]], 16
9 %or.3 = call i32 @llvm.bswap.i32(i32 %x)
10 ret i32 %or.3
11}
12
13define i64 @bswap64(i64 %x) nounwind readnone {
14entry:
Stephen Lind24ab202013-07-14 06:24:09 +000015; MIPS64-LABEL: bswap64:
Akira Hatanakabd952752011-12-20 23:58:36 +000016; MIPS64: dsbh $[[R0:[0-9]+]]
17; MIPS64: dshd ${{[0-9]+}}, $[[R0]]
18 %or.7 = call i64 @llvm.bswap.i64(i64 %x)
19 ret i64 %or.7
20}
21
22declare i32 @llvm.bswap.i32(i32) nounwind readnone
23
24declare i64 @llvm.bswap.i64(i64) nounwind readnone
25