[all-commits] [llvm/llvm-project] 0b8fd7: [AMDGPU][MC] Corrected decoding of 16-bit literals

dpreobra via All-commits all-commits at lists.llvm.org
Wed Jul 22 07:21:22 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b8fd77ad953e6968242a131a5ed3b881c19daac
      https://github.com/llvm/llvm-project/commit/0b8fd77ad953e6968242a131a5ed3b881c19daac
  Author: Dmitry Preobrazhensky <dmitry.preobrazhensky at amd.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp
    M llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h
    M llvm/test/CodeGen/AMDGPU/add.i16.ll
    M llvm/test/CodeGen/AMDGPU/add.v2i16.ll
    M llvm/test/CodeGen/AMDGPU/imm16.ll
    M llvm/test/CodeGen/AMDGPU/sub.i16.ll
    M llvm/test/CodeGen/AMDGPU/sub.v2i16.ll
    M llvm/test/MC/Disassembler/AMDGPU/literal16_vi.txt
    M llvm/test/MC/Disassembler/AMDGPU/vop1.txt
    M llvm/test/MC/Disassembler/AMDGPU/vop3-literal.txt

  Log Message:
  -----------
  [AMDGPU][MC] Corrected decoding of 16-bit literals

16-bit literals are encoded as 32-bit values. If high 16-bits of the value is 0xFFFF, the decoded instruction cannot be reassembled.

For example, the following code

0xff,0x04,0x04,0x52,0xcd,0xab,0xff,0xff

was decoded as

v_mul_lo_u16_e32 v2, 0xffffabcd, v2

However this literal is actually a 64-bit constant 0x00000000ffffabcd which violates requirements described in the documentation - the truncation is not safe.

This change corrects decoding to make reassembly possible.

Reviewers: arsenm, rampitec

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




More information about the All-commits mailing list