算術演算 加減算 addx, y // x ← x + y; sub x, y // x ← x – y; carryつき加減算 adc x, y // x ← x + y + CF; 繰り上がりを加味 sbb x, y // x ← x – y – CF; 繰り下がりを加味 乗算 64bit x 64bit → 128bit mul x // [rdx:rax] ← x * rax (rax, rdxレジスタ固定) 除算 128bit / 64bit = 64bit あまり 64bit div x // [rdx:rax] / x ; 商 : rax, あまり : rdx/ 2810
11.
条件比較 演算結果に応じてフラグが変わる フラグに応じて条件分岐するこういうコードはこんな感じ jg (jmp if greater), jge(jmp if greater or equal)などなど/ 2811if (x >= y) {Aの作業} else {Bの作業}cmp x, y // x-yの計算結果をCFに反映(CF = x >= y ? 0 : 1)jnc LABEL_A // jmp to LABEL_A if no carryBの作業jmp NEXTLABEL_A:Aの作業NEXT: