1570af302Sopenharmony_ci#include <math.h> 2570af302Sopenharmony_ci 3570af302Sopenharmony_cifloat fabsf(float x) 4570af302Sopenharmony_ci{ 5570af302Sopenharmony_ci float t; 6570af302Sopenharmony_ci __asm__ ("pcmpeqd %0, %0" : "=x"(t)); // t = ~0 7570af302Sopenharmony_ci __asm__ ("psrld $1, %0" : "+x"(t)); // t >>= 1 8570af302Sopenharmony_ci __asm__ ("andps %1, %0" : "+x"(x) : "x"(t)); // x &= t 9570af302Sopenharmony_ci return x; 10570af302Sopenharmony_ci} 11