---
title: 选项 --param=vect-alias-flexible-segment-len=n
description: "允许更短的循环进入向量化。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevkithistory/hgcc/hist-hgcc/kunpenghgcc_06_0043.html
sourcePath: /source/zh/kunpengdevkithistory/hgcc/hist-hgcc/kunpenghgcc_06_0043.html
indexId: f4db6df09a053e7be8f2ab4c413823d9f727e5613aab2efe008c0ee59a00eaf571
---
# 选项 --param=vect-alias-flexible-segment-len=n

#### 说明

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


#### 使用方法

使用参数--param=vect-alias-flexible-segment-len=1来使能该功能，默认为0。

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


#### 结果

测试用例如下：

```
#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];
}
```

测试命令：

```
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等指令。
