中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

选项 --param=vect-alias-flexible-segment-len=n

说明

允许更短的循环进入向量化。

使用方法

使用参数--param=vect-alias-flexible-segment-len=1使能,默认为0

注:此优化需要和-O2 -ftree-vectorize共同使用。

结果

测试用例如下:

1
2
3
4
5
6
7
8
#define TYPE int
#define SIZE 257
void __attribute__ ((weak))
f (TYPE *x, TYPE *y, unsigned short n, long m __attribute__((unused)))
{
  for (int i = 0; i < SIZE; ++i)
    x[i * n] += y[i * n];
}

测试命令:

1
gcc -march=armv8.2-a+sve -O2 -ftree-vectorize --param=vect-alias-flexible-segment-len=1 -S test.c -o test.s
图1 选项未打开
图2 选项已经打开

相比选项未打开时,选项打开后,生成的汇编代码指令使用了ld1w、st1w等指令。