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 bd228488cfa6e2631b8c6183980e73dc423d504f..03e09565efe9a40c8606a84a273818e2e6cdef00 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp @@ -9516,7 +9516,7 @@ RegOperand *AArch64CGFunc::SelectVectorImmMov(PrimType rType, Operand *src, Prim VectorRegSpec *vecSpec = GetMemoryPool()->New(rType); int64 val = static_cast(src)->GetValue(); - const int32 kMinImmVal = -256; + const int32 kMinImmVal = -128; const int32 kMaxImmVal = 255; /* copy the src imm operand to a reg if out of range */ @@ -9737,9 +9737,21 @@ void AArch64CGFunc::PrepareVectorOperands(Operand **o1, PrimType &oty1, Operand RegOperand *res = &CreateRegisterOperandOfType(rType); VectorRegSpec *vecSpec = GetMemoryPool()->New(rType); + bool immOpnd = false; + if (opd->IsConstImmediate()) { + int64 val = static_cast(opd)->GetValue(); + if (val >= -128 && val <= 255) { + immOpnd = true; + } else { + RegOperand *regOpd = &CreateRegisterOperandOfType(origTyp); + SelectCopyImm(*regOpd, origTyp, static_cast(*opd), origTyp); + opd = static_cast(regOpd); + } + } + /* need dup to vector operand */ MOperator mOp; - if (opd->IsConstImmediate()) { + if (immOpnd) { mOp = GetPrimTypeSize(rType) > k8ByteSize ? MOP_vmovvi : MOP_vmovui; /* a const */ } else { if (GetPrimTypeSize(origTyp) > k4ByteSize) {