[all-commits] [llvm/llvm-project] f74e9f: [Aarch64] Materialize immediates with 64-bit ORR +...

Dougall Johnson via All-commits all-commits at lists.llvm.org
Tue Oct 10 00:06:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f74e9f86a383868df66ae4f2e62589f9dfca1a0b
      https://github.com/llvm/llvm-project/commit/f74e9f86a383868df66ae4f2e62589f9dfca1a0b
  Author: Dougall Johnson <dougallj at gmail.com>
  Date:   2023-10-10 (Tue, 10 Oct 2023)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64ExpandImm.cpp
    M llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
    M llvm/test/CodeGen/AArch64/arm64-movi.ll

  Log Message:
  -----------
  [Aarch64] Materialize immediates with 64-bit ORR + EOR if shorter (#68287)

A number of useful constants can be encoded with a 64-bit ORR followed
by a 64-bit EOR, including all remaining repeated byte patterns, some
useful repeated 16-bit patterns, and some irregular masks. This patch
prioritizes that encoding over three or four instruction encodings.
Encoding with MOV + MOVK or ORR + MOVK is still preferred for fast
literal generation and readability respectively.

The method devises three candidate values, and checks if both Candidate
and (Imm ^ Candidate) are valid logical immediates. If so, Imm is
materialized with:

```
ORR Xd, XZR, #(Imm ^ Candidate)
EOR Xd, Xd, #(Candidate)
```

The method has been exhaustively tested to ensure it can solve all
possible values (excluding 0, ~0, and plain logical immediates, which
are handled earlier).




More information about the All-commits mailing list