blob: b9badf5dc5822f495cfc18988bfb75f55a3e2128 [file] [log] [blame]
Daniel Sandersa4eaf592013-10-17 13:38:20 +00001; Test the MSA intrinsics that are encoded with the SPECIAL instruction format.
2
Matheus Almeidab4133b22014-02-10 11:30:09 +00003; RUN: llc -march=mips -mattr=+msa,+fp64 < %s | \
4; RUN: FileCheck %s --check-prefix=MIPS32
Matheus Almeida4b27eb52014-02-10 12:05:17 +00005; RUN: llc -march=mips64 -mcpu=mips64r2 -mattr=+msa,+fp64 < %s | \
6; RUN: FileCheck %s --check-prefix=MIPS64
Zoran Jovanovic6a29b552014-06-20 09:28:09 +00007; 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 Sandersa4eaf592013-10-17 13:38:20 +000011
12define i32 @llvm_mips_lsa_test(i32 %a, i32 %b) nounwind {
13entry:
14 %0 = tail call i32 @llvm.mips.lsa(i32 %a, i32 %b, i32 2)
15 ret i32 %0
16}
17
18declare i32 @llvm.mips.lsa(i32, i32, i32) nounwind
19
Matheus Almeidab4133b22014-02-10 11:30:09 +000020; MIPS32: llvm_mips_lsa_test:
21; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2
22; MIPS32: .size llvm_mips_lsa_test
Daniel Sandersa4eaf592013-10-17 13:38:20 +000023
24define i32 @lsa_test(i32 %a, i32 %b) nounwind {
25entry:
26 %0 = shl i32 %b, 2
27 %1 = add i32 %a, %0
28 ret i32 %1
29}
30
Matheus Almeidab4133b22014-02-10 11:30:09 +000031; MIPS32: lsa_test:
32; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2
33; MIPS32: .size lsa_test
Matheus Almeida4b27eb52014-02-10 12:05:17 +000034
35define i64 @llvm_mips_dlsa_test(i64 %a, i64 %b) nounwind {
36entry:
37 %0 = tail call i64 @llvm.mips.dlsa(i64 %a, i64 %b, i32 2)
38 ret i64 %0
39}
40
41declare 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
47define i64 @dlsa_test(i64 %a, i64 %b) nounwind {
48entry:
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