Exemple #1
0
        public static Operand[] GetHalfSrcA(EmitterContext context)
        {
            OpCode op = context.CurrOp;

            bool absoluteA = false, negateA = false;

            if (op is IOpCodeCbuf || op is IOpCodeImm)
            {
                negateA   = op.RawOpCode.Extract(43);
                absoluteA = op.RawOpCode.Extract(44);
            }
            else if (op is IOpCodeReg)
            {
                absoluteA = op.RawOpCode.Extract(44);
            }
            else if (op is OpCodeAluImm32 && op.Emitter == InstEmit.Hadd2)
            {
                negateA = op.RawOpCode.Extract(56);
            }

            FPHalfSwizzle swizzle = (FPHalfSwizzle)op.RawOpCode.Extract(47, 2);

            Operand[] operands = GetHalfSources(context, GetSrcA(context), swizzle);

            return(FPAbsNeg(context, operands, absoluteA, negateA));
        }
Exemple #2
0
        public static Operand[] GetHalfSources(EmitterContext context, Operand src, FPHalfSwizzle swizzle)
        {
            switch (swizzle)
            {
            case FPHalfSwizzle.FP16:
                return(new Operand[]
                {
                    context.UnpackHalf2x16Low(src),
                    context.UnpackHalf2x16High(src)
                });

            case FPHalfSwizzle.FP32: return(new Operand[] { src, src });

            case FPHalfSwizzle.DupH0:
                return(new Operand[]
                {
                    context.UnpackHalf2x16Low(src),
                    context.UnpackHalf2x16Low(src)
                });

            case FPHalfSwizzle.DupH1:
                return(new Operand[]
                {
                    context.UnpackHalf2x16High(src),
                    context.UnpackHalf2x16High(src)
                });
            }

            throw new ArgumentException($"Invalid swizzle \"{swizzle}\".");
        }
Exemple #3
0
        public static Operand GetHalfPacked(EmitterContext context, Operand[] results)
        {
            OpCode op = context.CurrOp;

            FPHalfSwizzle swizzle = FPHalfSwizzle.FP16;

            if (!(op is OpCodeAluImm32))
            {
                swizzle = (FPHalfSwizzle)context.CurrOp.RawOpCode.Extract(49, 2);
            }

            switch (swizzle)
            {
            case FPHalfSwizzle.FP16: return(context.PackHalf2x16(results[0], results[1]));

            case FPHalfSwizzle.FP32: return(results[0]);

            case FPHalfSwizzle.DupH0:
            {
                Operand h1 = GetHalfDest(context, isHigh: true);

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

            case FPHalfSwizzle.DupH1:
            {
                Operand h0 = GetHalfDest(context, isHigh: false);

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

            throw new ArgumentException($"Invalid swizzle \"{swizzle}\".");
        }
Exemple #4
0
        public static Operand[] GetHalfSrcB(EmitterContext context)
        {
            OpCode op = context.CurrOp;

            FPHalfSwizzle swizzle = FPHalfSwizzle.FP16;

            bool absoluteB = false, negateB = false;

            if (op is IOpCodeReg)
            {
                swizzle = (FPHalfSwizzle)op.RawOpCode.Extract(28, 2);

                absoluteB = op.RawOpCode.Extract(30);
                negateB   = op.RawOpCode.Extract(31);
            }
            else if (op is IOpCodeCbuf)
            {
                swizzle = FPHalfSwizzle.FP32;

                absoluteB = op.RawOpCode.Extract(54);
            }

            Operand[] operands = GetHalfSources(context, GetSrcB(context), swizzle);

            return(FPAbsNeg(context, operands, absoluteB, negateB));
        }
Exemple #5
0
        public OpCodeHfma(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
        {
            Rd = new Register(opCode.Extract(0, 8), RegisterType.Gpr);
            Ra = new Register(opCode.Extract(8, 8), RegisterType.Gpr);
            Rc = new Register(opCode.Extract(39, 8), RegisterType.Gpr);

            SwizzleA = (FPHalfSwizzle)opCode.Extract(47, 2);
        }
        public OpCodeHfmaImm2x10(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
        {
            Immediate = DecoderHelper.Decode2xF10Immediate(opCode);

            NegateC  = opCode.Extract(51);
            Saturate = opCode.Extract(52);

            SwizzleC = (FPHalfSwizzle)opCode.Extract(53, 2);
        }
Exemple #7
0
        public OpCodeHfmaReg(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
        {
            Rb = new Register(opCode.Extract(20, 8), RegisterType.Gpr);

            SwizzleB = (FPHalfSwizzle)opCode.Extract(28, 2);

            NegateC  = opCode.Extract(30);
            NegateB  = opCode.Extract(31);
            Saturate = opCode.Extract(32);

            SwizzleC = (FPHalfSwizzle)opCode.Extract(35, 2);
        }
        public OpCodeHfmaRegCbuf(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
        {
            Offset = opCode.Extract(20, 14);
            Slot   = opCode.Extract(34, 5);

            NegateC  = opCode.Extract(51);
            Saturate = opCode.Extract(52);

            SwizzleB = (FPHalfSwizzle)opCode.Extract(53, 2);

            NegateB = opCode.Extract(56);
        }