File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -2302,7 +2302,24 @@ void GenSpecificPattern::visitFNeg(llvm::UnaryOperator& I)
2302
2302
2303
2303
IRBuilder<> builder (&I);
2304
2304
2305
- Value* fsub = builder.CreateFSub (ConstantFP::get (I.getType (), 0 .0f ), I.getOperand (0 ));
2305
+ Value* fsub = nullptr ;
2306
+
2307
+ if (!I.getType ()->isVectorTy ())
2308
+ {
2309
+ fsub = builder.CreateFSub (ConstantFP::get (I.getType (), 0 .0f ), I.getOperand (0 ));
2310
+ }
2311
+ else
2312
+ {
2313
+ uint32_t vectorSize = I.getType ()->getVectorNumElements ();
2314
+ fsub = llvm::UndefValue::get (I.getType ());
2315
+
2316
+ for (int i = 0 ; i < vectorSize; ++i)
2317
+ {
2318
+ Value* extract = builder.CreateExtractElement (I.getOperand (0 ), i);
2319
+ Value* extract_fsub = builder.CreateFSub (ConstantFP::get (extract->getType (), 0 .0f ), extract);
2320
+ fsub = builder.CreateInsertElement (fsub, extract_fsub, i);
2321
+ }
2322
+ }
2306
2323
2307
2324
I.replaceAllUsesWith (fsub);
2308
2325
}
You can’t perform that action at this time.
0 commit comments