Extend narrow CLMUL results stored in promoted registers
Fixes incorrect results for narrow CLMUL operations on AArch64 when results are stored in promoted registers.
This commit resolves an issue where narrow CLMUL (carry-less multiplication) results on AArch64 were not correctly extended when stored in promoted registers, leading to incorrect values being read by later operations. By using convert_move for promoted SUBREG targets, the fix ensures correct sign extension and passes libstdc++ tests.
In Details
The expand_CLMUL function in GCC's internal-fn handling was not correctly extending narrow CLMUL results when the destination was a promoted SUBREG (e.g., QImode or HImode on AArch64). This commit modifies the emit_move_insn to use convert_move, ensuring that the upper bits of the wider instruction are properly handled, thus preventing data corruption for users expecting extended values.
- CLMUL
- Carry-less Multiplication. A type of multiplication used in cryptography and error-correcting codes where the carry bits are discarded.
- SUBREG
- A subregister. When a larger hardware register is used to hold values of smaller data types, the smaller type occupies a SUBREG within the larger register.
- AArch64
- The 64-bit ARM architecture, commonly used in mobile and server devices.
- QImode
- GCC's internal mode for representing 8-bit integers (signed char).
- HImode
- GCC's internal mode for representing 16-bit integers (short).