How to tell GCC that a pointer argument is always double-word-aligned?

前端 未结 6 1662
花落未央
花落未央 2020-12-01 06:37

In my program I have a function that does a simple vector addition c[0:15] = a[0:15] + b[0:15]. The function prototype is:

void vecadd(float * r         


        
6条回答
  •  难免孤独
    2020-12-01 07:18

    I never used it, but there is _attribute_((aligned (8)))

    If I read the documentation right, then it is used this way:

    void vecadd(float * restrict a __attribute__((aligned (8))), 
                float * restrict b __attribute__((aligned (8))), 
                float * restrict c __attribute__((aligned (8))));
    

    see http://ohse.de/uwe/articles/gcc-attributes.html#type-aligned

提交回复
热议问题