1
2
3
4
5
6 #include "basic_asm.h"
7 #include "vsx_asm.h"
8
9
10
11
12 FUNC_START(check_vsx)
13 PUSH_BASIC_STACK(32)
14 std r3,STACK_FRAME_PARAM(0)(sp)
15 addi r3, r3, 16 * 12 #Second half of array
16 bl store_vsx
17 ld r3,STACK_FRAME_PARAM(0)(sp)
18 bl vsx_memcmp
19 POP_BASIC_STACK(32)
20 blr
21 FUNC_END(check_vsx)
22
23
24
25
26
27
28 FUNC_START(preempt_vsx)
29 PUSH_BASIC_STACK(512)
30 std r3,STACK_FRAME_PARAM(0)(sp) # vector int *varray
31 std r4,STACK_FRAME_PARAM(1)(sp) # int *threads_starting
32 std r5,STACK_FRAME_PARAM(2)(sp) # int *running
33
34 bl load_vsx
35 nop
36
37 sync
38
39 ld r3,STACK_FRAME_PARAM(1)(sp)
40 1: lwarx r4,0,r3
41 addi r4,r4,-1
42 stwcx. r4,0,r3
43 bne- 1b
44
45 2: ld r3,STACK_FRAME_PARAM(0)(sp)
46 bl check_vsx
47 nop
48 cmpdi r3,0
49 bne 3f
50 ld r4,STACK_FRAME_PARAM(2)(sp)
51 ld r5,0(r4)
52 cmpwi r5,0
53 bne 2b
54
55 3: POP_BASIC_STACK(512)
56 blr
57 FUNC_END(preempt_vsx)