1; RUN: llc -march=mips64el -filetype=obj -mcpu=mips64r2 -mattr=n64 %s -o - \
2; RUN: | llvm-objdump -disassemble -triple mips64el -mattr +mips64r2 - \
3; RUN: | FileCheck %s
4
5define i64 @dext(i64 %i) nounwind readnone {
6entry:
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
13define i64 @dextu(i64 %i) nounwind readnone {
14entry:
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
21define i64 @dextm(i64 %i) nounwind readnone {
22entry:
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
29define i64 @dins(i64 %i, i64 %j) nounwind readnone {
30entry:
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
39define i64 @dinsm(i64 %i, i64 %j) nounwind readnone {
40entry:
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
49define i64 @dinsu(i64 %i, i64 %j) nounwind readnone {
50entry:
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}
58