Simplify mult where both arguments are 0 or 1 (PR tree-optimization/87954).
2019-06-06 Martin Liska <mliska@suse.cz> PR tree-optimization/87954 * match.pd: Simplify mult where both arguments are 0 or 1. 2019-06-06 Martin Liska <mliska@suse.cz> PR tree-optimization/87954 * gcc.dg/pr87954.c: New test. From-SVN: r271991
This commit is contained in:
parent
8ce6fb5fec
commit
ea8a6038b0
@ -1,3 +1,8 @@
|
||||
2019-06-06 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR tree-optimization/87954
|
||||
* match.pd: Simplify mult where both arguments are 0 or 1.
|
||||
|
||||
2019-06-06 Richard Biener <rguenther@suse.de>
|
||||
|
||||
* vr-values.c (vr_values::extract_range_from_ssa_name): Do not
|
||||
|
@ -217,6 +217,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
|
||||
|| !COMPLEX_FLOAT_TYPE_P (type)))
|
||||
(negate @0)))
|
||||
|
||||
/* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 } */
|
||||
(simplify
|
||||
(mult SSA_NAME@1 SSA_NAME@2)
|
||||
(if (INTEGRAL_TYPE_P (type)
|
||||
&& get_nonzero_bits (@1) == 1
|
||||
&& get_nonzero_bits (@2) == 1)
|
||||
(bit_and @1 @2)))
|
||||
|
||||
/* Transform x * { 0 or 1, 0 or 1, ... } into x & { 0 or -1, 0 or -1, ...},
|
||||
unless the target has native support for the former but not the latter. */
|
||||
(simplify
|
||||
|
@ -1,3 +1,8 @@
|
||||
2019-06-06 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR tree-optimization/87954
|
||||
* gcc.dg/pr87954.c: New test.
|
||||
|
||||
2019-06-06 Richard Biener <rguenther@suse.de>
|
||||
|
||||
* gcc.dg/tree-ssa/alias-37.c: New testcase.
|
||||
|
21
gcc/testsuite/gcc.dg/pr87954.c
Normal file
21
gcc/testsuite/gcc.dg/pr87954.c
Normal file
@ -0,0 +1,21 @@
|
||||
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||
|
||||
#define __GFP_DMA 1u
|
||||
#define __GFP_RECLAIM 0x10u
|
||||
|
||||
#define KMALLOC_DMA 2
|
||||
#define KMALLOC_RECLAIM 1
|
||||
|
||||
unsigned int
|
||||
imul(unsigned int flags)
|
||||
{
|
||||
int is_dma, type_dma, is_rec;
|
||||
|
||||
is_dma = !!(flags & __GFP_DMA);
|
||||
type_dma = is_dma * KMALLOC_DMA;
|
||||
is_rec = !!(flags & __GFP_RECLAIM);
|
||||
|
||||
return type_dma + (is_rec * !is_dma) * KMALLOC_RECLAIM;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times { \* } 1 "optimized" } } */
|
Loading…
x
Reference in New Issue
Block a user