private void RewriteVectorUnaryOp(string fnNameFormat, ArmVectorData elemType) { var src1 = this.Operand(Src1()); var dst = this.Operand(Dst(), PrimitiveType.Word32, true); var dstType = Dst().Width; var srcType = Src1().Width; var srcElemSize = Arm32Architecture.VectorElementDataType(elemType); var celemSrc = srcType.BitSize / srcElemSize.BitSize; var arrSrc = new ArrayType(srcType, celemSrc); var arrDst = new ArrayType(dstType, celemSrc); var fnName = string.Format(fnNameFormat, VectorElementTypeName(elemType)); var intrinsic = host.Intrinsic(fnName, true, arrDst, src1); m.Assign(dst, intrinsic); }
private void RewriteVmul() { var src1 = this.Operand(Src1()); var src2 = this.Operand(Src2()); var dst = this.Operand(Dst(), PrimitiveType.Word32, true); var dstType = Dst().Width; var srcType = Src1().Width; var srcElemSize = Arm32Architecture.VectorElementDataType(instr.vector_data); var celemSrc = srcType.BitSize / srcElemSize.BitSize; var arrSrc = new ArrayType(srcType, celemSrc); var arrDst = new ArrayType(dstType, celemSrc); var fnName = $"__vmul_{VectorElementTypeName(instr.vector_data)}"; var intrinsic = host.Intrinsic(fnName, true, arrDst, src1, src2); m.Assign(dst, m.Fn(intrinsic)); }
private void RewriteVectorBinOp(string fnNameFormat, ArmVectorData elemType) { var src1 = this.Operand(Src1()); var src2 = this.Operand(Src2()); var dst = this.Operand(Dst(), PrimitiveType.Word32, true); var dstType = Dst().Width; var srcType = Src1().Width; var srcElemSize = Arm32Architecture.VectorElementDataType(elemType); //$BUG: some instructions are returned with srcElemnSize == 0! var celemSrc = srcType.BitSize / (srcElemSize.BitSize != 0 ? srcElemSize.BitSize : 8); var arrSrc = new ArrayType(srcType, celemSrc); var arrDst = new ArrayType(dstType, celemSrc); var fnName = string.Format(fnNameFormat, VectorElementType(elemType)); var intrinsic = host.PseudoProcedure(fnName, arrDst, src1, src2); m.Assign(dst, intrinsic); }
private void RewriteVmov() { //if (instr.ops.Length > 2) throw new NotImplementedException(); var dst = this.Operand(Dst(), PrimitiveType.Word32, true); var src = this.Operand(Src1()); if (instr.vector_data != ArmVectorData.INVALID && !(src is ArrayAccess)) { var dt = Arm32Architecture.VectorElementDataType(instr.vector_data); var dstType = Dst().Width; var srcType = Src1().Width; var srcElemSize = Arm32Architecture.VectorElementDataType(instr.vector_data); var celemSrc = dstType.BitSize / srcElemSize.BitSize; var arrDst = new ArrayType(dstType, celemSrc); if (Src1() is ImmediateOperand imm) { if (dst.DataType.BitSize == 128) { src = m.Seq(src, src); } m.Assign(dst, src); return; } var fname = $"__vmov_{VectorElementTypeName(instr.vector_data)}"; var intrinsic = host.Intrinsic(fname, true, Dst().Width, src); m.Assign(dst, m.Fn(intrinsic)); } else { if (dst.DataType.BitSize != src.DataType.BitSize) { src = m.Convert(src, src.DataType, dst.DataType); } m.Assign(dst, src); } }