root / target-arm / op_addsub.h @ 9ee6e8bb
History | View | Annotate | Download (1.8 kB)
1 |
/*
|
---|---|
2 |
* ARMv6 integer SIMD operations.
|
3 |
*
|
4 |
* Copyright (c) 2007 CodeSourcery.
|
5 |
* Written by Paul Brook
|
6 |
*
|
7 |
* This code is licenced under the GPL.
|
8 |
*/
|
9 |
|
10 |
#ifdef ARITH_GE
|
11 |
#define DECLARE_GE uint32_t ge = 0 |
12 |
#define SET_GE env->GE = ge
|
13 |
#else
|
14 |
#define DECLARE_GE do{}while(0) |
15 |
#define SET_GE do{}while(0) |
16 |
#endif
|
17 |
|
18 |
#define RESULT(val, n, width) \
|
19 |
res |= ((uint32_t)(glue(glue(uint,width),_t))(val)) << (n * width) |
20 |
|
21 |
void OPPROTO glue(glue(op_,PFX),add16_T0_T1)(void) |
22 |
{ |
23 |
uint32_t res = 0;
|
24 |
DECLARE_GE; |
25 |
|
26 |
ADD16(T0, T1, 0);
|
27 |
ADD16(T0 >> 16, T1 >> 16, 1); |
28 |
SET_GE; |
29 |
T0 = res; |
30 |
FORCE_RET(); |
31 |
} |
32 |
|
33 |
void OPPROTO glue(glue(op_,PFX),add8_T0_T1)(void) |
34 |
{ |
35 |
uint32_t res = 0;
|
36 |
DECLARE_GE; |
37 |
|
38 |
ADD8(T0, T1, 0);
|
39 |
ADD8(T0 >> 8, T1 >> 8, 1); |
40 |
ADD8(T0 >> 16, T1 >> 16, 2); |
41 |
ADD8(T0 >> 24, T1 >> 24, 3); |
42 |
SET_GE; |
43 |
T0 = res; |
44 |
FORCE_RET(); |
45 |
} |
46 |
|
47 |
void OPPROTO glue(glue(op_,PFX),sub16_T0_T1)(void) |
48 |
{ |
49 |
uint32_t res = 0;
|
50 |
DECLARE_GE; |
51 |
|
52 |
SUB16(T0, T1, 0);
|
53 |
SUB16(T0 >> 16, T1 >> 16, 1); |
54 |
SET_GE; |
55 |
T0 = res; |
56 |
FORCE_RET(); |
57 |
} |
58 |
|
59 |
void OPPROTO glue(glue(op_,PFX),sub8_T0_T1)(void) |
60 |
{ |
61 |
uint32_t res = 0;
|
62 |
DECLARE_GE; |
63 |
|
64 |
SUB8(T0, T1, 0);
|
65 |
SUB8(T0 >> 8, T1 >> 8, 1); |
66 |
SUB8(T0 >> 16, T1 >> 16, 2); |
67 |
SUB8(T0 >> 24, T1 >> 24, 3); |
68 |
SET_GE; |
69 |
T0 = res; |
70 |
FORCE_RET(); |
71 |
} |
72 |
|
73 |
void OPPROTO glue(glue(op_,PFX),subaddx_T0_T1)(void) |
74 |
{ |
75 |
uint32_t res = 0;
|
76 |
DECLARE_GE; |
77 |
|
78 |
ADD16(T0, T1, 0);
|
79 |
SUB16(T0 >> 16, T1 >> 16, 1); |
80 |
SET_GE; |
81 |
T0 = res; |
82 |
FORCE_RET(); |
83 |
} |
84 |
|
85 |
void OPPROTO glue(glue(op_,PFX),addsubx_T0_T1)(void) |
86 |
{ |
87 |
uint32_t res = 0;
|
88 |
DECLARE_GE; |
89 |
|
90 |
SUB16(T0, T1, 0);
|
91 |
ADD16(T0 >> 16, T1 >> 16, 1); |
92 |
SET_GE; |
93 |
T0 = res; |
94 |
FORCE_RET(); |
95 |
} |
96 |
|
97 |
#undef DECLARE_GE
|
98 |
#undef SET_GE
|
99 |
#undef RESULT
|
100 |
|
101 |
#undef ARITH_GE
|
102 |
#undef PFX
|
103 |
#undef ADD16
|
104 |
#undef SUB16
|
105 |
#undef ADD8
|
106 |
#undef SUB8
|