> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index 36f21d2259..e77b696d8e 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
<snip>
> @@ -695,13 +698,31 @@ if update_flags
>
>      machine_args = [] # Clear previous machine args
>
> +    candidate_mcpu = ''
> +    if part_number_config.has_key('mcpu')
> +        mcpu = part_number_config['mcpu']
> +        if (cc.has_argument('-mcpu=' + mcpu))
> +            candidate_mcpu = mcpu
> +        endif
> +    endif
> +
> +    march_features = []
> +    if part_number_config.has_key('march_features')
> +        march_features += part_number_config['march_features']
> +    endif
> +    if soc_config.has_key('extra_march_features')
> +        march_features += soc_config['extra_march_features']
> +    endif
> +
>      # probe supported archs and their features
>      candidate_march = ''
> -    if part_number_config.has_key('march')
> +    if part_number_config.has_key('march') and candidate_mcpu == ''

If we reorganize the code a bit it would read better I think:
if candidate_mcpu != ''
    <mcpu code>
elif part_number_config.has_key('march')
    <march code>
else
    error(no mcpu and no march) # not sure whether this is needed or
wanted though

This would also match the order before - first process mcpu, then
march. Come to think of it, maybe we should put the march_features
code before the candidate_mcpu code since that is common code and
would thus also read a bit better (common, then mcpu, then march).

>          if part_number_config.get('force_march', false)
> -            candidate_march = part_number_config['march']
> +            if cc.has_argument('-march=' +  part_number_config['march'])
> +                candidate_march = part_number_config['march']
> +            endif
>          else
> -            supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 
> 'armv8.3-a',
> +            supported_marchs = ['armv9-a', 'armv8.6-a', 'armv8.5-a', 
> 'armv8.4-a', 'armv8.3-a',
>                                  'armv8.2-a', 'armv8.1-a', 'armv8-a']
>              check_compiler_support = false
>              foreach supported_march: supported_marchs

Reply via email to