[all-commits] [llvm/llvm-project] 2c6cb8: [AArch64] [NFC] Add tests

Guy David via All-commits all-commits at lists.llvm.org
Mon Jul 6 00:27:23 PDT 2026


  Branch: refs/heads/users/guy-david/aarch64-neg-smin
  Home:   https://github.com/llvm/llvm-project
  Commit: 2c6cb8484c71cedecadd12e66385e4cf69a86f97
      https://github.com/llvm/llvm-project/commit/2c6cb8484c71cedecadd12e66385e4cf69a86f97
  Author: Guy David <guyda96 at gmail.com>
  Date:   2026-07-05 (Sun, 05 Jul 2026)

  Changed paths:
    A llvm/test/CodeGen/AArch64/neg-smin-zero.ll

  Log Message:
  -----------
  [AArch64] [NFC] Add tests


  Commit: f26241c864be9e12c71fc5fb4ab0a7e137f86683
      https://github.com/llvm/llvm-project/commit/f26241c864be9e12c71fc5fb4ab0a7e137f86683
  Author: Guy David <guyda96 at gmail.com>
  Date:   2026-07-05 (Sun, 05 Jul 2026)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/test/CodeGen/AArch64/neg-smin-zero.ll

  Log Message:
  -----------
  [AArch64] Fold -smin/-smax(X,0) to neg + masked AND

smin(X, 0) lowers to X & M and smax(X, 0) to X & ~M, where M is X
arithmetically shifted right by the bit width minus one (a 0 or -1 sign
mask). When negation is applied, -(X & M) is equivalent to (-X) & M. The
latter form is slightly better because the shift no longer depends on the
negation and the two can issue in parallel. Instruction count is unchanged.

The fold is suppressed when the result feeds a comparison because then the
negation is folded into a cmn for free. This covers the compare feeding a
SETCC, SELECT_CC, or BR_CC.

smin: https://alive2.llvm.org/ce/z/SfmPfH
smax: https://alive2.llvm.org/ce/z/_lVM0r

Assisted-by: Opus 4.8


Compare: https://github.com/llvm/llvm-project/compare/2c6cb8484c71%5E...f26241c864be

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list