From 656b840e7f5ee0eff08729146c4fc797c63968e1 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 30 Sep 2020 22:50:26 -0700 Subject: 6911 - comparing floats It turns out floating-point operations set different flags than most instructions. We have to branch on them using unsigned jumps. https://stackoverflow.com/questions/7057501/x86-assembler-floating-point-compare/7057771#7057771 --- 014indirect_addressing.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to '014indirect_addressing.cc') diff --git a/014indirect_addressing.cc b/014indirect_addressing.cc index fa679d6f..04b65215 100644 --- a/014indirect_addressing.cc +++ b/014indirect_addressing.cc @@ -538,7 +538,7 @@ void test_compare_mem_at_r32_with_r32_equal() { put_new(Name, "3b", "compare: set SF if r32 < rm32 (cmp)"); :(code) -void test_compare_r32_with_mem_at_r32_greater() { +void test_compare_r32_with_mem_at_rm32_greater() { Reg[EAX].i = 0x2000; Reg[EBX].i = 0x0a0b0c0d; run( @@ -576,7 +576,7 @@ case 0x3b: { // set SF if r32 < r/m32 } :(code) -void test_compare_r32_with_mem_at_r32_lesser_unsigned_and_signed() { +void test_compare_r32_with_mem_at_rm32_lesser_unsigned_and_signed() { Reg[EAX].i = 0x2000; Reg[EBX].i = 0x0a0b0c07; run( @@ -595,7 +595,7 @@ void test_compare_r32_with_mem_at_r32_lesser_unsigned_and_signed() { ); } -void test_compare_r32_with_mem_at_r32_lesser_unsigned_and_signed_due_to_overflow() { +void test_compare_r32_with_mem_at_rm32_lesser_unsigned_and_signed_due_to_overflow() { Reg[EAX].i = 0x2000; Reg[EBX].i = 0x7fffffff; // largest positive signed integer run( @@ -614,7 +614,7 @@ void test_compare_r32_with_mem_at_r32_lesser_unsigned_and_signed_due_to_overflow ); } -void test_compare_r32_with_mem_at_r32_lesser_signed() { +void test_compare_r32_with_mem_at_rm32_lesser_signed() { Reg[EAX].i = 0x2000; Reg[EBX].i = 0xffffffff; // -1 run( @@ -633,7 +633,7 @@ void test_compare_r32_with_mem_at_r32_lesser_signed() { ); } -void test_compare_r32_with_mem_at_r32_lesser_unsigned() { +void test_compare_r32_with_mem_at_rm32_lesser_unsigned() { Reg[EAX].i = 0x2000; Reg[EBX].i = 0x00000001; // 1 run( @@ -652,7 +652,7 @@ void test_compare_r32_with_mem_at_r32_lesser_unsigned() { ); } -void test_compare_r32_with_mem_at_r32_equal() { +void test_compare_r32_with_mem_at_rm32_equal() { Reg[EAX].i = 0x2000; Reg[EBX].i = 0x0a0b0c0d; run( -- cgit 1.4.1-2-gfad0