Exemplo n.º 1
0
        public static Operand GetHalfPacked(EmitterContext context, OFmt swizzle, Operand[] results, int rd)
        {
            switch (swizzle)
            {
                case OFmt.F16: return context.PackHalf2x16(results[0], results[1]);

                case OFmt.F32: return results[0];

                case OFmt.MrgH0:
                {
                    Operand h1 = GetHalfDest(context, rd, isHigh: true);

                    return context.PackHalf2x16(results[0], h1);
                }

                case OFmt.MrgH1:
                {
                    Operand h0 = GetHalfDest(context, rd, isHigh: false);

                    return context.PackHalf2x16(h0, results[1]);
                }
            }

            throw new ArgumentException($"Invalid swizzle \"{swizzle}\".");
        }
Exemplo n.º 2
0
        private static void EmitHadd2Hmul2(
            EmitterContext context,
            OFmt swizzle,
            Operand[] srcA,
            Operand[] srcB,
            bool isAdd,
            int rd,
            bool saturate)
        {
            Operand[] res = new Operand[2];

            for (int index = 0; index < res.Length; index++)
            {
                if (isAdd)
                {
                    res[index] = context.FPAdd(srcA[index], srcB[index]);
                }
                else
                {
                    res[index] = context.FPMultiply(srcA[index], srcB[index]);
                }

                res[index] = context.FPSaturate(res[index], saturate);
            }

            context.Copy(GetDest(rd), GetHalfPacked(context, swizzle, res, rd));
        }
Exemplo n.º 3
0
        public static void EmitHfma2(
            EmitterContext context,
            OFmt swizzle,
            Operand[] srcA,
            Operand[] srcB,
            Operand[] srcC,
            int rd,
            bool saturate)
        {
            Operand[] res = new Operand[2];

            for (int index = 0; index < res.Length; index++)
            {
                res[index] = context.FPFusedMultiplyAdd(srcA[index], srcB[index], srcC[index]);
                res[index] = context.FPSaturate(res[index], saturate);
            }

            context.Copy(GetDest(rd), GetHalfPacked(context, swizzle, res, rd));
        }