[Bug target/54700] Optimize away x<0 as mask argument of a blend.

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 28 13:50:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54700

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> I'm not really sure if we can optimize v<0 for floating point v even with
> -fno-signed-zeros, isn't that option about allowing to optimize away x+0.0
> and similar to x?  I guess one can't guarantee that -0.0 won't appear though
> and treating -0.0 < 0 as sometimes false and sometimes true could just break
> too much stuff.

Yeah, I'm not completely sure about the floating point case. I think it would
be safe for (most of?) my applications, but likely not for everyone. The int
case is definitely safer. We could have kept your PR as the main one since it
comes with a nice complete testcase and analysis. Related to another recent
report would be the unsigned version, but that probably should be handled
separately in a different place.

__v4su
f (__v4su a, __v4su b, __v4su c)
{
  return a > INT_MAX ? b : c;
}


More information about the Gcc-bugs mailing list