[all-commits] [llvm/llvm-project] 787eeb: [RISCV] Optimize immediate materialisation with BCLRI

Ben Shi via All-commits all-commits at lists.llvm.org
Tue Oct 12 17:59:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 787eeb8597fac22decb366a42176b11f52ec1bf0
      https://github.com/llvm/llvm-project/commit/787eeb8597fac22decb366a42176b11f52ec1bf0
  Author: Ben Shi <powerman1st at 163.com>
  Date:   2021-10-13 (Wed, 13 Oct 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
    M llvm/test/CodeGen/RISCV/imm.ll
    M llvm/test/MC/RISCV/rv64zbs-aliases-valid.s

  Log Message:
  -----------
  [RISCV] Optimize immediate materialisation with BCLRI

Do the following optimization for immediate materialisation:

1. For values in range 0xffffffff 7fffffff ~ 0xffffffff 00000000, first
   generate the lower 32-bit with Val|0x80000000 (which is expected be an
   int32), then emit (BCLRI r, 31).

2. For values in range 0x80000000 ~ 0xffffffff, first generate the lower
   32-bit with Val&~0x80000000 (which is expected to be an int32), then
   emit (BSETI r, 31).

Reviewed By: craig.topper

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




More information about the All-commits mailing list