1/*========================== begin_copyright_notice ============================
2
3Copyright (C) 2020-2021 Intel Corporation
4
5SPDX-License-Identifier: MIT
6
7============================= end_copyright_notice ===========================*/
8
9#include "../imf.h"
10#pragma OPENCL FP_CONTRACT OFF
11typedef struct
12{
13    unsigned int Log_HA_table[(1 << 8) + 2];
14    unsigned int SgnMask;
15    unsigned int XThreshold;
16    unsigned int XhMask;
17    unsigned int ExpMask0;
18    unsigned int ExpMask2;
19    unsigned int ha_poly_coeff[2];
20    unsigned int ExpMask;
21    unsigned int Two10;
22    unsigned int MinLog1p;
23    unsigned int MaxLog1p;
24    unsigned int HalfMask;
25    unsigned int L2H;
26    unsigned int L2L;
27    unsigned int sOne;
28    unsigned int sPoly[8];
29    unsigned int iHiDelta;
30    unsigned int iLoRange;
31    unsigned int iBrkValue;
32    unsigned int iOffExpoMask;
33
34    unsigned int sLn2;
35
36    unsigned int sInfs[2];
37    unsigned int sOnes[2];
38    unsigned int sZeros[2];
39} __internal_slog1p_la_data_t;
40static __constant __internal_slog1p_la_data_t __internal_slog1p_la_data = {
41
42    {
43     0xc2aeac38u, 0xb93cbf08u, 0xc2aeb034u, 0xb93ce972u, 0xc2aeb424u, 0xb95e1069u, 0xc2aeb814u, 0xb9412b26u, 0xc2aebbfcu, 0xb9272b41u, 0xc2aebfd4u,
44     0xb950fcd7u, 0xc2aec3acu, 0xb93f86b8u, 0xc2aec77cu, 0xb933aa90u, 0xc2aecb44u, 0xb92e4507u, 0xc2aecf04u, 0xb9302df1u, 0xc2aed2bcu, 0xb93a3869u,
45     0xc2aed66cu, 0xb94d32f7u, 0xc2aeda1cu, 0xb929e7b5u, 0xc2aeddbcu, 0xb9511c6au, 0xc2aee15cu, 0xb94392acu, 0xc2aee4f4u, 0xb94207fdu, 0xc2aee884u,
46     0xb94d35eau, 0xc2aeec14u, 0xb925d225u, 0xc2aeef94u, 0xb94c8ea1u, 0xc2aef314u, 0xb94219adu, 0xc2aef68cu, 0xb9471e0bu, 0xc2aef9fcu, 0xb95c430bu,
47     0xc2aefd6cu, 0xb9422ca0u, 0xc2af00d4u, 0xb9397b7bu, 0xc2af0434u, 0xb942cd1cu, 0xc2af0794u, 0xb91ebbeau, 0xc2af0ae4u, 0xb94ddf49u, 0xc2af0e34u,
48     0xb950cbabu, 0xc2af1184u, 0xb92812a5u, 0xc2af14c4u, 0xb9544303u, 0xc2af1804u, 0xb955e8d7u, 0xc2af1b44u, 0xb92d8d8du, 0xc2af1e74u, 0xb95bb7fau,
49     0xc2af21acu, 0xb920ec71u, 0xc2af24d4u, 0xb93dacccu, 0xc2af27fcu, 0xb9327882u, 0xc2af2b1cu, 0xb93fccb3u, 0xc2af2e3cu, 0xb9262434u, 0xc2af3154u,
50     0xb925f7a4u, 0xc2af3464u, 0xb93fbd72u, 0xc2af3774u, 0xb933e9f2u, 0xc2af3a7cu, 0xb942ef61u, 0xc2af3d84u, 0xb92d3dfbu, 0xc2af4084u, 0xb93343ffu,
51     0xc2af437cu, 0xb9556dbfu, 0xc2af4674u, 0xb95425adu, 0xc2af496cu, 0xb92fd461u, 0xc2af4c5cu, 0xb928e0a9u, 0xc2af4f44u, 0xb93faf8eu, 0xc2af522cu,
52     0xb934a465u, 0xc2af550cu, 0xb94820d2u, 0xc2af57ecu, 0xb93a84d8u, 0xc2af5ac4u, 0xb94c2eddu, 0xc2af5d9cu, 0xb93d7bb5u, 0xc2af606cu, 0xb94ec6aeu,
53     0xc2af633cu, 0xb9406992u, 0xc2af6604u, 0xb952bcb6u, 0xc2af68ccu, 0xb94616feu, 0xc2af6b8cu, 0xb95acde8u, 0xc2af6e4cu, 0xb951358fu, 0xc2af710cu,
54     0xb929a0b7u, 0xc2af73c4u, 0xb92460d4u, 0xc2af7674u, 0xb941c60fu, 0xc2af7924u, 0xb9421f4du, 0xc2af7bd4u, 0xb925ba37u, 0xc2af7e7cu, 0xb92ce340u,
55     0xc2af811cu, 0xb957e5adu, 0xc2af83c4u, 0xb9270b99u, 0xc2af865cu, 0xb95a9dfau, 0xc2af88fcu, 0xb932e4acu, 0xc2af8b94u, 0xb9302671u, 0xc2af8e24u,
56     0xb952a8fau, 0xc2af90b4u, 0xb95ab0eeu, 0xc2af9344u, 0xb94881e8u, 0xc2af95ccu, 0xb95c5e87u, 0xc2af9854u, 0xb9568869u, 0xc2af9adcu, 0xb9374037u,
57     0xc2af9d5cu, 0xb93ec5a6u, 0xc2af9fdcu, 0xb92d577du, 0xc2afa254u, 0xb9433399u, 0xc2afa4ccu, 0xb94096f3u, 0xc2afa744u, 0xb925bda3u, 0xc2afa9b4u,
58     0xb932e2e5u, 0xc2afac24u, 0xb928411du, 0xc2afae8cu, 0xb94611dau, 0xc2afb0f4u, 0xb94c8ddbu, 0xc2afb35cu, 0xb93bed15u, 0xc2afb5bcu, 0xb95466b2u,
59     0xc2afb81cu, 0xb9563119u, 0xc2afba7cu, 0xb94181f0u, 0xc2afbcd4u, 0xb9568e1eu, 0xc2afbf2cu, 0xb95589d1u, 0xc2afc184u, 0xb93ea881u, 0xc2afc3d4u,
60     0xb9521cf3u, 0xc2afc624u, 0xb950193bu, 0xc2afc874u, 0xb938cec0u, 0xc2afcabcu, 0xb94c6e3fu, 0xc2afcd04u, 0xb94b27d0u, 0xc2afcf4cu, 0xb9352ae6u,
61     0xc2afd18cu, 0xb94aa653u, 0xc2afd3ccu, 0xb94bc84cu, 0xc2afd60cu, 0xb938be68u, 0xc2afd844u, 0xb951b5a9u, 0xc2afda7cu, 0xb956da79u, 0xc2afdcb4u,
62     0xb94858aeu, 0xc2afdeecu, 0xb9265b90u, 0xc2afe11cu, 0xb9310dd5u, 0xc2afe34cu, 0xb92899abu, 0xc2afe574u, 0xb94d28b2u, 0xc2afe7a4u, 0xb91ee407u,
63     0xc2afe9c4u, 0xb95df440u, 0xc2afebecu, 0xb94a8170u, 0xc2afee14u, 0xb924b32au, 0xc2aff034u, 0xb92cb084u, 0xc2aff254u, 0xb922a015u, 0xc2aff46cu,
64     0xb946a7fcu, 0xc2aff684u, 0xb958eddfu, 0xc2aff89cu, 0xb95996edu, 0xc2affab4u, 0xb948c7e3u, 0xc2affcccu, 0xb926a508u, 0xc2affedcu, 0xb9335235u,
65     0xc2b000ecu, 0xb92ef2d4u, 0xc2b002f4u, 0xb959a9e1u, 0xc2b00504u, 0xb93399eeu, 0xc2b0070cu, 0xb93ce522u, 0xc2b00914u, 0xb935ad3du, 0xc2b00b14u,
66     0xb95e1399u, 0xc2b00d1cu, 0xb936392bu, 0xc2b00f1cu, 0xb93e3e84u}
67
68    , 0x7fffffffu, 0x39800000u, 0xffffff00u, 0x7f800000u, 0x7b000000u, {
69
70                                                                        0x3eAAAB39u, 0xbf000036u}
71
72    , 0x007fffffu, 0x3b800000u, 0xbf7fffffu, 0x7a800000u, 0xffffff00u, 0x3f317200u, 0x35bfbe00u, 0x3f800000u, {
73                                                                                                               0xbf000000u, 0x3eaaaa94u, 0xbe80058eu,
74                                                                                                               0x3e4ce190u, 0xbe28ad37u, 0x3e0fcb12u,
75                                                                                                               0xbe1ad9e3u, 0x3e0d84edu}
76
77    , 0x01000000u, 0x01800000u, 0x3f2aaaabu, 0x007fffffu, 0x3f317218u, {0x7f800000u, 0xff800000u}
78
79    , {0x3f800000u, 0xbf800000u}
80
81    , {0x00000000u, 0x80000000u}
82
83};
84
85static __constant _iml_v2_sp_union_t __slog1p_la_CoutTab[210] = {
86    0x3F800000,
87    0x00000000,
88    0x00000000,
89    0x3F7C0000,
90    0x3C810000,
91    0x35ACB127,
92    0x3F780000,
93    0x3D020000,
94    0x372EC4F4,
95    0x3F740000,
96    0x3D44C000,
97    0xB7D57AD8,
98    0x3F700000,
99    0x3D843000,
100    0xB6CE94C4,
101    0x3F6E0000,
102    0x3D955000,
103    0x349488E3,
104    0x3F6A0000,
105    0x3DB80000,
106    0x37530AEB,
107    0x3F660000,
108    0x3DDB5000,
109    0x37488DAD,
110    0x3F640000,
111    0x3DED4000,
112    0xB7589C7C,
113    0x3F600000,
114    0x3E08BC00,
115    0x35E8227E,
116    0x3F5E0000,
117    0x3E11EC00,
118    0xB5ED5B64,
119    0x3F5A0000,
120    0x3E248800,
121    0x36F60CCF,
122    0x3F580000,
123    0x3E2DFC00,
124    0xB6FE52AF,
125    0x3F540000,
126    0x3E412000,
127    0xB6FA6AB9,
128    0x3F520000,
129    0x3E4AD400,
130    0xB6948C24,
131    0x3F500000,
132    0x3E54A000,
133    0xB6161BA9,
134    0x3F4C0000,
135    0x3E688000,
136    0x36DFC995,
137    0x3F4A0000,
138    0x3E729800,
139    0x35EFFE71,
140    0x3F480000,
141    0x3E7CC800,
142    0x3663659E,
143    0x3F460000,
144    0x3E838A00,
145    0xB5F3F655,
146    0x3F440000,
147    0x3E88BC00,
148    0x3668227E,
149    0x3F400000,
150    0x3E934B00,
151    0x35044D37,
152    0x3F3E0000,
153    0x3E98A800,
154    0xB661E2CA,
155    0x3F3C0000,
156    0x3E9E1300,
157    0xB6588CCD,
158    0x3F3A0000,
159    0x3EA38C00,
160    0x365C271C,
161    0x3F380000,
162    0x3EA91500,
163    0x3660738A,
164    0x3F360000,
165    0x3EAEAE00,
166    0xB50829A8,
167    0x3F340000,
168    0x3EB45600,
169    0x3603E9C7,
170    0x3F320000,
171    0x3EBA0F00,
172    0xB5F12731,
173    0x3F300000,
174    0x3EBFD800,
175    0xB5B884FD,
176    0x3F2E0000,
177    0x3EC5B200,
178    0xB5CAEE9A,
179    0x3F2C0000,
180    0x3ECB9D00,
181    0x3550C4D6,
182    0x3F2A0000,
183    0x3ED19A00,
184    0x3580449F,
185    0x3F280000,
186    0x3ED7A900,
187    0x3615248D,
188    0x3F280000,
189    0x3ED7A900,
190    0x3615248D,
191    0x3F260000,
192    0x3EDDCB00,
193    0x348DC071,
194    0x3F240000,
195    0x3EE40000,
196    0xB5C71755,
197    0x3F220000,
198    0x3EEA4800,
199    0x3511B7BF,
200    0x3F200000,
201    0x3EF0A400,
202    0x3621A272,
203    0x3F200000,
204    0x3EF0A400,
205    0x3621A272,
206    0x3F1E0000,
207    0x3EF71500,
208    0x34AB5A0A,
209    0x3F1C0000,
210    0x3EFD9B00,
211    0xB5EA10B7,
212    0x3F1A0000,
213    0x3F021B00,
214    0x34BE7604,
215    0x3F1A0000,
216    0x3F021B00,
217    0x34BE7604,
218    0x3F180000,
219    0x3F0573C0,
220    0xB50E97D6,
221    0x3F160000,
222    0x3F08D7C0,
223    0x338F1D6B,
224    0x3F140000,
225    0x3F0C4780,
226    0xB55F86E2,
227    0x3F140000,
228    0x3F0C4780,
229    0xB55F86E2,
230    0x3F120000,
231    0x3F0FC300,
232    0x35D7F186,
233    0x3F100000,
234    0x3F134B00,
235    0x35844D37,
236    0x3F100000,
237    0x3F134B00,
238    0x35844D37,
239    0x3F0E0000,
240    0x3F16DFC0,
241    0xB5AA13C8,
242    0x3F0E0000,
243    0x3F16DFC0,
244    0xB5AA13C8,
245    0x3F0C0000,
246    0x3F1A8140,
247    0x34AD9D8D,
248    0x3F0A0000,
249    0x3F1E3040,
250    0x32C36BFB,
251    0x3F0A0000,
252    0x3F1E3040,
253    0x32C36BFB,
254    0x3F080000,
255    0x3F21ED00,
256    0xB2D06DC4,
257    0x3F080000,
258    0x3F21ED00,
259    0xB2D06DC4,
260    0x3F060000,
261    0x3F25B800,
262    0xB5A41A3D,
263    0x3F060000,
264    0x3F25B800,
265    0xB5A41A3D,
266    0x3F040000,
267    0x3F299180,
268    0xB56CBCC4,
269    0x3F040000,
270    0x3F299180,
271    0xB56CBCC4,
272    0x3F020000,
273    0x3F2D7A00,
274    0x34386C94,
275    0x3F020000,
276    0x3F2D7A00,
277    0x34386C94,
278    0x3F000000,
279    0x3F317200,
280    0x35BFBE8E,
281
282    0x3F317200,
283    0x35BFBE8E,
284
285    0x48000040,
286
287    0x46000000,
288
289    0x3C200000,
290
291    0x53800000,
292
293    0x00000000,
294    0x3F800000,
295
296    0xBF000000,
297    0x3EAAAAAB,
298    0xBE800000,
299    0x3E4CCCCD,
300    0xBE2AAAAB,
301    0x3E124E01,
302    0xBE0005A0,
303};
304
305__attribute__((always_inline))
306inline int __internal_slog1p_la_cout (float *a, float *r)
307{
308    float fap1, *ap1 = (&fap1);
309    float x, y, u;
310    float fP;
311    float fAbsU;
312    float fN, fNLn2Hi, fNLn2Lo;
313    float fRcprY, fLnRcprYHi, fLnRcprYLo, fWHi, fWLo;
314    float fYHi, fYLo, fUHi, fULo, fResHi, fResLo;
315    float fTmp;
316    int iN, j;
317    int i;
318    int nRet = 0;
319    int isDenorm = 0;
320
321    *ap1 = (*a) + 1.0f;
322
323    if ((((((_iml_v2_sp_union_t *) & ap1[0])->hex[0] >> 23) & 0xFF) != 0xFF))
324    {
325
326        x = ap1[0];
327        iN = 0;
328
329        if (((((_iml_v2_sp_union_t *) & x)->hex[0] >> 23) & 0xFF) == 0)
330        {
331
332            isDenorm = 1;
333
334            x *= ((__constant float *) __slog1p_la_CoutTab)[200];
335            iN -= 40;
336        }
337
338        if (x > ((__constant float *) __slog1p_la_CoutTab)[201])
339        {
340
341            u = x - 1.0f;
342            fAbsU = u;
343            (((_iml_v2_sp_union_t *) & fAbsU)->hex[0] = (((_iml_v2_sp_union_t *) & fAbsU)->hex[0] & 0x7FFFFFFF) | ((_iml_uint32_t) (0) << 31));
344
345            if (fAbsU > ((__constant float *) __slog1p_la_CoutTab)[199])
346            {
347
348                iN += ((((_iml_v2_sp_union_t *) & x)->hex[0] >> 23) & 0xFF) - 0x7F;
349                fN = (float) iN;
350
351                if (isDenorm == 1)
352                {
353                    fNLn2Hi = (fN * (((__constant float *) __slog1p_la_CoutTab)[195] + ((__constant float *) __slog1p_la_CoutTab)[196]));
354                    fNLn2Lo = 0.0f;
355                }
356                else
357                {
358                    fNLn2Hi = (fN * ((__constant float *) __slog1p_la_CoutTab)[195]);
359                    fNLn2Lo = (fN * ((__constant float *) __slog1p_la_CoutTab)[196]);
360                }
361
362                y = x;
363                (((_iml_v2_sp_union_t *) & y)->hex[0] = (((_iml_v2_sp_union_t *) & y)->hex[0] & 0x807FFFFF) | (((_iml_uint32_t) (0x7F) & 0xFF) << 23));
364
365                fTmp = (y + ((__constant float *) __slog1p_la_CoutTab)[197]);
366                j = (((_iml_v2_sp_union_t *) & fTmp)->hex[0] & 0x007FFFFF) & ((1 << (6 + 1)) - 1);
367
368                fRcprY = ((__constant float *) __slog1p_la_CoutTab)[3 * (j)];
369                fLnRcprYHi = ((__constant float *) __slog1p_la_CoutTab)[3 * (j) + 1];
370                fLnRcprYLo = ((__constant float *) __slog1p_la_CoutTab)[3 * (j) + 2];
371
372                fWHi = (fNLn2Hi + fLnRcprYHi);
373                fTmp = (fWHi - fNLn2Hi);
374                fTmp = (fLnRcprYHi - fTmp);
375                fWLo = (fNLn2Lo + fLnRcprYLo);
376                fWLo = (fTmp + fWLo);;
377
378                fTmp = (y + ((__constant float *) __slog1p_la_CoutTab)[198]);
379                fYHi = (fTmp - ((__constant float *) __slog1p_la_CoutTab)[198]);
380                fYLo = (y - fYHi);
381
382                fUHi = (fRcprY * fYHi - 1.0f);
383                fULo = (fRcprY * fYLo);
384
385                u = (fUHi + fULo);
386
387                fP = ((((((((__constant float *) __slog1p_la_CoutTab)[209] * u + ((__constant float *) __slog1p_la_CoutTab)[208]) * u +
388                          ((__constant float *) __slog1p_la_CoutTab)[207]) * u + ((__constant float *) __slog1p_la_CoutTab)[206]) * u +
389                        ((__constant float *) __slog1p_la_CoutTab)[205]) * u + ((__constant float *) __slog1p_la_CoutTab)[204]) * u +
390                      ((__constant float *) __slog1p_la_CoutTab)[203]);
391                fP = (fP * u * u);
392
393                fResHi = (fWHi + fUHi);
394
395                fResLo = (fWLo + fULo);
396                fTmp = (fResLo - fWLo);
397                fTmp = (fULo - fTmp);
398                fP = (fTmp + fP);
399
400                r[0] = (fResHi + fResLo);
401                fTmp = (r[0] - fResHi);
402                fTmp = (fResLo - fTmp);
403                fTmp = (fTmp + fP);
404                r[0] = (r[0] + fTmp);
405            }
406            else
407            {
408
409                fP = ((((((((__constant float *) __slog1p_la_CoutTab)[209] * u + ((__constant float *) __slog1p_la_CoutTab)[208]) * u +
410                          ((__constant float *) __slog1p_la_CoutTab)[207]) * u + ((__constant float *) __slog1p_la_CoutTab)[206]) * u +
411                        ((__constant float *) __slog1p_la_CoutTab)[205]) * u + ((__constant float *) __slog1p_la_CoutTab)[204]) * u +
412                      ((__constant float *) __slog1p_la_CoutTab)[203]);
413
414                fP = (fP * u * u);
415                fP = (fP + u);
416
417                r[0] = fP;
418            }
419        }
420        else
421        {
422
423            if (x == ((__constant float *) __slog1p_la_CoutTab)[201])
424            {
425
426                r[0] = -((__constant float *) __slog1p_la_CoutTab)[202] / ((__constant float *) __slog1p_la_CoutTab)[201];
427                nRet = 2;
428            }
429            else
430            {
431
432                r[0] = ((__constant float *) __slog1p_la_CoutTab)[201] / ((__constant float *) __slog1p_la_CoutTab)[201];
433                nRet = 1;
434            }
435        }
436    }
437    else
438    {
439
440        if (((((_iml_v2_sp_union_t *) & ap1[0])->hex[0] >> 31) == 1) && ((((_iml_v2_sp_union_t *) & ap1[0])->hex[0] & 0x007FFFFF) == 0))
441        {
442
443            r[0] = ((__constant float *) __slog1p_la_CoutTab)[201] / ((__constant float *) __slog1p_la_CoutTab)[201];
444            nRet = 1;
445        }
446        else
447        {
448
449            r[0] = (ap1[0] * ap1[0]);
450        }
451    }
452
453    return nRet;
454}
455
456float __ocl_svml_log1pf (float a)
457{
458
459    float va1;
460    float vr1;
461    unsigned int vm;
462
463    float r;
464
465    va1 = a;;
466
467    {
468
469        float SignMask;
470        float SgnMask;
471        unsigned int iHiDelta;
472        unsigned int iLoRange;
473        unsigned int iBrkValue;
474        unsigned int iOffExpoMask;
475        float One;
476        unsigned int iOne;
477        float sExp;
478        float X;
479        float Xl;
480        float A;
481        float B;
482        float Rl;
483        float Rh;
484        float Rlh;
485        float sR2;
486        float Kh;
487        float NaNMask;
488        unsigned int iNaNMask;
489
490        float sLn2;
491
492        float sPoly[8];
493
494        unsigned int iRangeMask;
495
496        unsigned int iX;
497        unsigned int iXTest;
498        float sN;
499        unsigned int iN;
500        float sR;
501        unsigned int iR;
502        float sP;
503        unsigned int iExp;
504
505        One = as_float (__internal_slog1p_la_data.sOne);
506        SgnMask = as_float (__internal_slog1p_la_data.SgnMask);
507
508        SignMask = as_float ((~(as_uint (SgnMask)) & as_uint (va1)));
509
510        NaNMask = as_float (((unsigned int) (-(signed int) (!(va1 == va1)))));
511        iNaNMask = as_uint (NaNMask);
512
513        A = ((One > va1) ? One : va1);
514        B = ((One < va1) ? One : va1);
515
516        X = (A + B);
517        Xl = (A - X);
518        Xl = (Xl + B);
519
520        iHiDelta = (__internal_slog1p_la_data.iHiDelta);
521        iLoRange = (__internal_slog1p_la_data.iLoRange);
522        iX = as_uint (X);
523        iXTest = (iX + iHiDelta);
524        iRangeMask = ((unsigned int) (-(signed int) ((signed int) iXTest < (signed int) iLoRange)));
525
526        iBrkValue = (__internal_slog1p_la_data.iBrkValue);
527        iOffExpoMask = (__internal_slog1p_la_data.iOffExpoMask);
528        iX = (iX - iBrkValue);
529        iR = (iX & iOffExpoMask);
530        iN = ((signed int) iX >> (23));
531        iR = (iR + iBrkValue);
532        sN = ((float) ((int) (iN)));
533        sR = as_float (iR);
534
535        iExp = ((unsigned int) (iN) << (23));
536        iOne = as_uint (One);
537        iExp = (iOne - iExp);
538        sExp = as_float (iExp);
539        Rl = (Xl * sExp);
540
541        iRangeMask = (iRangeMask | iNaNMask);
542
543        vm = 0;
544        vm = iRangeMask;
545
546        Rh = (sR - One);
547        sR = (Rh + Rl);
548        sPoly[7] = as_float (__internal_slog1p_la_data.sPoly[7]);
549        sPoly[6] = as_float (__internal_slog1p_la_data.sPoly[6]);
550        sP = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sPoly[7], sR, sPoly[6]);
551        sPoly[5] = as_float (__internal_slog1p_la_data.sPoly[5]);
552        sP = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sP, sR, sPoly[5]);
553        sPoly[4] = as_float (__internal_slog1p_la_data.sPoly[4]);
554        sP = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sP, sR, sPoly[4]);
555        sPoly[3] = as_float (__internal_slog1p_la_data.sPoly[3]);
556        sP = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sP, sR, sPoly[3]);
557        sPoly[2] = as_float (__internal_slog1p_la_data.sPoly[2]);
558        sP = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sP, sR, sPoly[2]);
559        sPoly[1] = as_float (__internal_slog1p_la_data.sPoly[1]);
560        sP = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sP, sR, sPoly[1]);
561        sPoly[0] = as_float (__internal_slog1p_la_data.sPoly[0]);
562        sP = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sP, sR, sPoly[0]);
563        sP = (sP * sR);
564        sP = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sP, sR, sR);
565        sLn2 = as_float (__internal_slog1p_la_data.sLn2);
566        vr1 = SPIRV_OCL_BUILTIN(fma, _f32_f32_f32, ) (sN, sLn2, sP);
567
568        vr1 = as_float ((as_uint (vr1) | as_uint (SignMask)));
569    }
570
571    if ((vm) != 0)
572    {
573        float _vapi_arg1[1];
574        float _vapi_res1[1];
575        ((float *) _vapi_arg1)[0] = va1;
576        ((float *) _vapi_res1)[0] = vr1;
577        __internal_slog1p_la_cout (_vapi_arg1, _vapi_res1);
578        vr1 = ((float *) _vapi_res1)[0];
579    };
580    r = vr1;;
581
582    return r;
583
584}
585