Code Rejuvenation: From Vector Compiler Intrinsics to Portable Standardized SIMD - Martínez-Davies, Daniel; Veigas-Ramírez, Santiago; Gallego-Torres, Lucía; Garcia, J. Daniel (International journal of parallel programming, 2025)
Legacy code is hard to refactor, and often times, the effort needed to rejuvenate old code is substantial. In particular, compiler intrinsics are often used for clearly and unambiguously expressing low-level vectorization. It is not uncommon for C++ codebases to make use of compiler intrinsics, especially if high performance is critical. Nevertheless, they can be verbose and hard to debug. The C++ standard library introduces std::simd, which is emerging as a high level abstraction for expressing vectorization, allowing for more readable and portable code. Additionally, many of the transformations from compiler intrinsics to std::simd expressions are straightforward and mechanical. However, refactoring code from compiler intrinsics to std::simd can be time-consuming and bug-prone, especially when unfamiliar with the new syntax. With the help of static analysis techniques, it is possible to automatize the process, and ensure code correctness when applying the transformation. In this paper, we introduce a set of techniques to assist developers in the process of migrating existing code bases to a standardized approach for expressing vectorization that is portable to multiple architectures.