File: pown_s_la_noLUT.cl

package info (click to toggle)
intel-graphics-compiler 1.0.12504.6-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 83,912 kB
  • sloc: cpp: 910,147; lisp: 202,655; ansic: 15,197; python: 4,025; yacc: 2,241; lex: 1,570; pascal: 244; sh: 104; makefile: 25
file content (617 lines) | stat: -rw-r--r-- 20,322 bytes parent folder | download
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
/*===================== begin_copyright_notice ==================================

Copyright (c) 2022 Intel Corporation

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


======================= end_copyright_notice ==================================*/

#include "../imf.h"
#pragma OPENCL FP_CONTRACT OFF
static __constant unsigned char __spown_la___rcp_tbl[] = {
    0xff, 0xf0, 0xe3, 0xd7, 0xcc, 0xc2, 0xb9,
    0xb1, 0xaa, 0xa3, 0x9d, 0x97, 0x91, 0x8c,
    0x88, 0x83, 0x7f,
};

// -log2(_VSTATIC(__rcp_tbl)[i]/2^8))*2^(23+32)
static __constant unsigned long __spown_la___log2_tbl[] = {
    0x0000000000000000uL, 0x000b2671360338acuL, 0x001563dc29ffacb2uL,
    0x001f5fd8a9063e36uL, 0x002906cbcd2baf2euL, 0x003243001249ba76uL,
    0x003afcd815786af2uL, 0x00431b2abc31565cuL, 0x004a83cf0d01c170uL,
    0x00523bbc64c5e644uL, 0x00591db662b66428uL, 0x006043e946fd97f4uL,
    0x0067b3d42fd0fc50uL, 0x006e232e68aad484uL, 0x007373af48dce654uL,
    0x007a514b229c40a0uL, 0x0080000000000000uL,
};

// polynomial coefficients
// c6*2^31
static __constant int __spown_la___lc6 = 0xE158260E;
// c5*2^31
static __constant int __spown_la___lc5 = 0x24F7FD36;
// c4*2^31
static __constant int __spown_la___lc4 = 0xD1D568F0;
// c3*2^31
static __constant int __spown_la___lc3 = 0x3D8E12ED;
// c2*2^31
static __constant int __spown_la___lc2 = 0xA3AAE26C;
// c1*2^(23+32)
static __constant unsigned long __spown_la___lc1 = 0xB8AA3B295EBB00uL;
// exp2 coefficients
// c7*2^32
static __constant int __spown_la___sc7 = 0x00016B68;
// c6*2^32
static __constant int __spown_la___sc6 = 0x00095E83;
// c5*2^32
static __constant int __spown_la___sc5 = 0x00580436;
// c4*2^32
static __constant int __spown_la___sc4 = 0x027607DE;
// c3*2^32
static __constant int __spown_la___sc3 = 0x0E359872;
// c2*2^32
static __constant int __spown_la___sc2 = 0x3D7F7977;
// c1*2^32
static __constant int __spown_la___sc1 = 0xB1721817;
static unsigned int __spown_la_pownf_cout (unsigned int xin, int iy, int *errcode)
{
    int mant, expon, index, sgn_y, R, poly, N;
    int expon_y, mant_y, mi_y;
    unsigned int rcp, res, shift, abs_y, poly_low, poly_h, sgn_x = 0, p_inf;
    unsigned long poly64, exp64, poly_s1;
    float fy = (float) iy;
    unsigned int yin = *(unsigned int *) &fy;
    // unpack mantissa, unbiased exponent
    mant = ((xin) & 0x7fffff);
    expon = ((xin) >> 23) - 0x7f;
    abs_y = yin & 0x7fffffff;
    sgn_y = (((int) (yin)) >> (31));
    if ((((unsigned int) (abs_y - 1)) >= (0x7F800000 - 1)))
        goto SPOWN_SPECIAL_Y;
    // filter out special and negative cases, as well as denormals
    if ((((unsigned int) (xin - 0x00800000)) >= (0x7F800000 - 0x00800000)))
        goto SPOWN_SPECIAL_X;
  SPOWN_LOG_MAIN:
    // add leading mantissa bit
    mant |= 0x00800000;
    // table index
    index = ((mant + 0x00040000) >> (23 - 4)) - 0x10;
    // rcp ~ 2^8/mant
    rcp = 1 + __spown_la___rcp_tbl[index];
    // reduced argument R = mant*rcp - 1, scale 2^32
    R = (((unsigned int) mant) * ((unsigned int) rcp)); // scale 2^31
    R = R + R;
    // (c6*R+c5)*2^31
    poly = ((((long) ((int) (__spown_la___lc6))) * ((int) (R))) >> 32);
    poly = poly + __spown_la___lc5;
    // poly*R+c4, scale 2^31
    poly = ((((long) ((int) (poly))) * ((int) (R))) >> 32);
    poly = poly + __spown_la___lc4;
    // poly*R+c3, scale 2^31
    poly = ((((long) ((int) (poly))) * ((int) (R))) >> 32);
    poly = poly + __spown_la___lc3;
    // poly*R+c2, scale 2^31
    poly = ((((long) ((int) (poly))) * ((int) (R))) >> 32);
    poly = poly + __spown_la___lc2;
    // poly*2^(23+32)
    poly_low = poly << (32 - 8);
    poly_h = (((int) (poly)) >> (8));
    // c1+R*poly, scale 2^(23+32)
    poly64 = (((long) ((int) (poly_h))) * ((int) (R))) + __spown_la___lc1;
    // poly_low to be treated as positive value
    poly_low = (((unsigned int) (poly_low)) >> (1));
    poly_low = ((((long) ((int) (poly_low))) * ((int) (R))) >> 32);
    poly_low += poly_low;
    poly64 += (long) ((int) poly_low);
    // adjustment for x near 1.0
    shift = 0x7f + 21;
    if (!((expon << 4) + index))
    {
        poly64 <<= 7;
        shift = 7 + 0x7f + 21;
        // is x exactly 1.0
        if (!R)
        {
            return sgn_x | 0x3f800000;
        }
    }
    // T+R*poly, scale 2^(2+32+(shift-bias))
    poly_low = (unsigned int) poly64;
    poly_h = (unsigned int) (poly64 >> 32);
    poly64 = (((long) ((int) (poly_h))) * ((int) (R))) + __spown_la___log2_tbl[index];
    // adjust for sign of poly_low
    poly_low = (((unsigned int) (poly_low)) >> (1));
    poly_low = ((((long) ((int) (poly_low))) * ((int) (R))) >> 32);
    poly_low += poly_low;
    poly64 += (long) ((int) poly_low);
    // log2(x) ~ expon+T+R*poly, sc 2^(2+32+(shift-bias))
    expon <<= 23;
    exp64 = (unsigned long) expon;
    poly64 += (exp64 << 32);
    poly_s1 = poly64 << 1;
    while (poly_s1 && (((long) (poly_s1 ^ poly64)) >= 0))
    {
        poly64 = poly_s1;
        poly_s1 <<= 1;
        shift++;
    }
    // y, sc 2^(30-expon_y)
    // unpack mantissa, biased exponent
    expon_y = shift - ((abs_y) >> 23);
    mant = ((abs_y) & 0x7fffff);
    // denormal y?
    if (abs_y < 0x00800000)
        expon_y = shift - 1;
    else
        mant |= 0x00800000;
    // apply sign to mantissa bits
    mant = (mant ^ sgn_y) - sgn_y;
    // mant, scale 2^30
    mant <<= 7;
    // y*log2(x), sc 2^(2+30 + expon_y)
    poly_low = (unsigned int) poly64;
    poly_h = (unsigned int) (poly64 >> 32);
    poly64 = (((long) ((int) (poly_h))) * ((int) (mant)));
    // adjust for sign of poly_low
    poly_low = (((unsigned int) (poly_low)) >> (1));
    poly_low = ((((long) ((int) (poly_low))) * ((int) (mant))) >> 32);
    poly_low += poly_low;
    poly64 += (long) ((int) poly_low);
    if (expon_y < 0)    //overflow/underflow
    {
        poly_h = (unsigned int) (poly64 >> 32);
        if (((int) poly_h) < 0)
            goto SPOWN_UF;
        goto SPOWN_OF;
    }
    if (expon_y >= 32)
    {
        expon_y -= 32;
        poly64 = (((long) (poly64)) >> (32));
        if (expon_y >= 32)
            return sgn_x | 0x3f800000;
    }
    // integer part in high 32 bits, fractional bits in low part
    poly64 = (((long) (poly64)) >> (expon_y));
    N = (unsigned int) (poly64 >> 32);
    // reduced exp2 argument, sc 2^32
    R = (unsigned int) poly64;
    // (c7*R+c6)*2^32
    poly = ((((unsigned long) ((unsigned int) (__spown_la___sc7))) * ((unsigned int) (R))) >> 32);
    poly = poly + __spown_la___sc6;
    // poly*2^32
    poly = ((((unsigned long) ((unsigned int) (poly))) * ((unsigned int) (R))) >> 32);
    poly = poly + __spown_la___sc5;
    // poly*2^32
    poly = ((((unsigned long) ((unsigned int) (poly))) * ((unsigned int) (R))) >> 32);
    poly = poly + __spown_la___sc4;
    // poly*2^32
    poly = ((((unsigned long) ((unsigned int) (poly))) * ((unsigned int) (R))) >> 32);
    poly = poly + __spown_la___sc3;
    // poly*2^32
    poly = ((((unsigned long) ((unsigned int) (poly))) * ((unsigned int) (R))) >> 32);
    poly = poly + __spown_la___sc2;
    // poly*2^32
    poly = ((((unsigned long) ((unsigned int) (poly))) * ((unsigned int) (R))) >> 32);
    poly = poly + __spown_la___sc1;
    // poly*2^32
    poly = ((((unsigned long) ((unsigned int) (poly))) * ((unsigned int) (R))) >> 32);
    // rounding and overflow/underflow checking
    // poly*2^31
    poly = (((unsigned int) (poly)) >> (1)) + 128;
    expon = N + 0x7f;
    N = expon + (((unsigned int) (poly)) >> (31));
    // overflow?
    if (N >= 0xff)
        goto SPOWN_OF;
    // underflow, possibly gradual?
    if (N <= 0)
        goto SPOWN_GRAD_UF;
    res = sgn_x | ((expon << 23) + (((unsigned int) (poly)) >> (8)));
    return res;
  SPOWN_OF:
    res = sgn_x | 0x7f800000;
    *errcode = 3;
    return res; // goto POWF_ERRCALL;
  SPOWN_GRAD_UF:
    if (N < -24)
        goto SPOWN_UF;
    // poly*2^31, undo rounding to 24 bits
    poly = poly + 0x80000000 - 128;
    N = expon;
    while (N < 1)
    {
        poly = (((unsigned int) (poly)) >> (1));
        N++;
    }
    poly = (((unsigned int) (poly + 128)) >> (8));
    if (poly)
        return sgn_x | poly;
  SPOWN_UF:
    res = sgn_x;
    *errcode = 4;
    return res; // goto POWF_ERRCALL;
  SPOWN_SPECIAL_Y:
    // 0, Inf, NaN
    // y == 0
    if (!abs_y)
    {
        return 0x3f800000;
    }
    // y == NaN
    if (abs_y > 0x7f800000)
    {
        return ((xin == 0x3f800000) ? xin : 0xffc00000);
    }
    // x == NaN
    if (((unsigned int) (xin + xin)) > 0xff000000u)
        return 0xffc00000;
    // |x| == 1
    R = (xin & 0x7fffffff) - 0x3f800000;
    if (R == 0)
        return 0x3f800000;
    R ^= sgn_y;
    if (((int) R) < 0)
        return 0;
    res = 0x7f800000;
    if (!(xin + xin))
    {
        *errcode = 1;
    }
    return res;
  SPOWN_SPECIAL_X:
    p_inf = 0x7f800000;
    // x == +Inf
    if (xin == p_inf)
    {
        return (sgn_y ? 0 : xin);
    }
    // x == NaN
    if (((unsigned int) (xin + xin)) > 0xff000000u)
    {
        return 0xffc00000;
    }
    // x > 0.0
    if (((int) xin) > 0)
    {
      SPOWN_DENORM_X:
        // x == denormal, normalize it
        expon = 1 - 0x7f;
        while (mant < 0x00800000)
        {
            expon--;
            mant <<= 1;
        }
        // return to main computation
        goto SPOWN_LOG_MAIN;
    }
    if (abs_y >= 0x3f800000)
    {
        sgn_x = iy << 31;
    }
    // x == +/-zero?
    if (!(xin + xin))
    {
        if (!sgn_y)
            return 0;
        sgn_x &= xin;
        res = sgn_x | 0x7f800000;
        *errcode = 1;
        return res; // goto POWF_ERRCALL;
    }
    // x == negative
    if (((int) xin) < 0)
    {
        if (xin == 0xff800000)
        {
            return (sgn_y ? sgn_x : (sgn_x | 0x7f800000));
        }
        expon -= 0x100;
        if (xin == 0xbf800000)
        {
            return sgn_x | 0x3f800000;
        }
        if (expon >= -126)
        {
            goto SPOWN_LOG_MAIN;
        }
        goto SPOWN_DENORM_X;
    }
    return xin;
}

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_c1 = { 0x3eaaaaa8 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_c2 = { 0x3e4cd0b0 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_c3 = { 0x3e1166f0 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_c4 = { 0x3e046000 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_m181o256 = { 0x3f350000 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_half = { 0x3f000000 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_two = { 0x40000000 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_log2hi = { 0x3f317218 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_slog_log2lo = { 0xb102e308 };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_shft = { 0x4ac000feu };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_l2e = { 0x3FB8AA3Bu };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_l2h = { 0x3f317218u };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_l2l = { 0xb102E308u };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_c5 = { 0x3c08ba8bu };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_c4 = { 0x3d2aec4eu };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_c3 = { 0x3e2aaa9cu };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_c2 = { 0x3effffe8u };

static __constant union
{
    unsigned int w;
    float f;
} __spown_la_sexp_c1 = { 0x3f800000u };

static inline float __spown_la_frexpf (float arg, int *exp_res)
{
    unsigned int uX;
    float fS, fR, fOne;
    uX = ((*(int *) &arg) & ~0x80000000) - 0x00800000;
    // Normal args
    if (uX < 0x7f800000 - 0x00800000)
    {
        (*(int *) &fR) = (*(int *) &arg) & 0x807fffff;
        (*(int *) &fR) |= 0x3f000000;
        *exp_res = ((int) (uX >> 23) - (0x007F - 1)) + 1;
    }
    // Subnormal args
    else
    {
        (*(int *) &fR) = (*(int *) &arg) | 0x3f000000;
        (*(int *) &fS) = 0x3f000000 | ((*(int *) &fR)) & 0x80000000;
        fR = fR - fS;
        uX = (*(int *) &fR);
        uX = uX & 0x7f800000;
        (*(int *) &fR) &= ~0x7f800000;
        (*(int *) &fR) |= 0x3f000000;
        *exp_res = ((int) (uX >> 23) - (0x007F - 1)) - 125;
    }
    return fR;
}

inline int __ocl_svml_internal_spown_noLUT (float *pxin, int *pyin, float *pres)
{
    int nRet = 0;
    union
    {
        unsigned int w;
        float f;
    } fwX, fwY;
    union
    {
        unsigned int w;
        float f;
    } fwYLogX;
    union
    {
        unsigned int w;
        float f;
    } fwS, fwTh, fwTh2, fwRes;
    float fX, fY;
    float fN, fR, fPoly;
    float fExpArgHi, fExpArgLo;
    float fLogResHi, fLogResLo, fLogTHi, fLogTLo, fLogPolyHi, fLogPolyLo, fLogR;
    float fLogMant, fLogExp, fLogV3, fLogV2, fLogV1, fLogFHi, fLogFLo;
    unsigned int uXa32, uSgnX, uExpCorr;
    unsigned int uExpX;
    unsigned int uAbsYLogX;
    int iIdxMask;
    int iExp32, iMask32, iMaskH;
    int iExpX, iSmallX;
    fX = *pxin;
    fY = (float) (*pyin);
    fwX.f = *pxin;
    fwY.f = (float) (*pyin);
    // Argument reduction to range from 181/256 to 362/256:
    // Get mantissa and exponent of argument
    fLogMant = __spown_la_frexpf (fX, &iExpX);
    // If mantissa less than 181/256 then multiply it by 2 and decrease exponent by 1
    iSmallX = (fLogMant < __spown_la_slog_m181o256.f);
    fLogMant = (iSmallX) ? (2.0f * fLogMant) : fLogMant;
    iExpX = (iSmallX) ? (iExpX - 1) : iExpX;
    // Fraction f = (fLogMant-1)/(fLogMant+1)
    fLogV1 = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogMant, 1.0f, 1.0f);
    fLogMant = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogMant, 1.0f, -1.0f);
    fLogR = 1.0f / fLogV1;
    fLogFHi = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogMant, fLogR, 0.0f);
    fLogV2 = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogFHi, -__spown_la_slog_two.f, fLogMant);
    fLogV3 = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogFHi, -fLogMant, fLogV2);
    fLogFLo = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogR, fLogV3, 0.0f);
    // atanh(f) approximation
    fLogV3 = fLogFHi * fLogFHi;
    fLogR = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (__spown_la_slog_c4.f, fLogV3, __spown_la_slog_c3.f);
    fLogR = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogR, fLogV3, __spown_la_slog_c2.f);
    fLogR = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogR, fLogV3, __spown_la_slog_c1.f);
    fLogV2 = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogFHi, fLogFLo + fLogFLo, SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogFHi, fLogFHi, -fLogV3));
    fLogV1 = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogV3, fLogFHi, 0.0f);
    fLogV2 =
        SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogV3, fLogFLo,
                                                SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogV2, fLogFHi,
                                                                                        SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogV3, fLogFHi,
                                                                                                                                -fLogV1)));
    fLogV3 = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogR, fLogV1, SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogR, fLogV2, fLogFLo));
    // Log exponent as floating point
    fLogExp = (float) iExpX;
    // log = 2 * atanh(f) + fLogExp * log(2)
    fLogV2 =
        SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (__spown_la_slog_half.f, __spown_la_slog_log2hi.f, 0.0f),
                                                fLogExp, fLogFHi);
    fLogV1 =
        SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (__spown_la_slog_half.f, -__spown_la_slog_log2hi.f, 0.0f),
                                                fLogExp, fLogV2);
    fLogV3 = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogFHi, 1.0f, -fLogV1), 1.0f, fLogV3);
    fLogV3 = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (__spown_la_slog_log2lo.f * __spown_la_slog_half.f, fLogExp, fLogV3);
    fLogR = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogV2, 1.0f, fLogV2);
    // log result in high and low parts
    fLogResHi = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (__spown_la_slog_two.f, fLogV3, fLogR);
    fLogResLo =
        SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (__spown_la_slog_two.f, fLogV3, SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogR, 1.0f, -fLogResHi));
    // Multiply  y * log(x)
    fLogTHi = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogResHi, fY, 0.0f);
    // Check for special args processing branch
    fwYLogX.f = (float) (fLogTHi);
    uExpX = fwX.w >> 23;
    uExpX--;
    uAbsYLogX = fwYLogX.w & 0x7fffffffu;
    if ((uExpX >= 0xfe) || (uAbsYLogX >= 0x42afb6e0))
    {
        goto SPOWN_MAIN_SPECIAL;
    }
    // Rest of multi-precision  y * log(x)
    fLogTLo = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogResHi, fY, -fLogTHi);
    fLogTLo = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogResLo, fY, +fLogTLo);
    fLogPolyHi = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogTHi, 1.0f, fLogTLo);
    fLogPolyLo = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fLogTHi, 1.0f, -fLogPolyHi), 1.0f, +fLogTLo);
    fExpArgHi = fLogPolyHi;
    fExpArgLo = fLogPolyLo;
    // Exp part computation
    fwS.f = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fExpArgHi, __spown_la_sexp_l2e.f, __spown_la_sexp_shft.f);
    fN = fwS.f - __spown_la_sexp_shft.f;
    fR = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) ((-fN), __spown_la_sexp_l2h.f, fExpArgHi);
    fR = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) ((-fN), __spown_la_sexp_l2l.f, fR);
    fR += fExpArgLo;
    // Set exponent in place
    fwTh.w = fwS.w << 22;
    // iIdxMask is based on last bit of fwS.w
    iIdxMask = 0 - (fwS.w & 1);
    // Set fwTh mantissa
    fwTh.w ^= (iIdxMask & 0x7504F3u);
    // Exp polynomial
    fPoly = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fR, __spown_la_sexp_c5.f, __spown_la_sexp_c4.f);
    fPoly = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fR, fPoly, __spown_la_sexp_c3.f);
    fPoly = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fR, fPoly, __spown_la_sexp_c2.f);
    fPoly = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fR, fPoly, __spown_la_sexp_c1.f);
    fPoly = fR * fPoly;
    // Big abs exp arg branch
    if (uAbsYLogX > 0x42AEAC4Fu)
    {
        fwS.w += 0xfe;
        fwTh2.w = (fwS.w >> 2) & 0xff;
        fwS.w -= (fwTh2.w << 1);
        fwTh2.w <<= 23;
        fwTh.w = fwS.w << 22;
        fwTh.w ^= (iIdxMask & 0x7504F3u);
        fwRes.f = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fPoly, fwTh.f, fwTh.f);
        fwRes.f *= fwTh2.f;
    }
    else
    {
        fwRes.f = SPIRV_OCL_BUILTIN (fma, _f32_f32_f32,) (fPoly, fwTh.f, fwTh.f);
    }
    *pres = fwRes.f;
    return nRet;
  SPOWN_MAIN_SPECIAL:
    fwRes.w = __spown_la_pownf_cout (fwX.w, *pyin, &nRet);
    *pres = fwRes.f;
    return nRet;
}

float __ocl_svml_pownf_noLUT (float a, int b)
{
    float r;
    __ocl_svml_internal_spown_noLUT (&a, &b, &r);
    return r;
}