From: ZAMBAR <hezb2...@shanghaitech.edu.cn>

Hi all,

I would like to seek feedback on the implementation approach for the 
TARGET_CLONES attribute in gfortran, specifically regarding the syntax 
for parsing multiple target specifications.

Currently, I have implemented TARGET_CLONES support for Fortran using 
a C-style comma-separated argument list within parentheses, following 
the same pattern as the C/C++ front ends. The syntax looks like:

    !GCC$ ATTRIBUTES TARGET_CLONES("default", "avx", "avx512f") :: function_name

This allows both double and single quoted strings:
    !GCC$ ATTRIBUTES TARGET_CLONES('default', 'avx', 'avx512f') :: function_name

The key design question I'd like feedback on is whether this C-style 
comma-separated syntax is appropriate for Fortran, or if we should 
consider alternative approaches that might be more idiomatic to Fortran.

The current implementation:
- Parses comma-separated quoted string arguments
- Stores the target specifications in the symbol structure
- Integrates with the existing multiple target infrastructure
- Follows the same semantics as C/C++ TARGET_CLONES

I have a working patch (attached) that implements C-like syntax, but before 
proceeding further, I wanted to get community input on whether this syntax 
feels appropriate for Fortran users, or if there are better alternatives 
that would be more consistent with Fortran conventions.

Thanks for your time and feedback.

Best regards,
ZAMBAR

ZAMBAR (1):
  feat: gfortran target_clones mversion

 gcc/fortran/decl.cc     | 116 ++++++++++++++++++++++++++++++++++++++++
 gcc/fortran/f95-lang.cc |  34 ++++++++++++
 gcc/fortran/gfortran.h  |   5 ++
 gcc/fortran/symbol.cc   |   8 +++
 gcc/multiple_target.cc  |   9 +++-
 5 files changed, 170 insertions(+), 2 deletions(-)

-- 
2.34.1

Reply via email to