]> git.ipfire.org Git - thirdparty/gcc.git/commit
MATCH: Simplify zero/sign extension bit operations [PR122848] master trunk
authorEikansh Gupta <eikansh.gupta@oss.qualcomm.com>
Wed, 3 Jun 2026 10:16:29 +0000 (15:46 +0530)
committerEikansh Gupta <eikansh.gupta@oss.qualcomm.com>
Thu, 30 Jul 2026 10:44:28 +0000 (16:14 +0530)
commitece564fdaa15a0da008cedd881afcd3f0f4dbd5a
tree741cdae3f027a389db8bae3955762fbeeb151b1a
parent1c8ca0108746d3a7452134f9d1c2e5d89857fed7
MATCH: Simplify zero/sign extension bit operations [PR122848]

Fold bitwise operations involving zero and sign extensions from the same
low-precision value.  The AND case folds to the zero extension, and the
OR case folds to the sign extension.

PR tree-optimization/122848

gcc/ChangeLog:

* match.pd (zero_extend & sign_extend -> zero_extend): New pattern.
(zero_extend | sign_extend -> sign_extend): Likewise.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr122848.c: New test.

Signed-off-by: Eikansh Gupta <eikansh.gupta@oss.qualcomm.com>
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/pr122848.c [new file with mode: 0644]