This is the mail archive of the
mailing list for the GCC project.
Re: [patches] Re: SSE min/max take2 - documentation
- To: Jan Hubicka <jh at suse dot cz>
- Subject: Re: [patches] Re: SSE min/max take2 - documentation
- From: Geert Bosch <bosch at gnat dot com>
- Date: Tue, 27 Feb 2001 14:36:00 -0500 (EST)
- Cc: Fergus Henderson <fjh at cs dot mu dot oz dot au>, gcc-patches at gcc dot gnu dot org,patches at x86-64 dot org
On Tue, 27 Feb 2001, Jan Hubicka wrote:
|> We can use the identity (x > y ? x : y) == (-y <= -x ? y : x)
|> to uniformly handle all cases on all platforms. This identity
|> holds in presence of signed zeroes, infinities and NaN's.
|hmm, thats nice, but how this helps to expanders?
|If we define min expander to generate three negations and max on target
|platform, I don't think we will win the code quality....
The negations only involve toggling one bit, and it also might be possible
to optimize away in many expressions (by reversing subtractions etc.)
but what I mean is that we can use the tree to express all cases.
If you have code like:
z = (x > y ? x : y)
and no special -ffast-math option and compile for PowerPC,
you would see that the cost of this is the cost of two negations
and the min operation, which might be high enough not to choose this.
On the other hand, on x86 this would just have the cost for the max.
Similarly, if you have code like
z = (x >= y ? x : y)
then you would notice that this is equivalent to (-y < -x ? y : x)
and the cost for the PowerPC would be lower than the cost for the x86.
So it seems that instead of a semantic issue, we would just have a
cost issue. I do not know enough on how exactly expansion and combination
of patterns works in GCC to see whether this would work, but it seems
to me that since we can always convert to/from these patterns there
should be a way to get the minimal cost alternative for a certain expression.