Adds Zilsd alignment control options for RISC-V.
Introduces `-mzilsd-word-align` and `-mzilsd-strict-align` options to control alignment policies for RISC-V Zilsd/Zclsd doubleword memory accesses.
This commit introduces new command-line options to control the alignment policies for RISC-V’s Zilsd/Zclsd extensions, which provide doubleword memory access instructions. The new options, -mzilsd-word-align and -mzilsd-strict-align, allow users to explicitly select between word-aligned and naturally aligned variants. If the selected alignment policy does not permit a 2 * XLEN access, the compiler will expand the access using scalar bit-field helpers instead of using Zilsd load or store instructions.
In Details
The RISC-V Zilsd and Zclsd extensions introduce doubleword memory access instructions. RISC-V toolchain conventions define separate alignment policies for these accesses. The -mzilsd-word-align and -mzilsd-strict-align options allow users to select the desired alignment policy. The implementation involves modifying riscv_handle_option to parse the new options, adding code to riscv_zilsd_valid_mem_p to check the validity of memory accesses based on the selected alignment policy, and updating riscv_expand_zilsd_misaligned_move to handle misaligned accesses.
For Context
When accessing data in memory, alignment refers to whether the data is located at an address that is a multiple of its size. For example, a 4-byte integer is naturally aligned if it is located at an address that is a multiple of 4. Misaligned memory accesses can be less efficient or even cause errors on some architectures. RISC-V is a modern instruction set architecture. The Zilsd and Zclsd extensions add new instructions for accessing larger chunks of memory. This commit provides new options that let you control how the compiler handles the alignment of these memory accesses.