-
Notifications
You must be signed in to change notification settings - Fork 18
/
OCLdecs.h
executable file
·76 lines (59 loc) · 1.55 KB
/
OCLdecs.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once
#ifndef OCLDECS_H
#define OCLDECS_H
typedef ulong cl_ulong;
typedef uint cl_uint;
#include "OCLdefs.h"////problem with relative path --
#define fn_mulHi(Val1, Val2, cv, Result,ret) \
do \
{ \
cl_ulong tmp = (cl_ulong)Val1 * (cl_ulong)Val2 + (cl_ulong)+cv;\
Result = tmp >> 32;\
ret = 0;\
}\
while(0)
#define fn_mulLow(Val1, Val2, Result,ret) \
do \
{ \
cl_ulong tmp = (cl_ulong)Val1 * (cl_ulong)Val2; \
Result = tmp; \
ret = tmp >> 32; \
} \
while (0)
#define fn_Add(Val1, Val2, cv, Result,ret) \
do \
{ \
cl_ulong tmp = (cl_ulong)Val1 + (cl_ulong)Val2 + (cl_ulong)cv; \
Result = tmp; \
ret = tmp >> 32;\
} \
while(0)
#define fn_Sub(Val1, Val2, cv, Result,ret) \
do \
{ \
cl_uint newcv = 0; \
if (Val1 < Val2 && Val2 - Val1>cv)newcv = 1; \
Result = Val1 - Val2 - cv; \
ret = newcv; \
} \
while(0)
#define fn_MadLo(Val1, Val2, cv, Result,ret) \
do \
{ \
cl_ulong tmp = Result; \
/*r[1]*/tmp += (cl_ulong)(Val1*Val2) + cv; \
Result = tmp; \
tmp = tmp >> 32; \
ret = tmp; \
} \
while(0)
#define fn_MadHi(Val1, Val2, cv, Result,ret) \
do \
{ \
cl_ulong tmp = Result; \
tmp += (((cl_ulong)Val1 * (cl_ulong)Val2) >> 32) + cv; \
Result = tmp; \
ret= tmp >> 32; \
} \
while(0)\
#endif //