diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp index ae4ddad5a48eb3f1e50fdda787fc0d28b53602d2..bf1224478ba8be0fbbef44574b62232c6b38f11e 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp @@ -3698,7 +3698,7 @@ static bool LIsPrimitivePointer(PrimType ptype) { } Operand *AArch64CGFunc::SelectRetype(TypeCvtNode &node, Operand &opnd0) { - PrimType fromType = node.FromType(); + PrimType fromType = node.Opnd(0)->GetPrimType(); PrimType toType = node.GetPrimType(); ASSERT(GetPrimTypeSize(fromType) == GetPrimTypeSize(toType), "retype bit widith doesn' match"); if (LIsPrimitivePointer(fromType) && LIsPrimitivePointer(toType)) { @@ -3742,11 +3742,16 @@ Operand *AArch64CGFunc::SelectRetype(TypeCvtNode &node, Operand &opnd0) { } else { newOpnd0 = &LoadIntoRegister(opnd0, itype); } - uint32 mopFmov = + if ((IsPrimitiveFloat(fromType) && IsPrimitiveInteger(toType)) || + (IsPrimitiveFloat(toType) && IsPrimitiveInteger(fromType))) { + MOperator mopFmov = isImm ? is64Bits ? MOP_xdfmovri : MOP_wsfmovri : isFromInt ? (is64Bits ? MOP_xvmovdr : MOP_xvmovsr) : (is64Bits ? MOP_xvmovrd : MOP_xvmovrs); - GetCurBB()->AppendInsn(GetCG()->BuildInstruction(mopFmov, *resOpnd, *newOpnd0)); - return resOpnd; + GetCurBB()->AppendInsn(GetCG()->BuildInstruction(mopFmov, *resOpnd, *newOpnd0)); + return resOpnd; + } else { + return newOpnd0; + } } else { CHECK_FATAL(false, "NYI retype"); }