superscalarGenerator.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. Copyright (c) 2019 tevador
  3. This file is part of RandomX.
  4. RandomX is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. RandomX is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with RandomX. If not, see<http://www.gnu.org/licenses/>.
  14. */
  15. #pragma once
  16. #include "Program.hpp"
  17. #include "Blake2Generator.hpp"
  18. namespace RandomX {
  19. // Intel Ivy Bridge reference
  20. namespace SuperscalarInstructionType { //uOPs (decode) execution ports latency code size
  21. constexpr int ISUB_R = 0; //1 p015 1 3 (sub)
  22. constexpr int IXOR_R = 1; //1 p015 1 3 (xor)
  23. constexpr int IADD_RS = 2; //1 p01 1 4 (lea)
  24. constexpr int IMUL_R = 3; //1 p1 3 4 (imul)
  25. constexpr int IROR_C = 4; //1 p05 1 4 (ror)
  26. constexpr int IADD_C7 = 5; //1 p015 1 7 (add)
  27. constexpr int IXOR_C7 = 6; //1 p015 1 7 (xor)
  28. constexpr int IADD_C8 = 7; //1+0 p015 1 7+1 (add+nop)
  29. constexpr int IXOR_C8 = 8; //1+0 p015 1 7+1 (xor+nop)
  30. constexpr int IADD_C9 = 9; //1+0 p015 1 7+2 (add+nop)
  31. constexpr int IXOR_C9 = 10; //1+0 p015 1 7+2 (xor+nop)
  32. constexpr int IMULH_R = 11; //1+2+1 0+(p1,p5)+0 3 3+3+3 (mov+mul+mov)
  33. constexpr int ISMULH_R = 12; //1+2+1 0+(p1,p5)+0 3 3+3+3 (mov+imul+mov)
  34. constexpr int IMUL_RCP = 13; //1+1 p015+p1 4 10+4 (mov+imul)
  35. constexpr int COUNT = 14;
  36. constexpr int INVALID = -1;
  37. }
  38. void generateSuperscalar(SuperscalarProgram& prog, Blake2Generator& gen);
  39. }