Readd queue runaway optimizations in comparisons
This commit is contained in:
parent
a754602bde
commit
870dcb105d
16
src/main.rs
16
src/main.rs
@ -475,10 +475,10 @@ fn generate_assembly_linux_x64_block(operations: &Vec<Operation>, functions: &Ve
|
|||||||
data.code += "\tmov rax, [queue+8*r12]\n";
|
data.code += "\tmov rax, [queue+8*r12]\n";
|
||||||
data.code += "\tcmp qword rax, [queue+8*r12+8]\n";
|
data.code += "\tcmp qword rax, [queue+8*r12+8]\n";
|
||||||
data.code += "\tcmovg rbx, rcx\n";
|
data.code += "\tcmovg rbx, rcx\n";
|
||||||
data.code += "\tmov qword [queue+8*r13], rbx\n";
|
|
||||||
data.code += "\tadd r12, 2\n";
|
data.code += "\tadd r12, 2\n";
|
||||||
data.code += "\tinc r13\n";
|
|
||||||
data.code += ASSEMBLY_LINUX_X64_TRY_RESET_QUEUE;
|
data.code += ASSEMBLY_LINUX_X64_TRY_RESET_QUEUE;
|
||||||
|
data.code += "\tmov qword [queue+8*r13], rbx\n";
|
||||||
|
data.code += "\tinc r13\n";
|
||||||
}
|
}
|
||||||
"<" =>
|
"<" =>
|
||||||
{
|
{
|
||||||
@ -487,10 +487,10 @@ fn generate_assembly_linux_x64_block(operations: &Vec<Operation>, functions: &Ve
|
|||||||
data.code += "\tmov rax, [queue+8*r12]\n";
|
data.code += "\tmov rax, [queue+8*r12]\n";
|
||||||
data.code += "\tcmp qword rax, [queue+8*r12+8]\n";
|
data.code += "\tcmp qword rax, [queue+8*r12+8]\n";
|
||||||
data.code += "\tcmovl rbx, rcx\n";
|
data.code += "\tcmovl rbx, rcx\n";
|
||||||
data.code += "\tmov qword [queue+8*r13], rbx\n";
|
|
||||||
data.code += "\tadd r12, 2\n";
|
data.code += "\tadd r12, 2\n";
|
||||||
data.code += "\tinc r13\n";
|
|
||||||
data.code += ASSEMBLY_LINUX_X64_TRY_RESET_QUEUE;
|
data.code += ASSEMBLY_LINUX_X64_TRY_RESET_QUEUE;
|
||||||
|
data.code += "\tmov qword [queue+8*r13], rbx\n";
|
||||||
|
data.code += "\tinc r13\n";
|
||||||
}
|
}
|
||||||
">=" =>
|
">=" =>
|
||||||
{
|
{
|
||||||
@ -499,10 +499,10 @@ fn generate_assembly_linux_x64_block(operations: &Vec<Operation>, functions: &Ve
|
|||||||
data.code += "\tmov rax, [queue+8*r12]\n";
|
data.code += "\tmov rax, [queue+8*r12]\n";
|
||||||
data.code += "\tcmp qword rax, [queue+8*r12+8]\n";
|
data.code += "\tcmp qword rax, [queue+8*r12+8]\n";
|
||||||
data.code += "\tcmovge rbx, rcx\n";
|
data.code += "\tcmovge rbx, rcx\n";
|
||||||
data.code += "\tmov qword [queue+8*r13], rbx\n";
|
|
||||||
data.code += "\tadd r12, 2\n";
|
data.code += "\tadd r12, 2\n";
|
||||||
data.code += "\tinc r13\n";
|
|
||||||
data.code += ASSEMBLY_LINUX_X64_TRY_RESET_QUEUE;
|
data.code += ASSEMBLY_LINUX_X64_TRY_RESET_QUEUE;
|
||||||
|
data.code += "\tmov qword [queue+8*r13], rbx\n";
|
||||||
|
data.code += "\tinc r13\n";
|
||||||
}
|
}
|
||||||
"<=" =>
|
"<=" =>
|
||||||
{
|
{
|
||||||
@ -511,10 +511,10 @@ fn generate_assembly_linux_x64_block(operations: &Vec<Operation>, functions: &Ve
|
|||||||
data.code += "\tmov rax, [queue+8*r12]\n";
|
data.code += "\tmov rax, [queue+8*r12]\n";
|
||||||
data.code += "\tcmp qword rax, [queue+8*r12+8]\n";
|
data.code += "\tcmp qword rax, [queue+8*r12+8]\n";
|
||||||
data.code += "\tcmovle rbx, rcx\n";
|
data.code += "\tcmovle rbx, rcx\n";
|
||||||
data.code += "\tmov qword [queue+8*r13], rbx\n";
|
|
||||||
data.code += "\tadd r12, 2\n";
|
data.code += "\tadd r12, 2\n";
|
||||||
data.code += "\tinc r13\n";
|
|
||||||
data.code += ASSEMBLY_LINUX_X64_TRY_RESET_QUEUE;
|
data.code += ASSEMBLY_LINUX_X64_TRY_RESET_QUEUE;
|
||||||
|
data.code += "\tmov qword [queue+8*r13], rbx\n";
|
||||||
|
data.code += "\tinc r13\n";
|
||||||
}
|
}
|
||||||
_ => todo!("intrinsic {} {}:{}", name, line, col)
|
_ => todo!("intrinsic {} {}:{}", name, line, col)
|
||||||
}
|
}
|
||||||
|
31
tests/comparisons.qbl
Normal file
31
tests/comparisons.qbl
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
//valid,true
|
||||||
|
//false
|
||||||
|
//true
|
||||||
|
//false
|
||||||
|
//false
|
||||||
|
//false
|
||||||
|
//true
|
||||||
|
//true
|
||||||
|
//:END:
|
||||||
|
|
||||||
|
function bool => str boolToStr
|
||||||
|
{
|
||||||
|
if
|
||||||
|
{
|
||||||
|
"true"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
"false"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1 0 > boolToStr println
|
||||||
|
1 0 < boolToStr println
|
||||||
|
1 0 >= boolToStr println
|
||||||
|
1 0 <= boolToStr println
|
||||||
|
|
||||||
|
1 1 > boolToStr println
|
||||||
|
1 1 < boolToStr println
|
||||||
|
1 1 >= boolToStr println
|
||||||
|
1 1 <= boolToStr println
|
Reference in New Issue
Block a user