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

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Wed Dec 14 16:27:42 PST 2011


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.

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



More information about the llvm-commits mailing list