[v3,0/3] Match: support additional cases of unsigned scalar arithmetic

Message ID 20241127202741.771893-1-Akram.Ahmad@arm.com
Headers
Series Match: support additional cases of unsigned scalar arithmetic |

Message

Akram Ahmad Nov. 27, 2024, 8:27 p.m. UTC
  Hi all,

This patch series adds support for 2 new cases of unsigned scalar saturating arithmetic
(one addition, one subtraction). This results in more valid patterns being recognised,
which results in a call to .SAT_ADD or .SAT_SUB where relevant.

v3 of this series now introduces support for dg-require-effective-target for both usadd
and ussub optabs as well as individual modes that these optabs may be implemented for.
aarch64 support for these optabs is in review, so there are currently no targets listed
in these effective-target options.

Regression tests for aarch64 all pass with no failures.

v3 changes:
- add support for new effective-target keywords.
- tests for the two new patterns now use the dg-require-effective-target so that they are
  skipped on relevant targets.

v2 changes:
- add new tests for both patterns (these will fail on targets which don't implement
  the standard insn names for IFN_SAT_ADD and IFN_SAT_SUB; another patch series adds
  support for this in aarch64).
- minor adjustment to the constraints on the match statement for usadd_left_part_1.

If this is OK for master, please commit these on my behalf, as I do not have the ability
to do so.

Many thanks,

Akram

---

Akram Ahmad (3):
  testsuite: Support dg-require-effective-target for us{add, sub}
  Match: support new case of unsigned scalar SAT_SUB
  Match: make SAT_ADD case 7 commutative

 gcc/match.pd                                  | 12 +++-
 .../gcc.dg/tree-ssa/sat-u-add-match-1-u16.c   | 22 ++++++++
 .../gcc.dg/tree-ssa/sat-u-add-match-1-u32.c   | 22 ++++++++
 .../gcc.dg/tree-ssa/sat-u-add-match-1-u64.c   | 22 ++++++++
 .../gcc.dg/tree-ssa/sat-u-add-match-1-u8.c    | 22 ++++++++
 .../gcc.dg/tree-ssa/sat-u-sub-match-1-u16.c   | 15 +++++
 .../gcc.dg/tree-ssa/sat-u-sub-match-1-u32.c   | 15 +++++
 .../gcc.dg/tree-ssa/sat-u-sub-match-1-u64.c   | 15 +++++
 .../gcc.dg/tree-ssa/sat-u-sub-match-1-u8.c    | 15 +++++
 gcc/testsuite/lib/target-supports.exp         | 56 +++++++++++++++++++
 10 files changed, 214 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u16.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u32.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u64.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u8.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u16.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u32.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u64.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u8.c
  

Comments

Akram Ahmad Dec. 6, 2024, 2:28 p.m. UTC | #1
Ping

On 27/11/2024 20:27, Akram Ahmad wrote:
> Hi all,
>
> This patch series adds support for 2 new cases of unsigned scalar saturating arithmetic
> (one addition, one subtraction). This results in more valid patterns being recognised,
> which results in a call to .SAT_ADD or .SAT_SUB where relevant.
>
> v3 of this series now introduces support for dg-require-effective-target for both usadd
> and ussub optabs as well as individual modes that these optabs may be implemented for.
> aarch64 support for these optabs is in review, so there are currently no targets listed
> in these effective-target options.
>
> Regression tests for aarch64 all pass with no failures.
>
> v3 changes:
> - add support for new effective-target keywords.
> - tests for the two new patterns now use the dg-require-effective-target so that they are
>    skipped on relevant targets.
>
> v2 changes:
> - add new tests for both patterns (these will fail on targets which don't implement
>    the standard insn names for IFN_SAT_ADD and IFN_SAT_SUB; another patch series adds
>    support for this in aarch64).
> - minor adjustment to the constraints on the match statement for usadd_left_part_1.
>
> If this is OK for master, please commit these on my behalf, as I do not have the ability
> to do so.
>
> Many thanks,
>
> Akram
>
> ---
>
> Akram Ahmad (3):
>    testsuite: Support dg-require-effective-target for us{add, sub}
>    Match: support new case of unsigned scalar SAT_SUB
>    Match: make SAT_ADD case 7 commutative
>
>   gcc/match.pd                                  | 12 +++-
>   .../gcc.dg/tree-ssa/sat-u-add-match-1-u16.c   | 22 ++++++++
>   .../gcc.dg/tree-ssa/sat-u-add-match-1-u32.c   | 22 ++++++++
>   .../gcc.dg/tree-ssa/sat-u-add-match-1-u64.c   | 22 ++++++++
>   .../gcc.dg/tree-ssa/sat-u-add-match-1-u8.c    | 22 ++++++++
>   .../gcc.dg/tree-ssa/sat-u-sub-match-1-u16.c   | 15 +++++
>   .../gcc.dg/tree-ssa/sat-u-sub-match-1-u32.c   | 15 +++++
>   .../gcc.dg/tree-ssa/sat-u-sub-match-1-u64.c   | 15 +++++
>   .../gcc.dg/tree-ssa/sat-u-sub-match-1-u8.c    | 15 +++++
>   gcc/testsuite/lib/target-supports.exp         | 56 +++++++++++++++++++
>   10 files changed, 214 insertions(+), 2 deletions(-)
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u16.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u32.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u64.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u8.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u16.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u32.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u64.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u8.c
>
  
Akram Ahmad Dec. 17, 2024, noon UTC | #2
Pinging

On 27/11/2024 20:27, Akram Ahmad wrote:
> Hi all,
>
> This patch series adds support for 2 new cases of unsigned scalar saturating arithmetic
> (one addition, one subtraction). This results in more valid patterns being recognised,
> which results in a call to .SAT_ADD or .SAT_SUB where relevant.
>
> v3 of this series now introduces support for dg-require-effective-target for both usadd
> and ussub optabs as well as individual modes that these optabs may be implemented for.
> aarch64 support for these optabs is in review, so there are currently no targets listed
> in these effective-target options.
>
> Regression tests for aarch64 all pass with no failures.
>
> v3 changes:
> - add support for new effective-target keywords.
> - tests for the two new patterns now use the dg-require-effective-target so that they are
>    skipped on relevant targets.
>
> v2 changes:
> - add new tests for both patterns (these will fail on targets which don't implement
>    the standard insn names for IFN_SAT_ADD and IFN_SAT_SUB; another patch series adds
>    support for this in aarch64).
> - minor adjustment to the constraints on the match statement for usadd_left_part_1.
>
> If this is OK for master, please commit these on my behalf, as I do not have the ability
> to do so.
>
> Many thanks,
>
> Akram
>
> ---
>
> Akram Ahmad (3):
>    testsuite: Support dg-require-effective-target for us{add, sub}
>    Match: support new case of unsigned scalar SAT_SUB
>    Match: make SAT_ADD case 7 commutative
>
>   gcc/match.pd                                  | 12 +++-
>   .../gcc.dg/tree-ssa/sat-u-add-match-1-u16.c   | 22 ++++++++
>   .../gcc.dg/tree-ssa/sat-u-add-match-1-u32.c   | 22 ++++++++
>   .../gcc.dg/tree-ssa/sat-u-add-match-1-u64.c   | 22 ++++++++
>   .../gcc.dg/tree-ssa/sat-u-add-match-1-u8.c    | 22 ++++++++
>   .../gcc.dg/tree-ssa/sat-u-sub-match-1-u16.c   | 15 +++++
>   .../gcc.dg/tree-ssa/sat-u-sub-match-1-u32.c   | 15 +++++
>   .../gcc.dg/tree-ssa/sat-u-sub-match-1-u64.c   | 15 +++++
>   .../gcc.dg/tree-ssa/sat-u-sub-match-1-u8.c    | 15 +++++
>   gcc/testsuite/lib/target-supports.exp         | 56 +++++++++++++++++++
>   10 files changed, 214 insertions(+), 2 deletions(-)
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u16.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u32.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u64.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-add-match-1-u8.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u16.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u32.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u64.c
>   create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/sat-u-sub-match-1-u8.c
>
  
Jeff Law Jan. 18, 2025, 4:18 p.m. UTC | #3
On 12/17/24 5:00 AM, Akram Ahmad wrote:
> Pinging
While this was submitted before the stage1 deadline, it seems to have 
fallen through the cracks on the review side.

It's unfortunate, but I'd tend to think it ought to be deferred at this 
point until the gcc-16 cycle.

However, I won't object if Richi or Jakub wants to move it forward now 
rather than waiting.

jeff