GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
i386 Performance Win

i386: Add vector lrint expanders for conversions

Enables vectorizer to use new conversion instructions for 'lrint' operations.

This commit exposes existing vector conversion instructions, vcvtps2qq and vcvtpd2dq, through lrint optabs. This allows the vectorizer to utilize these specialized instructions instead of falling back to less efficient scalar conversion sequences when determining the nearest integral value for floating-point numbers. New tests have been added to verify this functionality.

In Details

The lrint operation typically involves converting floating-point values to integers, rounding to the nearest integer. On the i386 architecture, new vector instructions like vcvtps2qq (float to quadword) and vcvtpd2dq (double to doubleword) can perform these conversions on multiple elements. By adding expanders for these in the lrint optabs, the compiler's vectorizer can now select these more efficient vector operations, improving performance for vectorized code that uses lrint.

For Context
lrint
A function that rounds a floating-point number to the nearest integer, returning a long integer type. It is part of the C standard's math functions.
optabs
Optimization tables within GCC that store information about supported machine instructions and their corresponding operations.
vectorizer
A compiler optimization pass that transforms scalar code into vector code, allowing operations to be performed on multiple data elements simultaneously using SIMD instructions.
vcvtps2qq
An AVX-512 instruction that converts packed single-precision floating-point values to packed quadword integers.
vcvtpd2dq
An AVX-512 instruction that converts packed double-precision floating-point values to packed doubleword integers.
Filed Under: i386vectorizationoptimizationintrinsics