Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OR operator for option '--with-extra-multilib-test' #1378

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 53 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,59 @@ even multilib is disable, but the user must ensure extra multilib test
configuration can be work with existing lib/multilib, e.g. rv32gcv/ilp32 test
can't work if multilib didn't have any rv32 multilib.

`--with-extra-multilib-test` also allow you append additional build flags after
the arch/ABI, for example: built a linux toolchain with `rv64gc/lp64d`, and you
can test more configuration like `rv64gcv/lp64d` with one additional build config
`--param=riscv-autovec-lmul=dynamic`, then you can use --with-extra-multilib-test
to specify that via
`--with-extra-multilib-test="rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic"`.
Then the testing will build the run test with option `--param=riscv-autovec-lmul=dynamic`
before run the `rv64gcv-lp64d` test.
`--with-extra-multilib-test` also support more complicated format to fit the
requirements of end-users. First of all, the argument is a list of test
configurations. Each test configuration are separated by `;`. For example:

`rv64gcv-lp64d;rv64_zvl256b_zvfh-lp64d`

For each test configuration, it has two parts, aka required arch-abi part and
optional build flags. We leverage `:` to separate them with some restrictions.

* arch-abi should be required and there must be only one at the begining of
the test configuration.
* build flags is a array-like flags after the arch-abi, there will be two
ways to arrange them, aka AND, OR operation.
* If you would like the flags in build flags array acts on arch-abi
__simultaneously__, you can use `:` to separate them. For example:

```
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax
```

will be consider as one target board same as below:

```
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic/--param=riscv-autovec-preference=fixed-vlmax
```

* If you would like the flags in build flags array acts on arch-abi
__respectively__, you can use ',' to separate them. For example:

```
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic,--param=riscv-autovec-preference=fixed-vlmax
```

will be consider as two target boards same as below:

```
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-preference=fixed-vlmax
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic
```

* However, you can also leverage AND(`:`), OR(`,`) operator together but the
OR(`,`) will always have the higher priority. For example:

```
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax,--param=riscv-autovec-lmul=m2
```

will be consider as tow target boars same as below:

```
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic/--param=riscv-autovec-preference=fixed-vlmax
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=m2
```

### LLVM / clang

Expand Down
24 changes: 17 additions & 7 deletions scripts/generate_target_board
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ def parse_options(argv):
# riscv-sim/-march=rv64gcv_zvl256b/-mabi=lp64d/-mcmodel=medlow
# From the config_string like below, --param is optional
# rv64gcv_zvl128b-lp64d:--param=riscv-autovec-lmul=m1
def generate_one_target_board(config_string, options):
configs = config_string.split(":")
arch_and_abi = configs[0].split("-")
def generate_one_target_board(arch_abi, flags, options):
arch_and_abi = arch_abi.split("-")
arch = arch_and_abi[0]
abi = arch_and_abi[1]

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

flags = '/'.join(configs[1:])
flags = flags.replace(":", "/")

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

target_board_list = [
generate_one_target_board(options.build_arch_abi, options)
generate_one_target_board(options.build_arch_abi, "", options)
]

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

for extra_test in extra_test_list:
target_board_list.append(generate_one_target_board(extra_test, options))
idx = extra_test.find(":")

if idx == -1:
one_target_board = generate_one_target_board(extra_test, "", options)
target_board_list.append(one_target_board)
else:
arch_abi = extra_test[:idx - 1]
flags = extra_test[idx + 1:]

for flag in flags.split(","):
one_target_board = generate_one_target_board(arch_abi, flag, options)
target_board_list.append(one_target_board)

print(' '.join(target_board_list))

Expand Down