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
|
typedef float F32;
typedef double F64;
typedef float *__restrict__ pRF32;
typedef double *__restrict__ pRF64;
extern float fabsf (float);
extern double fabs (double);
#define DEF3a(fname, type, op) \
void fname##_##type (pR##type a, \
pR##type b, \
pR##type c) \
{ \
int i; \
for (i = 0; i < 16; i++) \
a[i] = op (b[i] - c[i]); \
}
#define DEF3(fname, type, op) \
void fname##_##type (pR##type a, \
pR##type b, \
pR##type c) \
{ \
int i; \
for (i = 0; i < 16; i++) \
a[i] = b[i] op c[i]; \
}
#define DEF2(fname, type, op) \
void fname##_##type (pR##type a, \
pR##type b) \
{ \
int i; \
for (i = 0; i < 16; i++) \
a[i] = op(b[i]); \
}
#define DEFN3a(fname, op) \
DEF3a (fname, F32, op) \
DEF3a (fname, F64, op)
#define DEFN3(fname, op) \
DEF3 (fname, F32, op) \
DEF3 (fname, F64, op)
#define DEFN2(fname, op) \
DEF2 (fname, F32, op) \
DEF2 (fname, F64, op)
DEFN3 (add, +)
DEFN3 (sub, -)
DEFN3 (mul, *)
DEFN3 (div, /)
DEFN2 (neg, -)
DEF2 (abs, F32, fabsf)
DEF2 (abs, F64, fabs)
DEF3a (fabd, F32, fabsf)
DEF3a (fabd, F64, fabs)
|