This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][PR 81376] Remove unnecessary float casts in comparisons


On Mon, 30 Oct 2017, Jeff Law wrote:

+/* Optimize various special cases of (FTYPE) N CMP (FTYPE) M.  */
+(for cmp (lt le eq ne ge gt)
+ (simplify
+  (cmp (float@0 @1) (float @2))
Since this runs on GENERIC as well as GIMPLE, I don't think you can rely
on the types of the float expressions being the same?!?  Which implies
subsequent code will need and fmt1/fmt2 because you don't know they're
necessarily the same.

Why would GENERIC have comparisons of operands with different types? The front-ends first convert both sides to the same type before sending it anywhere near the folding machinery. I am pretty sure we have a number of other places in match.pd where we assume that the existence of the expression "a OP b" implies that the types of a and b are the same.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]