GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/risc-v

RISC-V: Simplify vector comparison by removing cbranch_all patterns.

GCC's RISC-V backend no longer uses cbranch_all patterns for vector comparisons, simplifying the code.

This commit removes the cbranch_all patterns from the RISC-V backend. The original implementation of these patterns was flawed, and the existing early-break handling provides similar functionality. The int and float comparison emitter functions are unified, with the latter now supporting masking.

In Details

The commit removes the cbranch_all patterns from autovec.md. These patterns were intended to optimize early breaking in vector comparisons but were not correctly implemented. The current early-break handling via autovec-opt.md, while not ideal, provides similar functionality. The commit also unifies the expand_vec_cmp and expand_vec_cmp_float functions, with the latter now supporting mask capabilities.

For Context

When compiling code that uses vectors on RISC-V processors, the compiler needs to perform comparisons between elements of those vectors. This commit simplifies the way the compiler handles these comparisons by removing a set of patterns called cbranch_all. These patterns were intended to improve performance, but they were not working correctly. The compiler now uses a different approach that achieves similar results, while also making the code easier to understand and maintain.

Filed Under: gccrisc-vvectorizationoptimizationcode simplification