Skip to content

[AArch64][GlobalISel] HADD operations and combines #118083

@davemgreen

Description

@davemgreen

SDAG, via these nodes can pattern-recognise and optimise hadd and rhadd nodes. We should add the same operations for global isel.

  /// AVGFLOORS/AVGFLOORU - Averaging add - Add two integers using an integer of
  /// type i[N+1], halving the result by shifting it one bit right.
  /// shr(add(ext(X), ext(Y)), 1)
  AVGFLOORS,
  AVGFLOORU,
  /// AVGCEILS/AVGCEILU - Rounding averaging add - Add two integers using an
  /// integer of type i[N+2], add 1 and halve the result by shifting it one bit
  /// right. shr(add(ext(X), ext(Y), 1), 1)
  AVGCEILS,
  AVGCEILU,

There are tests in, for example, llvm/test/CodeGen/AArch64/hadd-combine.ll.
https://godbolt.org/z/xGs95MGz5

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions