[pypy-svn] r58219 - in pypy/branch/oo-jit/pypy/jit/codegen/x86_64: . test
witulski at codespeak.net
witulski at codespeak.net
Thu Sep 18 11:33:54 CEST 2008
Author: witulski
Date: Thu Sep 18 11:33:53 2008
New Revision: 58219
Modified:
pypy/branch/oo-jit/pypy/jit/codegen/x86_64/assembler.py
pypy/branch/oo-jit/pypy/jit/codegen/x86_64/test/test_simple.py
Log:
Added a new Test which adds two nums, seams the return is the cause of all broken tests(neg num bug)
Modified: pypy/branch/oo-jit/pypy/jit/codegen/x86_64/assembler.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/x86_64/assembler.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/x86_64/assembler.py Thu Sep 18 11:33:53 2008
@@ -143,7 +143,8 @@
# The opcodes differs depending on the operands
# Params:
- # W (64bit Operands), R, X, B, Opcode, mod, modrm1, modrm2, tttn(JUMPS), extraopcode
+ # W (64bit Operands), R (permits R8-R15), X (extend Index field), B (extend r/m field),
+ # Opcode, mod, modrm1, modrm2, tttn(JUMPS), extraopcode
# FIXME: rexB is set
_ADD_QWREG_IMM32 = make_two_operand_instr( 1, 0, 0, 0, "\x81", 3, None, 2)
Modified: pypy/branch/oo-jit/pypy/jit/codegen/x86_64/test/test_simple.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/x86_64/test/test_simple.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/x86_64/test/test_simple.py Thu Sep 18 11:33:53 2008
@@ -24,7 +24,7 @@
def test_add_big_num(self):
builder, fp, inputargs_gv, token = make_testbuilder(2)
- genv0 = inputargs_gv[0] #the first argument "place"
+ genv0 = inputargs_gv[0] #the first argument "location"
genv1 = inputargs_gv[1]
genv_result = builder.genop2("int_add", genv0, genv1) #creates the addition and returns the place(register) of the result in genv_result
builder.finish_and_return(token, genv_result)
@@ -32,10 +32,29 @@
assert num == 2280
print num
- def test_add(self):
+ def test_add_twice(self):
builder, fp, inputargs_gv, token = make_testbuilder(2)
genv0 = inputargs_gv[0] #the first argument "place"
genv1 = inputargs_gv[1]
+ genv2 = builder.genop2("int_add", genv0, genv1)
+ genv_result = builder.genop2("int_add", genv2, genv1)
+ builder.finish_and_return(token, genv_result)
+ result = fp(4, 6) # 4+6+6= 16
+ assert result == 16
+ result = fp(2,12) # 2+12+12= 26
+ assert result == 26
+ result = fp(10,-2) # 10+(-2)+(-2) = 6
+ assert result == 6
+ result = fp(-4,0) # -4 +0+0 = -4
+ assert result == -4
+ result = fp(0,-4) # 0+(-4)+(-4) = -8
+ assert result == -8
+
+
+ def test_add(self):
+ builder, fp, inputargs_gv, token = make_testbuilder(2)
+ genv0 = inputargs_gv[0] #the first argument "location"
+ genv1 = inputargs_gv[1]
genv_result = builder.genop2("int_add", genv0, genv1) #creates the addition and returns the place(register) of the result in genv_result
builder.finish_and_return(token, genv_result)
ten = fp(4, 6) # 4+6= 10
@@ -44,7 +63,7 @@
def test_add_neg(self):
builder, fp, inputargs_gv, token = make_testbuilder(2)
- genv0 = inputargs_gv[0] #the first argument "place"
+ genv0 = inputargs_gv[0] #the first argument "location"
genv1 = inputargs_gv[1]
genv_result = builder.genop2("int_add", genv0, genv1) #creates the addition and returns the place(register) of the result in genv_result
builder.finish_and_return(token, genv_result)
@@ -66,7 +85,7 @@
def test_add_imm32(self):
builder, fp, inputargs_gv, token = make_testbuilder(1)
- genv0 = inputargs_gv[0] #the first argument "place"
+ genv0 = inputargs_gv[0] #the first argument "location"
genv_result = builder.genop2("int_add", genv0, rgenop.genconst(1000)) #creates the addition and returns the place(register) of the result in genv_result
builder.finish_and_return(token, genv_result)
num = fp(1111) # 1111+1000 = 2111
@@ -83,17 +102,21 @@
def test_sub(self):
builder, fp, inputargs_gv, token = make_testbuilder(2)
- genv0 = inputargs_gv[0] #the first argument "place"
+ genv0 = inputargs_gv[0] #the first argument "location"
genv1 = inputargs_gv[1]
genv_result = builder.genop2("int_sub", genv0, genv1) #creates the subtraction and returns the place(register) of the result in genv_result
builder.finish_and_return(token, genv_result)
four = fp(10, 6) # 10 - 6 = 4
assert four == 4
+ ten = fp(-2, 8)
+ assert ten == -10
+ ten = fp(-2,-12)
+ assert ten == 10
print four
def test_sub_imm32(self):
builder, fp, inputargs_gv, token = make_testbuilder(1)
- genv0 = inputargs_gv[0] #the first argument "place"
+ genv0 = inputargs_gv[0] #the first argument "location"
genv_result = builder.genop2("int_sub", genv0, rgenop.genconst(2)) #creates the subtraction and returns the place(register) of the result in genv_result
builder.finish_and_return(token, genv_result)
eight = fp(10) # 10-2 = 8
More information about the Pypy-commit
mailing list