================
@@ -3359,6 +3391,143 @@ static bool 
interp__builtin_ia32_cvt_vec2mask(InterpState &S, CodePtr OpPC,
   pushInteger(S, RetMask, Call->getType());
   return true;
 }
+static bool interp__builtin_ia32_cvtsd2ss(InterpState &S, CodePtr OpPC,
+                                          const CallExpr *Call) {
+  assert(Call->getNumArgs() == 2);
+
+  const Pointer &B = S.Stk.pop<Pointer>();
+  const Pointer &A = S.Stk.pop<Pointer>();
+  if (!CheckLoad(S, OpPC, A) || !CheckLoad(S, OpPC, B))
+    return false;
+
+  const auto *DstVTy = Call->getType()->castAs<VectorType>();
+  unsigned NumElems = DstVTy->getNumElements();
+  const Pointer &Dst = S.Stk.peek<Pointer>();
+
+  // Copy all elements from A to Dst
+  for (unsigned I = 0; I != NumElems; ++I)
+    Dst.elem<Floating>(I) = A.elem<Floating>(I);
+
+  // Convert element 0 from double to float
+  Floating Conv = S.allocFloat(
+      S.getASTContext().getFloatTypeSemantics(S.getASTContext().FloatTy));
----------------
tbaederr wrote:

My preference would be to use the `getElementType()` version and add an assert 
before that to make sure they are the same.

https://github.com/llvm/llvm-project/pull/169980
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to