1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; 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) {
; 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
entry:
%and = and i32 %a, -276
ret i32 %and
}
define i32 @j(i32 %a) {
; 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
entry:
%and = and i32 %a, -129
ret i32 %and
}
define void @truncated(i16 %a, i16* %p) {
; CHECK-T1-LABEL: truncated:
; CHECK-T1: @ %bb.0:
; 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
; 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:
; CHECK-T1-NEXT: .LCPI5_0:
; CHECK-T1-NEXT: .long 65025 @ 0xfe01
;
; CHECK-T2-LABEL: truncated_neg511:
; CHECK-T2: @ %bb.0:
; CHECK-T2-NEXT: movw r2, #65025
; CHECK-T2-NEXT: ands r0, r2
; CHECK-T2-NEXT: strh r0, [r1]
; CHECK-T2-NEXT: bx lr
%and = and i16 %a, -511
store i16 %and, i16* %p
ret void
}
|