[PATCH 8/8] AArch64: rules for CMPBR instructions

2025-05-07 Thread Karl Meakin
Add rules for lowering `cbranch4` to CBB/CBH/CB when CMPBR extension is enabled. gcc/ChangeLog: * config/aarch64/aarch64.md (cbranch4): emit CMPBR instructions if possible. (cbranch4): new expand rule. (aarch64_cb): likewise. (aarch64_cb): likewise.

[PATCH 3/8] AArch64: rename branch instruction rules

2025-05-07 Thread Karl Meakin
Give the `define_insn` rules used in lowering `cbranch4` to RTL more descriptive and consistent names: from now on, each rule is named after the AArch64 instruction that it generates. Also add comments to document each rule. gcc/ChangeLog: * config/aarch64/aarch64.md (condjump): rename to

[PATCH 0/8] AArch64: CMPBR support

2025-05-07 Thread Karl Meakin
This patch series adds support for the CMPBR extension. It includes the new `+cmpbr` option and rules to generate the new instructions when lowering conditional branches. Karl Meakin (8): AArch64: place branch instruction rules together AArch64: reformat branch instruction rules AArch64

[PATCH 1/8] AArch64: place branch instruction rules together

2025-05-07 Thread Karl Meakin
The rules for conditional branches were spread throughout `aarch64.md`. Group them together so it is easier to understand how `cbranch4` is lowered to RTL. gcc/ChangeLog: * config/aarch64/aarch64.md (condjump): move. (*compare_condjump): likewise. (aarch64_cb1): likewise.

[PATCH 7/8] AArch64: precommit test for CMPBR instructions

2025-05-07 Thread Karl Meakin
Commit the test file `cmpbr.c` before rules for generating the new instructions are added, so that the changes in codegen are more obvious in the next commit. gcc/testsuite/ChangeLog: * gcc.target/aarch64/cmpbr.c: New test. --- gcc/testsuite/gcc.target/aarch64/cmpbr.c | 1378

[PATCH 2/8] AArch64: reformat branch instruction rules

2025-05-07 Thread Karl Meakin
Make the formatting of the RTL templates in the rules for branch instructions more consistent with each other. gcc/ChangeLog: * config/aarch64/aarch64.md (cbranch4): reformat. (cbranchcc4): likewise. (condjump): likewise. (*compare_condjump): likewise. (aar

[PATCH 6/8] AArch64: recognize `+cmpbr` option

2025-05-07 Thread Karl Meakin
Add the `+cmpbr` option to enable the FEAT_CMPBR architectural extension. gcc/ChangeLog: * config/aarch64/aarch64-option-extensions.def (cmpbr): new option. * config/aarch64/aarch64.h (TARGET_CMPBR): new macro. * doc/invoke.texi (cmpbr): new option. --- gcc/config

[PATCH 4/8] AArch64: add constants for branch displacements

2025-05-07 Thread Karl Meakin
Extract the hardcoded values for the minimum PC-relative displacements into named constants and document them. gcc/ChangeLog: * config/aarch64/aarch64.md (BRANCH_LEN_P_128MiB): New constant. (BRANCH_LEN_N_128MiB): likewise. (BRANCH_LEN_P_1MiB): likewise. (BRANCH_LE

[PATCH 5/8] AArch64: make `far_branch` attribute a boolean

2025-05-07 Thread Karl Meakin
The `far_branch` attribute only ever takes the values 0 or 1, so make it a `no/yes` valued string attribute instead. gcc/ChangeLog: * config/aarch64/aarch64.md (far_branch): replace 0/1 with no/yes. (aarch64_bcond): handle rename. (aarch64_cb1): likewise. (

[PATCH 9/9] AArch64: make rules for CBZ/TBZ higher priority

2025-05-08 Thread Karl Meakin
Move the rules for CBZ/TBZ to be above the rules for CBB/CBH/CB. We want them to have higher priority because they can express larger displacements. gcc/ChangeLog: * config/aarch64/aarch64.md (aarch64_cbz1): Move above rules for CBB/CBH/CB. (*aarch64_tbz1): Likewise. gcc/

[PATCH 7/9] AArch64: precommit test for CMPBR instructions

2025-05-08 Thread Karl Meakin
Commit the test file `cmpbr.c` before rules for generating the new instructions are added, so that the changes in codegen are more obvious in the next commit. gcc/testsuite/ChangeLog: * gcc.target/aarch64/cmpbr.c: New test. --- gcc/testsuite/gcc.target/aarch64/cmpbr.c | 1378

[PATCH 8/9] AArch64: rules for CMPBR instructions

2025-05-08 Thread Karl Meakin
Add rules for lowering `cbranch4` to CBB/CBH/CB when CMPBR extension is enabled. gcc/ChangeLog: * config/aarch64/aarch64.md (cbranch4): Mmit CMPBR instructions if possible. (BRANCH_LEN_P_1Kib): New constant. (BRANCH_LEN_N_1Kib): Likewise. (cbranch4): New ex

[PATCH 2/9] AArch64: reformat branch instruction rules

2025-05-08 Thread Karl Meakin
Make the formatting of the RTL templates in the rules for branch instructions more consistent with each other. gcc/ChangeLog: * config/aarch64/aarch64.md (cbranch4): Reformat. (cbranchcc4): Likewise. (condjump): Likewise. (*compare_condjump): Likewise. (aar

[PATCH 1/9] AArch64: place branch instruction rules together

2025-05-08 Thread Karl Meakin
The rules for conditional branches were spread throughout `aarch64.md`. Group them together so it is easier to understand how `cbranch4` is lowered to RTL. gcc/ChangeLog: * config/aarch64/aarch64.md (condjump): Move. (*compare_condjump): Likewise. (aarch64_cb1): Likewise.

[PATCH 5/9] AArch64: make `far_branch` attribute a boolean

2025-05-08 Thread Karl Meakin
The `far_branch` attribute only ever takes the values 0 or 1, so make it a `no/yes` valued string attribute instead. gcc/ChangeLog: * config/aarch64/aarch64.md (far_branch): Replace 0/1 with no/yes. (aarch64_bcond): Handle rename. (aarch64_cb1): Likewise. (

[PATCH 3/9] AArch64: rename branch instruction rules

2025-05-08 Thread Karl Meakin
Give the `define_insn` rules used in lowering `cbranch4` to RTL more descriptive and consistent names: from now on, each rule is named after the AArch64 instruction that it generates. Also add comments to document each rule. gcc/ChangeLog: * config/aarch64/aarch64.md (condjump): Rename to

[PATCH 4/9] AArch64: add constants for branch displacements

2025-05-08 Thread Karl Meakin
Extract the hardcoded values for the minimum PC-relative displacements into named constants and document them. gcc/ChangeLog: * config/aarch64/aarch64.md (BRANCH_LEN_P_128MiB): New constant. (BRANCH_LEN_N_128MiB): Likewise. (BRANCH_LEN_P_1MiB): Likewise. (BRANCH_LE

[PATCH 6/9] AArch64: recognize `+cmpbr` option

2025-05-08 Thread Karl Meakin
Add the `+cmpbr` option to enable the FEAT_CMPBR architectural extension. gcc/ChangeLog: * config/aarch64/aarch64-option-extensions.def (cmpbr): New option. * config/aarch64/aarch64.h (TARGET_CMPBR): New macro. * doc/invoke.texi (cmpbr): New option. --- gcc/config

[PATCH 0/9] AArch64: CMPBR support

2025-05-08 Thread Karl Meakin
This patch series adds support for the CMPBR extension. It includes the new `+cmpbr` option and rules to generate the new instructions when lowering conditional branches. Karl Meakin (9): AArch64: place branch instruction rules together AArch64: reformat branch instruction rules AArch64