@img/sharp-libvips-dev-wasm32 1.3.0-rc.1 → 1.3.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +23 -23
  2. package/include/aom/aom_codec.h +1 -1
  3. package/include/aom/aom_decoder.h +4 -0
  4. package/include/aom/aom_encoder.h +19 -8
  5. package/include/aom/aom_ext_ratectrl.h +664 -0
  6. package/include/aom/aom_image.h +93 -30
  7. package/include/aom/aom_tpl.h +99 -0
  8. package/include/aom/aomcx.h +89 -16
  9. package/include/aom/aomdx.h +12 -0
  10. package/include/expat.h +15 -3
  11. package/include/expat_config.h +6 -6
  12. package/include/expat_external.h +4 -4
  13. package/include/glib-2.0/gio/gdbusconnection.h +2 -8
  14. package/include/glib-2.0/gio/gfileattribute.h +1 -1
  15. package/include/glib-2.0/gio/gfileinfo.h +5 -0
  16. package/include/glib-2.0/gio/gicon.h +1 -1
  17. package/include/glib-2.0/gio/gio-autocleanups.h +0 -1
  18. package/include/glib-2.0/gio/gio-visibility.h +34 -0
  19. package/include/glib-2.0/gio/gio.h +2 -0
  20. package/include/glib-2.0/gio/gioenums.h +66 -44
  21. package/include/glib-2.0/gio/gioenumtypes.h +2 -0
  22. package/include/glib-2.0/gio/giptosmessage.h +46 -0
  23. package/include/glib-2.0/gio/gipv6tclassmessage.h +46 -0
  24. package/include/glib-2.0/gio/gresolver.h +1 -1
  25. package/include/glib-2.0/gio/gsettings.h +1 -1
  26. package/include/glib-2.0/gio/gsocketcontrolmessage.h +2 -0
  27. package/include/glib-2.0/glib/gatomic.h +26 -2
  28. package/include/glib-2.0/glib/gfileutils.h +2 -2
  29. package/include/glib-2.0/glib/ghook.h +3 -1
  30. package/include/glib-2.0/glib/giochannel.h +1 -1
  31. package/include/glib-2.0/glib/gkeyfile.h +1 -1
  32. package/include/glib-2.0/glib/glib-visibility.h +34 -0
  33. package/include/glib-2.0/glib/gmacros.h +32 -0
  34. package/include/glib-2.0/glib/gmain.h +4 -0
  35. package/include/glib-2.0/glib/gmarkup.h +18 -1
  36. package/include/glib-2.0/glib/gmem.h +4 -4
  37. package/include/glib-2.0/glib/gmessages.h +7 -9
  38. package/include/glib-2.0/glib/gnode.h +1 -1
  39. package/include/glib-2.0/glib/goption.h +1 -1
  40. package/include/glib-2.0/glib/gsequence.h +2 -2
  41. package/include/glib-2.0/glib/gslice.h +12 -4
  42. package/include/glib-2.0/glib/gspawn.h +1 -1
  43. package/include/glib-2.0/glib/gstrfuncs.h +191 -1
  44. package/include/glib-2.0/glib/gtestutils.h +6 -3
  45. package/include/glib-2.0/glib/gtimer.h +1 -0
  46. package/include/glib-2.0/glib/guri.h +3 -3
  47. package/include/glib-2.0/glib/gutils.h +10 -1
  48. package/include/glib-2.0/glib/gvarianttype.h +16 -16
  49. package/include/glib-2.0/glib/gversionmacros.h +22 -0
  50. package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
  51. package/include/glib-2.0/gmodule.h +1 -1
  52. package/include/glib-2.0/gobject/gbinding.h +1 -1
  53. package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
  54. package/include/glib-2.0/gobject/gobject.h +1 -1
  55. package/include/glib-2.0/gobject/gparam.h +1 -1
  56. package/include/glib-2.0/gobject/gsignal.h +8 -8
  57. package/include/glib-2.0/gobject/gtype.h +17 -17
  58. package/include/hwy/aligned_allocator.h +44 -2
  59. package/include/hwy/auto_tune.h +22 -6
  60. package/include/hwy/base.h +60 -90
  61. package/include/hwy/bit_set.h +410 -0
  62. package/include/hwy/cache_control.h +3 -2
  63. package/include/hwy/detect_compiler_arch.h +134 -14
  64. package/include/hwy/detect_targets.h +82 -36
  65. package/include/hwy/highway.h +15 -0
  66. package/include/hwy/nanobenchmark.h +12 -3
  67. package/include/hwy/ops/arm_neon-inl.h +96 -25
  68. package/include/hwy/ops/arm_sve-inl.h +250 -95
  69. package/include/hwy/ops/emu128-inl.h +12 -7
  70. package/include/hwy/ops/generic_ops-inl.h +271 -131
  71. package/include/hwy/ops/loongarch_lasx-inl.h +31 -9
  72. package/include/hwy/ops/loongarch_lsx-inl.h +33 -12
  73. package/include/hwy/ops/ppc_vsx-inl.h +99 -19
  74. package/include/hwy/ops/rvv-inl.h +239 -130
  75. package/include/hwy/ops/scalar-inl.h +22 -7
  76. package/include/hwy/ops/set_macros-inl.h +163 -107
  77. package/include/hwy/ops/wasm_128-inl.h +13 -22
  78. package/include/hwy/ops/x86_128-inl.h +223 -120
  79. package/include/hwy/ops/x86_256-inl.h +70 -134
  80. package/include/hwy/ops/x86_512-inl.h +130 -134
  81. package/include/hwy/print-inl.h +2 -0
  82. package/include/hwy/profiler.h +355 -264
  83. package/include/hwy/robust_statistics.h +3 -1
  84. package/include/hwy/timer.h +44 -0
  85. package/include/lcms2.h +35 -5
  86. package/include/lcms2_plugin.h +1 -1
  87. package/include/libexif/exif-utils.h +1 -1
  88. package/include/libheif/heif.h +2 -0
  89. package/include/libheif/heif_aux_images.h +2 -2
  90. package/include/libheif/heif_brands.h +16 -4
  91. package/include/libheif/heif_color.h +147 -25
  92. package/include/libheif/heif_components.h +264 -0
  93. package/include/libheif/heif_context.h +18 -4
  94. package/include/libheif/heif_cxx.h +20 -18
  95. package/include/libheif/heif_decoding.h +63 -9
  96. package/include/libheif/heif_encoding.h +46 -12
  97. package/include/libheif/heif_error.h +15 -6
  98. package/include/libheif/heif_export.h +48 -0
  99. package/include/libheif/heif_image.h +94 -32
  100. package/include/libheif/heif_image_handle.h +54 -3
  101. package/include/libheif/heif_items.h +25 -2
  102. package/include/libheif/heif_library.h +13 -18
  103. package/include/libheif/heif_metadata.h +5 -2
  104. package/include/libheif/heif_omaf.h +104 -0
  105. package/include/libheif/heif_plugin.h +80 -13
  106. package/include/libheif/heif_properties.h +259 -5
  107. package/include/libheif/heif_regions.h +5 -3
  108. package/include/libheif/heif_security.h +24 -2
  109. package/include/libheif/heif_sequences.h +163 -14
  110. package/include/libheif/heif_text.h +161 -0
  111. package/include/libheif/heif_tiling.h +2 -2
  112. package/include/libheif/heif_uncompressed.h +29 -5
  113. package/include/libheif/heif_version.h +2 -2
  114. package/include/libpng16/png.h +637 -488
  115. package/include/libpng16/pngconf.h +2 -2
  116. package/include/libpng16/pnglibconf.h +2 -2
  117. package/include/png.h +637 -488
  118. package/include/pngconf.h +2 -2
  119. package/include/pnglibconf.h +2 -2
  120. package/include/resvg.h +3 -3
  121. package/include/tiffconf.h +9 -10
  122. package/include/tiffio.h +10 -9
  123. package/include/tiffvers.h +1 -1
  124. package/include/ultrahdr_api.h +5 -11
  125. package/include/vips/colour.h +2 -2
  126. package/include/vips/memory.h +1 -1
  127. package/include/vips/version.h +4 -4
  128. package/include/zlib.h +3 -3
  129. package/lib/glib-2.0/include/glibconfig.h +1 -3
  130. package/lib/libaom.a +0 -0
  131. package/lib/libcgif.a +0 -0
  132. package/lib/libexif.a +0 -0
  133. package/lib/libexif.la +1 -1
  134. package/lib/libexpat.a +0 -0
  135. package/lib/libexpat.la +2 -2
  136. package/lib/libffi.a +0 -0
  137. package/lib/libgio-2.0.a +0 -0
  138. package/lib/libglib-2.0.a +0 -0
  139. package/lib/libgmodule-2.0.a +0 -0
  140. package/lib/libgobject-2.0.a +0 -0
  141. package/lib/libgthread-2.0.a +0 -0
  142. package/lib/libheif.a +0 -0
  143. package/lib/libhwy.a +0 -0
  144. package/lib/libimagequant.a +0 -0
  145. package/lib/libjpeg.a +0 -0
  146. package/lib/liblcms2.a +0 -0
  147. package/lib/libpng.a +0 -0
  148. package/lib/libpng.la +2 -2
  149. package/lib/libpng16.a +0 -0
  150. package/lib/libpng16.la +2 -2
  151. package/lib/libresvg.a +0 -0
  152. package/lib/libsharpyuv.a +0 -0
  153. package/lib/libtiff.a +0 -0
  154. package/lib/libuhdr.a +0 -0
  155. package/lib/libvips-cpp.a +0 -0
  156. package/lib/libvips.a +0 -0
  157. package/lib/libwebp.a +0 -0
  158. package/lib/libwebpdecoder.a +0 -0
  159. package/lib/libwebpdemux.a +0 -0
  160. package/lib/libwebpmux.a +0 -0
  161. package/lib/libz.a +0 -0
  162. package/lib/pkgconfig/aom.pc +2 -2
  163. package/lib/pkgconfig/cgif.pc +1 -1
  164. package/lib/pkgconfig/expat.pc +1 -1
  165. package/lib/pkgconfig/gio-2.0.pc +1 -1
  166. package/lib/pkgconfig/glib-2.0.pc +1 -1
  167. package/lib/pkgconfig/gmodule-2.0.pc +1 -1
  168. package/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
  169. package/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  170. package/lib/pkgconfig/gobject-2.0.pc +1 -1
  171. package/lib/pkgconfig/gthread-2.0.pc +1 -1
  172. package/lib/pkgconfig/lcms2.pc +1 -1
  173. package/lib/pkgconfig/libexif.pc +1 -1
  174. package/lib/pkgconfig/libheif.pc +1 -1
  175. package/lib/pkgconfig/libhwy.pc +3 -4
  176. package/lib/pkgconfig/libpng.pc +1 -1
  177. package/lib/pkgconfig/libpng16.pc +1 -1
  178. package/lib/pkgconfig/libsharpyuv.pc +1 -1
  179. package/lib/pkgconfig/libtiff-4.pc +2 -2
  180. package/lib/pkgconfig/libwebp.pc +1 -1
  181. package/lib/pkgconfig/libwebpdecoder.pc +11 -0
  182. package/lib/pkgconfig/libwebpmux.pc +1 -1
  183. package/lib/pkgconfig/vips-cpp.pc +1 -1
  184. package/lib/pkgconfig/vips.pc +1 -1
  185. package/package.json +1 -1
  186. package/versions.json +15 -15
  187. package/lib/libsharpyuv.la +0 -41
  188. package/lib/libtiff.la +0 -41
  189. package/lib/libwebp.la +0 -41
  190. package/lib/libwebpdemux.la +0 -41
  191. package/lib/libwebpmux.la +0 -41
@@ -20,9 +20,14 @@
20
20
  // inclusion by foreach_target.h.
21
21
 
22
22
  // Add to #if conditions to prevent IDE from graying out code.
23
+ // Note for clangd users: There is no predefined macro in clangd, so you must
24
+ // manually add these two lines (without the preceding '// ') to your project's
25
+ // `.clangd` file:
26
+ // CompileFlags:
27
+ // Add: [-D__CLANGD__]
23
28
  #if (defined __CDT_PARSER__) || (defined __INTELLISENSE__) || \
24
29
  (defined Q_CREATOR_RUN) || (defined __CLANGD__) || \
25
- (defined GROK_ELLIPSIS_BUILD)
30
+ (defined GROK_ELLIPSIS_BUILD) || (defined __JETBRAINS_IDE__)
26
31
  #define HWY_IDE 1
27
32
  #else
28
33
  #define HWY_IDE 0
@@ -65,15 +70,23 @@
65
70
  #define HWY_COMPILER_GCC 0
66
71
  #endif
67
72
 
68
- // Clang or clang-cl, not GCC.
69
- #ifdef __clang__
73
+ #ifndef HWY_COMPILER_CLANG // Allow user override.
74
+ #ifdef __clang__ // Clang or clang-cl, not GCC.
70
75
  // In case of Apple LLVM (whose version number is unrelated to that of LLVM) or
71
76
  // an invalid version number, deduce it from the presence of warnings.
72
77
  // Originally based on
73
78
  // https://github.com/simd-everywhere/simde/blob/47d6e603de9d04ee05cdfbc57cf282a02be1bf2a/simde/simde-detect-clang.h#L59.
74
79
  // Please send updates below to them as well, thanks!
75
80
  #if defined(__apple_build_version__) || __clang_major__ >= 999
76
- #if __has_warning("-Woverriding-option")
81
+ #if __has_builtin(__builtin_elementwise_fshl)
82
+ #define HWY_COMPILER_CLANG 2201
83
+ #elif __has_builtin(__builtin_structured_binding_size)
84
+ #define HWY_COMPILER_CLANG 2101
85
+ #elif __has_builtin(__builtin_common_type)
86
+ #define HWY_COMPILER_CLANG 2001
87
+ #elif __has_warning("-Wreturn-mismatch")
88
+ #define HWY_COMPILER_CLANG 1901
89
+ #elif __has_warning("-Woverriding-option")
77
90
  #define HWY_COMPILER_CLANG 1801
78
91
  // No new warnings in 17.0, and Apple LLVM 15.3, which should be 1600, already
79
92
  // has the unsafe_buffer_usage attribute, so we instead check for new builtins.
@@ -108,7 +121,6 @@
108
121
  #else // Anything older than 7.0 is not recommended for Highway.
109
122
  #define HWY_COMPILER_CLANG 600
110
123
  #endif // __has_warning chain
111
- #define HWY_COMPILER3_CLANG (HWY_COMPILER_CLANG * 100)
112
124
  #else // use normal version
113
125
  #define HWY_COMPILER_CLANG (__clang_major__ * 100 + __clang_minor__)
114
126
  #define HWY_COMPILER3_CLANG \
@@ -117,6 +129,12 @@
117
129
  #else // Not clang
118
130
  #define HWY_COMPILER_CLANG 0
119
131
  #define HWY_COMPILER3_CLANG 0
132
+ #endif // __clang__
133
+ #endif // HWY_COMPILER_CLANG
134
+
135
+ // User-defined or deduced HWY_COMPILER_CLANG: derive HWY_COMPILER3_CLANG.
136
+ #ifndef HWY_COMPILER3_CLANG
137
+ #define HWY_COMPILER3_CLANG (HWY_COMPILER_CLANG * 100)
120
138
  #endif
121
139
 
122
140
  #if HWY_COMPILER_GCC && !HWY_COMPILER_CLANG && !HWY_COMPILER_ICC && \
@@ -174,19 +192,30 @@
174
192
  #define HWY_CXX_LANG __cplusplus
175
193
  #endif
176
194
 
177
- #if defined(__cpp_constexpr) && __cpp_constexpr >= 201603L
178
- #define HWY_CXX17_CONSTEXPR constexpr
179
- #else
180
- #define HWY_CXX17_CONSTEXPR
181
- #endif
182
-
195
+ // Use instead of constexpr to avoid compiler errors for older compilers. This
196
+ // macro is for when a constexpr function involves multiple statements and
197
+ // loops, which is allowed in C++14 but not before. If the compiler does not
198
+ // support C++14 constexpr, this evaluates to nothing.
183
199
  #if defined(__cpp_constexpr) && __cpp_constexpr >= 201304L
184
200
  #define HWY_CXX14_CONSTEXPR constexpr
185
201
  #else
186
202
  #define HWY_CXX14_CONSTEXPR
187
203
  #endif
188
204
 
189
- #if HWY_CXX_LANG >= 201703L
205
+ // Same as above, but for C++17 constexpr, which adds support for lambdas, the
206
+ // standard library, and capturing *this.
207
+ // Note that C++17 constexpr still disallows allocating and virtual functions,
208
+ // which are allowed in C++20, but we do not have a use case yet.
209
+ #if defined(__cpp_constexpr) && __cpp_constexpr >= 201603L
210
+ #define HWY_CXX17_CONSTEXPR constexpr
211
+ #else
212
+ #define HWY_CXX17_CONSTEXPR
213
+ #endif
214
+
215
+ // Use instead of `if constexpr` to avoid compiler errors for older compilers.
216
+ // When compilers lack C++17 support, this evaluates to a normal if statement.
217
+ #if HWY_CXX_LANG >= 201703L || \
218
+ (defined(__cpp_if_constexpr) && __cpp_if_constexpr >= 201606L)
190
219
  #define HWY_IF_CONSTEXPR if constexpr
191
220
  #else
192
221
  #define HWY_IF_CONSTEXPR if
@@ -204,6 +233,58 @@
204
233
  #endif
205
234
  #endif
206
235
 
236
+ //------------------------------------------------------------------------------
237
+ // Sanitizers
238
+
239
+ #if HWY_HAS_FEATURE(memory_sanitizer) || defined(MEMORY_SANITIZER) || \
240
+ defined(__SANITIZE_MEMORY__)
241
+ #define HWY_IS_MSAN 1
242
+ #else
243
+ #define HWY_IS_MSAN 0
244
+ #endif
245
+
246
+ #if HWY_HAS_FEATURE(address_sanitizer) || defined(ADDRESS_SANITIZER) || \
247
+ defined(__SANITIZE_ADDRESS__)
248
+ #define HWY_IS_ASAN 1
249
+ #else
250
+ #define HWY_IS_ASAN 0
251
+ #endif
252
+
253
+ #if HWY_HAS_FEATURE(hwaddress_sanitizer) || defined(HWADDRESS_SANITIZER) || \
254
+ defined(__SANITIZE_HWADDRESS__)
255
+ #define HWY_IS_HWASAN 1
256
+ #else
257
+ #define HWY_IS_HWASAN 0
258
+ #endif
259
+
260
+ #if HWY_HAS_FEATURE(thread_sanitizer) || defined(THREAD_SANITIZER) || \
261
+ defined(__SANITIZE_THREAD__)
262
+ #define HWY_IS_TSAN 1
263
+ #else
264
+ #define HWY_IS_TSAN 0
265
+ #endif
266
+
267
+ #if HWY_HAS_FEATURE(undefined_behavior_sanitizer) || \
268
+ defined(UNDEFINED_BEHAVIOR_SANITIZER)
269
+ #define HWY_IS_UBSAN 1
270
+ #else
271
+ #define HWY_IS_UBSAN 0
272
+ #endif
273
+
274
+ // MSAN may cause lengthy build times or false positives e.g. in AVX3 DemoteTo.
275
+ // You can disable MSAN by adding this attribute to the function that fails.
276
+ #if HWY_IS_MSAN
277
+ #define HWY_ATTR_NO_MSAN __attribute__((no_sanitize_memory))
278
+ #else
279
+ #define HWY_ATTR_NO_MSAN
280
+ #endif
281
+
282
+ #if HWY_IS_ASAN || HWY_IS_HWASAN || HWY_IS_MSAN || HWY_IS_TSAN || HWY_IS_UBSAN
283
+ #define HWY_IS_SANITIZER 1
284
+ #else
285
+ #define HWY_IS_SANITIZER 0
286
+ #endif
287
+
207
288
  //------------------------------------------------------------------------------
208
289
  // Architecture
209
290
 
@@ -334,13 +415,36 @@
334
415
  #define HWY_ARCH_LOONGARCH 0
335
416
  #endif
336
417
 
418
+ #if defined(__hexagon__) || defined(__HEXAGON_ARCH__)
419
+ #define HWY_ARCH_HEXAGON 1
420
+ #else
421
+ #define HWY_ARCH_HEXAGON 0
422
+ #endif
423
+
337
424
  // It is an error to detect multiple architectures at the same time, but OK to
338
425
  // detect none of the above.
339
- #if (HWY_ARCH_X86 + HWY_ARCH_PPC + HWY_ARCH_ARM + HWY_ARCH_ARM_OLD + \
340
- HWY_ARCH_WASM + HWY_ARCH_RISCV + HWY_ARCH_S390X + HWY_ARCH_LOONGARCH) > 1
426
+ #if (HWY_ARCH_X86 + HWY_ARCH_PPC + HWY_ARCH_ARM + HWY_ARCH_ARM_OLD + \
427
+ HWY_ARCH_WASM + HWY_ARCH_RISCV + HWY_ARCH_S390X + HWY_ARCH_LOONGARCH + \
428
+ HWY_ARCH_HEXAGON) > 1
341
429
  #error "Must not detect more than one architecture"
342
430
  #endif
343
431
 
432
+ #if HWY_ARCH_RISCV
433
+ #define HWY_ARCH_MAX_BYTES 65536
434
+ #elif HWY_ARCH_ARM_A64
435
+ #define HWY_ARCH_MAX_BYTES 256
436
+ #elif HWY_ARCH_HEXAGON
437
+ #define HWY_ARCH_MAX_BYTES 128
438
+ #elif HWY_ARCH_X86
439
+ #define HWY_ARCH_MAX_BYTES 64
440
+ #elif HWY_ARCH_WASM || HWY_ARCH_LOONGARCH
441
+ #define HWY_ARCH_MAX_BYTES 32
442
+ #elif HWY_ARCH_PPC || HWY_ARCH_S390X || HWY_ARCH_ARM_V7 || HWY_ARCH_ARM_OLD
443
+ #define HWY_ARCH_MAX_BYTES 16
444
+ #else
445
+ #error "Missing case for HWY_ARCH_*"
446
+ #endif
447
+
344
448
  //------------------------------------------------------------------------------
345
449
  // Operating system
346
450
 
@@ -404,4 +508,20 @@
404
508
  #error "Must only detect one byte order"
405
509
  #endif
406
510
 
511
+ //------------------------------------------------------------------------------
512
+ // Features checked in set_macros-inl.h
513
+
514
+ // Compiler supports ACLE __bf16, not necessarily with operators.
515
+ //
516
+ // Disable the __bf16 type on AArch64 with GCC 13 or earlier as there is a bug
517
+ // in GCC 13 and earlier that sometimes causes BF16 constant values to be
518
+ // incorrectly loaded on AArch64, and this GCC bug on AArch64 is
519
+ // described at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111867.
520
+ #if HWY_ARCH_ARM_A64 && \
521
+ (HWY_COMPILER_CLANG >= 1700 || HWY_COMPILER_GCC_ACTUAL >= 1400)
522
+ #define HWY_ARM_HAVE_SCALAR_BF16_TYPE 1
523
+ #else
524
+ #define HWY_ARM_HAVE_SCALAR_BF16_TYPE 0
525
+ #endif
526
+
407
527
  #endif // HIGHWAY_HWY_DETECT_COMPILER_ARCH_H_
@@ -1,4 +1,5 @@
1
1
  // Copyright 2021 Google LLC
2
+ // Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
2
3
  // SPDX-License-Identifier: Apache-2.0
3
4
  //
4
5
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -92,7 +93,7 @@
92
93
  #define HWY_SVE2 (1LL << 23)
93
94
  #define HWY_SVE (1LL << 24)
94
95
  // Bit 25 reserved for NEON
95
- #define HWY_NEON_BF16 (1LL << 26) // fp16/dot/bf16 (e.g. Neoverse V2/N2/N3)
96
+ #define HWY_NEON_BF16 (1LL << 26) // fp16/dot/bf16 (e.g. Neoverse V2/N2)
96
97
  // Bit 27 reserved for NEON
97
98
  #define HWY_NEON (1LL << 28) // Implies support for AES
98
99
  #define HWY_NEON_WITHOUT_AES (1LL << 29)
@@ -194,10 +195,21 @@
194
195
  #endif
195
196
  #endif // HWY_BROKEN_MSVC
196
197
 
198
+ #ifndef HWY_BROKEN_AVX10_2 // allow override
199
+ // AVX10_2 requires clang >= 20.1 (postpone to 23 due to "avx10.2-512" remnant,
200
+ // only removed in https://github.com/llvm/llvm-project/pull/157034) or
201
+ // gcc >= 15.2 with binutils 2.44.
202
+ #if (HWY_COMPILER_CLANG < 2300) && (HWY_COMPILER_GCC_ACTUAL < 1502)
203
+ #define HWY_BROKEN_AVX10_2 HWY_AVX10_2
204
+ #else
205
+ #define HWY_BROKEN_AVX10_2 0
206
+ #endif
207
+ #endif // HWY_BROKEN_AVX10_2
208
+
197
209
  #ifndef HWY_BROKEN_AVX3_DL_ZEN4 // allow override
198
- // AVX3_DL and AVX3_ZEN4 require clang >= 7 (ensured above), gcc >= 8.1 or ICC
210
+ // AVX3_DL and AVX3_ZEN4 require clang >= 7 (ensured above), gcc >= 10.1 or ICC
199
211
  // 2021.
200
- #if (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 801) || \
212
+ #if (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1001) || \
201
213
  (HWY_COMPILER_ICC && HWY_COMPILER_ICC < 2021)
202
214
  #define HWY_BROKEN_AVX3_DL_ZEN4 (HWY_AVX3_DL | HWY_AVX3_ZEN4)
203
215
  #else
@@ -245,9 +257,10 @@
245
257
  #endif // HWY_BROKEN_ARM7_WITHOUT_VFP4
246
258
 
247
259
  #ifndef HWY_BROKEN_NEON_BF16 // allow override
248
- // HWY_NEON_BF16 requires recent compilers.
260
+ // Broken on older compilers:
249
261
  #if (HWY_COMPILER_CLANG != 0 && HWY_COMPILER_CLANG < 1700) || \
250
- (HWY_COMPILER_GCC_ACTUAL != 0 && HWY_COMPILER_GCC_ACTUAL < 1302)
262
+ (HWY_COMPILER_GCC_ACTUAL != 0 && HWY_COMPILER_GCC_ACTUAL < 1302) || \
263
+ (defined(__apple_build_version__) && __apple_build_version__ <= 17000000)
251
264
  #define HWY_BROKEN_NEON_BF16 (HWY_NEON_BF16)
252
265
  #else
253
266
  #define HWY_BROKEN_NEON_BF16 0
@@ -257,11 +270,11 @@
257
270
  // SVE[2] require recent clang or gcc versions.
258
271
 
259
272
  #ifndef HWY_BROKEN_SVE // allow override
260
- // GCC 10+. Clang 19 still has many test failures for SVE. No Apple CPU (at
261
- // least up to and including M4 and A18) has SVE.
262
- #if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2000) || \
273
+ // Clang 22+, GCC 10+, except MSAN does not yet support SVE.
274
+ // No Apple CPU (at least up to and including M4 and A18) has SVE.
275
+ #if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2200) || \
263
276
  (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1000) || \
264
- HWY_OS_APPLE
277
+ HWY_OS_APPLE || HWY_IS_MSAN
265
278
  #define HWY_BROKEN_SVE (HWY_SVE | HWY_SVE_256)
266
279
  #else
267
280
  #define HWY_BROKEN_SVE 0
@@ -269,16 +282,28 @@
269
282
  #endif // HWY_BROKEN_SVE
270
283
 
271
284
  #ifndef HWY_BROKEN_SVE2 // allow override
272
- // Clang 19 still has many test failures for SVE2.
273
- #if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2000) || \
285
+ // Clang 22+, GCC 10+, except MSAN does not yet support SVE2.
286
+ // No Apple CPU (at least up to and including M4 and A18) has SVE2.
287
+ #if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2200) || \
274
288
  (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1000) || \
275
- HWY_OS_APPLE
276
- #define HWY_BROKEN_SVE2 (HWY_SVE2 | HWY_SVE2_128)
289
+ HWY_OS_APPLE || HWY_IS_MSAN
290
+ #define HWY_BROKEN_SVE2 (HWY_SVE2)
277
291
  #else
278
292
  #define HWY_BROKEN_SVE2 0
279
293
  #endif
280
294
  #endif // HWY_BROKEN_SVE2
281
295
 
296
+ #ifndef HWY_BROKEN_SVE2_128 // allow override
297
+ // GCC 10+. Clang 21 works for SVE2_128, but not for SVE2 nor MSAN.
298
+ #if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2100) || \
299
+ (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1000) || \
300
+ HWY_OS_APPLE || HWY_IS_MSAN
301
+ #define HWY_BROKEN_SVE2_128 (HWY_SVE2_128)
302
+ #else
303
+ #define HWY_BROKEN_SVE2_128 0
304
+ #endif
305
+ #endif // HWY_BROKEN_SVE2_128
306
+
282
307
  #ifndef HWY_BROKEN_PPC10 // allow override
283
308
  #if (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1100)
284
309
  // GCC 10 supports the -mcpu=power10 option but does not support the PPC10
@@ -332,9 +357,12 @@
332
357
  #ifndef HWY_BROKEN_LOONGARCH // allow override
333
358
  // Using __loongarch_sx and __loongarch_asx macros to
334
359
  // check whether LSX/LASX targets are available.
335
- #if !defined(__loongarch_sx)
360
+ // GCC does not work yet, see https://gcc.gnu.org/PR121875.
361
+ #if !defined(__loongarch_sx) && \
362
+ !(HWY_COMPILER_CLANG && HWY_COMPILER_CLANG >= 1800)
336
363
  #define HWY_BROKEN_LOONGARCH (HWY_LSX | HWY_LASX)
337
- #elif !defined(__loongarch_asx)
364
+ #elif !defined(__loongarch_asx) && \
365
+ !(HWY_COMPILER_CLANG && HWY_COMPILER_CLANG >= 1800)
338
366
  #define HWY_BROKEN_LOONGARCH (HWY_LASX)
339
367
  #else
340
368
  #define HWY_BROKEN_LOONGARCH 0
@@ -360,13 +388,13 @@
360
388
  // Allow the user to override this without any guarantee of success.
361
389
  #ifndef HWY_BROKEN_TARGETS
362
390
 
363
- #define HWY_BROKEN_TARGETS \
364
- (HWY_BROKEN_CLANG6 | HWY_BROKEN_32BIT | HWY_BROKEN_MSVC | \
365
- HWY_BROKEN_AVX3_DL_ZEN4 | HWY_BROKEN_AVX3_SPR | \
366
- HWY_BROKEN_ARM7_BIG_ENDIAN | HWY_BROKEN_ARM7_WITHOUT_VFP4 | \
367
- HWY_BROKEN_NEON_BF16 | HWY_BROKEN_SVE | HWY_BROKEN_SVE2 | \
368
- HWY_BROKEN_PPC10 | HWY_BROKEN_PPC_32BIT | HWY_BROKEN_RVV | \
369
- HWY_BROKEN_LOONGARCH | HWY_BROKEN_Z14)
391
+ #define HWY_BROKEN_TARGETS \
392
+ (HWY_BROKEN_CLANG6 | HWY_BROKEN_32BIT | HWY_BROKEN_MSVC | \
393
+ HWY_BROKEN_AVX10_2 | HWY_BROKEN_AVX3_DL_ZEN4 | HWY_BROKEN_AVX3_SPR | \
394
+ HWY_BROKEN_ARM7_BIG_ENDIAN | HWY_BROKEN_ARM7_WITHOUT_VFP4 | \
395
+ HWY_BROKEN_NEON_BF16 | HWY_BROKEN_SVE | HWY_BROKEN_SVE2 | \
396
+ HWY_BROKEN_SVE2_128 | HWY_BROKEN_PPC10 | HWY_BROKEN_PPC_32BIT | \
397
+ HWY_BROKEN_RVV | HWY_BROKEN_LOONGARCH | HWY_BROKEN_Z14)
370
398
 
371
399
  #endif // HWY_BROKEN_TARGETS
372
400
 
@@ -489,7 +517,8 @@
489
517
  #if defined(__ARM_FEATURE_AES) && \
490
518
  defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && \
491
519
  defined(__ARM_FEATURE_DOTPROD) && \
492
- defined(__ARM_FEATURE_BF16_VECTOR_ARITHMETIC)
520
+ defined(__ARM_FEATURE_BF16_VECTOR_ARITHMETIC) && \
521
+ defined(__ARM_FEATURE_MATMUL_INT8)
493
522
  #define HWY_BASELINE_NEON HWY_ALL_NEON
494
523
  #elif defined(__ARM_FEATURE_AES)
495
524
  #define HWY_BASELINE_NEON (HWY_NEON_WITHOUT_AES | HWY_NEON)
@@ -642,8 +671,7 @@
642
671
  #define HWY_BASELINE_AVX3_SPR 0
643
672
  #endif
644
673
 
645
- #if HWY_BASELINE_AVX3_SPR != 0 && defined(__AVX10_2__) && \
646
- (HWY_COMPILER_GCC_ACTUAL >= 1500 || HWY_COMPILER_CLANG >= 2001)
674
+ #if HWY_BASELINE_AVX3_SPR != 0 && defined(__AVX10_2__)
647
675
  #define HWY_BASELINE_AVX10_2 HWY_AVX10_2
648
676
  #else
649
677
  #define HWY_BASELINE_AVX10_2 0
@@ -669,7 +697,20 @@
669
697
  #define HWY_BASELINE_LOONGARCH 0
670
698
  #endif
671
699
 
672
- // Allow the user to override this without any guarantee of success.
700
+ // Workaround for libaom, which unconditionally defines HWY_BASELINE_TARGETS
701
+ // even when that would be disabled/broken. If so, at least use AVX2.
702
+ #if defined(HWY_BASELINE_TARGETS)
703
+ #if HWY_BASELINE_TARGETS == HWY_AVX3_DL && \
704
+ ((HWY_BROKEN_TARGETS | HWY_DISABLED_TARGETS) & HWY_AVX3_DL)
705
+ #undef HWY_BASELINE_TARGETS
706
+ #define HWY_BASELINE_TARGETS HWY_AVX2
707
+ #endif
708
+ #endif // HWY_BASELINE_TARGETS
709
+
710
+ // Allow the user to override this without any guarantee of success. If the
711
+ // compiler invocation considers that target to be broken/disabled, then
712
+ // `HWY_ENABLED_BASELINE` will be 0 and users will have to check for that and
713
+ // skip their code.
673
714
  #ifndef HWY_BASELINE_TARGETS
674
715
  #define HWY_BASELINE_TARGETS \
675
716
  (HWY_BASELINE_SCALAR | HWY_BASELINE_WASM | HWY_BASELINE_PPC8 | \
@@ -686,7 +727,11 @@
686
727
 
687
728
  #define HWY_ENABLED_BASELINE HWY_ENABLED(HWY_BASELINE_TARGETS)
688
729
  #if HWY_ENABLED_BASELINE == 0
689
- #error "At least one baseline target must be defined and enabled"
730
+ #pragma message \
731
+ "All baseline targets are disabled or considered broken." \
732
+ "This is typically due to very restrictive HWY_BASELINE_TARGETS, or " \
733
+ "too expansive HWY_BROKEN_TARGETS or HWY_DISABLED_TAREGTS. User code " \
734
+ "must also check for this and skip any usage of SIMD."
690
735
  #endif
691
736
 
692
737
  // Best baseline, used for static dispatch. This is the least-significant 1-bit
@@ -744,12 +789,10 @@
744
789
  #endif // HWY_HAVE_AUXV
745
790
 
746
791
  #ifndef HWY_HAVE_RUNTIME_DISPATCH_RVV // allow override
747
- // The riscv_vector.h in Clang 16-18 requires compiler flags, and 19 still has
748
- // some missing intrinsics, see
749
- // https://github.com/llvm/llvm-project/issues/56592. GCC 13.3 also has an
750
- // #error check, whereas 14.1 fails with "argument type 'vuint16m8_t' requires
751
- // the V ISA extension": https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115325.
752
- #if HWY_ARCH_RISCV && HWY_COMPILER_CLANG >= 1900 && 0
792
+ // Clang 19+ supports target attributes for RVV intrinsics (resolved in
793
+ // https://github.com/llvm/llvm-project/issues/56592 and
794
+ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115325).
795
+ #if HWY_ARCH_RISCV && HWY_COMPILER_CLANG >= 1900
753
796
  #define HWY_HAVE_RUNTIME_DISPATCH_RVV 1
754
797
  #else
755
798
  #define HWY_HAVE_RUNTIME_DISPATCH_RVV 0
@@ -766,8 +809,8 @@
766
809
  #endif // HWY_HAVE_RUNTIME_DISPATCH_APPLE
767
810
 
768
811
  #ifndef HWY_HAVE_RUNTIME_DISPATCH_LOONGARCH // allow override
769
- #if HWY_ARCH_LOONGARCH && HWY_HAVE_AUXV && (defined(__loongarch_sx) || \
770
- defined(__loongarch_asx))
812
+ #if HWY_ARCH_LOONGARCH && HWY_HAVE_AUXV && !defined(__loongarch_asx) && \
813
+ HWY_COMPILER_CLANG && HWY_COMPILER_CLANG >= 1800
771
814
  #define HWY_HAVE_RUNTIME_DISPATCH_LOONGARCH 1
772
815
  #else
773
816
  #define HWY_HAVE_RUNTIME_DISPATCH_LOONGARCH 0
@@ -786,6 +829,9 @@
786
829
  // Allow opting out, and without a guarantee of success, opting-in.
787
830
  #ifndef HWY_HAVE_RUNTIME_DISPATCH
788
831
  // Clang, GCC and MSVC allow OS-independent runtime dispatch on x86.
832
+ // Wasm does not, because browsers reject a binary containing any SIMD
833
+ // instructions when the browser does not support them. Typical practice there
834
+ // is to build two binaries, one with the -msimd128 flag.
789
835
  #if HWY_ARCH_X86 || HWY_HAVE_RUNTIME_DISPATCH_RVV || \
790
836
  HWY_HAVE_RUNTIME_DISPATCH_APPLE || HWY_HAVE_RUNTIME_DISPATCH_LOONGARCH || \
791
837
  HWY_HAVE_RUNTIME_DISPATCH_LINUX
@@ -930,7 +976,7 @@
930
976
  // HWY_ONCE and the multiple-inclusion mechanism rely on HWY_STATIC_TARGET being
931
977
  // one of the dynamic targets. This also implies HWY_TARGETS != 0 and
932
978
  // (HWY_TARGETS & HWY_ENABLED_BASELINE) != 0.
933
- #if (HWY_TARGETS & HWY_STATIC_TARGET) == 0
979
+ #if (HWY_TARGETS & HWY_STATIC_TARGET) == 0 && HWY_ENABLED_BASELINE != 0
934
980
  #error "Logic error: best baseline should be included in dynamic targets"
935
981
  #endif
936
982
 
@@ -677,6 +677,19 @@ struct AddExport {
677
677
  #define HWY_HIGHWAY_PER_TARGET
678
678
  #endif
679
679
 
680
+ // No SIMD target enabled, skip header inclusion.
681
+ #if HWY_ENABLED_BASELINE == 0
682
+
683
+ // We would expect that HWY_TARGET and HWY_STATIC_TARGET are now both 0.
684
+ #if HWY_TARGET != 0
685
+ #error "Why is HWY_TARGET not 0 when HWY_ENABLED_BASELINE == 0?"
686
+ #endif
687
+ #if HWY_STATIC_TARGET != 0
688
+ #error "Why is HWY_STATIC_TARGET not 0 when HWY_ENABLED_BASELINE == 0?"
689
+ #endif
690
+
691
+ #else
692
+
680
693
  // These define ops inside namespace hwy::HWY_NAMESPACE.
681
694
  #if HWY_TARGET == HWY_SSE2 || HWY_TARGET == HWY_SSSE3 || HWY_TARGET == HWY_SSE4
682
695
  #include "hwy/ops/x86_128-inl.h"
@@ -713,4 +726,6 @@ struct AddExport {
713
726
 
714
727
  #include "hwy/ops/generic_ops-inl.h"
715
728
 
729
+ #endif // HWY_ENABLED_BASELINE
730
+
716
731
  #endif // HWY_HIGHWAY_PER_TARGET
@@ -50,6 +50,7 @@
50
50
 
51
51
  #include "hwy/highway_export.h"
52
52
  #include "hwy/timer.h" // IWYU pragma: export
53
+ #include "hwy/base.h"
53
54
 
54
55
  namespace hwy {
55
56
 
@@ -114,6 +115,14 @@ struct Result {
114
115
  float variability;
115
116
  };
116
117
 
118
+ // Returns a Params struct with customized configuration for benchmarks.
119
+ // Specifically limits `max_evals` to prevent timeout in tests.
120
+ static inline Params DefaultBenchmarkParams() {
121
+ Params p;
122
+ p.max_evals = HWY_IS_DEBUG_BUILD ? 3 : 4;
123
+ return p;
124
+ }
125
+
117
126
  // Precisely measures the number of ticks elapsed when calling "func" with the
118
127
  // given inputs, shuffled to ensure realistic branch prediction hit rates.
119
128
  //
@@ -132,8 +141,8 @@ HWY_DLLEXPORT size_t Measure(Func func, const uint8_t* arg,
132
141
 
133
142
  // Calls operator() of the given closure (lambda function).
134
143
  template <class Closure>
135
- static FuncOutput CallClosure(const Closure* f, const FuncInput input) {
136
- return (*f)(input);
144
+ static FuncOutput CallClosure(const void* f, const FuncInput input) {
145
+ return (*reinterpret_cast<const Closure*>(f))(input);
137
146
  }
138
147
 
139
148
  // Same as Measure, except "closure" is typically a lambda function of
@@ -143,7 +152,7 @@ static inline size_t MeasureClosure(const Closure& closure,
143
152
  const FuncInput* inputs,
144
153
  const size_t num_inputs, Result* results,
145
154
  const Params& p = Params()) {
146
- return Measure(reinterpret_cast<Func>(&CallClosure<Closure>),
155
+ return Measure(static_cast<Func>(&CallClosure<Closure>),
147
156
  reinterpret_cast<const uint8_t*>(&closure), inputs, num_inputs,
148
157
  results, p);
149
158
  }