[Interest] armv7a-hard-float in Qt android apps

Thiago Macieira thiago.macieira at intel.com
Sat Apr 30 20:28:59 CEST 2016


On sábado, 30 de abril de 2016 10:46:21 PDT Jean-Michaël Celerier wrote:
> https://godbolt.org/g/DqBlFG
> 
> With gcc -O1
> 
> float f(float x)
> {
>   return 2. * x;
> }
> 
> becomes
> 
> f(float):
>         addss   %xmm0, %xmm0
>         ret
> 
> 
> and
> 
> float g (float x)
> {
>   return 2.f * x;
> }
> 
> becomes
> 
> g(float):
>         addss   %xmm0, %xmm0
>         ret

Because 2 can be represented with no loss of precision in both single- and 
double-precision floating point. The compiler actually produced an "as-if" 
optimisation here.

Try multiplying by something different, something that isn't precise, like 
2.1.

f:
        cvtss2sd        %xmm0, %xmm0
        mulsd   .LC0(%rip), %xmm0
        cvtsd2ss        %xmm0, %xmm0
        ret


https://godbolt.org/g/4yEj4Y

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list