]> gcc.gnu.org Git - gcc.git/commit
fold-const: Fix up ((1 << x) & y) != 0 folding for vectors [PR99225]
authorJakub Jelinek <jakub@redhat.com>
Wed, 24 Feb 2021 11:10:25 +0000 (12:10 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 20 Apr 2021 23:28:14 +0000 (01:28 +0200)
commit7c9f7293c995b662457b4e7aba97a6faa4d86dc5
treecbcc4320f6fb0c38086ec675395fd466afb73ef9
parentaec805be1ba98f9d79b1f7be3236deacc2e63551
fold-const: Fix up ((1 << x) & y) != 0 folding for vectors [PR99225]

This optimization was written purely with scalar integers in mind,
can work fine even with vectors, but we can't use build_int_cst but
need to use build_one_cst instead.

2021-02-24  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/99225
* fold-const.c (fold_binary_loc) <case NE_EXPR>: In (x & (1 << y)) != 0
to ((x >> y) & 1) != 0 simplifications use build_one_cst instead of
build_int_cst (..., 1).  Formatting fixes.

* gcc.c-torture/compile/pr99225.c: New test.

(cherry picked from commit 4de402ab60c54fff48cb7371644b024d10d7e5bb)
gcc/fold-const.c
gcc/testsuite/gcc.c-torture/compile/pr99225.c [new file with mode: 0644]
This page took 0.09851 seconds and 6 git commands to generate.