Skip to content

Commit ffe927a

Browse files
authored
Merge pull request #1378 from Incarnation-p-lee/master
Add OR operator for option '--with-extra-multilib-test'
2 parents fcc49c7 + 7e6696a commit ffe927a

File tree

2 files changed

+70
-15
lines changed

2 files changed

+70
-15
lines changed

README.md

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,59 @@ even multilib is disable, but the user must ensure extra multilib test
261261
configuration can be work with existing lib/multilib, e.g. rv32gcv/ilp32 test
262262
can't work if multilib didn't have any rv32 multilib.
263263

264-
`--with-extra-multilib-test` also allow you append additional build flags after
265-
the arch/ABI, for example: built a linux toolchain with `rv64gc/lp64d`, and you
266-
can test more configuration like `rv64gcv/lp64d` with one additional build config
267-
`--param=riscv-autovec-lmul=dynamic`, then you can use --with-extra-multilib-test
268-
to specify that via
269-
`--with-extra-multilib-test="rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic"`.
270-
Then the testing will build the run test with option `--param=riscv-autovec-lmul=dynamic`
271-
before run the `rv64gcv-lp64d` test.
264+
`--with-extra-multilib-test` also support more complicated format to fit the
265+
requirements of end-users. First of all, the argument is a list of test
266+
configurations. Each test configuration are separated by `;`. For example:
267+
268+
`rv64gcv-lp64d;rv64_zvl256b_zvfh-lp64d`
269+
270+
For each test configuration, it has two parts, aka required arch-abi part and
271+
optional build flags. We leverage `:` to separate them with some restrictions.
272+
273+
* arch-abi should be required and there must be only one at the begining of
274+
the test configuration.
275+
* build flags is a array-like flags after the arch-abi, there will be two
276+
ways to arrange them, aka AND, OR operation.
277+
* If you would like the flags in build flags array acts on arch-abi
278+
__simultaneously__, you can use `:` to separate them. For example:
279+
280+
```
281+
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax
282+
```
283+
284+
will be consider as one target board same as below:
285+
286+
```
287+
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic/--param=riscv-autovec-preference=fixed-vlmax
288+
```
289+
290+
* If you would like the flags in build flags array acts on arch-abi
291+
__respectively__, you can use ',' to separate them. For example:
292+
293+
```
294+
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic,--param=riscv-autovec-preference=fixed-vlmax
295+
```
296+
297+
will be consider as two target boards same as below:
298+
299+
```
300+
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-preference=fixed-vlmax
301+
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic
302+
```
303+
304+
* However, you can also leverage AND(`:`), OR(`,`) operator together but the
305+
OR(`,`) will always have the higher priority. For example:
306+
307+
```
308+
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax,--param=riscv-autovec-lmul=m2
309+
```
310+
311+
will be consider as tow target boars same as below:
312+
313+
```
314+
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic/--param=riscv-autovec-preference=fixed-vlmax
315+
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=m2
316+
```
272317

273318
### LLVM / clang
274319

scripts/generate_target_board

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@ def parse_options(argv):
2929
# riscv-sim/-march=rv64gcv_zvl256b/-mabi=lp64d/-mcmodel=medlow
3030
# From the config_string like below, --param is optional
3131
# rv64gcv_zvl128b-lp64d:--param=riscv-autovec-lmul=m1
32-
def generate_one_target_board(config_string, options):
33-
configs = config_string.split(":")
34-
arch_and_abi = configs[0].split("-")
32+
def generate_one_target_board(arch_abi, flags, options):
33+
arch_and_abi = arch_abi.split("-")
3534
arch = arch_and_abi[0]
3635
abi = arch_and_abi[1]
3736

38-
if len (configs) == 1:
37+
if len(flags) == 0:
3938
return "{0}/-march={1}/-mabi={2}/-mcmodel={3}".format(
4039
options.sim_name, arch, abi, options.cmodel)
4140

42-
flags = '/'.join(configs[1:])
41+
flags = flags.replace(":", "/")
4342

4443
return "{0}/-march={1}/-mabi={2}/-mcmodel={3}/{4}".format(
4544
options.sim_name, arch, abi, options.cmodel, flags)
@@ -52,14 +51,25 @@ def main(argv):
5251
return
5352

5453
target_board_list = [
55-
generate_one_target_board(options.build_arch_abi, options)
54+
generate_one_target_board(options.build_arch_abi, "", options)
5655
]
5756

5857
if options.extra_test_arch_abi_flags_list:
5958
extra_test_list = options.extra_test_arch_abi_flags_list.split (";")
6059

6160
for extra_test in extra_test_list:
62-
target_board_list.append(generate_one_target_board(extra_test, options))
61+
idx = extra_test.find(":")
62+
63+
if idx == -1:
64+
one_target_board = generate_one_target_board(extra_test, "", options)
65+
target_board_list.append(one_target_board)
66+
else:
67+
arch_abi = extra_test[:idx - 1]
68+
flags = extra_test[idx + 1:]
69+
70+
for flag in flags.split(","):
71+
one_target_board = generate_one_target_board(arch_abi, flag, options)
72+
target_board_list.append(one_target_board)
6373

6474
print(' '.join(target_board_list))
6575

0 commit comments

Comments
 (0)