[all-commits] [llvm/llvm-project] a8697c: [PowerPC] Fix the check for 16-bit signed field in...

Nemanja Ivanovic via All-commits all-commits at lists.llvm.org
Fri Mar 19 05:16:21 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a8697c57fa994ebb9524d837ba1ebe7ab00bfb6e
      https://github.com/llvm/llvm-project/commit/a8697c57fa994ebb9524d837ba1ebe7ab00bfb6e
  Author: Nemanja Ivanovic <nemanja.i.ibm at gmail.com>
  Date:   2021-03-19 (Fri, 19 Mar 2021)

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
    A llvm/test/CodeGen/PowerPC/out-of-range-dform.ll

  Log Message:
  -----------
  [PowerPC] Fix the check for 16-bit signed field in peephole

When a D-Form instruction is fed by an add-immediate, we attempt
to merge the two immediates to form a single displacement so we
can remove the add-immediate.

However, we don't check whether the new displacement fits into
a 16-bit signed immediate field early enough. Namely, we do a
sign-extend from 16 bits first which will discard high bits and
then we check whether the result is a 16-bit signed immediate.
It of course will always be.

Move the check prior to the sign extend to ensure we are checking
the correct value.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49640




More information about the All-commits mailing list