]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/Mips/bswap.ll
Vendor import of llvm release_34 branch r197841 (effectively, 3.4 RC3):
[FreeBSD/FreeBSD.git] / test / CodeGen / Mips / bswap.ll
1 ; 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 ; RUN: llc  < %s -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips32r2 -mattr=+mips16 -soft-float -mips16-hard-float   | FileCheck %s -check-prefix=mips16 
4
5 define i32 @bswap32(i32 %x) nounwind readnone {
6 entry:
7 ; MIPS32-LABEL: bswap32:
8 ; MIPS32: wsbh $[[R0:[0-9]+]]
9 ; MIPS32: rotr ${{[0-9]+}}, $[[R0]], 16
10 ; mips16: .ent bswap32
11   %or.3 = call i32 @llvm.bswap.i32(i32 %x)
12   ret i32 %or.3
13 }
14
15 define i64 @bswap64(i64 %x) nounwind readnone {
16 entry:
17 ; MIPS64-LABEL: bswap64:
18 ; MIPS64: dsbh $[[R0:[0-9]+]]
19 ; MIPS64: dshd ${{[0-9]+}}, $[[R0]]
20 ; mips16: .ent bswap64
21   %or.7 = call i64 @llvm.bswap.i64(i64 %x)
22   ret i64 %or.7
23 }
24
25 declare i32 @llvm.bswap.i32(i32) nounwind readnone
26
27 declare i64 @llvm.bswap.i64(i64) nounwind readnone
28