コード例 #1
0
        public AstNodeStm Vrot()
        {
            var imm5      = _instruction.Imm5;
            var cosIndex  = BitUtils.Extract(imm5, 0, 2);
            var sinIndex  = BitUtils.Extract(imm5, 2, 2);
            var negateSin = BitUtils.ExtractBool(imm5, 4);

            var dest = VecVd;
            var src  = CelVs;

            AstNodeExpr sine   = _ast.CallStatic((Func <float, float>)MathFloat.SinV1, src.Get());
            AstNodeExpr cosine = _ast.CallStatic((Func <float, float>)MathFloat.CosV1, src.Get());

            if (negateSin)
            {
                sine = -sine;
            }

            //Console.WriteLine("{0},{1},{2}", CosIndex, SinIndex, NegateSin);

            return(dest.SetVector(index =>
            {
                if (index == cosIndex)
                {
                    return cosine;
                }
                if (index == sinIndex)
                {
                    return sine;
                }
                return (sinIndex == cosIndex) ? sine : 0f;
            }, _pc));
        }