1 ; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone | FileCheck %s
3 define i128 @shl(i128 %r, i128 %s) nounwind readnone {
5 ; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
6 ; CHECK: lsr [[LO_FOR_HI_NORMAL:x[0-9]+]], x0, [[REV_SHIFT]]
8 ; CHECK: csel [[LO_FOR_HI:x[0-9]+]], xzr, [[LO_FOR_HI_NORMAL]], eq
9 ; CHECK: lsl [[HI_FOR_HI:x[0-9]+]], x1, x2
10 ; CHECK: orr [[HI_NORMAL:x[0-9]+]], [[LO_FOR_HI]], [[HI_FOR_HI]]
11 ; CHECK: lsl [[HI_BIG_SHIFT:x[0-9]+]], x0, x2
12 ; CHECK: sub [[EXTRA_SHIFT:x[0-9]+]], x2, #64
13 ; CHECK: cmp [[EXTRA_SHIFT]], #0
14 ; CHECK: csel x1, [[HI_BIG_SHIFT]], [[HI_NORMAL]], ge
15 ; CHECK: csel x0, xzr, [[HI_BIG_SHIFT]], ge
18 %shl = shl i128 %r, %s
22 define i128 @ashr(i128 %r, i128 %s) nounwind readnone {
24 ; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
25 ; CHECK: lsl [[HI_FOR_LO_NORMAL:x[0-9]+]], x1, [[REV_SHIFT]]
27 ; CHECK: csel [[HI_FOR_LO:x[0-9]+]], xzr, [[HI_FOR_LO_NORMAL]], eq
28 ; CHECK: lsr [[LO_FOR_LO:x[0-9]+]], x0, x2
29 ; CHECK: orr [[LO_NORMAL:x[0-9]+]], [[LO_FOR_LO]], [[HI_FOR_LO]]
30 ; CHECK: asr [[LO_BIG_SHIFT:x[0-9]+]], x1, x2
31 ; CHECK: sub [[EXTRA_SHIFT:x[0-9]+]], x2, #64
32 ; CHECK: cmp [[EXTRA_SHIFT]], #0
33 ; CHECK: csel x0, [[LO_BIG_SHIFT]], [[LO_NORMAL]], ge
34 ; CHECK: asr [[BIGSHIFT_HI:x[0-9]+]], x1, #63
35 ; CHECK: csel x1, [[BIGSHIFT_HI]], [[LO_BIG_SHIFT]], ge
38 %shr = ashr i128 %r, %s
42 define i128 @lshr(i128 %r, i128 %s) nounwind readnone {
44 ; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
45 ; CHECK: lsl [[HI_FOR_LO_NORMAL:x[0-9]+]], x1, [[REV_SHIFT]]
47 ; CHECK: csel [[HI_FOR_LO:x[0-9]+]], xzr, [[HI_FOR_LO_NORMAL]], eq
48 ; CHECK: lsr [[LO_FOR_LO:x[0-9]+]], x0, x2
49 ; CHECK: orr [[LO_NORMAL:x[0-9]+]], [[LO_FOR_LO]], [[HI_FOR_LO]]
50 ; CHECK: lsr [[LO_BIG_SHIFT:x[0-9]+]], x1, x2
51 ; CHECK: cmp [[EXTRA_SHIFT]], #0
52 ; CHECK: csel x0, [[LO_BIG_SHIFT]], [[LO_NORMAL]], ge
53 ; CHECK: csel x1, xzr, [[LO_BIG_SHIFT]], ge
56 %shr = lshr i128 %r, %s