AMDGPU: Error if branch distance exceeds limit

llvm-svn: 269951
This commit is contained in:
Matt Arsenault 2016-05-18 16:10:24 +00:00
parent 1735da460b
commit a519cf593f
1 changed files with 5 additions and 1 deletions

View File

@ -96,8 +96,12 @@ void AMDGPUAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
switch ((unsigned)Fixup.getKind()) {
case AMDGPU::fixup_si_sopp_br: {
int64_t BrImm = (Value - 4) / 4;
if (!isInt<16>(BrImm))
report_fatal_error("branch size exceeds simm16");
uint16_t *Dst = (uint16_t*)(Data + Fixup.getOffset());
*Dst = (Value - 4) / 4;
*Dst = BrImm;
break;
}