llvm-6502/test/MC/Mips/micromips-bad-branches.s
Matheus Almeida b90ed644fc [mips] Add checks for alignment and maximum displacements for most of the
branch instructions for mips and micromips instruction sets thus avoiding
the situation of generating branches to undesired locations if offsets
cannot be encoded.

This patch also checks if a fixup cannot be applied and returns a fatal error
if that's the case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197223 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 11:11:02 +00:00

226 lines
6.2 KiB
ArmAsm

# RUN: not llvm-mc %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -mattr=+msa -arch=mips -mattr=+micromips 2>&1 | FileCheck %s
#
# CHECK: error: branch to misaligned address
# CHECK: b -65535
# CHECK: error: branch target out of range
# CHECK: b -65537
# CHECK: error: branch to misaligned address
# CHECK: b 65535
# CHECK: error: branch target out of range
# CHECK: b 65536
# CHECK: error: branch to misaligned address
# CHECK: beq $1, $1, -65535
# CHECK: error: branch target out of range
# CHECK: beq $1, $1, -65537
# CHECK: error: branch to misaligned address
# CHECK: beq $1, $1, 65535
# CHECK: error: branch target out of range
# CHECK: beq $1, $1, 65536
# CHECK: error: branch to misaligned address
# CHECK: bne $1, $1, -65535
# CHECK: error: branch target out of range
# CHECK: bne $1, $1, -65537
# CHECK: error: branch to misaligned address
# CHECK: bne $1, $1, 65535
# CHECK: error: branch target out of range
# CHECK: bne $1, $1, 65536
# CHECK: error: branch to misaligned address
# CHECK: bal -65535
# CHECK: error: branch target out of range
# CHECK: bal -65537
# CHECK: error: branch to misaligned address
# CHECK: bal 65535
# CHECK: error: branch target out of range
# CHECK: bal 65536
# CHECK: error: branch to misaligned address
# CHECK: bgez $1, -65535
# CHECK: error: branch target out of range
# CHECK: bgez $1, -65537
# CHECK: error: branch to misaligned address
# CHECK: bgez $1, 65535
# CHECK: error: branch target out of range
# CHECK: bgez $1, 65536
# CHECK: error: branch to misaligned address
# CHECK: bgtz $1, -65535
# CHECK: error: branch target out of range
# CHECK: bgtz $1, -65537
# CHECK: error: branch to misaligned address
# CHECK: bgtz $1, 65535
# CHECK: error: branch target out of range
# CHECK: bgtz $1, 65536
# CHECK: error: branch to misaligned address
# CHECK: blez $1, -65535
# CHECK: error: branch target out of range
# CHECK: blez $1, -65537
# CHECK: error: branch to misaligned address
# CHECK: blez $1, 65535
# CHECK: error: branch target out of range
# CHECK: blez $1, 65536
# CHECK: error: branch to misaligned address
# CHECK: bltz $1, -65535
# CHECK: error: branch target out of range
# CHECK: bltz $1, -65537
# CHECK: error: branch to misaligned address
# CHECK: bltz $1, 65535
# CHECK: error: branch target out of range
# CHECK: bltz $1, 65536
# CHECK: error: branch to misaligned address
# CHECK: bgezal $1, -65535
# CHECK: error: branch target out of range
# CHECK: bgezal $1, -65537
# CHECK: error: branch to misaligned address
# CHECK: bgezal $1, 65535
# CHECK: error: branch target out of range
# CHECK: bgezal $1, 65536
# CHECK: error: branch to misaligned address
# CHECK: bltzal $1, -65535
# CHECK: error: branch target out of range
# CHECK: bltzal $1, -65537
# CHECK: error: branch to misaligned address
# CHECK: bltzal $1, 65535
# CHECK: error: branch target out of range
# CHECK: bltzal $1, 65536
# CHECK: error: branch to misaligned address
# CHECK: bc1f -65535
# CHECK: error: branch target out of range
# CHECK: bc1f -65537
# CHECK: error: branch to misaligned address
# CHECK: bc1f 65535
# CHECK: error: branch target out of range
# CHECK: bc1f 65536
# CHECK: error: branch to misaligned address
# CHECK: bc1f $fcc0, -65535
# CHECK: error: branch target out of range
# CHECK: bc1f $fcc0, -65537
# CHECK: error: branch to misaligned address
# CHECK: bc1f $fcc0, 65535
# CHECK: error: branch target out of range
# CHECK: bc1f $fcc0, 65536
# CHECK: error: branch to misaligned address
# CHECK: bc1t -65535
# CHECK: error: branch target out of range
# CHECK: bc1t -65537
# CHECK: error: branch to misaligned address
# CHECK: bc1t 65535
# CHECK: error: branch target out of range
# CHECK: bc1t 65536
# CHECK: error: branch to misaligned address
# CHECK: bc1t $fcc0, -65535
# CHECK: error: branch target out of range
# CHECK: bc1t $fcc0, -65537
# CHECK: error: branch to misaligned address
# CHECK: bc1t $fcc0, 65535
# CHECK: error: branch target out of range
# CHECK: bc1t $fcc0, 65536
b -65535
b -65536
b -65537
b 65534
b 65535
b 65536
beq $1, $1, -65535
beq $1, $1, -65536
beq $1, $1, -65537
beq $1, $1, 65534
beq $1, $1, 65535
beq $1, $1, 65536
bne $1, $1, -65535
bne $1, $1, -65536
bne $1, $1, -65537
bne $1, $1, 65534
bne $1, $1, 65535
bne $1, $1, 65536
bal -65535
bal -65536
bal -65537
bal 65534
bal 65535
bal 65536
bgez $1, -65535
bgez $1, -65536
bgez $1, -65537
bgez $1, 65534
bgez $1, 65535
bgez $1, 65536
bgtz $1, -65535
bgtz $1, -65536
bgtz $1, -65537
bgtz $1, 65534
bgtz $1, 65535
bgtz $1, 65536
blez $1, -65535
blez $1, -65536
blez $1, -65537
blez $1, 65534
blez $1, 65535
blez $1, 65536
bltz $1, -65535
bltz $1, -65536
bltz $1, -65537
bltz $1, 65534
bltz $1, 65535
bltz $1, 65536
bgezal $1, -65535
bgezal $1, -65536
bgezal $1, -65537
bgezal $1, 65534
bgezal $1, 65535
bgezal $1, 65536
bltzal $1, -65535
bltzal $1, -65536
bltzal $1, -65537
bltzal $1, 65534
bltzal $1, 65535
bltzal $1, 65536
bc1f -65535
bc1f -65536
bc1f -65537
bc1f 65534
bc1f 65535
bc1f 65536
bc1f $fcc0, -65535
bc1f $fcc0, -65536
bc1f $fcc0, -65537
bc1f $fcc0, 65534
bc1f $fcc0, 65535
bc1f $fcc0, 65536
bc1t -65535
bc1t -65536
bc1t -65537
bc1t 65534
bc1t 65535
bc1t 65536
bc1t $fcc0, -65535
bc1t $fcc0, -65536
bc1t $fcc0, -65537
bc1t $fcc0, 65534
bc1t $fcc0, 65535
bc1t $fcc0, 65536