Neon ARM Quick Guide

Neon

See more detailed instructions on this web
While using armv7, all data address must be 16-aligned

Sample


#include <arm_neon.h>

float[N] a;
//=======Use variable========
//base struct, a vector stores 4 float_t
float32x4_t float_vector;
//fetch a vector from an array
float_vector = vld1q_f32(&a[i+offset]);
//store all values to array, use them by using t[i]
float t[4];
vst1q_f32(t, v4_1);

//======Use pointer(good)=====
float32x4_t *v_p;
float32x4_t v_ans;
v_p = (float32x4_t*)(&a[i+offset]);
//v_ans += v_p * int_a
v_ans = vmlaq_n_f32(v_ans, *v_p, int_a); 
offset+=4;
g++ filename.cpp -mfpu=neon

inline NEON

size = ((size - 1) & -64) + 64;
asm volatile (
    "NEONCopy2: \n"
    "   ld1 {V0.4S}, [%1]\n"
    "   st1 {V0.4S}, [%0]\n"
    "   adds %1, %1, #0x10\n"
    "   adds %0, %0, #0x10\n"
    "   SUBS %2,%2,#0x10 \n"
    "   BGT NEONCopy2  \n"
    :"+r"(dst)
    :"r"(src), "r"(size)
);
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值