summaryrefslogtreecommitdiff
path: root/test/MC/Mips/mips64extins.ll
diff options
context:
space:
mode:
authorJack Carter <jcarter@mips.com>2012-08-28 20:07:41 +0000
committerJack Carter <jcarter@mips.com>2012-08-28 20:07:41 +0000
commit714313b4828cec98b086b54b356407540aa775c4 (patch)
tree2c6a9d6c673915520cbdabf8905c72d9d8b856bd /test/MC/Mips/mips64extins.ll
parentfd6d1651551d5a08b3cf0fcafed5e91a40b8e317 (diff)
downloadllvm-714313b4828cec98b086b54b356407540aa775c4.tar.gz
llvm-714313b4828cec98b086b54b356407540aa775c4.tar.bz2
llvm-714313b4828cec98b086b54b356407540aa775c4.tar.xz
The instruction DEXT may be transformed into DEXTU or DEXTM depending
on the size of the extraction and its position in the 64 bit word. This patch allows support of the dext transformations with mips64 direct object output. 0 <= msb < 32 0 <= lsb < 32 0 <= pos < 32 1 <= size <= 32 DINS The field is entirely contained in the right-most word of the doubleword 32 <= msb < 64 0 <= lsb < 32 0 <= pos < 32 2 <= size <= 64 DINSM The field straddles the words of the doubleword 32 <= msb < 64 32 <= lsb < 64 32 <= pos < 64 1 <= size <= 32 DINSU The field is entirely contained in the left-most word of the doubleword git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162782 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/Mips/mips64extins.ll')
-rw-r--r--test/MC/Mips/mips64extins.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/MC/Mips/mips64extins.ll b/test/MC/Mips/mips64extins.ll
new file mode 100644
index 0000000000..b15409e5ca
--- /dev/null
+++ b/test/MC/Mips/mips64extins.ll
@@ -0,0 +1,28 @@
+; RUN: llc -march=mips64el -filetype=obj -mcpu=mips64r2 -mattr=n64 %s -o - \
+; RUN: | llvm-objdump -disassemble -triple mips64el -mattr +mips64r2 - \
+; RUN: | FileCheck %s
+
+define i64 @dext(i64 %i) nounwind readnone {
+entry:
+; CHECK: dext ${{[0-9]+}}, ${{[0-9]+}}, 5, 10
+ %shr = lshr i64 %i, 5
+ %and = and i64 %shr, 1023
+ ret i64 %and
+}
+
+define i64 @dextu(i64 %i) nounwind readnone {
+entry:
+; CHECK: dextu ${{[0-9]+}}, ${{[0-9]+}}, 2, 6
+ %shr = lshr i64 %i, 34
+ %and = and i64 %shr, 63
+ ret i64 %and
+}
+
+define i64 @dextm(i64 %i) nounwind readnone {
+entry:
+; CHECK: dextm ${{[0-9]+}}, ${{[0-9]+}}, 5, 2
+ %shr = lshr i64 %i, 5
+ %and = and i64 %shr, 17179869183
+ ret i64 %and
+}
+