2018-06-19 08:08:32 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2016-07-05 20:37:13 +08:00
|
|
|
; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi -mcpu=cortex-m0 -verify-machineinstrs | FileCheck --check-prefix CHECK-T1 %s
|
|
|
|
; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi -mcpu=cortex-m3 -verify-machineinstrs | FileCheck --check-prefix CHECK-T2 %s
|
|
|
|
|
|
|
|
define i32 @i(i32 %a) {
|
2018-06-19 08:08:32 +08:00
|
|
|
; CHECK-T1-LABEL: i:
|
|
|
|
; CHECK-T1: @ %bb.0: @ %entry
|
|
|
|
; CHECK-T1-NEXT: movs r1, #255
|
|
|
|
; CHECK-T1-NEXT: adds r1, #20
|
|
|
|
; CHECK-T1-NEXT: bics r0, r1
|
|
|
|
; CHECK-T1-NEXT: bx lr
|
|
|
|
;
|
|
|
|
; CHECK-T2-LABEL: i:
|
|
|
|
; CHECK-T2: @ %bb.0: @ %entry
|
|
|
|
; CHECK-T2-NEXT: movw r1, #275
|
|
|
|
; CHECK-T2-NEXT: bics r0, r1
|
|
|
|
; CHECK-T2-NEXT: bx lr
|
2016-07-05 20:37:13 +08:00
|
|
|
entry:
|
|
|
|
%and = and i32 %a, -276
|
|
|
|
ret i32 %and
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @j(i32 %a) {
|
2018-06-19 08:08:32 +08:00
|
|
|
; CHECK-T1-LABEL: j:
|
|
|
|
; CHECK-T1: @ %bb.0: @ %entry
|
|
|
|
; CHECK-T1-NEXT: movs r1, #128
|
|
|
|
; CHECK-T1-NEXT: bics r0, r1
|
|
|
|
; CHECK-T1-NEXT: bx lr
|
|
|
|
;
|
|
|
|
; CHECK-T2-LABEL: j:
|
|
|
|
; CHECK-T2: @ %bb.0: @ %entry
|
|
|
|
; CHECK-T2-NEXT: bic r0, r0, #128
|
|
|
|
; CHECK-T2-NEXT: bx lr
|
2016-07-05 20:37:13 +08:00
|
|
|
entry:
|
|
|
|
%and = and i32 %a, -129
|
|
|
|
ret i32 %and
|
|
|
|
}
|
2018-06-19 08:08:32 +08:00
|
|
|
|
|
|
|
define void @truncated(i16 %a, i16* %p) {
|
|
|
|
; CHECK-T1-LABEL: truncated:
|
|
|
|
; CHECK-T1: @ %bb.0:
|
2018-08-11 05:21:53 +08:00
|
|
|
; CHECK-T1-NEXT: movs r2, #128
|
|
|
|
; CHECK-T1-NEXT: bics r0, r2
|
|
|
|
; CHECK-T1-NEXT: strh r0, [r1]
|
|
|
|
; CHECK-T1-NEXT: bx lr
|
|
|
|
;
|
|
|
|
; CHECK-T2-LABEL: truncated:
|
|
|
|
; CHECK-T2: @ %bb.0:
|
|
|
|
; CHECK-T2-NEXT: bic r0, r0, #128
|
|
|
|
; CHECK-T2-NEXT: strh r0, [r1]
|
|
|
|
; CHECK-T2-NEXT: bx lr
|
|
|
|
%and = and i16 %a, -129
|
|
|
|
store i16 %and, i16* %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @truncated_neg2(i16 %a, i16* %p) {
|
|
|
|
; CHECK-T1-LABEL: truncated_neg2:
|
|
|
|
; CHECK-T1: @ %bb.0:
|
|
|
|
; CHECK-T1-NEXT: movs r2, #1
|
|
|
|
; CHECK-T1-NEXT: bics r0, r2
|
|
|
|
; CHECK-T1-NEXT: strh r0, [r1]
|
|
|
|
; CHECK-T1-NEXT: bx lr
|
|
|
|
;
|
|
|
|
; CHECK-T2-LABEL: truncated_neg2:
|
|
|
|
; CHECK-T2: @ %bb.0:
|
|
|
|
; CHECK-T2-NEXT: bic r0, r0, #1
|
|
|
|
; CHECK-T2-NEXT: strh r0, [r1]
|
|
|
|
; CHECK-T2-NEXT: bx lr
|
|
|
|
%and = and i16 %a, -2
|
|
|
|
store i16 %and, i16* %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @truncated_neg256(i16 %a, i16* %p) {
|
|
|
|
; CHECK-T1-LABEL: truncated_neg256:
|
|
|
|
; CHECK-T1: @ %bb.0:
|
|
|
|
; CHECK-T1-NEXT: movs r2, #255
|
|
|
|
; CHECK-T1-NEXT: bics r0, r2
|
|
|
|
; CHECK-T1-NEXT: strh r0, [r1]
|
|
|
|
; CHECK-T1-NEXT: bx lr
|
|
|
|
;
|
|
|
|
; CHECK-T2-LABEL: truncated_neg256:
|
|
|
|
; CHECK-T2: @ %bb.0:
|
|
|
|
; CHECK-T2-NEXT: bic r0, r0, #255
|
|
|
|
; CHECK-T2-NEXT: strh r0, [r1]
|
|
|
|
; CHECK-T2-NEXT: bx lr
|
|
|
|
%and = and i16 %a, -256
|
|
|
|
store i16 %and, i16* %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FIXME: Thumb2 supports "bic r0, r0, #510"
|
|
|
|
define void @truncated_neg511(i16 %a, i16* %p) {
|
|
|
|
; CHECK-T1-LABEL: truncated_neg511:
|
|
|
|
; CHECK-T1: @ %bb.0:
|
|
|
|
; CHECK-T1-NEXT: ldr r2, .LCPI5_0
|
2018-06-19 08:08:32 +08:00
|
|
|
; CHECK-T1-NEXT: ands r2, r0
|
|
|
|
; CHECK-T1-NEXT: strh r2, [r1]
|
|
|
|
; CHECK-T1-NEXT: bx lr
|
|
|
|
; CHECK-T1-NEXT: .p2align 2
|
|
|
|
; CHECK-T1-NEXT: @ %bb.1:
|
2018-08-11 05:21:53 +08:00
|
|
|
; CHECK-T1-NEXT: .LCPI5_0:
|
|
|
|
; CHECK-T1-NEXT: .long 65025 @ 0xfe01
|
2018-06-19 08:08:32 +08:00
|
|
|
;
|
2018-08-11 05:21:53 +08:00
|
|
|
; CHECK-T2-LABEL: truncated_neg511:
|
2018-06-19 08:08:32 +08:00
|
|
|
; CHECK-T2: @ %bb.0:
|
2018-08-11 05:21:53 +08:00
|
|
|
; CHECK-T2-NEXT: movw r2, #65025
|
2018-06-19 08:08:32 +08:00
|
|
|
; CHECK-T2-NEXT: ands r0, r2
|
|
|
|
; CHECK-T2-NEXT: strh r0, [r1]
|
|
|
|
; CHECK-T2-NEXT: bx lr
|
2018-08-11 05:21:53 +08:00
|
|
|
%and = and i16 %a, -511
|
2018-06-19 08:08:32 +08:00
|
|
|
store i16 %and, i16* %p
|
|
|
|
ret void
|
|
|
|
}
|