@pinskia wrote in 
https://forge.sourceware.org/gcc/gcc/pulls/193#issuecomment-6747:

> @azoff wrote in #193 (comment):
> 
> > @pinskia wrote in #193 (comment):
> > > So can you generalize it slightly to instead of zero be all constants. 
> > > Like (cond (eq @0 CONSTANT_CLASS@1) @0 @1).
> > 
> > 
> > I tried a few different things and ended up with
> > ```text
> >      /* A == CST ? A : CST -> CST.  */
> >      (simplify
> >       (cnd (eq:c @0 @1) @2 @1)
> >       (if (ANY_INTEGRAL_TYPE_P (type)
> >            && CONSTANT_CLASS_P (@1)
> >            && bitwise_equal_p (@0, @2))
> >        @1))
> >     
> >      /* A != CST ? CST : A -> CST.  */
> >      (simplify
> >       (cnd (ne:c @0 @1) @1 @2)
> >       (if (ANY_INTEGRAL_TYPE_P (type)
> >            && CONSTANT_CLASS_P (@1)
> >            && bitwise_equal_p (@0, @2))
> >        @1)))
> > ```
> > 
> > Is this what you were thinking of?
> 
> Yes but I dont think you need the :c and on the ne/eq as constant class 
> should always be last always. Though you might need a convert too.

Are you saying that there is no way to end up with `CST == A ? A : CST` instead 
of `A == CST ? A : CST`? Also, is there any drawback of leaving the `:c` just 
in case?
What other converter are you thinking of?
With the above, the test case that were failing starts to pass on 
arm-none-eabi, so it should be fine as-is, right?

--
https://forge.sourceware.org/gcc/gcc/pulls/193#issuecomment-6748

Reply via email to