GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
risc-v Performance Win

Enable RISC-V vector initialization from two halves

Adds support for constructing full-width RISC-V vectors from two half-width vectors.

GCC now supports constructing full-width vectors on RISC-V architectures by concatenating two half-width vectors. This is achieved by implementing new vec_concat and vec_init expanders that utilize the vslideup instruction. The support has been extended to include half-precision floating-point formats (Float16 and BFloat16) and general vector half modes. This enhancement allows for more flexible vector initialization, particularly useful in autovectorization efforts.

In Details

This patch introduces vec_concat and vec_init expanders for RISC-V vectors, enabling the construction of a full-width vector from two half-width vectors (e.g., [v0, v1] + [v2, v3] -> [v0, v1, v2, v3]). These expanders are implemented using vslideup and are restricted to LMUL <= 1 to avoid multi-register spills. The existing VLS_HAS_HALF iterator is extended to include HF (Float16) and BF (BFloat16) modes, and new iterators VLA_HAS_HALF and V_HAS_HALF are introduced. The V_HALF and v_half macros (renamed from VLS_HALF/vls_half) are generalized, and vec_extract is…

For Context
RISC-V
An open-standard instruction set architecture (ISA) based on Reduced Instruction Set Computing principles. It is designed to be simple, modular, and extensible.
vector initialization
The process of assigning initial values to the elements of a vector data type.
vec_concat
A GCC intrinsic function or internal representation for concatenating two vectors into a wider vector.
vec_init
A GCC intrinsic function or internal representation for initializing a vector, potentially from multiple sources.
vslideup
A RISC-V vector instruction that performs a sliding window operation, useful for operations like vector concatenation or permuting elements.
autovectorization
A compiler optimization process that automatically converts scalar code (operating on single data elements) into vector code (operating on multiple data elements simultaneously using SIMD instructions).
Float16 (HF)
A 16-bit floating-point format, offering reduced precision and range compared to 32-bit (float) or 64-bit (double) formats, often used for memory savings or performance on specialized hardware.
BFloat16 (BF)
A 16-bit floating-point format, similar to IEEE 754 half-precision but with the exponent range of single-precision (32-bit) float and a smaller mantissa, making it suitable for machine learning workloads.
Filed Under: RISC-Vvectorizationautovectorization