[all-commits] [llvm/llvm-project] 9bf6be: [AArch64] Optimize add/sub with immediate

Ben Shi via All-commits all-commits at lists.llvm.org
Sat Oct 16 01:51:48 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9bf6bef9951a1c230796ccad2c5c0195ce4c4dff
      https://github.com/llvm/llvm-project/commit/9bf6bef9951a1c230796ccad2c5c0195ce4c4dff
  Author: Ben Shi <powerman1st at 163.com>
  Date:   2021-10-16 (Sat, 16 Oct 2021)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
    M llvm/test/CodeGen/AArch64/addsub.ll
    M llvm/test/Transforms/CodeGenPrepare/AArch64/large-offset-gep.ll

  Log Message:
  -----------
  [AArch64] Optimize add/sub with immediate

Optimize ([add|sub] r, imm) -> ([ADD|SUB] ([ADD|SUB] r, #imm0, lsl #12), #imm1),
if imm == (imm0<<12)+imm1. and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

Optimize ([add|sub] r, imm) -> ([SUB|ADD] ([SUB|ADD] r, #imm0, lsl #12), #imm1),
if imm == -(imm0<<12)-imm1, and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

Reviewed By: jaykang10, dmgreen

Differential Revision: https://reviews.llvm.org/D111034




More information about the All-commits mailing list