galois_ppc64le.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //+build !noasm
  2. //+build !appengine
  3. //+build !gccgo
  4. // Copyright 2015, Klaus Post, see LICENSE for details.
  5. // Copyright 2018, Minio, Inc.
  6. package reedsolomon
  7. //go:noescape
  8. func galMulPpc(low, high, in, out []byte)
  9. //go:noescape
  10. func galMulPpcXor(low, high, in, out []byte)
  11. // This is what the assembler routines do in blocks of 16 bytes:
  12. /*
  13. func galMulPpc(low, high, in, out []byte) {
  14. for n, input := range in {
  15. l := input & 0xf
  16. h := input >> 4
  17. out[n] = low[l] ^ high[h]
  18. }
  19. }
  20. func galMulPpcXor(low, high, in, out []byte) {
  21. for n, input := range in {
  22. l := input & 0xf
  23. h := input >> 4
  24. out[n] ^= low[l] ^ high[h]
  25. }
  26. }
  27. */
  28. func galMulSlice(c byte, in, out []byte, o *options) {
  29. done := (len(in) >> 4) << 4
  30. if done > 0 {
  31. galMulPpc(mulTableLow[c][:], mulTableHigh[c][:], in[:done], out)
  32. }
  33. remain := len(in) - done
  34. if remain > 0 {
  35. mt := mulTable[c][:256]
  36. for i := done; i < len(in); i++ {
  37. out[i] = mt[in[i]]
  38. }
  39. }
  40. }
  41. func galMulSliceXor(c byte, in, out []byte, o *options) {
  42. done := (len(in) >> 4) << 4
  43. if done > 0 {
  44. galMulPpcXor(mulTableLow[c][:], mulTableHigh[c][:], in[:done], out)
  45. }
  46. remain := len(in) - done
  47. if remain > 0 {
  48. mt := mulTable[c][:256]
  49. for i := done; i < len(in); i++ {
  50. out[i] ^= mt[in[i]]
  51. }
  52. }
  53. }
  54. // slice galois add
  55. func sliceXor(in, out []byte, sse2 bool) {
  56. for n, input := range in {
  57. out[n] ^= input
  58. }
  59. }
  60. func (r reedSolomon) codeSomeShardsAvx512(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) {
  61. }