-
Notifications
You must be signed in to change notification settings - Fork 2
Extensions: Complex implications #112
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
Open
a4lg
wants to merge
3
commits into
master
Choose a base branch
from
riscv-ext-imply-complex
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78b97d4 to
d738708
Compare
d738708 to
1874da7
Compare
3a66e57 to
9a869a7
Compare
961b24a to
0927141
Compare
0927141 to
5e9f6a2
Compare
5d1cddf to
981ef2b
Compare
e3d6f58 to
2334ee6
Compare
Thanks to the commit 48558a5 ("RISC-V: Allow nested implications for extensions"), we can write complex extension implications in theory. However, to actually do that, we need to pass more information to check_func. For example, we want to imply 'Zcf' from 'F' if and only if the 'Zce' extension is also enabled and XLEN is 32. Passing rps is a way to enable this. This commit prepares for such complex extension implications. bfd/ChangeLog: * elfxx-riscv.c (struct riscv_implicit_subset): Move around and change check_func function prototype. (check_implicit_always): New arguments. (check_implicit_for_i): Likewise. (riscv_implicit_subsets): Add comment for this variable. (riscv_parse_add_implicit_subsets): Call check_func with new arguments.
The 'C' extension and its subsets have complex relations, depending on
the implemented floating point extensions.
They are the expansions related in this context:
'C' == 'Zca'
'C' + 'F' == 'Zca' + 'Zcf' + 'F' (RV32)
'C' + 'F' == 'Zca' + 'F' (RV64)
'C' + 'F' + 'D' == 'Zca' + 'Zcf' + 'Zcd' + 'F' + 'D' (RV32)
'C' + 'F' + 'D' == 'Zca' + 'Zcd' + 'F' + 'D' (RV64)
[they exclude dependencies from 'F' and 'D']
This commit implements those implications.
Note that some test cases are modified to reflect new compressed
instruction extensions:
1. Test cases that use ".option arch, -c" to turn off RVC
(at least the 'Zca' extension must be also turned off).
2. Test cases that test RISC-V attributes and/or mapping symbols
when the 'C' extension is enabled.
bfd/ChangeLog:
* elfxx-riscv.c (check_implicit_for_d_c): New.
(check_implicit_for_f_c): New.
(riscv_implicit_subsets): Add unconditional implication,
'C' -> 'Zca'. Add conditional implications, 'D' -> 'Zcd'
and 'F' -> 'Zcf'.
gas/ChangeLog:
* testsuite/gas/riscv/march-imply-c.d: Test implied
extensions from 'C' alone.
* testsuite/gas/riscv/march-imply-c-d-32.d: New to test implied
extensions from 'C' and 'D' on RV32.
* testsuite/gas/riscv/march-imply-c-d-64.d: New to test implied
extensions from 'C' and 'D' on RV64.
* testsuite/gas/riscv/attribute-10.d: Reflect reorganization of
compressed instruction extensions.
* testsuite/gas/riscv/dis-addr-overflow-32.d: Likewise.
* testsuite/gas/riscv/dis-addr-overflow-64.d: Likewise.
* testsuite/gas/riscv/dis-addr-overflow.s: Likewise.
* testsuite/gas/riscv/mapping-symbols.d: Likewise.
* testsuite/gas/riscv/mapping.s: Likewise.
* testsuite/gas/riscv/march-ok-reorder.d: Likewise.
* testsuite/gas/riscv/option-arch-01.s: Likewise.
* testsuite/gas/riscv/option-arch-01b.d: Likewise.
* testsuite/gas/riscv/option-arch-02.d: Likewise.
* testsuite/gas/riscv/option-arch-02.s: Likewise.
* testsuite/gas/riscv/option-arch-03.d: Likewise.
* testsuite/gas/riscv/option-arch-03.s: Likewise.
Despite its deprecation, ".option norvc" may used to turn off the 'C' extension. This commit also disables its subsets, 'Zca', 'Zcf' and 'Zcd' and clarifies that it won't completely do the job if other enabled extensions depend on 'C' or 'Zc*'. Note that, even if it does not "completely" work, we cannot emit any compressed instructions after the ".option norvc" directive since it disables RVC and prevents any 2-byte instructions from assembling. gas/ChangeLog: * config/tc-riscv.c (s_riscv_option): Also turn off 'Zca', 'Zcf' and 'Zcd'. Clarify the limitation of this directive.
2334ee6 to
a4e2990
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Wiki Page (details): https://github.com/a4lg/binutils-gdb/wiki/riscv_ext_imply_complex