blob: 2e67cc296b5515f4803b0e174167946f770ded9a (
plain)
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
|
extern int abs (int);
extern long labs (long);
typedef signed char *__restrict__ pRINT8;
typedef short *__restrict__ pRINT16;
typedef int *__restrict__ pRINT32;
typedef long *__restrict__ pRLONG;
typedef long long *__restrict__ pRINT64;
#define DEF_ABS(size) void absolute_s##size (pRINT##size a, pRINT##size b) \
{ \
int i; \
for (i=0; i<N; i++) \
a[i] = (b[i] > 0 ? b[i] : -b[i]); \
}
DEF_ABS (8);
DEF_ABS (16);
DEF_ABS (32);
DEF_ABS (64);
/* Test abs () vectorization. */
void absolute_s32_lib (pRINT32 a, pRINT32 b)
{
int i;
for (i=0; i<N; i++)
a[i] = abs (b[i]);
}
void absolute_l32_lib (pRLONG a, pRLONG b)
{
int i;
for (i=0; i<N; i++)
a[i] = labs (b[i]);
}
|