[mips] [IAS] Add support for the B{L,G}{T,E}(U) branch pseudo-instructions.

Summary:
This does not include support for the immediate variants of these pseudo-instructions.
Fixes llvm.org/PR20968.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: seanbruno, emaste, llvm-commits

Differential Revision: http://reviews.llvm.org/D8537

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239905 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Toma Tabacu
2015-06-17 13:20:24 +00:00
parent 87f93f5387
commit 279a212ca2
5 changed files with 556 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# RUN: not llvm-mc %s -arch=mips -mcpu=mips32 2>&1 | FileCheck %s
# Check for errors when using conditional branch pseudos after .set noat.
.set noat
local_label:
blt $7, $8, local_label
# CHECK: :[[@LINE-1]]:3: error: pseudo-instruction requires $at, which is not available
bltu $7, $8, local_label
# CHECK: :[[@LINE-1]]:3: error: pseudo-instruction requires $at, which is not available
ble $7, $8, local_label
# CHECK: :[[@LINE-1]]:3: error: pseudo-instruction requires $at, which is not available
bleu $7, $8, local_label
# CHECK: :[[@LINE-1]]:3: error: pseudo-instruction requires $at, which is not available
bge $7, $8, local_label
# CHECK: :[[@LINE-1]]:3: error: pseudo-instruction requires $at, which is not available
bgeu $7, $8, local_label
# CHECK: :[[@LINE-1]]:3: error: pseudo-instruction requires $at, which is not available
bgt $7, $8, local_label
# CHECK: :[[@LINE-1]]:3: error: pseudo-instruction requires $at, which is not available
bgtu $7, $8, local_label
# CHECK: :[[@LINE-1]]:3: error: pseudo-instruction requires $at, which is not available

View File

@@ -0,0 +1,189 @@
# RUN: llvm-mc %s -arch=mips -mcpu=mips32 -show-encoding | FileCheck %s
# RUN: llvm-mc %s -arch=mips -mcpu=mips32 2>&1 | \
# RUN: FileCheck %s --check-prefix=WARNING
.text
local_label:
blt $7, $8, local_label
# CHECK: slt $1, $7, $8 # encoding: [0x00,0xe8,0x08,0x2a]
# CHECK: bnez $1, local_label # encoding: [0x14,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
blt $7, $8, global_label
# CHECK: slt $1, $7, $8 # encoding: [0x00,0xe8,0x08,0x2a]
# CHECK: bnez $1, global_label # encoding: [0x14,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: global_label, kind: fixup_Mips_PC16
# CHECK: nop
blt $7, $0, local_label
# CHECK: bltz $7, local_label # encoding: [0x04,0xe0,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
blt $0, $8, local_label
# CHECK: bgtz $8, local_label # encoding: [0x1d,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
blt $0, $0, local_label
# CHECK: bltz $zero, local_label # encoding: [0x04,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bltu $7, $8, local_label
# CHECK: sltu $1, $7, $8 # encoding: [0x00,0xe8,0x08,0x2b]
# CHECK: bnez $1, local_label # encoding: [0x14,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bltu $7, $8, global_label
# CHECK: sltu $1, $7, $8 # encoding: [0x00,0xe8,0x08,0x2b]
# CHECK: bnez $1, global_label # encoding: [0x14,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: global_label, kind: fixup_Mips_PC16
# CHECK: nop
bltu $7, $0, local_label
# CHECK: nop
bltu $0, $8, local_label
# CHECK: bnez $8, local_label # encoding: [0x15,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bltu $0, $0, local_label
# CHECK: nop
ble $7, $8, local_label
# CHECK: slt $1, $8, $7 # encoding: [0x01,0x07,0x08,0x2a]
# CHECK: beqz $1, local_label # encoding: [0x10,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
ble $7, $8, global_label
# CHECK: slt $1, $8, $7 # encoding: [0x01,0x07,0x08,0x2a]
# CHECK: beqz $1, global_label # encoding: [0x10,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: global_label, kind: fixup_Mips_PC16
# CHECK: nop
ble $7, $0, local_label
# CHECK: blez $7, local_label # encoding: [0x18,0xe0,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
ble $0, $8, local_label
# CHECK: bgez $8, local_label # encoding: [0x05,0x01,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
ble $0, $0, local_label
# WARNING: :[[@LINE-1]]:3: warning: branch is always taken
# CHECK: blez $zero, local_label # encoding: [0x18,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bleu $7, $8, local_label
# CHECK: sltu $1, $8, $7 # encoding: [0x01,0x07,0x08,0x2b]
# CHECK: beqz $1, local_label # encoding: [0x10,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bleu $7, $8, global_label
# CHECK: sltu $1, $8, $7 # encoding: [0x01,0x07,0x08,0x2b]
# CHECK: beqz $1, global_label # encoding: [0x10,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: global_label, kind: fixup_Mips_PC16
# CHECK: nop
bleu $7, $0, local_label
# CHECK: beqz $7, local_label # encoding: [0x10,0xe0,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bleu $0, $8, local_label
# WARNING: :[[@LINE-1]]:3: warning: branch is always taken
# CHECK: b local_label # encoding: [0x10,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bleu $0, $0, local_label
# WARNING: :[[@LINE-1]]:3: warning: branch is always taken
# CHECK: b local_label # encoding: [0x10,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bge $7, $8, local_label
# CHECK: slt $1, $7, $8 # encoding: [0x00,0xe8,0x08,0x2a]
# CHECK: beqz $1, local_label # encoding: [0x10,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bge $7, $8, global_label
# CHECK: slt $1, $7, $8 # encoding: [0x00,0xe8,0x08,0x2a]
# CHECK: beqz $1, global_label # encoding: [0x10,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: global_label, kind: fixup_Mips_PC16
# CHECK: nop
bge $7, $0, local_label
# CHECK: bgez $7, local_label # encoding: [0x04,0xe1,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bge $0, $8, local_label
# CHECK: blez $8, local_label # encoding: [0x19,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bge $0, $0, local_label
# WARNING: :[[@LINE-1]]:3: warning: branch is always taken
# CHECK: bgez $zero, local_label # encoding: [0x04,0x01,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgeu $7, $8, local_label
# CHECK: sltu $1, $7, $8 # encoding: [0x00,0xe8,0x08,0x2b]
# CHECK: beqz $1, local_label # encoding: [0x10,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgeu $7, $8, global_label
# CHECK: sltu $1, $7, $8 # encoding: [0x00,0xe8,0x08,0x2b]
# CHECK: beqz $1, global_label # encoding: [0x10,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: global_label, kind: fixup_Mips_PC16
# CHECK: nop
bgeu $7, $0, local_label
# WARNING: :[[@LINE-1]]:3: warning: branch is always taken
# CHECK: b local_label # encoding: [0x10,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgeu $0, $8, local_label
# CHECK: beqz $8, local_label # encoding: [0x11,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgeu $0, $0, local_label
# WARNING: :[[@LINE-1]]:3: warning: branch is always taken
# CHECK: b local_label # encoding: [0x10,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgt $7, $8, local_label
# CHECK: slt $1, $8, $7 # encoding: [0x01,0x07,0x08,0x2a]
# CHECK: bnez $1, local_label # encoding: [0x14,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgt $7, $8, global_label
# CHECK: slt $1, $8, $7 # encoding: [0x01,0x07,0x08,0x2a]
# CHECK: bnez $1, global_label # encoding: [0x14,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: global_label, kind: fixup_Mips_PC16
# CHECK: nop
bgt $7, $0, local_label
# CHECK: bgtz $7, local_label # encoding: [0x1c,0xe0,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgt $0, $8, local_label
# CHECK: bltz $8, local_label # encoding: [0x05,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgt $0, $0, local_label
# CHECK: bgtz $zero, local_label # encoding: [0x1c,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgtu $7, $8, local_label
# CHECK: sltu $1, $8, $7 # encoding: [0x01,0x07,0x08,0x2b]
# CHECK: bnez $1, local_label # encoding: [0x14,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgtu $7, $8, global_label
# CHECK: sltu $1, $8, $7 # encoding: [0x01,0x07,0x08,0x2b]
# CHECK: bnez $1, global_label # encoding: [0x14,0x20,A,A]
# CHECK: # fixup A - offset: 0, value: global_label, kind: fixup_Mips_PC16
# CHECK: nop
bgtu $7, $0, local_label
# CHECK: bnez $7, local_label # encoding: [0x14,0xe0,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop
bgtu $0, $8, local_label
# CHECK: nop
bgtu $0, $0, local_label
# CHECK: bnez $zero, local_label # encoding: [0x14,0x00,A,A]
# CHECK: # fixup A - offset: 0, value: local_label, kind: fixup_Mips_PC16
# CHECK: nop

View File

@@ -20,6 +20,46 @@
beq $2, 0, 1332
beq $2, 1, 1332
blt $7, $8, local_label
blt $7, $0, local_label
blt $0, $8, local_label
blt $0, $0, local_label
bltu $7, $8, local_label
bltu $7, $0, local_label
bltu $0, $8, local_label
bltu $0, $0, local_label
ble $7, $8, local_label
ble $7, $0, local_label
ble $0, $8, local_label
ble $0, $0, local_label
bleu $7, $8, local_label
bleu $7, $0, local_label
bleu $0, $8, local_label
bleu $0, $0, local_label
bge $7, $8, local_label
bge $7, $0, local_label
bge $0, $8, local_label
bge $0, $0, local_label
bgeu $7, $8, local_label
bgeu $7, $0, local_label
bgeu $0, $8, local_label
bgeu $0, $0, local_label
bgt $7, $8, local_label
bgt $7, $0, local_label
bgt $0, $8, local_label
bgt $0, $0, local_label
bgtu $7, $8, local_label
bgtu $7, $0, local_label
bgtu $0, $8, local_label
bgtu $0, $0, local_label
add $4, $5, $6
.set noreorder
@@ -56,5 +96,77 @@
beq $2, 1, 1332
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
blt $7, $8, local_label
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
blt $7, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
blt $0, $8, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
blt $0, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bltu $7, $8, local_label
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bltu $7, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bltu $0, $8, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bltu $0, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
ble $7, $8, local_label
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
ble $7, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
ble $0, $8, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
ble $0, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bleu $7, $8, local_label
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bleu $7, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bleu $0, $8, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bleu $0, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bge $7, $8, local_label
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bge $7, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bge $0, $8, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bge $0, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgeu $7, $8, local_label
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgeu $7, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgeu $0, $8, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgeu $0, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgt $7, $8, local_label
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgt $7, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgt $0, $8, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgt $0, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgtu $7, $8, local_label
# CHECK: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgtu $7, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgtu $0, $8, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
bgtu $0, $0, local_label
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions
add $4, $5, $6
# CHECK-NOT: [[@LINE-1]]:3: warning: macro instruction expanded into multiple instructions