-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathvr_interp_operator_template_3args.h
123 lines (114 loc) · 3.03 KB
/
vr_interp_operator_template_3args.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//FMA Operator
static VG_REGPARM(3) Long FCTNAME(64F,) (Long a, Long b, Long c) {
#ifdef USE_VERROU_FMA
double *arg1 = (double*)(&a);
double *arg2 = (double*)(&b);
double *arg3 = (double*)(&c);
double res;
PREBACKEND;
BACKENDFUNC(double)(*arg1, *arg2, SIGN *arg3, &res, CONTEXT);
POSTBACKEND;
#else
double res=0.;
VG_(tool_panic) ( "Verrou needs to be compiled with FMA support \n");
#endif
Long *d = (Long*)(&res);
return *d;
}
static VG_REGPARM(3) Long FCTCONVNAME(64F,) (Long a, Long b, Long c) {
#ifdef USE_VERROU_FMA
double *arg1 = (double*)(&a);
double *arg2 = (double*)(&b);
double *arg3 = (double*)(&c);
float arg1f=*arg1;
float arg2f=*arg2;
float arg3f=*arg3;
double res;
float resf;
PREBACKEND;
BACKENDFUNC(float)(arg1f, arg2f, SIGN arg3f, &resf, CONTEXT);
POSTBACKEND;
res=resf;
#else
double res=0.;
VG_(tool_panic) ( "Verrou needs to be compiled with FMA support \n");
#endif
Long *d = (Long*)(&res);
return *d;
}
static VG_REGPARM(3) Int FCTNAME(32F,) (Long a, Long b, Long c) {
#ifdef USE_VERROU_FMA
float *arg1 = (float*)(&a);
float *arg2 = (float*)(&b);
float *arg3 = (float*)(&c);
float res;
PREBACKEND;
BACKENDFUNC(float)(*arg1, *arg2, SIGN *arg3, &res, CONTEXT);
POSTBACKEND;
#else
float res=0.;
VG_(tool_panic) ( "Verrou needs to be compiled with FMA support \n");
#endif
Int *d = (Int*)(&res);
return *d;
}
//unFusED vERSION
static VG_REGPARM(3) Long FCTNAMEUNFUSED(64F,) (Long a, Long b, Long c) {
#ifdef USE_VERROU_FMA
double *arg1 = (double*)(&a);
double *arg2 = (double*)(&b);
double *arg3 = (double*)(&c);
double res;
double res_temp;
PREBACKEND;
BACKEND_FIRST_FUNC(double)(*arg1, *arg2, &res_temp, CONTEXT);
BACKEND_SECOND_FUNC(double)(res_temp, SIGN *arg3, &res, CONTEXT);
POSTBACKEND;
#else
double res=0.;
VG_(tool_panic) ( "Verrou needs to be compiled with FMA support \n");
#endif
Long *d = (Long*)(&res);
return *d;
}
static VG_REGPARM(3) Long FCTCONVNAMEUNFUSED(64F,) (Long a, Long b, Long c) {
#ifdef USE_VERROU_FMA
double *arg1 = (double*)(&a);
double *arg2 = (double*)(&b);
double *arg3 = (double*)(&c);
float arg1f=*arg1;
float arg2f=*arg2;
float arg3f=*arg3;
double res;
float resf;
float res_temp;
PREBACKEND;
BACKEND_FIRST_FUNC(float)(arg1f, arg2f, &res_temp, CONTEXT);
BACKEND_SECOND_FUNC(float)(res_temp, SIGN arg3f, &resf, CONTEXT);
POSTBACKEND;
res=resf;
#else
double res=0.;
VG_(tool_panic) ( "Verrou needs to be compiled with FMA support \n");
#endif
Long *d = (Long*)(&res);
return *d;
}
static VG_REGPARM(3) Int FCTNAMEUNFUSED(32F,) (Long a, Long b, Long c) {
#ifdef USE_VERROU_FMA
float *arg1 = (float*)(&a);
float *arg2 = (float*)(&b);
float *arg3 = (float*)(&c);
float res;
float res_temp;
PREBACKEND;
BACKEND_FIRST_FUNC(float)(*arg1, *arg2, &res_temp, CONTEXT);
BACKEND_SECOND_FUNC(float)(res_temp, SIGN *arg3, &res, CONTEXT);
POSTBACKEND;
#else
float res=0.;
VG_(tool_panic) ( "Verrou needs to be compiled with FMA support \n");
#endif
Int *d = (Int*)(&res);
return *d;
}