[llvm-commits] [PATCH] Add support for lowering FNEG with AVX

Chad Rosier mcrosier at apple.com
Wed Dec 14 16:37:31 PST 2011


On Dec 14, 2011, at 4:27 PM, Bruno Cardoso Lopes wrote:

> On Wed, Dec 14, 2011 at 8:15 PM, Chad Rosier <mcrosier at apple.com> wrote:
>> Before committing I'll take care of the missing newline at EOF.
>> 
>> On Dec 14, 2011, at 2:13 PM, Chad Rosier wrote:
>> 
>>> With AVX enabled the included test case clang would assert:
>>> Assertion failed: (VT.getSizeInBits() == Operand.getValueType().getSizeInBits() && "Cannot BITCAST between types of different sizes!")
>>> 
>>> This patch add support for lowering FNEG when AVX is enabled.
>>> 
>>> Hoping for feedback from someone with more AVX experience (e.g., Bruno, Craig, Evan, Eli).
> 
> LGTM! One minor thing:
> 
> +    if (NumBits == 256) {
> +      CV.push_back(C);
> +      CV.push_back(C);
> +    }
>   } else {
>     Constant *C = ConstantFP::get(*Context, APFloat(APInt(32, 1U << 31)));
>     CV.push_back(C);
>     CV.push_back(C);
>     CV.push_back(C);
>     CV.push_back(C);
> +    if (NumBits == 256) {
> +      CV.push_back(C);
> +      CV.push_back(C);
> +      CV.push_back(C);
> +      CV.push_back(C);
> +    }
> 
> If you iterate over the number of elements to push_back the constants,
> you can make it more general and don't need to get the size here.

Sure, easy fix.

Thanks, Bruno.

> -- 
> Bruno Cardoso Lopes
> http://www.brunocardoso.cc




More information about the llvm-commits mailing list