Commit | Line | Data |
---|---|---|
51b057f2 AC |
1 | .include "t-macros.i" |
2 | ||
3 | start | |
4 | ||
5 | ;; The d10v implements negated addition for subtraction | |
6 | ||
7 | .macro check_sub2w s x y r c v | |
8 | ||
9 | ;; clear carry | |
10 | ldi r6,#0x8004 | |
11 | mvtc r6,cr0 | |
12 | ||
13 | ;; load opnds | |
14 | ld2w r6, @(1f,r0) | |
15 | ld2w r8, @(2f,r0) | |
16 | .data | |
17 | 1: .long \x | |
18 | 2: .long \y | |
19 | .text | |
20 | ||
21 | ;; subtract | |
22 | SUB2W r6, r8 | |
23 | ||
24 | ;; verify result | |
25 | ld2w r10, @(1f,r0) | |
26 | .data | |
27 | 1: .long \r | |
28 | .text | |
29 | cmpeq r6, r10 | |
30 | brf0f 2f | |
31 | cmpeq r7, r11 | |
32 | brf0t 3f | |
33 | 2: ldi r6, 1 | |
34 | ldi r2, \s | |
35 | trap 15 | |
36 | 3: | |
37 | ||
38 | ;; verify carry | |
39 | mvfc r6, cr0 | |
40 | and3 r6, r6, #1 | |
41 | cmpeqi r6, #\c | |
42 | brf0t 1f | |
43 | ldi r6, 1 | |
44 | ldi r2, \s | |
45 | trap 15 | |
46 | 1: | |
47 | .endm | |
48 | ||
49 | check_sub2w 1 0x00000000 0x00000000 0x00000000 1 0 | |
50 | check_sub2w 2 0x00000000 0x00000001 0xffffffff 0 0 | |
51 | check_sub2w 3 0x00000001 0x00000000 0x00000001 1 0 | |
52 | check_sub2w 3 0x00000001 0x00000001 0x00000000 1 0 | |
53 | check_sub2w 5 0x00000000 0x80000000 0x80000000 0 1 | |
54 | check_sub2w 6 0x80000000 0x00000001 0x7fffffff 1 1 | |
55 | check_sub2w 7 0x7fffffff 0x7fffffff 0x00000000 1 0 | |
56 | ||
57 | exit0 |