On Mon, 17 Apr 2023 08:24:44 PDT (-0700), Palmer Dabbelt wrote:
> On Fri, 14 Apr 2023 00:15:07 PDT (-0700), Kito Cheng wrote:
>> Wait, take second round review:
>>
>>> * All extensions were being prefixed with an underscore, which leads to
>>> some odd combinations like "rv32gc_v", this just adds underscores to
>>> the multi-letter extensions.
>>> * The input base ISAs were being canonicalized, which resulted in some
>>> odd multilib default search paths. I'm not sure if anything breaks
>>> due to this, but it seems safer to just leave them alone.
>>
>>>* All extensions were being prefixed with an underscore, which leads to
>>> some odd combinations like "rv32gc_v", this just adds underscores to
>>> the multi-letter extensions.
>>
>> I think that weirdness can be removed arch-canonicalize I think?
>>
>> And currently all -march will be canonicalized before query multi lib
>>
>>> @@ -163,14 +168,13 @@ for cmodel in cmodels:
>>> if cmodel == "compact" and arch.startswith("rv32"):
>>> continue
>>>
>>> - arch = arch_canonicalize (arch, args.misa_spec)
>>> arches[arch] = 1
>>> abis[abi] = 1
>>> extra = list(filter(None, extra.split(',')))
>>> ext_combs = expand_combination(ext)
>>> alts = sum([[x] + [x + y for y in ext_combs] for x in [arch] + extra],
>>> [])
>>> alts = filter(lambda x: len(x) != 0, alts)
>>> - alts = list(map(lambda a : arch_canonicalize(a, args.misa_spec), alts))
>>> + alts = alts + list(map(lambda a : arch_canonicalize(a,
>>> args.misa_spec), alts))
>>
>> So we don't really need to append non-canonical one to the list?
>
> IIUC the multilib processing happens before the canonicialization, so
> we'd need the non-canonicial strings in there too (as those are what
> most users will provide, and what we have now). I haven't actually
> tested that, though...
Yep, if I drop the non-canonicial strings via
diff --git a/gcc/config/riscv/multilib-generator
b/gcc/config/riscv/multilib-generator
index 58b7198b243..a63a4d69c18 100755
--- a/gcc/config/riscv/multilib-generator
+++ b/gcc/config/riscv/multilib-generator
@@ -174,7 +174,7 @@ for cmodel in cmodels:
ext_combs = expand_combination(ext)
alts = sum([[x] + [x + y for y in ext_combs] for x in [arch] + extra],
[])
alts = filter(lambda x: len(x) != 0, alts)
- alts = alts + list(map(lambda a : arch_canonicalize(a,
args.misa_spec), alts))
+ alts = list(map(lambda a : arch_canonicalize(a, args.misa_spec), alts))
# Drop duplicated entry.
alts = unique(alts)
then I can't link `-march=rv32imafdcv`, I need
`-march=rv32imacv_zicsr_zve32f_zve32x_zve64x_zvl128b_zvl32b_zvl64b`. That's
kind of a headache for users to type in.