| Daniel Sanders | a4eaf59 | 2013-10-17 13:38:20 +0000 | [diff] [blame] | 1 | ; Test the MSA intrinsics that are encoded with the SPECIAL instruction format. |
| 2 | |
| Matheus Almeida | b4133b2 | 2014-02-10 11:30:09 +0000 | [diff] [blame] | 3 | ; RUN: llc -march=mips -mattr=+msa,+fp64 < %s | \ |
| 4 | ; RUN: FileCheck %s --check-prefix=MIPS32 |
| Matheus Almeida | 4b27eb5 | 2014-02-10 12:05:17 +0000 | [diff] [blame] | 5 | ; RUN: llc -march=mips64 -mcpu=mips64r2 -mattr=+msa,+fp64 < %s | \ |
| 6 | ; RUN: FileCheck %s --check-prefix=MIPS64 |
| Zoran Jovanovic | 6a29b55 | 2014-06-20 09:28:09 +0000 | [diff] [blame] | 7 | ; RUN: llc -march=mips -mcpu=mips32r6 -mattr=+msa < %s | \ |
| 8 | ; RUN: FileCheck %s --check-prefix=MIPS32 |
| 9 | ; RUN: llc -march=mips64 -mcpu=mips64r6 -mattr=+msa < %s | \ |
| 10 | ; RUN: FileCheck %s --check-prefix=MIPS64 |
| Daniel Sanders | a4eaf59 | 2013-10-17 13:38:20 +0000 | [diff] [blame] | 11 | |
| 12 | define i32 @llvm_mips_lsa_test(i32 %a, i32 %b) nounwind { |
| 13 | entry: |
| 14 | %0 = tail call i32 @llvm.mips.lsa(i32 %a, i32 %b, i32 2) |
| 15 | ret i32 %0 |
| 16 | } |
| 17 | |
| 18 | declare i32 @llvm.mips.lsa(i32, i32, i32) nounwind |
| 19 | |
| Matheus Almeida | b4133b2 | 2014-02-10 11:30:09 +0000 | [diff] [blame] | 20 | ; MIPS32: llvm_mips_lsa_test: |
| 21 | ; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2 |
| 22 | ; MIPS32: .size llvm_mips_lsa_test |
| Daniel Sanders | a4eaf59 | 2013-10-17 13:38:20 +0000 | [diff] [blame] | 23 | |
| 24 | define i32 @lsa_test(i32 %a, i32 %b) nounwind { |
| 25 | entry: |
| 26 | %0 = shl i32 %b, 2 |
| 27 | %1 = add i32 %a, %0 |
| 28 | ret i32 %1 |
| 29 | } |
| 30 | |
| Matheus Almeida | b4133b2 | 2014-02-10 11:30:09 +0000 | [diff] [blame] | 31 | ; MIPS32: lsa_test: |
| 32 | ; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2 |
| 33 | ; MIPS32: .size lsa_test |
| Matheus Almeida | 4b27eb5 | 2014-02-10 12:05:17 +0000 | [diff] [blame] | 34 | |
| 35 | define i64 @llvm_mips_dlsa_test(i64 %a, i64 %b) nounwind { |
| 36 | entry: |
| 37 | %0 = tail call i64 @llvm.mips.dlsa(i64 %a, i64 %b, i32 2) |
| 38 | ret i64 %0 |
| 39 | } |
| 40 | |
| 41 | declare i64 @llvm.mips.dlsa(i64, i64, i32) nounwind |
| 42 | |
| 43 | ; MIPS64: llvm_mips_dlsa_test: |
| 44 | ; MIPS64: dlsa {{\$[0-9]+}}, $5, $4, 2 |
| 45 | ; MIPS64: .size llvm_mips_dlsa_test |
| 46 | |
| 47 | define i64 @dlsa_test(i64 %a, i64 %b) nounwind { |
| 48 | entry: |
| 49 | %0 = shl i64 %b, 2 |
| 50 | %1 = add i64 %a, %0 |
| 51 | ret i64 %1 |
| 52 | } |
| 53 | |
| 54 | ; MIPS64: dlsa_test: |
| 55 | ; MIPS64: dlsa {{\$[0-9]+}}, $5, $4, 2 |
| 56 | ; MIPS64: .size dlsa_test |