Commit 9c67b2b7 authored by Roland Levillain's avatar Roland Levillain
Browse files

Fix the handling of `.half' assembler directives.

	* src/inst/program_builder.hxx (inst::ProgramBuilder::add_half):
	Use bitwise ``and'' operators instead of logical ``and''
	operators.
	This mistake was reported by clang++ 3.0.
	* tests/good/print-half.s,
	* tests/good/print-half.ref:
	New test.
	* tests/good/Makefile.am (ASM_FILES): Add print_half.s.
parent 4a1885dc
2012-05-22 Roland Levillain <roland@lrde.epita.fr>
Fix the handling of `.half' assembler directives.
* src/inst/program_builder.hxx (inst::ProgramBuilder::add_half):
Use bitwise ``and'' operators instead of logical ``and''
operators.
This mistake was reported by clang++ 3.0.
* tests/good/print-half.s,
* tests/good/print-half.ref:
New test.
* tests/good/Makefile.am (ASM_FILES): Add print_half.s.
2012-05-22 Roland Levillain <roland@lrde.epita.fr>
Fix the comparison of produced and expected tests outputs.
......
......@@ -89,8 +89,8 @@ namespace inst
ProgramBuilder::add_half(int imm)
{
// FIXME: check that imm is less than 0x10000!
add_byte((imm >> 8) && 0xff);
add_byte(imm && 0xff);
add_byte((imm >> 8) & 0xff);
add_byte(imm & 0xff);
}
inline void
......
......@@ -13,7 +13,8 @@ ASM_FILES = \
fact.s \
gtcd.s \
extended-euclide.s \
modular-exponent.s
modular-exponent.s \
print-half.s
INPUT_FILES = \
read_int.in
......
### Test the `.half' directive.
.data
val:
.half 2046
.half 2047
eol:
.asciiz "\n"
.text
main:
# print_int(val)
lw $a0, val($zero)
li $v0, 1
syscall
# print("\n")
la $a0, eol
li $v0, 4
syscall
# exit(0)
li $a0, 0
li $v0, 10
syscall
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