Пример #1
0
        private static void EmitLopPredWrite(EmitterContext context, Operand result, PredicateOp predOp, int pred)
        {
            if (pred != RegisterConsts.PredicateTrueIndex)
            {
                Operand pRes;

                if (predOp == PredicateOp.F)
                {
                    pRes = Const(IrConsts.False);
                }
                else if (predOp == PredicateOp.T)
                {
                    pRes = Const(IrConsts.True);
                }
                else if (predOp == PredicateOp.Z)
                {
                    pRes = context.ICompareEqual(result, Const(0));
                }
                else /* if (predOp == Pop.Nz) */
                {
                    pRes = context.ICompareNotEqual(result, Const(0));
                }

                context.Copy(Register(pred, RegisterType.Predicate), pRes);
            }
        }
Пример #2
0
        private static void EmitLop(
            EmitterContext context,
            LogicOp logicOp,
            PredicateOp predOp,
            Operand srcA,
            Operand srcB,
            int rd,
            int destPred,
            bool invertA,
            bool invertB,
            bool extended,
            bool writeCC)
        {
            srcA = context.BitwiseNot(srcA, invertA);
            srcB = context.BitwiseNot(srcB, invertB);

            Operand res = logicOp switch
            {
                LogicOp.And => res = context.BitwiseAnd(srcA, srcB),
                LogicOp.Or => res  = context.BitwiseOr(srcA, srcB),
                LogicOp.Xor => res = context.BitwiseExclusiveOr(srcA, srcB),
                _ => srcB
            };

            EmitLopPredWrite(context, res, predOp, destPred);

            context.Copy(GetDest(rd), res);

            SetZnFlags(context, res, writeCC, extended);
        }
Пример #3
0
        private static void EmitLop3(
            EmitterContext context,
            int truthTable,
            PredicateOp predOp,
            Operand srcA,
            Operand srcB,
            Operand srcC,
            int rd,
            int destPred,
            bool extended,
            bool writeCC)
        {
            Operand res = Lop3Expression.GetFromTruthTable(context, srcA, srcB, srcC, truthTable);

            EmitLopPredWrite(context, res, predOp, destPred);

            context.Copy(GetDest(rd), res);

            SetZnFlags(context, res, writeCC, extended);
        }