09-12-2016
算数与逻辑操作指令
| 指令 | 效果 | 全称 | 描述 |
|---|---|---|---|
| leaq S,D | D←&S | load effective address quadword | 加载有效地址 |
| INC D | D←D+1 | increase | 加1 |
| DEC D | D←D-1 | decrease | 减1 |
| NEG D | D←-D | negative | 取负 |
| NOT D | D←~D | not | 取补 |
| ADD S,D | D←D+S | add | 加 |
| SUB S,D | D←D-S | substract | 减 |
| IMUL S,D | D←D*S | signed multiplication | 有符号乘 |
| MUL S,D | D←D*S | multiplication | 无符号乘 |
| XOR S,D | D←D^S | exclusive or | 异或 |
| OR S,D | D←D|S | or | 或 |
| AND S,D | D←D&S | and | 与 |
| SAL k,D | D←D«k | shift arithmatic left | 左移 |
| SHL k,D | D←D«k | shift left | 左移 |
| SAR k,D | D←D»k | shift arithmatic right | 算术右移 |
| SHR k,D | D←D»>k | shift right | 右移 |
大写指令后添加指令后缀指定操作的数据类型。
右移需要处理符号位所以区分右移与算术右移,左移不需要所以SAL与SHL的操作是一样的。
特殊的算数操作
| 指令 | 效果 | 全称 | 描述 |
|---|---|---|---|
| imulq S | R[%rdx]:R[%rax]←S*R[%rax] | signed multiplication quadword | 有符号全乘法 |
| mulq S | R[%rdx]:R[%rax]←S*R[%rax] | multiplication quadword | 无符号全乘法 |
| cqto | R[%rdx]:R[%rax]←符号扩展(R[%rax]) | convert quadword to octoword | 转换为八字 |
| idivq S | R[%rdx]←R[%rdx]:R[%rax] mod S R[%rax]←R[%rdx]:R[%rax] ÷ S |
signed divide | 有符号除法 |
| divq S | R[%rdx]←R[%rdx]:R[%rax] mod S R[%rax]←R[%rdx]:R[%rax] ÷ S |
divide | 无符号除法 |