neon

Why is __ARM_FEATURE_CRC32 not being defined by the compiler?

浪尽此生 提交于 2019-11-28 10:46:40
问题 I've been working on this issue for some time now, and I hope someone can point out my mistake. I guess I can no longer see the forest through the trees. I have a LeMaker HiKey dev board I use for testing. Its AArch64, so its has NEON and the other cpu features like AES, SHA and CRC32: $ cat /proc/cpuinfo Processor : AArch64 Processor rev 3 (aarch64) ... Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 ... When I attempt to compile a program: $ cat test.cxx #if (defined(__ARM_NEON__) ||

SSE _mm_movemask_epi8 equivalent method for ARM NEON

孤人 提交于 2019-11-28 10:24:17
I decided to continue Fast corners optimisation and stucked at _mm_movemask_epi8 SSE instruction. How can i rewrite it for ARM Neon with uint8x16_t input? I know this post is quite outdated but I found it useful to give my (validated) solution. It assumes all ones/all zeroes in every lane of the Input argument. const uint8_t __attribute__ ((aligned (16))) _Powers[16]= { 1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128 }; // Set the powers of 2 (do it once for all, if applicable) uint8x16_t Powers= vld1q_u8(_Powers); // Compute the mask from the input uint64x2_t Mask= vpaddlq_u32

NEON pack vector compare result into bitmap

无人久伴 提交于 2019-11-28 09:46:53
问题 I have a comparison result of comparison of two floating point operands as follows; What I need to do is based on the result of comparison need to perform the following: i.e: neon_gt_res = vcgtq_f32(temp1, temp2); if(neon_gt_res[0]) array[0] |= (unsigned char)0x01; if(neon_gt_res[1]) array[0] |= (unsigned char)0x02; if(neon_gt_res[2]) array[0] |= (unsigned char)0x04; if(neon_gt_res[3]) array[0] |= (unsigned char)0x08; But writing like this is again equivalent to multiple comparison. How do I

How to optimize histogram statistics with neon intrinsics?

亡梦爱人 提交于 2019-11-28 09:40:49
问题 I want to optimize histogram statistic code with neon intrinsics.But I didn't succeed.Here is the c code: #define NUM (7*1024*1024) uint8 src_data[NUM]; uint32 histogram_result[256] = {0}; for (int i = 0; i < NUM; i++) { histogram_result[src_data[i]]++; } Historam statistic is more like serial processing.It's difficult to optimize with neon intrinsics.Does anyone know how to optimize?Thanks in advance. 回答1: You can't vectorise the stores directly, but you can pipeline them, and you can

Unknown register name “q0” in asm (arm64)

风流意气都作罢 提交于 2019-11-28 09:24:41
问题 I'm currently trying to compile my lib for the new arm64 arch. I have a bunch of NEON assembly and for all of them I receive an error Unknown register name "q0" in asm. Even if I write smth simple as this: asm ( "" : : : "q0", "q1", "q2", "q3" ); I thought arm64 supports NEON. Am i missing something ? 回答1: “v0”: scanon$ cat bar.c int foo(void) { __asm__("":::"q0"); return 0; } scanon$ xcrun -sdk iphoneos clang bar.c -arch arm64 -c bar.c:2:16: error: unknown register name 'q0' in asm __asm__("

How to stop GCC from breaking my NEON intrinsics?

大城市里の小女人 提交于 2019-11-28 03:55:51
问题 I need to write optimized NEON code for a project and I'm perfectly happy to write assembly language, but for portability/maintainability I'm using NEON instrinsics. This code needs to be as fast as possible, so I'm using my experience in ARM optimization to properly interleave instructions and avoid pipe stalls. No matter what I do, GCC works against me and creates slower code full of stalls. Does anyone know how to have GCC get out of the way and just translate my intrinsics into code? Here

ARM Cortex-A8: Whats the difference between VFP and NEON

无人久伴 提交于 2019-11-28 03:33:52
In ARM Cortex-A8 processor, I understand what NEON is, it is an SIMD co-processor. But is VFP(Vector Floating Point) unit, which is also a co-processor, works as a SIMD processor? If so which one is better to use? I read few links such as - Link1 Link2 . But not really very clear what they mean. They say that VFP was never intended to be used for SIMD but on Wiki I read the following - " The VFP architecture also supports execution of short vector instructions but these operate on each vector element sequentially and thus do not offer the performance of true SIMD (Single Instruction Multiple

Using an union (encapsulated in a struct) to bypass conversions for neon data types

核能气质少年 提交于 2019-11-27 15:53:17
I made my first approach with vectorization intrinsics with SSE, where there is basically only one data type __m128i . Switching to Neon I found the data types and function prototypes to be much more specific, e.g. uint8x16_t (a vector of 16 unsigned char ), uint8x8x2_t (2 vectors with 8 unsigned char each), uint32x4_t (a vector with 4 uint32_t ) etc. First I was enthusiastic (much easier to find the exact function operating on the desired data type), then I saw what a mess it was when wanting to treat the data in different ways. Using specific casting operators would take me forever. The

Methods to vectorise histogram in SIMD?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 14:23:14
I am trying to implement histogram in Neon. Is it possible to vectorise ? Histogramming is almost impossible to vectorize, unfortunately. You can probably optimise the scalar code somewhat however - a common trick is to use two histograms and then combine them at the end. This allows you to overlap loads/increments/stores and thereby bury some of the serial dependencies and associated latencies. Pseudo code: init histogram 1 to all 0s init histogram 2 to all 0s loop get input value 1 get input value 2 load count for value 1 from histogram 1 load count for value 2 from histogram 2 increment

Android build system, NEON and non-NEON builds

蹲街弑〆低调 提交于 2019-11-27 07:41:46
I want to build my library for armv6, and there is some neon code that I enable at runtime if the device supports it. The neon code uses neon intrinsics, and to be able to compile it, I must enable armeabi-v7a, but that affects regular c-code (it becomes broken on some low-end devices). So, if the android build system wasn't excessively intrusive, I wouldn't have to ask questions, but it seems that there is no way for me to compile one file for armv6 and the other file for arm7-neon. Can anybody give any clues if that's doable? Edit Before trying to reply and wasting internet-ink, it should be