]> git.ipfire.org Git - thirdparty/gcc.git/commit
match.pd: Check trunc_mod vector obtap before folding.
authorJennifer Schmitz <jschmitz@nvidia.com>
Thu, 3 Oct 2024 11:46:51 +0000 (04:46 -0700)
committerJennifer Schmitz <jschmitz@nvidia.com>
Thu, 10 Oct 2024 08:31:01 +0000 (10:31 +0200)
commita2e06b7f081a3d2e50e3afa8d3f1676a05099707
tree59ffe18724ec525cb37dd113f2d4ef463c3ec6d3
parentbcccc3221b838ee7ae7848e7194603acb18294b3
match.pd: Check trunc_mod vector obtap before folding.

This patch guards the simplification x / y * y == x -> x % y == 0 in
match.pd by a check for:
1) Non-vector mode of x OR
2) Lack of support for vector division OR
3) Support of vector modulo

The patch was bootstrapped and tested with no regression on
aarch64-linux-gnu and x86_64-linux-gnu.
OK for mainline?

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/
PR tree-optimization/116831
* match.pd: Guard simplification to trunc_mod with check for
mod optab support.

gcc/testsuite/
PR tree-optimization/116831
* gcc.dg/torture/pr116831.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/torture/pr116831.c [new file with mode: 0644]