2016-07-19 21:35:11 +08:00
|
|
|
; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone | FileCheck %s
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
define i128 @shl(i128 %r, i128 %s) nounwind readnone {
|
|
|
|
; CHECK-LABEL: shl:
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: lsr [[LO_FOR_HI_NORMAL:x[0-9]+]], x0, [[REV_SHIFT]]
|
|
|
|
; CHECK: cmp x2, #0
|
|
|
|
; CHECK: csel [[LO_FOR_HI:x[0-9]+]], xzr, [[LO_FOR_HI_NORMAL]], eq
|
|
|
|
; CHECK: lsl [[HI_FOR_HI:x[0-9]+]], x1, x2
|
|
|
|
; CHECK: orr [[HI_NORMAL:x[0-9]+]], [[LO_FOR_HI]], [[HI_FOR_HI]]
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: lsl [[HI_BIG_SHIFT:x[0-9]+]], x0, x2
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: sub [[EXTRA_SHIFT:x[0-9]+]], x2, #64
|
|
|
|
; CHECK: cmp [[EXTRA_SHIFT]], #0
|
|
|
|
; CHECK: csel x1, [[HI_BIG_SHIFT]], [[HI_NORMAL]], ge
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: csel x0, xzr, [[HI_BIG_SHIFT]], ge
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: ret
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
%shl = shl i128 %r, %s
|
|
|
|
ret i128 %shl
|
|
|
|
}
|
|
|
|
|
|
|
|
define i128 @ashr(i128 %r, i128 %s) nounwind readnone {
|
2014-04-16 19:52:51 +08:00
|
|
|
; CHECK-LABEL: ashr:
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: lsl [[HI_FOR_LO_NORMAL:x[0-9]+]], x1, [[REV_SHIFT]]
|
|
|
|
; CHECK: cmp x2, #0
|
|
|
|
; CHECK: csel [[HI_FOR_LO:x[0-9]+]], xzr, [[HI_FOR_LO_NORMAL]], eq
|
|
|
|
; CHECK: lsr [[LO_FOR_LO:x[0-9]+]], x0, x2
|
|
|
|
; CHECK: orr [[LO_NORMAL:x[0-9]+]], [[LO_FOR_LO]], [[HI_FOR_LO]]
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: asr [[LO_BIG_SHIFT:x[0-9]+]], x1, x2
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: sub [[EXTRA_SHIFT:x[0-9]+]], x2, #64
|
|
|
|
; CHECK: cmp [[EXTRA_SHIFT]], #0
|
|
|
|
; CHECK: csel x0, [[LO_BIG_SHIFT]], [[LO_NORMAL]], ge
|
|
|
|
; CHECK: asr [[BIGSHIFT_HI:x[0-9]+]], x1, #63
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: csel x1, [[BIGSHIFT_HI]], [[LO_BIG_SHIFT]], ge
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: ret
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
%shr = ashr i128 %r, %s
|
|
|
|
ret i128 %shr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i128 @lshr(i128 %r, i128 %s) nounwind readnone {
|
2014-04-16 19:52:51 +08:00
|
|
|
; CHECK-LABEL: lshr:
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: neg [[REV_SHIFT:x[0-9]+]], x2
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: lsl [[HI_FOR_LO_NORMAL:x[0-9]+]], x1, [[REV_SHIFT]]
|
|
|
|
; CHECK: cmp x2, #0
|
|
|
|
; CHECK: csel [[HI_FOR_LO:x[0-9]+]], xzr, [[HI_FOR_LO_NORMAL]], eq
|
|
|
|
; CHECK: lsr [[LO_FOR_LO:x[0-9]+]], x0, x2
|
|
|
|
; CHECK: orr [[LO_NORMAL:x[0-9]+]], [[LO_FOR_LO]], [[HI_FOR_LO]]
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: lsr [[LO_BIG_SHIFT:x[0-9]+]], x1, x2
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: cmp [[EXTRA_SHIFT]], #0
|
|
|
|
; CHECK: csel x0, [[LO_BIG_SHIFT]], [[LO_NORMAL]], ge
|
2018-05-25 02:29:42 +08:00
|
|
|
; CHECK: csel x1, xzr, [[LO_BIG_SHIFT]], ge
|
2015-12-02 08:33:54 +08:00
|
|
|
; CHECK: ret
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
%shr = lshr i128 %r, %s
|
|
|
|
ret i128 %shr
|
|
|
|
}
|