[mips][ias] Range check uimm3 operands.
[oota-llvm.git] / test / MC / Mips / mips64extins.ll
1 ; RUN: llc -march=mips64el -filetype=obj -mcpu=mips64r2 -target-abi=n64 %s -o - \
2 ; RUN: | llvm-objdump -disassemble -triple mips64el -mattr +mips64r2 - \
3 ; RUN: | FileCheck %s
4
5 define i64 @dext(i64 %i) nounwind readnone {
6 entry:
7 ; CHECK: dext ${{[0-9]+}}, ${{[0-9]+}}, 5, 10
8   %shr = lshr i64 %i, 5
9   %and = and i64 %shr, 1023
10   ret i64 %and
11 }
12
13 define i64 @dextu(i64 %i) nounwind readnone {
14 entry:
15 ; CHECK: dextu ${{[0-9]+}}, ${{[0-9]+}}, 2, 6
16   %shr = lshr i64 %i, 34
17   %and = and i64 %shr, 63
18   ret i64 %and
19 }
20
21 define i64 @dextm(i64 %i) nounwind readnone {
22 entry:
23 ; CHECK: dextm ${{[0-9]+}}, ${{[0-9]+}}, 5, 2
24   %shr = lshr i64 %i, 5
25   %and = and i64 %shr, 17179869183
26   ret i64 %and
27 }
28
29 define i64 @dins(i64 %i, i64 %j) nounwind readnone {
30 entry:
31 ; CHECK: dins ${{[0-9]+}}, ${{[0-9]+}}, 8, 10
32   %shl2 = shl i64 %j, 8
33   %and = and i64 %shl2, 261888
34   %and3 = and i64 %i, -261889
35   %or = or i64 %and3, %and
36   ret i64 %or
37 }
38
39 define i64 @dinsm(i64 %i, i64 %j) nounwind readnone {
40 entry:
41 ; CHECK: dinsm ${{[0-9]+}}, ${{[0-9]+}}, 10, 1
42   %shl4 = shl i64 %j, 10
43   %and = and i64 %shl4, 8796093021184
44   %and5 = and i64 %i, -8796093021185
45   %or = or i64 %and5, %and
46   ret i64 %or
47 }
48
49 define i64 @dinsu(i64 %i, i64 %j) nounwind readnone {
50 entry:
51 ; CHECK: dinsu ${{[0-9]+}}, ${{[0-9]+}}, 8, 13
52   %shl4 = shl i64 %j, 40
53   %and = and i64 %shl4, 9006099743113216
54   %and5 = and i64 %i, -9006099743113217
55   %or = or i64 %and5, %and
56   ret i64 %or
57 }