double myPow2(double x) {
  double p;
  if (x >= 0)
    p = (1 + x * 0.00270760617406228636491106297445);
  else
    p = 1 / (1 - x * 0.00270760617406228636491106297445);
  p *= p;
  p *= p;
  p *= p;
  p *= p;
  p *= p;
  p *= p;
  p *= p;
  return p * p;
}


x86 assembly (clang, -O0):
<myPow2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1142 <myPow2+0x42>
movsd  -0x8(%rbp),%xmm0
movsd  0xee0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xecc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1187 <myPow2+0x87>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xea2(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe8e(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe82(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<myPow2>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    1128 <myPow2+0x28>
mulsd  0xefe(%rip),%xmm0
movsd  0xeee(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    1138 <myPow2+0x38>
mulsd  0xed0(%rip),%xmm0
addsd  0xed0(%rip),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @myPow2(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %2
%8 = call double @llvm.fmuladd.f64(double %7, double 0x3F662E42FEFA39EF, double 1.000000e+00)
store double %8, double* %3
br label %14
9: ; preds = %1
%10 = load double, double* %2
%11 = fneg double %10
%12 = call double @llvm.fmuladd.f64(double %11, double 0x3F662E42FEFA39EF, double 1.000000e+00)
%13 = fdiv double 1.000000e+00, %12
store double %13, double* %3
br label %14
14: ; preds = %9, %6
%15 = load double, double* %3
%16 = load double, double* %3
%17 = fmul double %16, %15
store double %17, double* %3
%18 = load double, double* %3
%19 = load double, double* %3
%20 = fmul double %19, %18
store double %20, double* %3
%21 = load double, double* %3
%22 = load double, double* %3
%23 = fmul double %22, %21
store double %23, double* %3
%24 = load double, double* %3
%25 = load double, double* %3
%26 = fmul double %25, %24
store double %26, double* %3
%27 = load double, double* %3
%28 = load double, double* %3
%29 = fmul double %28, %27
store double %29, double* %3
%30 = load double, double* %3
%31 = load double, double* %3
%32 = fmul double %31, %30
store double %32, double* %3
%33 = load double, double* %3
%34 = load double, double* %3
%35 = fmul double %34, %33
store double %35, double* %3
%36 = load double, double* %3
%37 = load double, double* %3
%38 = fmul double %36, %37
ret double %38
}

LLVM IR (-O2):
define double @myPow2(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double 0x3F662E42FEFA39EF, double 1.000000e+00)
br label %9
5: ; preds = %1
%6 = fneg double %0
%7 = tail call double @llvm.fmuladd.f64(double %6, double 0x3F662E42FEFA39EF, double 1.000000e+00)
%8 = fdiv double 1.000000e+00, %7
br label %9
9: ; preds = %5, %3
%10 = phi double [ %4, %3 ], [ %8, %5 ]
%11 = fmul double %10, %10
%12 = fmul double %11, %11
%13 = fmul double %12, %12
%14 = fmul double %13, %13
%15 = fmul double %14, %14
%16 = fmul double %15, %15
%17 = fmul double %16, %16
%18 = fmul double %17, %17
ret double %18
}