s390: Implement clmuldi3 and clmul_widendi3
Add hardware acceleration for 64-bit carry-less multiplication on s390x.
This commit introduces hardware-accelerated implementations for clmuldi3 and clmul_widendi3 on s390x processors starting from the z13. These functions perform 64-bit carry-less multiplication. The implementation leverages specific s390x instructions to improve performance. The commit also includes a new test case to verify the functionality. The author notes the potential for further optimization by implementing clmulsi3 and clmul_widensi3 using vector instructions.
In Details
This patch adds expanders for clmuldi3 and clmul_widendi3 to config/s390/s390.md. These expanders utilize hardware instructions on z13 and later processors for 64-bit carry-less multiplication. The implementation considers the vgfmf instruction and the gen_vec_gfmsum_128 pattern, ensuring that one operand is zeroed when necessary to isolate the desired clmul operation from the combined XOR-clmul provided by vgfmf. A new test case gcc.target/s390/vector/builtin-clmulg-1.c is added to cover this functionality.
- clmuldi3
- A GCC internal function representing a 64-bit carry-less multiplication operation.
- clmul_widendi3
- A GCC internal function representing a wider carry-less multiplication operation, typically producing a result larger than 64 bits.
- s390x
- The 64-bit architecture of IBM's System/390 mainframe.
- z13
- A specific model of IBM z/Architecture mainframe server that supports certain advanced instructions.
- vector instructions
- CPU instructions that perform the same operation on multiple data elements simultaneously, often used for multimedia and scientific computing.