[Interest] qnumeric.h and use of #include <intrin.h> for MSVC
Thiago Macieira
thiago.macieira at intel.com
Mon Dec 2 18:07:33 CET 2024
[Updating to the right interest@ address]
On Friday 29 November 2024 17:48:18 Pacific Standard Time David C. Partridge
wrote:
> The header file qnumeric.h includes <intrin.h> if the MVSC compiler is in
> use so that implementations of qMulOverflow and qAddOverFlow that exploit
> the intrinsics can be defined.
>
> As far as I can determine, the code also implements "generic" versions of
> those which do not rely on the use of MSVC intrinsics.
Hello David
I also see you've filed https://bugreports.qt.io/browse/QTBUG-131757, which I'd
closed but have now reopened as a suggestion.
The "generic" versions work, but they are worse than simply asking the CPU if
the operation in question has overflown. For additions the cost is minimal, but
for multiplications it's very difficult to do it generically properly without
processor support.
You suggested moving the operations out-of-line but I think that's worse. The
cost of the call is going to be worse than even the fallback implementations
for additions and some of the optimisable multiplications. Moreover, none of
the ABIs allow returning flags, so there are more operations required.
Those functions were not originally public. We made them so in 6.1.0 because I
think someone asked us.
As discussed in the task, I'll accept a macro to disable the #include and
therefore fall back to the alternative implementations.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Principal Engineer - Intel DCAI Platform & System Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20241202/7906d62a/attachment.bin>
More information about the Interest
mailing list