Commit e743985f authored by George Hotz's avatar George Hotz

remove branch likely tests

parent 068c2980
###############################################################################
# File : beql.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'beql' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $t0, $0, 0xcafe
ori $t1, $0, 0xcafe
ori $v0, $0, 0 # The test result starts as a failure
ori $t2, $0, 0
ori $t3, $0, 0
beql $t0, $v0, $finish # Expect no branch, no BDS
ori $t2, $0, 0xcafe
beql $t0, $t1, $target # Expect branch and BDS
nop
$finish:
sw $v0, 8($s0) # Late-by-1 branch detection (result not stored)
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
beql $0, $0, $likely
ori $t3, $0, 0xcafe
j $finish
nop
$likely:
subu $t4, $t3, $t2 # Should be t4 = 0xcafe - 0
subu $t5, $t4, $t0 # Should be t5 = 0xcafe - 0xcafe = 0
beql $0, $0, $finish
sltiu $v0, $t5, 1 # Set the result to pass
#### Test code end ####
.end test
###############################################################################
# File : bgezal.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'bgezal' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $v1, $ra, 0 # Save $ra
ori $v0, $0, 0 # The test result starts as a failure
lui $t0, 0xffff
bgezal $t0, $finish # No branch
nop
bgezal $s1, $target
nop
$finish:
sw $v0, 8($s0)
ori $ra, $v1, 0 # Restore $ra
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
ori $v0, $0, 1 # Set the result to pass
jr $ra
nop
#### Test code end ####
.end test
###############################################################################
# File : bgezall.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'bgezall' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $v1, $ra, 0 # Save $ra
ori $v0, $0, 0 # The test result starts as a failure
lui $t0, 0xffff
ori $t1, $0, 0
ori $t2, $0, 0
bgezall $t0, $finish # No branch, no BDS
ori $t1, $0, 0x1
bgezall $s1, $target
ori $t2, $0, 0x1
j $likely
nop
$finish:
sw $v0, 8($s0)
ori $ra, $v1, 0 # Restore $ra
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
jr $ra
nop
$likely:
subu $t3, $t2, $t1 # Should be t3 = 1 - 0
addiu $t4, $t3, -1 # Should be t4 = 1 - 1 = 0
bgezall $s1, $finish
sltiu $v0, $t4, 1
#### Test code end ####
.end test
###############################################################################
# File : bgezl.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'bgezl' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
lui $t0, 0xffff
ori $t1, $0, 0
ori $t2, $0, 0
bgezl $t0, $finish # No branch, no BDS
ori $t1, $0, 0x1
bgezl $s1, $target
ori $t2, $0, 0x1
$finish:
sw $v0, 8($s0)
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
bgezl $0, $likely
nop
j $finish # Broken branch recovery
nop
$likely:
subu $t3, $t2, $t1 # Should be t3 = 1 - 0
subu $t4, $t3, $s1 # Should be t4 = 1 - 1 = 0
bgezl $s1, $finish
sltiu $v0, $t4, 1
j $finish
ori $v0, $0, 0
#### Test code end ####
.end test
###############################################################################
# File : bgtzl.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'bgtzl' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $v0, $0, 0 # The test result starts as a failure
lui $t0, 0xffff
ori $t1, $0, 0
ori $t2, $0, 0
bgtzl $t0, $finish # No branch, no BDS
ori $t1, $0, 0x1
bgtzl $s1, $target
ori $t2, $0, 0x1
$finish:
sw $v0, 8($s0)
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
bgtzl $s1, $likely # Late-by-1 branch detection (result not stored)
nop
j $finish # Broken branch recovery
nop
$likely:
subu $t3, $t2, $t1 # Should be t3 = 1 - 0
addiu $t4, $t3, -1 # Should be t4 = 1 - 1 = 0
bgtzl $s1, $finish
sltiu $v0, $t4, 1
j $finish
ori $v0, $0, 0
#### Test code end ####
.end test
###############################################################################
# File : blezl.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'blezl' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $v0, $0, 0 # The test result starts as a failure
lui $t0, 0xffff
ori $t1, $0, 0
ori $t2, $0, 0
blezl $s1, $finish # No branch, no BDS
ori $t1, $0, 1
blezl $t0, $target
ori $t2, $0, 1
$finish:
sw $v0, 8($s0)
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
blezl $0, $likely
nop
j $finish
nop
$likely:
subu $t3, $t2, $t1 # Should be t3 = 1 - 0
addiu $t4, $t3, -1 # Should be t4 = 1 - 1 = 0
blezl $t0, $finish
sltiu $v0, $t4, 1
j $finish
ori $v0, $0, 0
#### Test code end ####
.end test
###############################################################################
# File : bltzal.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'bltzal' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $v0, $0, 0 # The test result starts as a failure
ori $v1, $ra, 0 # Save $ra
lui $t0, 0xffff
bltzal $0, $finish # No branch
nop
bltzal $t0, $target
nop
$finish:
sw $v0, 8($s0)
ori $ra, $v1, 0 # Restore $ra
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
ori $v0, $0, 1 # Set the result to pass
jr $ra
nop
#### Test code end ####
.end test
###############################################################################
# File : bltzall.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'bltzall' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $v0, $0, 0 # The test result starts as a failure
ori $v1, $ra, 0 # Save $ra
lui $t0, 0xffff
ori $t1, $0, 0
ori $t2, $0, 0
bltzall $0, $finish # No branch, no BDS
ori $t1, $0, 1
bltzall $t0, $target
ori $t2, $0, 1
j $likely
nop
$finish:
sw $v0, 8($s0)
ori $ra, $v1, 0 # Restore $ra
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
jr $ra
nop
$likely:
subu $t3, $t2, $t1 # Should be t3 = 1 - 0
addiu $t4, $t3, -1 # Should be t4 = 1 - 1 = 0
bltzall $t0, $finish
sltiu $v0, $t4, 1
j $finish
ori $v0, $0, 0
#### Test code end ####
.end test
###############################################################################
# File : bltzl.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'bltzl' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $v0, $0, 0 # The test result starts as a failure
lui $t0, 0xffff
ori $t1, $0, 0
ori $t2, $0, 0
bltzl $0, $finish # No branch, no BDS
ori $t1, $0, 1
bltzl $s1, $finish # No branch, no BDS
ori $t1, $0, 2
bltzl $t0, $target
ori $t2, $0, 1
$finish:
sw $v0, 8($s0)
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
bltzl $t0, $likely
nop
j $finish # Broken branch recovery
nop
$likely:
subu $t3, $t2, $t1 # Should be t3 = 1 - 0
addiu $t4, $t3, -1 # Should be t4 = 1 - 1 = 0
bltzl $t0, $finish
sltiu $v0, $t4, 1
j $finish
ori $v0, $0, 0
#### Test code end ####
.end test
###############################################################################
# File : bnel.asm
# Project : MIPS32 MUX
# Author: : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
# MIPS gas, soft tab, 80 column
#
# Description:
# Test the functionality of the 'bnel' instruction.
#
###############################################################################
.section .test, "x"
.balign 4
.set noreorder
.global test
.ent test
test:
lui $s0, 0xbfff # Load the base address 0xbffffff0
ori $s0, 0xfff0
ori $s1, $0, 1 # Prepare the 'done' status
#### Test code start ####
ori $t0, $0, 0xcafe
ori $t1, $0, 0xcafe
ori $v0, $0, 0 # The test result starts as a failure
ori $t2, $0, 0
ori $t3, $0, 0
bnel $t0, $t1, $finish # No branch, no BDS
ori $t2, $0, 1
bnel $t0, $v0, $target
ori $t3, $0, 1
$finish:
sw $v0, 8($s0)
sw $s1, 4($s0)
$done:
jr $ra
nop
j $finish # Early-by-1 branch detection
$target:
nop
bnel $t0, $0, $likely
nop
j $finish
nop
$likely:
subu $t4, $t3, $t2 # Should be t4 = 1 - 0
addiu $t5, $t4, -1 # Should be t5 = 1 - 1 = 0
bnel $t0, $v0, $finish
sltiu $v0, $t5, 1
j $finish
ori $v0, $0, 0
#### Test code end ####
.end test
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment