Akira Hatanaka | bd95275 | 2011-12-20 23:58:36 +0000 | [diff] [blame] | 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 |
Simon Atanasyan | 1093afe2 | 2013-11-19 12:20:17 +0000 | [diff] [blame] | 3 | ; RUN: llc < %s -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips32r2 -mattr=+mips16 | FileCheck %s -check-prefix=mips16 |
Akira Hatanaka | bd95275 | 2011-12-20 23:58:36 +0000 | [diff] [blame] | 4 | |
| 5 | define i32 @bswap32(i32 %x) nounwind readnone { |
| 6 | entry: |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 7 | ; MIPS32-LABEL: bswap32: |
Akira Hatanaka | bd95275 | 2011-12-20 23:58:36 +0000 | [diff] [blame] | 8 | ; MIPS32: wsbh $[[R0:[0-9]+]] |
| 9 | ; MIPS32: rotr ${{[0-9]+}}, $[[R0]], 16 |
Reed Kotler | 97309af | 2013-10-08 17:32:33 +0000 | [diff] [blame] | 10 | ; mips16: .ent bswap32 |
Akira Hatanaka | bd95275 | 2011-12-20 23:58:36 +0000 | [diff] [blame] | 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: |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 17 | ; MIPS64-LABEL: bswap64: |
Akira Hatanaka | bd95275 | 2011-12-20 23:58:36 +0000 | [diff] [blame] | 18 | ; MIPS64: dsbh $[[R0:[0-9]+]] |
| 19 | ; MIPS64: dshd ${{[0-9]+}}, $[[R0]] |
Reed Kotler | 97309af | 2013-10-08 17:32:33 +0000 | [diff] [blame] | 20 | ; mips16: .ent bswap64 |
Akira Hatanaka | bd95275 | 2011-12-20 23:58:36 +0000 | [diff] [blame] | 21 | %or.7 = call i64 @llvm.bswap.i64(i64 %x) |
| 22 | ret i64 %or.7 |
| 23 | } |
| 24 | |
Raul E. Silvera | a9dafe6 | 2014-03-18 17:49:12 +0000 | [diff] [blame^] | 25 | define <4 x i32> @bswapv4i32(<4 x i32> %x) nounwind readnone { |
| 26 | entry: |
| 27 | ; MIPS32-LABEL: bswapv4i32: |
| 28 | ; MIPS32: wsbh $[[R0:[0-9]+]] |
| 29 | ; MIPS32: rotr ${{[0-9]+}}, $[[R0]], 16 |
| 30 | ; MIPS32: wsbh $[[R0:[0-9]+]] |
| 31 | ; MIPS32: rotr ${{[0-9]+}}, $[[R0]], 16 |
| 32 | ; MIPS32: wsbh $[[R0:[0-9]+]] |
| 33 | ; MIPS32: rotr ${{[0-9]+}}, $[[R0]], 16 |
| 34 | ; MIPS32: wsbh $[[R0:[0-9]+]] |
| 35 | ; MIPS32: rotr ${{[0-9]+}}, $[[R0]], 16 |
| 36 | ; mips16: .ent bswapv4i32 |
| 37 | %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %x) |
| 38 | ret <4 x i32> %ret |
| 39 | } |
| 40 | |
| 41 | |
| 42 | |
Akira Hatanaka | bd95275 | 2011-12-20 23:58:36 +0000 | [diff] [blame] | 43 | declare i32 @llvm.bswap.i32(i32) nounwind readnone |
| 44 | |
| 45 | declare i64 @llvm.bswap.i64(i64) nounwind readnone |
| 46 | |
Raul E. Silvera | a9dafe6 | 2014-03-18 17:49:12 +0000 | [diff] [blame^] | 47 | declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>) nounwind readnone |