Exp and Log#

On PowerVR Rogue architecture, the 2^n operation is directly supported by an instruction (EXP):

fragColor.x = exp2(t.x); // one cycle
{fexp}

The same is true with the log2() function (LOG):

fragColor.x = log2(t.x); // one cycle
{flog}

exp is implemented as:

float exp2( float x )
{
    return exp2(x * 1.442695); // two cycles
    {sop, sop}
    {fexp}
}

log is implemented as:

float log2( float x )
{
    return log2(x * 0.693147); // two cycles
    {sop, sop}
    {flog}
}

pow(x, y) is implemented as:

float pow( float x, float y )
{
    return exp2(log2(x) * y); // three cycles
    {flog}
    {sop, sop}
    {fexp}
}