1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone -aarch64-enable-sink-fold=true | FileCheck %s
4 define i128 @shl(i128 %r, i128 %s) nounwind readnone {
7 ; CHECK-NEXT: lsl x8, x1, x2
8 ; CHECK-NEXT: mvn w9, w2
9 ; CHECK-NEXT: lsr x10, x0, #1
10 ; CHECK-NEXT: lsr x9, x10, x9
11 ; CHECK-NEXT: orr x8, x8, x9
12 ; CHECK-NEXT: lsl x9, x0, x2
13 ; CHECK-NEXT: tst x2, #0x40
14 ; CHECK-NEXT: csel x1, x9, x8, ne
15 ; CHECK-NEXT: csel x0, xzr, x9, ne
17 %shl = shl i128 %r, %s
21 define i128 @shl_mask(i128 %r, i128 %s) nounwind readnone {
22 ; CHECK-LABEL: shl_mask:
24 ; CHECK-NEXT: lsl x8, x1, x2
25 ; CHECK-NEXT: lsr x9, x0, #1
26 ; CHECK-NEXT: and x10, x2, #0x3f
27 ; CHECK-NEXT: eor x10, x10, #0x3f
28 ; CHECK-NEXT: lsr x9, x9, x10
29 ; CHECK-NEXT: lsl x0, x0, x2
30 ; CHECK-NEXT: orr x1, x8, x9
32 %mask = and i128 %s, 63
33 %shl = shl i128 %r, %mask
37 define i128 @ashr(i128 %r, i128 %s) nounwind readnone {
40 ; CHECK-NEXT: lsr x8, x0, x2
41 ; CHECK-NEXT: mvn w9, w2
42 ; CHECK-NEXT: lsl x10, x1, #1
43 ; CHECK-NEXT: lsl x9, x10, x9
44 ; CHECK-NEXT: orr x8, x9, x8
45 ; CHECK-NEXT: asr x9, x1, x2
46 ; CHECK-NEXT: tst x2, #0x40
47 ; CHECK-NEXT: csel x0, x9, x8, ne
48 ; CHECK-NEXT: asr x8, x1, #63
49 ; CHECK-NEXT: csel x1, x8, x9, ne
51 %shr = ashr i128 %r, %s
55 define i128 @ashr_mask(i128 %r, i128 %s) nounwind readnone {
56 ; CHECK-LABEL: ashr_mask:
58 ; CHECK-NEXT: lsr x8, x0, x2
59 ; CHECK-NEXT: lsl x9, x1, #1
60 ; CHECK-NEXT: and x10, x2, #0x3f
61 ; CHECK-NEXT: eor x10, x10, #0x3f
62 ; CHECK-NEXT: lsl x9, x9, x10
63 ; CHECK-NEXT: asr x1, x1, x2
64 ; CHECK-NEXT: orr x0, x9, x8
66 %mask = and i128 %s, 63
67 %shr = ashr i128 %r, %mask
71 define i128 @lshr(i128 %r, i128 %s) nounwind readnone {
74 ; CHECK-NEXT: lsr x8, x0, x2
75 ; CHECK-NEXT: mvn w9, w2
76 ; CHECK-NEXT: lsl x10, x1, #1
77 ; CHECK-NEXT: lsl x9, x10, x9
78 ; CHECK-NEXT: orr x8, x9, x8
79 ; CHECK-NEXT: lsr x9, x1, x2
80 ; CHECK-NEXT: tst x2, #0x40
81 ; CHECK-NEXT: csel x0, x9, x8, ne
82 ; CHECK-NEXT: csel x1, xzr, x9, ne
84 %shr = lshr i128 %r, %s
88 define i128 @lshr_mask(i128 %r, i128 %s) nounwind readnone {
89 ; CHECK-LABEL: lshr_mask:
91 ; CHECK-NEXT: lsr x8, x0, x2
92 ; CHECK-NEXT: lsl x9, x1, #1
93 ; CHECK-NEXT: and x10, x2, #0x3f
94 ; CHECK-NEXT: eor x10, x10, #0x3f
95 ; CHECK-NEXT: lsl x9, x9, x10
96 ; CHECK-NEXT: lsr x1, x1, x2
97 ; CHECK-NEXT: orr x0, x9, x8
99 %mask = and i128 %s, 63
100 %shr = lshr i128 %r, %mask