Readd queue runaway optimizations in comparisons

This commit is contained in:
0x4261756D 2023-01-03 20:55:05 +01:00
parent a754602bde
commit 870dcb105d
2 changed files with 39 additions and 8 deletions

View File

@ -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 += "\tcmp qword rax, [queue+8*r12+8]\n";
data.code += "\tcmovg rbx, rcx\n";
data.code += "\tmov qword [queue+8*r13], rbx\n";
data.code += "\tadd r12, 2\n";
data.code += "\tinc r13\n";
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 += "\tcmp qword rax, [queue+8*r12+8]\n";
data.code += "\tcmovl rbx, rcx\n";
data.code += "\tmov qword [queue+8*r13], rbx\n";
data.code += "\tadd r12, 2\n";
data.code += "\tinc r13\n";
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 += "\tcmp qword rax, [queue+8*r12+8]\n";
data.code += "\tcmovge rbx, rcx\n";
data.code += "\tmov qword [queue+8*r13], rbx\n";
data.code += "\tadd r12, 2\n";
data.code += "\tinc r13\n";
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 += "\tcmp qword rax, [queue+8*r12+8]\n";
data.code += "\tcmovle rbx, rcx\n";
data.code += "\tmov qword [queue+8*r13], rbx\n";
data.code += "\tadd r12, 2\n";
data.code += "\tinc r13\n";
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)
}

31
tests/comparisons.qbl Normal file
View 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