This is the mail archive of the
mailing list for the GCC project.
Re: Vector comparison
On 08/16/2010 12:24 PM, Richard Henderson wrote:
> On 08/15/2010 12:15 PM, Artem Shinkarov wrote:
>> SSE and AltiVec at least define vector comparison result as a vector
>> of 0 and -1. So I think that this would be an exotic architecture (but
>> I'm not sure). Anyway, if the target returns boolean value, then the
>> implementation of the hook should return constant vector of zeros for
>> false and constant vector of -1-s for true.
> MIPS isn't so exotic. The result of a float-pair comparison is to
> set a pair of condition codes. One can then use a branch that examines
> both CC results, or a special move instruction for the SELECT operation.
All that said, as long as we're clever enough to fold
t1 = (v1 == v2);
t2 = t1 ? v3 : v4;
where ?: is also as defined by OpenCL into
t2 = VCOND< v1 == v2 ? v3 : v4 >
where VCOND is as defined by the existing gcc tree code,
then we're likely to produce optimal results for MIPS.