# 选项 -mcmlt-arith

#### 说明

对部分四则运算生成cmlt指令，以减少指令数。


#### 使用方法

使用选项-mcmlt-arith使能优化。

注：此优化需要-O3以上优化等级使用。


#### 结果

测试用例如下：

```
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;

void foo( uint32_t *a, uint32_t *b)
{
    for (unsigned i = 0; i < 4; i++)
    {
        uint32_t s = ((a[i]>>((8 * sizeof(uint16_t))-1))
		    &(((uint32_t)1<<(8 * sizeof(uint16_t)))+1))*((uint16_t)-1);
        b[i] = (a[i]+s)^s;
    }
}
```

测试命令：

```
gcc -O3 -mcmlt-arith -S test.c -o test.s
```

图1 选项未开启

图2 选项已经打开

启用该选项后，生成的汇编代码通过cmlt指令简化一组计算指令，相比未启用时指令更少。
