events.ll
1.15 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
; RUN: llc < %s -march=xcore | FileCheck %s
declare void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p)
declare i8* @llvm.xcore.waitevent()
declare i8* @llvm.xcore.checkevent(i8*)
declare void @llvm.xcore.clre()
define i32 @f(i8 addrspace(1)* %r) nounwind {
; CHECK-LABEL: f:
entry:
; CHECK: clre
call void @llvm.xcore.clre()
call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* blockaddress(@f, %L1))
call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* blockaddress(@f, %L2))
%goto_addr = call i8* @llvm.xcore.waitevent()
; CHECK: waiteu
indirectbr i8* %goto_addr, [label %L1, label %L2]
L1:
br label %ret
L2:
br label %ret
ret:
%retval = phi i32 [1, %L1], [2, %L2]
ret i32 %retval
}
define i32 @g(i8 addrspace(1)* %r) nounwind {
; CHECK-LABEL: g:
entry:
; CHECK: clre
call void @llvm.xcore.clre()
call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* blockaddress(@f, %L1))
%goto_addr = call i8* @llvm.xcore.checkevent(i8 *blockaddress(@f, %L2))
; CHECK: setsr 1
; CHECK: clrsr 1
indirectbr i8* %goto_addr, [label %L1, label %L2]
L1:
br label %ret
L2:
br label %ret
ret:
%retval = phi i32 [1, %L1], [2, %L2]
ret i32 %retval
}