Remove the restrictions on instruction operand count #223

Open
feedable wants to merge 7 commits from feedable/gcc-TEST:operand-cnt-test into trunk
Member

Changes since v1:

  • Formatting changes in vec.h.
  • Supplemental table handling fixes in ira.cc.
  • Increase in reload limit in lra-constraints.cc.

This patch series adjusts the RTL infrastructure so that it can recognize
and handle an arbitrary amount of instruction operands.

This is mostly done by replacing the usages of C-style arrays with a fixed
bound in favor of SOO-vectors and array_views.
MAX_RECOG_OPERANDS is retained for compatibility, but now it mostly
serves as a hint for inline buffer size for SOO-vectors.

The only observable effect for most targets is the ability to express
asm blocks with more than 30 operands without issues, but this PR is
also a prerequisite for register allocation for targets with instructions
that have an arbitrary operand count.

The patchset is bootstrapped and tested on x86_64. I've done some
benchmarking, and the patch seems to cause a ~4% slowdown across
the testsuite.

CC: Richard Biener rguenther@suse.de, Richard Sandiford rdsandiford@googlemail.com, Jeffrey Law jeffrey.law@oss.qualcomm.com, Vladimir Makarov vmakarov@redhat.com, Robin Dapp rdapp.gcc@gmail.com

Changes since v1: - Formatting changes in `vec.h`. - Supplemental table handling fixes in `ira.cc`. - Increase in reload limit in `lra-constraints.cc`. This patch series adjusts the RTL infrastructure so that it can recognize and handle an arbitrary amount of instruction operands. This is mostly done by replacing the usages of C-style arrays with a fixed bound in favor of SOO-vectors and `array_view`s. `MAX_RECOG_OPERANDS` is retained for compatibility, but now it mostly serves as a hint for inline buffer size for SOO-vectors. The only observable effect for most targets is the ability to express asm blocks with more than 30 operands without issues, but this PR is also a prerequisite for register allocation for targets with instructions that have an arbitrary operand count. The patchset is bootstrapped and tested on x86_64. I've done some benchmarking, and the patch seems to cause a ~4% slowdown across the testsuite. CC: Richard Biener <rguenther@suse.de>, Richard Sandiford <rdsandiford@googlemail.com>, Jeffrey Law <jeffrey.law@oss.qualcomm.com>, Vladimir Makarov <vmakarov@redhat.com>, Robin Dapp <rdapp.gcc@gmail.com>
const_derived_container seems to accept its arguments by-value, and then
tries to forward them, which doesn't make sense. Accept values by
universal reference instead.

gcc/ChangeLog:

	* iterator-utils.h: Pass constructor args by reference.
Member

Hi @feedable. This bot helps send your PR as a patch series to the mailing list.

Next steps

  1. Write a clear PR description. It will be used as the cover letter.
  2. To CC extra people, add lines like this at the end of the PR description: CC: Reviewer1 <revi.ewer@example.com>, Reviewer2 <an.other@example.com>.
  3. To preview the emails, comment with /preview.
  4. When ready, request review in the Reviewers section. Or, if you just want to send the series, comment with /submit.
  5. Use the cover-letter links below to follow replies.
  6. For a new patch series, push your changes, update the PR description with a Changes since vX section, and comment with /submit again.

See Submitting Patches and UsingForge.

Consider joining the gcc and gcc-patches mailing lists..
For real time communication, check the gcc irc channels.

Or join #overseers on Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).

<!-- pr-welcome --> Hi @feedable. This bot helps send your PR as a patch series to the mailing list. ## Next steps 1. Write a clear PR description. It will be used as the cover letter. 2. To CC extra people, add lines like this **at the end** of the PR description: `CC: Reviewer1 <revi.ewer@example.com>, Reviewer2 <an.other@example.com>`. 3. To preview the emails, comment with `/preview`. 4. When ready, request review in the Reviewers section. Or, if you just want to send the series, comment with `/submit`. 5. Use the cover-letter links below to follow replies. 6. For a new patch series, push your changes, update the PR description with a `Changes since vX` section, and comment with `/submit` again. See [Submitting Patches](https://gcc.gnu.org/contribute.html#patches) and [UsingForge](https://gcc.gnu.org/wiki/UsingForge). Consider joining the [gcc and gcc-patches mailing lists.](https://gcc.gnu.org/lists.html). For real time communication, check the [gcc irc channels](https://gcc.gnu.org/wiki/GCConIRC). Or join [`#overseers`](https://web.libera.chat/#overseers) on Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).
feedable force-pushed operand-cnt-test from 722672098f
Some checks failed
/ format-checks (pull_request) Failing after 1m40s
to a7986cd385
Some checks failed
/ format-checks (pull_request) Failing after 1m35s
2026-08-20 22:55:36 +00:00
Compare
feedable force-pushed operand-cnt-test from a7986cd385
Some checks failed
/ format-checks (pull_request) Failing after 1m35s
to 2fbcaae196
Some checks failed
/ format-checks (pull_request) Failing after 1m37s
2026-08-20 23:10:04 +00:00
Compare
feedable force-pushed operand-cnt-test from 2fbcaae196
Some checks failed
/ format-checks (pull_request) Failing after 1m37s
to ec830f12ed
Some checks failed
/ format-checks (pull_request) Failing after 3m44s
2026-08-21 10:55:37 +00:00
Compare
feedable force-pushed operand-cnt-test from ec830f12ed
Some checks failed
/ format-checks (pull_request) Failing after 3m44s
to 9c54b27001
Some checks failed
/ format-checks (pull_request) Failing after 1m40s
2026-08-21 11:00:37 +00:00
Compare
feedable force-pushed operand-cnt-test from 9c54b27001
Some checks failed
/ format-checks (pull_request) Failing after 1m40s
to 331da0018a
Some checks failed
/ format-checks (pull_request) Failing after 2m19s
2026-08-21 15:13:15 +00:00
Compare
feedable force-pushed operand-cnt-test from 331da0018a
Some checks failed
/ format-checks (pull_request) Failing after 2m19s
to 7a55203f10
Some checks failed
/ format-checks (pull_request) Failing after 2m30s
2026-08-21 17:21:09 +00:00
Compare
feedable force-pushed operand-cnt-test from 7a55203f10
Some checks failed
/ format-checks (pull_request) Failing after 2m30s
to c0214189f7
Some checks failed
/ format-checks (pull_request) Failing after 1m34s
2026-08-21 17:28:01 +00:00
Compare
Author
Member

/submit

/submit
Member

Version 1 of this pull request has been stored. It includes the following commits:

  • iterator-utils.h: Fixup const_derived_container constructor - ad88464fe4
  • vec.h: Add a convenient way to construct an invalid array_slice - 94ccda57ad
  • vec.h: Add utility functions to array_slice - 5d2323cff3
  • vec.h: Implement copy&move construction&assignment for auto_vec - b11e19daac
  • i386: Don't use operands array as storage - aec89fa152
  • rtl: Make operand count dynamic - bda6f75a1d
  • rtl: Adjust generation machinery to work with arbitrary amount of operands - c0214189f7
<!-- pr-new-version --> Version 1 of this pull request has been stored. It includes the following commits: - iterator-utils.h: Fixup const_derived_container constructor - ad88464fe42ab9e83f7e0a372cfef20aec882541 - vec.h: Add a convenient way to construct an invalid array_slice - 94ccda57ada63f503d3d4a7357ff76189fdef5ad - vec.h: Add utility functions to array_slice - 5d2323cff34aaa09d110bce2142c02bedc1c2278 - vec.h: Implement copy&move construction&assignment for auto_vec - b11e19daac158f814ed6c49bf1c68d8466ab0c3c - i386: Don't use operands array as storage - aec89fa152446460ad967ac2e1bacfc94b4bb95e - rtl: Make operand count dynamic - bda6f75a1d0f6fe09ec928cb5b32c24e4cff830b - rtl: Adjust generation machinery to work with arbitrary amount of operands - c0214189f7e69062c6ca3c4b78a405bab2fcf541
Member

Sent patch series version 1 containing 7 patches to gcc-patches mailing list gcc-patches@gcc.gnu.org and cc'd Richard Biener rguenther@suse.de, Richard Sandiford rdsandiford@googlemail.com, Jeffrey Law jeffrey.law@oss.qualcomm.com, Vladimir Makarov vmakarov@redhat.com, Robin Dapp rdapp.gcc@gmail.com.
Cover letter

Sent patch series version 1 containing 7 patches to gcc-patches mailing list <gcc-patches@gcc.gnu.org> and cc'd Richard Biener <rguenther@suse.de>, Richard Sandiford <rdsandiford@googlemail.com>, Jeffrey Law <jeffrey.law@oss.qualcomm.com>, Vladimir Makarov <vmakarov@redhat.com>, Robin Dapp <rdapp.gcc@gmail.com>. [Cover letter](https://inbox.sourceware.org/gcc-patches/bmm.hlk1r3usv8.gcc.gcc.feedable.223.1.0@forge-stage.sourceware.org)
feedable changed title from WIP: Remove the restrictions on instruction operand count to Remove the restrictions on instruction operand count 2026-08-21 17:44:18 +00:00
feedable force-pushed operand-cnt-test from c0214189f7
Some checks failed
/ format-checks (pull_request) Failing after 1m34s
to e3184d0fec
Some checks failed
/ format-checks (pull_request) Failing after 1m33s
2026-08-22 14:09:43 +00:00
Compare
feedable force-pushed operand-cnt-test from e3184d0fec
Some checks failed
/ format-checks (pull_request) Failing after 1m33s
to 1fdebfa779
Some checks failed
/ format-checks (pull_request) Failing after 1m38s
2026-08-22 17:28:08 +00:00
Compare
feedable force-pushed operand-cnt-test from 1fdebfa779
Some checks failed
/ format-checks (pull_request) Failing after 1m38s
to de27c80098
Some checks failed
/ format-checks (pull_request) Failing after 1m37s
2026-08-24 22:42:30 +00:00
Compare
feedable force-pushed operand-cnt-test from de27c80098
Some checks failed
/ format-checks (pull_request) Failing after 1m37s
to c81f66d609
Some checks failed
/ format-checks (pull_request) Failing after 1m36s
2026-08-24 23:01:45 +00:00
Compare
feedable force-pushed operand-cnt-test from c81f66d609
Some checks failed
/ format-checks (pull_request) Failing after 1m36s
to a6ca7e094b
Some checks failed
/ format-checks (pull_request) Failing after 1m35s
2026-08-24 23:10:12 +00:00
Compare
Author
Member

/preview

/preview
Member

Sent patch series version 2 containing 7 patches to @feedable's email address.
Message ID is <bmm.hlnmel6rs6.gcc.gcc.feedable.223.2.0@forge-stage.sourceware.org>.

Sent patch series version 2 containing 7 patches to @feedable's email address. Message ID is `<bmm.hlnmel6rs6.gcc.gcc.feedable.223.2.0@forge-stage.sourceware.org>`.
Author
Member

/submit

/submit
Member

Version 2 of this pull request has been stored. It includes the following commits:

  • iterator-utils.h: Fixup const_derived_container constructor - ad88464fe4
  • vec.h: Add a convenient way to construct an invalid array_slice - 94ccda57ad
  • vec.h: Add utility functions to array_slice - 469ce43cb8
  • vec.h: Implement copy&move construction&assignment for auto_vec - 348c0e4c9f
  • i386: Don't use operands array as storage - c049d0fc9c
  • rtl: Make operand count dynamic - 1b4d679adf
  • rtl: Adjust generation machinery to work with arbitrary amount of operands - a6ca7e094b
<!-- pr-new-version --> Version 2 of this pull request has been stored. It includes the following commits: - iterator-utils.h: Fixup const_derived_container constructor - ad88464fe42ab9e83f7e0a372cfef20aec882541 - vec.h: Add a convenient way to construct an invalid array_slice - 94ccda57ada63f503d3d4a7357ff76189fdef5ad - vec.h: Add utility functions to array_slice - 469ce43cb8d99a81598164b535b83f5b9a5ae2ad - vec.h: Implement copy&move construction&assignment for auto_vec - 348c0e4c9fc190047f757393d9cee0714997a0c4 - i386: Don't use operands array as storage - c049d0fc9cdce1500dca52f15119f8620051ed3b - rtl: Make operand count dynamic - 1b4d679adfe4d87a0e0a562d2e311201930ff429 - rtl: Adjust generation machinery to work with arbitrary amount of operands - a6ca7e094b4d57ac4c8661911c328b5d6823ea5f
Member

Pull Request versions:

# Base Head
1 844c665f17 c0214189f7 (diff)
2 844c665f17 a6ca7e094b (diff)

In order to compare , clone this repository and run

PR=223
git fetch origin "refs/versioned_pull/${PR}/*:refs/versioned_pull/${PR}/*"
PRV1=1
PRV2=2
git range-diff "refs/versioned_pull/${PR}/${PRV1}/base..refs/versioned_pull/${PR}/${PRV1}/head"  "refs/versioned_pull/${PR}/${PRV2}/base..refs/versioned_pull/${PR}/${PRV2}/head"
<!-- pr-versions --> Pull Request versions: | # | Base | Head | | | - | ---- | ---- | - | | 1 | 844c665f1701e889b4883df65004dfc310445422 | c0214189f7e69062c6ca3c4b78a405bab2fcf541 | [(diff)](https://forge.sourceware.org/gcc/gcc.git/compare/844c665f1701e889b4883df65004dfc310445422...c0214189f7e69062c6ca3c4b78a405bab2fcf541) | | 2 | 844c665f1701e889b4883df65004dfc310445422 | a6ca7e094b4d57ac4c8661911c328b5d6823ea5f | [(diff)](https://forge.sourceware.org/gcc/gcc.git/compare/844c665f1701e889b4883df65004dfc310445422...a6ca7e094b4d57ac4c8661911c328b5d6823ea5f) | In order to compare , clone this repository and run ``` PR=223 git fetch origin "refs/versioned_pull/${PR}/*:refs/versioned_pull/${PR}/*" PRV1=1 PRV2=2 git range-diff "refs/versioned_pull/${PR}/${PRV1}/base..refs/versioned_pull/${PR}/${PRV1}/head" "refs/versioned_pull/${PR}/${PRV2}/base..refs/versioned_pull/${PR}/${PRV2}/head" ```
Member

Sent patch series version 2 containing 7 patches to gcc-patches mailing list gcc-patches@gcc.gnu.org and cc'd Richard Biener rguenther@suse.de, Richard Sandiford rdsandiford@googlemail.com, Jeffrey Law jeffrey.law@oss.qualcomm.com, Vladimir Makarov vmakarov@redhat.com, Robin Dapp rdapp.gcc@gmail.com.
Cover letter

Sent patch series version 2 containing 7 patches to gcc-patches mailing list <gcc-patches@gcc.gnu.org> and cc'd Richard Biener <rguenther@suse.de>, Richard Sandiford <rdsandiford@googlemail.com>, Jeffrey Law <jeffrey.law@oss.qualcomm.com>, Vladimir Makarov <vmakarov@redhat.com>, Robin Dapp <rdapp.gcc@gmail.com>. [Cover letter](https://inbox.sourceware.org/gcc-patches/bmm.hlnmhdo3u6.gcc.gcc.feedable.223.2.0@forge-stage.sourceware.org)
feedable force-pushed operand-cnt-test from a6ca7e094b
Some checks failed
/ format-checks (pull_request) Failing after 1m35s
to 7d66940ce3
Some checks failed
/ format-checks (pull_request) Failing after 1m21s
2026-09-12 16:05:24 +00:00
Compare
Some checks failed
/ format-checks (pull_request) Failing after 1m21s
This pull request has changes conflicting with the target branch.
  • gcc/genextract.cc
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u operand-cnt-test:feedable-operand-cnt-test
git switch feedable-operand-cnt-test

Merge

Merge the changes and update on Forgejo.
git switch trunk
git merge --no-ff feedable-operand-cnt-test
git switch feedable-operand-cnt-test
git rebase trunk
git switch trunk
git merge --ff-only feedable-operand-cnt-test
git switch feedable-operand-cnt-test
git rebase trunk
git switch trunk
git merge --no-ff feedable-operand-cnt-test
git switch trunk
git merge --squash feedable-operand-cnt-test
git switch trunk
git merge --ff-only feedable-operand-cnt-test
git switch trunk
git merge feedable-operand-cnt-test
git push origin trunk
Sign in to join this conversation.
No reviewers
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gcc/gcc!223
No description provided.