Constant divisions not converted to multiplications

LIU Hao lh_mouse@126.com
Thu May 21 14:06:08 GMT 2026


在 2026-5-21 21:49, Matteo Nicoli via Gcc 写道:
> On GCC 16.1.1 I observe the same behavior (except from the fact that it uses the AVX instruction vdivss).

The option which enables such optimization is `-freciprocal-math`: https://gcc.godbolt.org/z/YovYMMdbj

It's off by default as it may result in precision loss. It can also be enabled indirectly with 
`-funsafe-math-optimizations` or `-ffast-math`.


-- 
Best regards,
LIU Hao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20260521/194b7d5f/attachment.sig>


More information about the Gcc mailing list