[PATCH] D20380: AMDGPU: Fix incorrect simm check

Jan Vesely via llvm-commits llvm-commits at lists.llvm.org
Wed May 18 11:42:14 PDT 2016


jvesely created this revision.
jvesely added reviewers: arsenm, tstellarAMD.
jvesely added a subscriber: llvm-commits.
jvesely set the repository for this revision to rL LLVM.
Herald added subscribers: kzhuravl, arsenm.

Use signed division otherwise all back jumps fail the check
Fixes regression introduced in r269951

Repository:
  rL LLVM

http://reviews.llvm.org/D20380

Files:
  lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp

Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
@@ -96,7 +96,7 @@
 
   switch ((unsigned)Fixup.getKind()) {
     case AMDGPU::fixup_si_sopp_br: {
-      int64_t BrImm = (Value - 4) / 4;
+      int64_t BrImm = ((int64_t)Value - 4) / 4;
       if (!isInt<16>(BrImm))
         report_fatal_error("branch size exceeds simm16");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20380.57654.patch
Type: text/x-patch
Size: 517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160518/713f1f31/attachment.bin>


More information about the llvm-commits mailing list