[cfe-commits] [PATCH] - Problem with '==' and AltiVec vectors

Eli Friedman eli.friedman at gmail.com
Fri Jul 2 21:34:21 PDT 2010


On Fri, Jul 2, 2010 at 9:04 PM, John Thompson
<john.thompson.jtsoftware at gmail.com> wrote:
> Here's my crack at a partial fix for bug 7553.  In my PS3 gcc, a vector
> comparison generates a call to the AltiVec vcmpeqfp instruction, and then
> pulls the condition code bit for the boolean result.  The current Clang
> implementation seems to consider the result of the comparison expression as
> a vector of intregal fields corresponding to the source operands.  Which is
> the correct way for the C-style comparison expression?
>
> The enclosed patch assumes the comparison expression is of type bool for C++
> and int for C just for AltiVec.
>
> However, there's an assert from the code generation if I use -emit-llvm
> because it expects a vector type for the expression.  Looking into it, it
> seems to use the LLVM "cmp" instruction for both vectors and atomic floating
> point types.  Is this still the right thing for AltiVec, or does it need to
> be changed to use something else?  Sorry, I haven't yet looked much at the
> code generation stuff yet, but I wanted to see if I was on the right track.

If you're describing the semantics correctly, you're on the right
track, and AltiVec IRGen needs to be fixed.

-Eli




More information about the cfe-commits mailing list