在 2026/10/23 14:09, Uros Bizjak 写道: > On Fri, Oct 23, 2026 at 3:55 AM Kewen Lin <[email protected]> wrote: >> >> Hi Uros, >> >> 在 2026/10/22 15:42, Uros Bizjak 写道: >>> On Wed, Oct 21, 2026 at 11:01 AM Kewen Lin <[email protected]> wrote: >>>> >>>> Hi, >>>> >>>> GCC supports generating vectorized math calls to Intel SVML and the >>>> AMD ACML and AOCL libraries. Add equivalent support for the HYGON >>>> vector math library (HVML) through -mveclibabi=hvml. >>>> >>>> The new handler maps 39 scalar math function families to the HVML >>>> entry-point naming convention, including the seven C23 pi-based >>>> trigonometric families. Record the exact single- and double-precision >>>> vector widths provided by latest HVML alongside their operation >>>> cases, and translate the log operation to the HVML ln spelling. >>>> See invoke.texi for the complete list of mapped functions. >>>> >>>> Add a testcase that checks all 194 supported operation, precision, >>>> and vector-width combinations independently using -march=c86-4g-m7. >>>> >>>> The latest hvml library can be found via: >>>> https://github.com/BaoshunFang/binarys/blob/main/hpc/hml.tar.gz >>>> >>>> Bootstrapped and regress-tested on one c86-4g-m7 machine. >>>> Is it ok for trunk? Also backport to gcc-16 and gcc-15 (with pi-based >>>> trigonometric functions dropped)? >>> >>> The patch is isolated, so IMO it is OK to backport, but let's also ask >>> release managers (CC'd) for approval. >>> >>> BTW: Even isolated patches need some "soak time" in the mainline (a >>> week or two), to ensure there are no unknown issues. I see no problems >>> here, though. >> >> Thanks for the comments! I've made patch v2 as below, it's tested >> as before, could you help to review it again? >> >> Changes since v1: >> * Guard against mathfn_built_in returning NULL_TREE before using fndecl. >> * Rename the original test to vectorize-hvml-1.c and add two additional >> tests: one disables unsafe math optimizations and checks that no HVML >> calls are emitted; the other uses -mno-avx and checks that only >> 128-bit HVML calls are emitted. >> * Use -funsafe-math-optimizations and -fno-math-errno explicitly in the >> positive tests. Keep -fno-math-errno but disable unsafe math >> optimizations in the negative test. Add -mprefer-vector-width=512 to >> the comprehensive test and restrict all three tests to glibc targets. >> * Clarify the 64-bit restriction for ACML, AOCL, and HVML, correct the >> library list and wording, and reflow the HVML symbol list to three entries >> per line where possible. >> * Clarify the pi-based builtin dependencies in the commit message and >> format the fndecl assignment as suggested. >> >> ----- >> >> [PATCH v2] i386: Add -mveclibabi=hvml for HYGON vector math library >> >> GCC supports generating vectorized math calls to Intel SVML and the >> AMD ACML and AOCL libraries. Add equivalent support for the HYGON >> vector math library (HVML) through -mveclibabi=hvml. >> >> The new handler maps 39 scalar math function families to the HVML >> entry-point naming convention, including the seven C23 pi-based >> trigonometric families. Record the selected single- and double-precision >> vector widths alongside their operation cases, and translate the log >> operation to the HVML ln spelling. The handler requires a 64-bit target >> and unsafe math optimizations. See invoke.texi for the complete list of >> mapped functions. >> >> The pi-based builtins were introduced by r16-710-g591d3d02664c7b. >> Their type-specific lookup was completed by >> r17-5176-g10e202e107d23a. Use the common mathfn_built_in path for >> these functions, avoiding target-specific builtin declaration handling. >> >> Add three testcases. The first checks all 194 selected operation, >> precision, and vector-width combinations independently using >> -march=c86-4g-m7 and -mprefer-vector-width=512. The others check that >> HVML calls are disabled without unsafe math optimizations and that >> -mno-avx selects only 128-bit HVML calls. >> >> gcc/ChangeLog: >> >> * config/i386/i386-options.cc (ix86_option_override_internal): >> Handle ix86_veclibabi_type_hvml case. >> * config/i386/i386-options.h (ix86_veclibabi_hvml): New declare. >> * config/i386/i386-opts.h (enum ix86_veclibabi): Add >> ix86_veclibabi_type_hvml into the ix86_veclibabi enum. >> * config/i386/i386.cc (ix86_veclibabi_hvml): New function. >> * config/i386/i386.opt: Add the hvml type. >> * doc/invoke.texi: Document -mveclibabi=hvml and clarify the 64-bit >> restriction for ACML and AOCL. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.target/i386/vectorize-hvml-1.c: New test. >> * gcc.target/i386/vectorize-hvml-2.c: Likewise. >> * gcc.target/i386/vectorize-hvml-3.c: Likewise. > > OK for mainline and backports, but please wait at least a week before > backporting.
Thanks Uros, pushed to trunk as r17-5497-g5db04303f76bc4. BR, Kewen
