io.ll
1.8 KB
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
; RUN: llc < %s -march=avr | FileCheck %s
define i8 @read8() {
; CHECK-LABEL: read8
; CHECK: in r24, 8
%1 = load i8, i8* inttoptr (i16 40 to i8*)
ret i8 %1
}
define i16 @read16() {
; CHECK-LABEL: read16
; CHECK: in r24, 8
; CHECK: in r25, 9
%1 = load i16, i16* inttoptr (i16 40 to i16*)
ret i16 %1
}
define i32 @read32() {
; CHECK-LABEL: read32
; CHECK: in r22, 8
; CHECK: in r23, 9
; CHECK: in r24, 10
; CHECK: in r25, 11
%1 = load i32, i32* inttoptr (i16 40 to i32*)
ret i32 %1
}
define i64 @read64() {
; CHECK-LABEL: read64
; CHECK: in r18, 8
; CHECK: in r19, 9
; CHECK: in r20, 10
; CHECK: in r21, 11
; CHECK: in r22, 12
; CHECK: in r23, 13
; CHECK: in r24, 14
; CHECK: in r25, 15
%1 = load i64, i64* inttoptr (i16 40 to i64*)
ret i64 %1
}
define void @write8() {
; CHECK-LABEL: write8
; CHECK: out 8
store i8 22, i8* inttoptr (i16 40 to i8*)
ret void
}
define void @write16() {
; CHECK-LABEL: write16
; CHECK: out 9
; CHECK: out 8
store i16 1234, i16* inttoptr (i16 40 to i16*)
ret void
}
define void @write32() {
; CHECK-LABEL: write32
; CHECK: out 11
; CHECK: out 10
; CHECK: out 9
; CHECK: out 8
store i32 12345678, i32* inttoptr (i16 40 to i32*)
ret void
}
define void @write64() {
; CHECK-LABEL: write64
; CHECK: out 15
; CHECK: out 14
; CHECK: out 13
; CHECK: out 12
; CHECK: out 11
; CHECK: out 10
; CHECK: out 9
; CHECK: out 8
store i64 1234567891234567, i64* inttoptr (i16 40 to i64*)
ret void
}
define void @sbi8() {
; CHECK-LABEL: sbi8
; CHECK: sbi 8, 5
%1 = load i8, i8* inttoptr (i16 40 to i8*)
%or = or i8 %1, 32
store i8 %or, i8* inttoptr (i16 40 to i8*)
ret void
}
define void @cbi8() {
; CHECK-LABEL: cbi8
; CHECK: cbi 8, 5
%1 = load volatile i8, i8* inttoptr (i16 40 to i8*)
%and = and i8 %1, -33
store volatile i8 %and, i8* inttoptr (i16 40 to i8*)
ret void
}