================
@@ -74,6 +75,42 @@ static Value *expandAbs(CallInst *Orig) {
"dx.max");
}
+static Value *expandCrossIntrinsic(CallInst *Orig) {
+
+ VectorType *VT = cast<VectorType>(Orig->getType());
+ if (cast<FixedVectorType>(VT)->getNumElements() != 3)
+ report_fatal_error(Twine("return vector must have exactly 3 elements"),
+ /* gen_crash_diag=*/false);
+
+ Value *op0 = Orig->getOperand(0);
+ Value *op1 = Orig->getOperand(1);
+ IRBuilder<> Builder(Orig);
+
+ Value *op0_x = Builder.CreateExtractElement(op0, (uint64_t)0, "x0");
+ Value *op0_y = Builder.CreateExtractElement(op0, 1, "x1");
+ Value *op0_z = Builder.CreateExtractElement(op0, 2, "x2");
+
+ Value *op1_x = Builder.CreateExtractElement(op1, (uint64_t)0, "y0");
+ Value *op1_y = Builder.CreateExtractElement(op1, 1, "y1");
+ Value *op1_z = Builder.CreateExtractElement(op1, 2, "y2");
+
+ auto MulSub = [&](Value *x0, Value *y0, Value *x1, Value *y1) -> Value * {
+ Value *xy = Builder.CreateFMul(x0, y1);
+ Value *yx = Builder.CreateFMul(y0, x1);
+ return Builder.CreateFSub(xy, yx);
----------------
bob80905 wrote:
I don't think so, since we want distinct variable names when constructing the
final result vector. Each insertelement needs a unique variable name so that
contents of the vector are correct.
https://github.com/llvm/llvm-project/pull/109180
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits