ppc-opcode.h 1.2 KB

123456789101112131415161718192021222324252627
  1. // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  2. // Copyright (c) 2017 International Business Machines Corp.
  3. // All rights reserved.
  4. // This source code is licensed under both the GPLv2 (found in the
  5. // COPYING file in the root directory) and Apache 2.0 License
  6. // (found in the LICENSE.Apache file in the root directory).
  7. #pragma once
  8. #define __PPC_RA(a) (((a)&0x1f) << 16)
  9. #define __PPC_RB(b) (((b)&0x1f) << 11)
  10. #define __PPC_XA(a) ((((a)&0x1f) << 16) | (((a)&0x20) >> 3))
  11. #define __PPC_XB(b) ((((b)&0x1f) << 11) | (((b)&0x20) >> 4))
  12. #define __PPC_XS(s) ((((s)&0x1f) << 21) | (((s)&0x20) >> 5))
  13. #define __PPC_XT(s) __PPC_XS(s)
  14. #define VSX_XX3(t, a, b) (__PPC_XT(t) | __PPC_XA(a) | __PPC_XB(b))
  15. #define VSX_XX1(s, a, b) (__PPC_XS(s) | __PPC_RA(a) | __PPC_RB(b))
  16. #define PPC_INST_VPMSUMW 0x10000488
  17. #define PPC_INST_VPMSUMD 0x100004c8
  18. #define PPC_INST_MFVSRD 0x7c000066
  19. #define PPC_INST_MTVSRD 0x7c000166
  20. #define VPMSUMW(t, a, b) .long PPC_INST_VPMSUMW | VSX_XX3((t), a, b)
  21. #define VPMSUMD(t, a, b) .long PPC_INST_VPMSUMD | VSX_XX3((t), a, b)
  22. #define MFVRD(a, t) .long PPC_INST_MFVSRD | VSX_XX1((t) + 32, a, 0)
  23. #define MTVRD(t, a) .long PPC_INST_MTVSRD | VSX_XX1((t) + 32, a, 0)