]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Add ashiftrt operand 2 for vector avg_floor and avg_ceil
authorPan Li <pan2.li@intel.com>
Sat, 19 Jul 2025 09:17:11 +0000 (17:17 +0800)
committerPan Li <pan2.li@intel.com>
Sun, 20 Jul 2025 02:03:41 +0000 (10:03 +0800)
commitc655047d3dbd4db295ea9385ac2e337cba0b5e05
treee51cb091e3b2f502cdd8cba15794f4c21b3d46a2
parent1e005687dd6e86aefac0455a1ba1ecea65302285
RISC-V: Add ashiftrt operand 2 for vector avg_floor and avg_ceil

According to the semantics of the avg_floor and avg_ceil as below:

floor: op0 = (narrow) (((wide) op1 + (wide) op2) >> 1);
ceil:  op0 = (narrow) (((wide) op1 + (wide) op2 + 1) >> 1);

Aka we have (const_int 1) as the op2 of the ashiftrt but seems missed.
Thus, add it back to align the definition.

The below test suites are passed for this patch.
* The rv64gcv fully regression test.

gcc/ChangeLog:

* config/riscv/autovec.md: Add (const_int 1) as the op2 of
ashiftrt.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/config/riscv/autovec.md