InstEmitMove.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using ARMeilleure.Decoders;
  2. using ARMeilleure.IntermediateRepresentation;
  3. using ARMeilleure.Translation;
  4. using static ARMeilleure.Instructions.InstEmitHelper;
  5. using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
  6. namespace ARMeilleure.Instructions
  7. {
  8. static partial class InstEmit
  9. {
  10. public static void Movk(ArmEmitterContext context)
  11. {
  12. OpCodeMov op = (OpCodeMov)context.CurrOp;
  13. OperandType type = op.GetOperandType();
  14. Operand res = GetIntOrZR(context, op.Rd);
  15. res = context.BitwiseAnd(res, Const(type, ~(0xffffL << op.Bit)));
  16. res = context.BitwiseOr(res, Const(type, op.Immediate));
  17. SetIntOrZR(context, op.Rd, res);
  18. }
  19. public static void Movn(ArmEmitterContext context)
  20. {
  21. OpCodeMov op = (OpCodeMov)context.CurrOp;
  22. SetIntOrZR(context, op.Rd, Const(op.GetOperandType(), ~op.Immediate));
  23. }
  24. public static void Movz(ArmEmitterContext context)
  25. {
  26. OpCodeMov op = (OpCodeMov)context.CurrOp;
  27. SetIntOrZR(context, op.Rd, Const(op.GetOperandType(), op.Immediate));
  28. }
  29. }
  30. }