gf_vect_gfni.inc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ; Copyright(c) 2023 Intel Corporation All rights reserved.
  3. ;
  4. ; Redistribution and use in source and binary forms, with or without
  5. ; modification, are permitted provided that the following conditions
  6. ; are met:
  7. ; * Redistributions of source code must retain the above copyright
  8. ; notice, this list of conditions and the following disclaimer.
  9. ; * Redistributions in binary form must reproduce the above copyright
  10. ; notice, this list of conditions and the following disclaimer in
  11. ; the documentation and/or other materials provided with the
  12. ; distribution.
  13. ; * Neither the name of Intel Corporation nor the names of its
  14. ; contributors may be used to endorse or promote products derived
  15. ; from this software without specific prior written permission.
  16. ;
  17. ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  20. ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  21. ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  22. ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  23. ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  25. ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. ;
  30. ; Multiply 1 source register to up to 6 different GF table registers
  31. ; and XOR the results to partial registers
  32. ;
  33. %macro GF_MUL_XOR 5-20
  34. %define %%ENCODING %1
  35. %define %%SRC %2
  36. %define %%GFTABLE1 %3
  37. %define %%TMP1 %4
  38. %define %%PARTIAL1 %5
  39. %define %%GFTABLE2 %6
  40. %define %%TMP2 %7
  41. %define %%PARTIAL2 %8
  42. %define %%GFTABLE3 %9
  43. %define %%TMP3 %10
  44. %define %%PARTIAL3 %11
  45. %define %%GFTABLE4 %12
  46. %define %%TMP4 %13
  47. %define %%PARTIAL4 %14
  48. %define %%GFTABLE5 %15
  49. %define %%TMP5 %16
  50. %define %%PARTIAL5 %17
  51. %define %%GFTABLE6 %18
  52. %define %%TMP6 %19
  53. %define %%PARTIAL6 %20
  54. %define %%N_BLOCKS ((%0 - 2) / 3)
  55. %assign %%I 1
  56. %rep %%N_BLOCKS
  57. vgf2p8affineqb %%TMP %+ %%I, %%SRC, %%GFTABLE %+ %%I, 0x00
  58. %assign %%I (%%I + 1)
  59. %endrep
  60. %assign %%I 1
  61. %rep %%N_BLOCKS
  62. %ifidn %%ENCODING, VEX
  63. vpxor %%PARTIAL %+ %%I, %%TMP %+ %%I
  64. %else
  65. vpxorq %%PARTIAL %+ %%I, %%TMP %+ %%I
  66. %endif
  67. %assign %%I (%%I + 1)
  68. %endrep
  69. %endmacro