@@ -2709,10 +2709,40 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
27092709 std::max ((uint64_t )LargestVectorWidth,
27102710 VT->getPrimitiveSizeInBits ().getKnownMinValue ());
27112711
2712- ArgTypes.push_back (Arg->getType ());
2713- ArgElemTypes.push_back (ArgElemType);
2714- Args.push_back (Arg);
2715- Constraints += InputConstraint;
2712+ // Expand RVV tuple type input operands.
2713+ if (InputExpr->getType ()->isRVVType () && Arg->getType ()->isStructTy ()) {
2714+ std::string ExpandedInputContraint;
2715+
2716+ auto *STy = cast<llvm::StructType>(Arg->getType ());
2717+
2718+ assert (STy->containsHomogeneousScalableVectorTypes () &&
2719+ isa<llvm::ScalableVectorType>(STy->getElementType (0 )) &&
2720+ " Only aggregate type of homogeneous scalable vectors is handled "
2721+ " here" );
2722+
2723+ auto *VTy = cast<llvm::ScalableVectorType>(STy->getElementType (0 ));
2724+
2725+ for (unsigned Idx = 0 , TupleSize = STy->getNumElements ();
2726+ Idx != TupleSize; ++Idx) {
2727+ if (ExpandedInputContraint.size ())
2728+ ExpandedInputContraint += " ," ;
2729+
2730+ ExpandedInputContraint += InputConstraint;
2731+ ArgTypes.push_back (VTy);
2732+ ArgElemTypes.push_back (ArgElemType);
2733+
2734+ llvm::Value *SubVec = Builder.CreateExtractValue (Arg, {Idx});
2735+
2736+ Args.push_back (SubVec);
2737+ }
2738+
2739+ Constraints += ExpandedInputContraint;
2740+ } else {
2741+ ArgTypes.push_back (Arg->getType ());
2742+ ArgElemTypes.push_back (ArgElemType);
2743+ Args.push_back (Arg);
2744+ Constraints += InputConstraint;
2745+ }
27162746 }
27172747
27182748 // Append the "input" part of inout constraints.
0 commit comments