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

Nuno Santos nunosantos at imaginando.pt
Fri Apr 29 15:59:35 CEST 2016


Thanks for your reply.

While Qt code may be compiled with support for hard float, the qmake.specs file for android doesn’t show that and, in general, it seems that hard float support is disabled by default in android:

QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove

I have found some questions/answer around the internet suggesting the following:

QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mhard-float -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -D_NDK_MATH_NO_SOFTFP=1 -Wa,--noexecstack -fno-builtin-memmove

How can I have sure that it is in fact enabled?


Nuno Santos
Founder / CEO / CTO
+351 91 621 69 62

> On 29 Apr 2016, at 12:55, Ola Røer Thorsen <ola at silentwings.no> wrote:
> 2016-04-29 10:11 GMT+02:00 Nuno Santos <nunosantos at imaginando.pt <mailto:nunosantos at imaginando.pt>>:
> Code compiled and ruined fine but couldn’t notice a faster performance (I have profiling timers in critical parts of the application).
> Has anyone done this before? 
> As far as I know Qt is built with qreal as double as a default setting. 
> In case your cpu only does single precision floats in hardware:
> Maybe try to build Qt with qreal as single precision floats?
> I think the Qt configure option is "-qreal float", please check to be sure. 
> Makes a notable difference on my ancient arm omap3 processor, at least. 
> Also I'd recommend using the gcc warnings
> -Wdouble-promotion
> -Wfloat-conversion
> and make sure you are just using single precision floats as much as possible. Lots of performance is lost if you keep mixing single- and double precision. 
> float a = 1.0f;
> float b = 2.0*a; // BAD!
> float b = 2.0f*a; // Good!
> Make sure you are using single-precision math functions (use std::sin, std::abs, not cmath sin, abs, etc). The warnings above will show you all these cases. 
> Cheers,
> Ola
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160429/f712e383/attachment.html>

More information about the Interest mailing list