[all-commits] [llvm/llvm-project] 776d50: [SPARC][MC] Fix encoding of backwards BPr branches

Brad Smith via All-commits all-commits at lists.llvm.org
Thu May 4 20:20:04 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 776d50d371a5da06bb156bf61a9efe38dfe4d65a
  Author: Brad Smith <brad at comstyle.com>
  Date:   2023-05-04 (Thu, 04 May 2023)

  Changed paths:
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcFixupKinds.h
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp
    A llvm/test/MC/Sparc/sparc64-bpr-offset.s
    M llvm/test/MC/Sparc/sparc64-ctrl-instructions.s

  Log Message:
  [SPARC][MC] Fix encoding of backwards BPr branches

Make sure that the upper bits of the offset is placed in bits 20-21 of the
instruction word.

This fixes the encoding of backwards (negative offset) BPr branches.

(Previously, the upper two bits of the offset would overwrite parts of the rs1
field, causing it to branch on the wrong register, with the wrong offset)

Reviewed By: arsenm

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

More information about the All-commits mailing list