gccrs: Implement platform-intrinsic SIMD function support
gccrs now supports platform-intrinsic SIMD functions, enabling compilation of Rust code using low-level hardware acceleration features.
This commit introduces support in gccrs for compiling Rust’s platform-intrinsic functions, which map to specific SIMD (Single Instruction, Multiple Data) hardware instructions. It generates GIMPLE code for various intrinsic operations like comparisons, arithmetic, and bitwise operations, ensuring these are compiled with the cdecl ABI. This enables gccrs to handle Rust code that leverages specialized SIMD capabilities for performance.
In Details
gccrs now supports the platform-intrinsic extern function feature in Rust. This commit introduces the necessary logic in rust-compile-platform-intrinsic.cc to generate GIMPLE for SIMD operations (arithmetic, comparisons, bitwise ops) invoked via these intrinsics. It correctly sets the cdecl ABI for these functions and handles related type-checking aspects like const parameters and tuple destructuring. This is crucial for compiling Rust's std::arch and similar performance-critical libraries.
- SIMD
- Single Instruction, Multiple Data is a class of parallel computers in Flynn's taxonomy. It describes processors that can perform the same operation on multiple data points simultaneously, often used for graphics and scientific computing.
- platform-intrinsic
- A Rust feature allowing direct access to specific hardware instructions, often for SIMD or other low-level performance optimizations. These are typically declared as
externfunctions. - GIMPLE
- GNU Intermediate Representation Language. It's a three-address code representation used internally by GCC after the initial parsing and Abstract Syntax Tree (AST) phases, serving as a common ground for various optimizations.
- ABI
- Application Binary Interface. It defines how functions are called, how data is laid out in memory, and other low-level details required for compiled code from different sources to interoperate.
- cdecl
- A common C calling convention where the caller cleans up the stack and arguments are pushed from right to left. It's often the default for C functions.