Selectively disable vectorization
Michael Hope
michael.hope at linaro.org
Wed Apr 11 20:57:39 UTC 2012
On 12 April 2012 04:21, Mans Rullgard <mans.rullgard at linaro.org> wrote:
> On 11 April 2012 16:16, Ulrich Weigand <Ulrich.Weigand at de.ibm.com> wrote:
>> "Singh, Ravi Kumar (Ravi)" <Ravi.Singh at lsi.com> wrote:
>>
>>> Are there any pragmas for selectively disabling (in one chunk of
>>> code) the vectorization, when its enabled globally.
>>
>> No, there are not (just like for all optimization settings).
>
> Are you saying __attribute__((optimise("foo"))) is a lie?
It seems to work on 4.6 on public functions:
void doubleit(int *pout, const int *pin)
{
for (int i = 0; i < 64; i++)
{
pout[i] = pin[i]*2;
}
}
(gets vectorised)
__attribute__((optimize("-fno-tree-vectorize")))
void novect(int *pout, const int *pin)
{
for (int i = 0; i < 64; i++)
{
pout[i] = pin[i]*2;
}
}
(no vector code)
The attribute applies to that function only and doesn't seem to apply
if the function is inlined, such as:
__attribute__((optimize("-fno-tree-vectorize")))
static void novect(int *pout, const int *pin)
...
void outer(int *pin, int *pout)
{
novect(pout, pin);
}
'outer' contains vectorised code.
-- Michael
More information about the linaro-toolchain
mailing list