================
@@ -73,6 +74,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);
----------------
farzonl wrote:

NIT: in general I don't think this matters but since cross product is crossing 
over elements
with `x1*y2 - x2*y1` I think its worth naming these elements like so  
`Builder.CreateExtractElement(op0, 0, "x0");`
This will effect the SSA names so it isn't just %1-%n

https://github.com/llvm/llvm-project/pull/109180
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to