summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatheus Almeida <matheus.almeida@imgtec.com>2014-02-10 12:05:17 +0000
committerMatheus Almeida <matheus.almeida@imgtec.com>2014-02-10 12:05:17 +0000
commit3f14ca5e3027bae10203ea02e716a1a4c6fddf80 (patch)
tree8204d1d596830ae72feff848c04457955a25cb27 /test
parent5f09dd31f0220d54c32464ce7ca19b1af17ec984 (diff)
downloadllvm-3f14ca5e3027bae10203ea02e716a1a4c6fddf80.tar.gz
llvm-3f14ca5e3027bae10203ea02e716a1a4c6fddf80.tar.bz2
llvm-3f14ca5e3027bae10203ea02e716a1a4c6fddf80.tar.xz
[mips][msa] Add DLSA instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201081 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/Mips/msa/special.ll25
-rw-r--r--test/MC/Mips/msa/test_dlsa.s21
2 files changed, 46 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/msa/special.ll b/test/CodeGen/Mips/msa/special.ll
index b325c68b6a..f65a14f7bb 100644
--- a/test/CodeGen/Mips/msa/special.ll
+++ b/test/CodeGen/Mips/msa/special.ll
@@ -2,6 +2,8 @@
; RUN: llc -march=mips -mattr=+msa,+fp64 < %s | \
; RUN: FileCheck %s --check-prefix=MIPS32
+; RUN: llc -march=mips64 -mcpu=mips64r2 -mattr=+msa,+fp64 < %s | \
+; RUN: FileCheck %s --check-prefix=MIPS64
define i32 @llvm_mips_lsa_test(i32 %a, i32 %b) nounwind {
entry:
@@ -25,3 +27,26 @@ entry:
; MIPS32: lsa_test:
; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2
; MIPS32: .size lsa_test
+
+define i64 @llvm_mips_dlsa_test(i64 %a, i64 %b) nounwind {
+entry:
+ %0 = tail call i64 @llvm.mips.dlsa(i64 %a, i64 %b, i32 2)
+ ret i64 %0
+}
+
+declare i64 @llvm.mips.dlsa(i64, i64, i32) nounwind
+
+; MIPS64: llvm_mips_dlsa_test:
+; MIPS64: dlsa {{\$[0-9]+}}, $5, $4, 2
+; MIPS64: .size llvm_mips_dlsa_test
+
+define i64 @dlsa_test(i64 %a, i64 %b) nounwind {
+entry:
+ %0 = shl i64 %b, 2
+ %1 = add i64 %a, %0
+ ret i64 %1
+}
+
+; MIPS64: dlsa_test:
+; MIPS64: dlsa {{\$[0-9]+}}, $5, $4, 2
+; MIPS64: .size dlsa_test
diff --git a/test/MC/Mips/msa/test_dlsa.s b/test/MC/Mips/msa/test_dlsa.s
new file mode 100644
index 0000000000..a70999dc72
--- /dev/null
+++ b/test/MC/Mips/msa/test_dlsa.s
@@ -0,0 +1,21 @@
+# RUN: llvm-mc %s -arch=mips64 -mcpu=mips64r2 -mattr=+msa -show-encoding | \
+# RUN: FileCheck %s
+#
+# RUN: llvm-mc %s -arch=mips -mcpu=mips64r2 -mattr=+msa -filetype=obj -o - | \
+# RUN: llvm-objdump -d -arch=mips64 -mattr=+msa - | \
+# RUN: FileCheck %s -check-prefix=CHECKOBJDUMP
+#
+# CHECK: dlsa $8, $9, $10, 1 # encoding: [0x01,0x2a,0x40,0x15]
+# CHECK: dlsa $8, $9, $10, 2 # encoding: [0x01,0x2a,0x40,0x55]
+# CHECK: dlsa $8, $9, $10, 3 # encoding: [0x01,0x2a,0x40,0x95]
+# CHECK: dlsa $8, $9, $10, 4 # encoding: [0x01,0x2a,0x40,0xd5]
+
+# CHECKOBJDUMP: dlsa $8, $9, $10, 1
+# CHECKOBJDUMP: dlsa $8, $9, $10, 2
+# CHECKOBJDUMP: dlsa $8, $9, $10, 3
+# CHECKOBJDUMP: dlsa $8, $9, $10, 4
+
+ dlsa $8, $9, $10, 1
+ dlsa $8, $9, $10, 2
+ dlsa $8, $9, $10, 3
+ dlsa $8, $9, $10, 4