aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2023-12-11 10:58:49 +0800
committerGitHub <noreply@github.com>2023-12-11 10:58:49 +0800
commitffe927a567425b5048d9fb03daa7af6d8fd2c8a0 (patch)
tree11d484239fd7573010cabb002d0924e6b1726156
parentfcc49c7f4a19f6c41383894ef55e0488751ae875 (diff)
parent7e6696a6c97b09c9dfe36446950921a1280b6ba9 (diff)
downloadriscv-gnu-toolchain-ffe927a567425b5048d9fb03daa7af6d8fd2c8a0.zip
riscv-gnu-toolchain-ffe927a567425b5048d9fb03daa7af6d8fd2c8a0.tar.gz
riscv-gnu-toolchain-ffe927a567425b5048d9fb03daa7af6d8fd2c8a0.tar.bz2
Merge pull request #1378 from Incarnation-p-lee/master
Add OR operator for option '--with-extra-multilib-test'
-rw-r--r--README.md61
-rwxr-xr-xscripts/generate_target_board24
2 files changed, 70 insertions, 15 deletions
diff --git a/README.md b/README.md
index 21dd68e..375d743 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/scripts/generate_target_board b/scripts/generate_target_board
index 00d8e9f..9996f7e 100755
--- a/scripts/generate_target_board
+++ b/scripts/generate_target_board
@@ -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)
@@ -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))