![]() |
2010-04-23
, 09:05
|
Posts: 62 |
Thanked: 97 times |
Joined on Dec 2009
@ Finland, Kerava
|
#2
|
![]() |
2010-04-23
, 17:22
|
Posts: 46 |
Thanked: 392 times |
Joined on Apr 2010
@ Stanford University
|
#3
|
g++ -mfpu=neon -c test.cpp
mad g++ -mfpu=neon -c test.cpp
#include <math.h> #include <string.h> #include <iostream> #include <map> #include <vector> using namespace std; void correctColors_asm(int &red, int &grn, int &blu, int* col_iColorMatrix) { int tmp1, tmp2, tmp3; //Load color values into Q0-Q3 [which are equivalent to D0 - D7] __asm__ volatile("VMOV D0, %[rval], %[rval]\n\t" "VMOV D1, %[rval], %[rval]\n\t" "VMOV D2, %[gval], %[gval]\n\t" "VMOV D3, %[gval], %[gval]\n\t" "VMOV D4, %[bval], %[bval]\n\t" "VMOV D5, %[bval], %[bval]\n\t" "VMOV D6, %[v1], %[v1]\n\t" "VMOV D7, %[v1], %[v1]\n\t" :: [rval] "r" (red), [gval] "r" (grn), [bval] "r" (blu), [v1] "r" (1) : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); //Load color correction matrix into Q4-Q7 [which are equivalent to D8 - D15] __asm__ volatile("MOV r0, %[matrixPtr]" : : [matrixPtr] "r" (col_iColorMatrix) : "r0"); __asm__ volatile("VLD1.64 {D8}, [r0]!" ::: "r0", "d8"); __asm__ volatile("VLD1.32 {D9[0]}, [r0]!" ::: "r0", "d9"); __asm__ volatile("VLD1.64 {D10}, [r0]!" ::: "r0", "d10"); __asm__ volatile("VLD1.32 {D11[0]}, [r0]!" ::: "r0", "d11"); __asm__ volatile("VLD1.64 {D12}, [r0]!" ::: "r0", "d12"); __asm__ volatile("VLD1.32 {D13[0]}, [r0]!" ::: "r0", "d13"); __asm__ volatile("VLD1.64 {D14}, [r0]!" ::: "r0", "d14"); __asm__ volatile("VLD1.32 {D15[0]}, [r0]!" ::: "r0", "d15"); //'matrix' mutliply the vectors together __asm__ volatile("VMUL.I32 Q3, Q3, Q7\n\t" "VMLA.I32 Q3, Q0, Q4\n\t" "VMLA.I32 Q3, Q1, Q5\n\t" "VMLA.I32 Q3, Q2, Q6" ::: "q3"); //ARM has a mov with a right shift built in as one instruction, so right shifting the vector is a waste of time //__asm__ volatile("VSHR.S32 Q3, Q3, #10" ::: "q3"); //extract final rgb values from vector __asm__ volatile("VMOV %[tmp1], %[tmp2], D6" : [tmp1] "=r" (tmp1), [tmp2] "=r" (tmp2) :); __asm__ volatile("VMOV %[tmp3], r0, D7" : [tmp3] "=r" (tmp3) :: "r0"); red = tmp1; grn = tmp2; blu = tmp3; }
![]() |
2010-04-25
, 23:02
|
Posts: 1 |
Thanked: 0 times |
Joined on Apr 2010
|
#4
|
![]() |
2010-04-26
, 07:20
|
Posts: 62 |
Thanked: 97 times |
Joined on Dec 2009
@ Finland, Kerava
|
#5
|
Perhaps this bug is relevant?
https://bugs.maemo.org/show_bug.cgi?id=9624
![]() |
2010-04-27
, 19:13
|
Posts: 46 |
Thanked: 392 times |
Joined on Apr 2010
@ Stanford University
|
#6
|
The library is a very simple Makefile-based system, so I tried to build it in MADDE with a 'mad make'. This mostly worked fine, but then it ran into a file with some inline NEON assembly. The result is:
....
and so on.
The g++ version in MADDE ('mad g++ --version') seems to match the scratchbox version (4.2.1), so I'm at a bit of a loss as to why this won't work.
Anyone have any ideas?