On Fri, 10 Jul 2020, Joe Ramsay wrote:
adds a new pattern to simplify a >= 0 && b >= 0 to (a | b) >= 0.
We should probably add the symmetric simplification of a<0|b<0 to (a|b)<0
* match.pd: New simplication.
I think Jakub was suggesting something slightly mode detailed.
It would be nice to put the transformation next to "(x == 0 & y == 0) ->
(x | typeof(x)(y)) == 0." in the file, since they work similarly.
+(for and (truth_and truth_andif)
I think the most important one here is bit_and.
+ (and (ge @0 integer_zerop) (ge @1 integer_zerop))
I was expecting some :s on the ge, but I notice that we don't have them
for the similar transformation, so I don't know...
+ If one type is wider then the narrower type is sign-extended
Is that necessarily a sign-extension? True, for an unsigned type, we
usually replace >=0 with !=0 IIRC, but it wouldn't hurt to add an explicit
check for that.
+ (if ( INTEGRAL_TYPE_P (TREE_TYPE (@0))
+ && INTEGRAL_TYPE_P (TREE_TYPE (@1)))
I like indenting to align things, but I don't think that matches the
official style used in gcc.
I am always afraid that this kind of transformation may hurt if it happens
too early (does VRP know how to get ranges for a and b from (a|b)>=0?) but
I guess this isn't the first transformation in this direction, so we can
see all of them later if it causes trouble...
If the types are int128_t and int64_t, is extending the right thing to do?
Will it eventually simplify to ((int64_t)(i128>>64)|i64)>=0
--
Marc Glisse