github.com/minio/simdjson-go@v0.4.6-0.20231116094823-04d21cddf993/find_subroutines_amd64.go (about) 1 //go:build !noasm && !appengine && gc 2 // +build !noasm,!appengine,gc 3 4 /* 5 * MinIO Cloud Storage, (C) 2020 MinIO, Inc. 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 package simdjson 21 22 import ( 23 "unsafe" 24 ) 25 26 //go:noescape 27 func __finalize_structurals() 28 29 //go:noescape 30 func __finalize_structurals_avx512() 31 32 //go:noescape 33 func _finalize_structurals(structurals_in, whitespace, quote_mask, quote_bits uint64, prev_iter_ends_pseudo_pred unsafe.Pointer) (structurals uint64) 34 35 func finalize_structurals(structurals, whitespace, quote_mask, quote_bits uint64, prev_iter_ends_pseudo_pred *uint64) uint64 { 36 return _finalize_structurals(structurals, whitespace, quote_mask, quote_bits, unsafe.Pointer(prev_iter_ends_pseudo_pred)) 37 } 38 39 //go:noescape 40 func _find_newline_delimiters(raw []byte, quoteMask uint64) (mask uint64) 41 42 //go:noescape 43 func __find_newline_delimiters() 44 45 //go:noescape 46 func _find_newline_delimiters_avx512(raw []byte, quoteMask uint64) (mask uint64) 47 48 //go:noescape 49 func __init_newline_delimiters_avx512() 50 51 //go:noescape 52 func __find_newline_delimiters_avx512() 53 54 //go:noescape 55 func __find_quote_mask_and_bits() 56 57 //go:noescape 58 func _find_quote_mask_and_bits(input unsafe.Pointer, odd_ends uint64, prev_iter_inside_quote, quote_bits, error_mask unsafe.Pointer) (quote_mask uint64) 59 60 func find_quote_mask_and_bits(buf []byte, odd_ends uint64, prev_iter_inside_quote, quote_bits, error_mask *uint64) (quote_mask uint64) { 61 62 return _find_quote_mask_and_bits(unsafe.Pointer(&buf[0]), odd_ends, unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer(quote_bits), unsafe.Pointer(error_mask)) 63 } 64 65 //go:noescape 66 func __init_quote_mask_and_bits_avx512() 67 68 //go:noescape 69 func __find_quote_mask_and_bits_avx512() 70 71 //go:noescape 72 func _find_quote_mask_and_bits_avx512(input unsafe.Pointer, odd_ends uint64, prev_iter_inside_quote unsafe.Pointer) (error_mask, quote_bits, quote_mask uint64) 73 74 func find_quote_mask_and_bits_avx512(buf []byte, odd_ends uint64, prev_iter_inside_quote, quote_bits, error_mask *uint64) (quote_mask uint64) { 75 76 *error_mask, *quote_bits, quote_mask = _find_quote_mask_and_bits_avx512(unsafe.Pointer(&buf[0]), odd_ends, unsafe.Pointer(prev_iter_inside_quote)) 77 return 78 } 79 80 //go:noescape 81 func __find_odd_backslash_sequences() 82 83 //go:noescape 84 func _find_odd_backslash_sequences(p1, p3 unsafe.Pointer) (result uint64) 85 86 func find_odd_backslash_sequences(buf []byte, prev_iter_ends_odd_backslash *uint64) uint64 { 87 return _find_odd_backslash_sequences(unsafe.Pointer(&buf[0]), unsafe.Pointer(prev_iter_ends_odd_backslash)) 88 } 89 90 //go:noescape 91 func __init_odd_backslash_sequences_avx512() 92 93 //go:noescape 94 func __find_odd_backslash_sequences_avx512() 95 96 //go:noescape 97 func _find_odd_backslash_sequences_avx512(p1, p3 unsafe.Pointer) (result uint64) 98 99 func find_odd_backslash_sequences_avx512(buf []byte, prev_iter_ends_odd_backslash *uint64) uint64 { 100 return _find_odd_backslash_sequences_avx512(unsafe.Pointer(&buf[0]), unsafe.Pointer(prev_iter_ends_odd_backslash)) 101 } 102 103 //go:noescape 104 func _find_structural_bits(p1, p3 unsafe.Pointer, /* for: find_odd_backslash_sequences() */ 105 prev_iter_inside_quote, quote_bits, error_mask unsafe.Pointer, /* for: find_quote_mask_and_bits() */ 106 whitespace, structurals_in unsafe.Pointer, /* for: find_whitespace_and_structurals() */ 107 prev_iter_ends_pseudo_pred unsafe.Pointer, /* for: finalize_structurals() */ 108 ) (structurals uint64) 109 110 func find_structural_bits(buf []byte, prev_iter_ends_odd_backslash *uint64, 111 prev_iter_inside_quote, error_mask *uint64, 112 structurals uint64, 113 prev_iter_ends_pseudo_pred *uint64) uint64 { 114 115 quote_bits := uint64(0) 116 whitespace := uint64(0) 117 118 return _find_structural_bits(unsafe.Pointer(&buf[0]), unsafe.Pointer(prev_iter_ends_odd_backslash), 119 unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer("e_bits), unsafe.Pointer(error_mask), 120 unsafe.Pointer(&whitespace), unsafe.Pointer(&structurals), 121 unsafe.Pointer(prev_iter_ends_pseudo_pred)) 122 } 123 124 //go:noescape 125 func _find_structural_bits_avx512(p1, p3 unsafe.Pointer, /* for: find_odd_backslash_sequences() */ 126 prev_iter_inside_quote, error_mask unsafe.Pointer, /* for: find_quote_mask_and_bits() */ 127 structurals_in unsafe.Pointer, /* for: find_whitespace_and_structurals() */ 128 prev_iter_ends_pseudo_pred unsafe.Pointer, /* for: finalize_structurals() */ 129 ) (structurals uint64) 130 131 func find_structural_bits_avx512(buf []byte, prev_iter_ends_odd_backslash *uint64, 132 prev_iter_inside_quote, error_mask *uint64, 133 structurals uint64, 134 prev_iter_ends_pseudo_pred *uint64) uint64 { 135 136 return _find_structural_bits_avx512(unsafe.Pointer(&buf[0]), unsafe.Pointer(prev_iter_ends_odd_backslash), 137 unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer(error_mask), 138 unsafe.Pointer(&structurals), 139 unsafe.Pointer(prev_iter_ends_pseudo_pred)) 140 } 141 142 //go:noescape 143 func _find_structural_bits_in_slice(buf unsafe.Pointer, len uint64, p3 unsafe.Pointer, /* for: find_odd_backslash_sequences() */ 144 prev_iter_inside_quote, quote_bits, error_mask unsafe.Pointer, /* for: find_quote_mask_and_bits() */ 145 whitespace, structurals_in unsafe.Pointer, /* for: find_whitespace_and_structurals() */ 146 prev_iter_ends_pseudo_pred unsafe.Pointer, /* for: finalize_structurals() */ 147 indexes, index unsafe.Pointer, indexes_len uint64, 148 carried unsafe.Pointer, position unsafe.Pointer, 149 ndjson uint64) (processed uint64) 150 151 func find_structural_bits_in_slice(buf []byte, prev_iter_ends_odd_backslash *uint64, 152 prev_iter_inside_quote, error_mask *uint64, 153 prev_iter_ends_pseudo_pred *uint64, 154 indexes *[indexSize]uint32, index *int, carried *uint64, position *uint64, 155 ndjson uint64) (processed uint64) { 156 157 if len(buf) == 0 { 158 return 0 159 } 160 161 structurals := uint64(0) 162 quote_bits := uint64(0) 163 whitespace := uint64(0) 164 165 return _find_structural_bits_in_slice(unsafe.Pointer(&buf[0]), uint64(len(buf)), unsafe.Pointer(prev_iter_ends_odd_backslash), 166 unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer("e_bits), unsafe.Pointer(error_mask), 167 unsafe.Pointer(&whitespace), unsafe.Pointer(&structurals), 168 unsafe.Pointer(prev_iter_ends_pseudo_pred), 169 unsafe.Pointer(&(*indexes)[0]), unsafe.Pointer(index), indexSizeWithSafetyBuffer, 170 unsafe.Pointer(carried), unsafe.Pointer(position), 171 ndjson) 172 } 173 174 //go:noescape 175 func _find_structural_bits_in_slice_avx512(buf unsafe.Pointer, len uint64, p3 unsafe.Pointer, /* for: find_odd_backslash_sequences() */ 176 prev_iter_inside_quote, error_mask unsafe.Pointer, /* for: find_quote_mask_and_bits() */ 177 prev_iter_ends_pseudo_pred unsafe.Pointer, /* for: finalize_structurals() */ 178 indexes, index unsafe.Pointer, indexes_len uint64, 179 carried unsafe.Pointer, position unsafe.Pointer, 180 ndjson uint64) (processed uint64) 181 182 func find_structural_bits_in_slice_avx512(buf []byte, prev_iter_ends_odd_backslash *uint64, 183 prev_iter_inside_quote, error_mask *uint64, 184 prev_iter_ends_pseudo_pred *uint64, 185 indexes *[indexSize]uint32, index *int, carried *uint64, position *uint64, 186 ndjson uint64) (processed uint64) { 187 188 if len(buf) == 0 { 189 return 0 190 } 191 192 return _find_structural_bits_in_slice_avx512(unsafe.Pointer(&buf[0]), uint64(len(buf)), unsafe.Pointer(prev_iter_ends_odd_backslash), 193 unsafe.Pointer(prev_iter_inside_quote), unsafe.Pointer(error_mask), 194 unsafe.Pointer(prev_iter_ends_pseudo_pred), 195 unsafe.Pointer(&(*indexes)[0]), unsafe.Pointer(index), indexSizeWithSafetyBuffer, 196 unsafe.Pointer(carried), unsafe.Pointer(position), 197 ndjson) 198 } 199 200 //go:noescape 201 func __find_whitespace_and_structurals() 202 203 //go:noescape 204 func _find_whitespace_and_structurals(input, whitespace, structurals unsafe.Pointer) 205 206 func find_whitespace_and_structurals(buf []byte, whitespace, structurals *uint64) { 207 _find_whitespace_and_structurals(unsafe.Pointer(&buf[0]), unsafe.Pointer(whitespace), unsafe.Pointer(structurals)) 208 } 209 210 //go:noescape 211 func __init_whitespace_and_structurals_avx512() 212 213 //go:noescape 214 func __find_whitespace_and_structurals_avx512() 215 216 //go:noescape 217 func _find_whitespace_and_structurals_avx512(input unsafe.Pointer) (whitespace, structurals uint64) 218 219 func find_whitespace_and_structurals_avx512(buf []byte, whitespace, structurals *uint64) { 220 *whitespace, *structurals = _find_whitespace_and_structurals_avx512(unsafe.Pointer(&buf[0])) 221 } 222 223 //go:noescape 224 func __flatten_bits_incremental() 225 226 //go:noescape 227 func _flatten_bits_incremental(base_ptr, pbase unsafe.Pointer, mask uint64, carried unsafe.Pointer, position unsafe.Pointer) 228 229 func flatten_bits_incremental(base *[indexSize]uint32, base_index *int, mask uint64, carried *int, position *uint64) { 230 _flatten_bits_incremental(unsafe.Pointer(&(*base)[0]), unsafe.Pointer(base_index), mask, unsafe.Pointer(carried), unsafe.Pointer(position)) 231 }