Active Topics

 


Reply
Thread Tools
Posts: 46 | Thanked: 392 times | Joined on Apr 2010 @ Stanford University
#1
We have a library we've been developing using scratchbox for the N900, and today I decided to give MADDE a spin, to see how well it does.

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:

....
Code:
g++ -O3 -Wall -mfpu=neon -mfloat-abi=softfp -c processing/Demosaic.cpp -o processing/Demosaic.o
C:/Users/talvala/AppData/Local/Temp/ccYQ7YcJ.s: Assembler messages:
C:/Users/talvala/AppData/Local/Temp/ccYQ7YcJ.s:51: Error: bad instruction `vld1.64 {D8},[r0]!'
C:/Users/talvala/AppData/Local/Temp/ccYQ7YcJ.s:52: Error: bad instruction `vld1.32 {D9[0]},[r0]!'
C:/Users/talvala/AppData/Local/Temp/ccYQ7YcJ.s:53: Error: bad instruction `vld1.64 {D10},[r0]!'
C:/Users/talvala/AppData/Local/Temp/ccYQ7YcJ.s:54: Error: bad instruction `vld1.32 {D11[0]},[r0]!'
C:/Users/talvala/AppData/Local/Temp/ccYQ7YcJ.s:55: Error: bad instruction `vld1.64 {D12},[r0]!'
C:/Users/talvala/AppData/Local/Temp/ccYQ7YcJ.s:56: Error: bad instruction `vld1.32 {D13[0]},[r0]!'
C:/Users/talvala/AppData/Local/Temp/ccYQ7YcJ.s:57: Error: bad instruction `vld1.64 {D14},[r0]!'
....

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?
 
Posts: 62 | Thanked: 97 times | Joined on Dec 2009 @ Finland, Kerava
#2
Where could I get the code, so that I can investigate the problem?
 
Posts: 46 | Thanked: 392 times | Joined on Apr 2010 @ Stanford University
#3
The following sample code compiles fine under scratchbox with
Code:
g++ -mfpu=neon -c test.cpp
It doesn't compile under MADDE with
Code:
mad g++ -mfpu=neon -c test.cpp
test.cpp:
Code:
#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;
}
(Note for those interested in NEON assembly: The above is not fast at all, so don't use it as an example! It's just a quick testcase for compilation)
 
Posts: 1 | Thanked: 0 times | Joined on Apr 2010
#4
Perhaps this bug is relevant?

https://bugs.maemo.org/show_bug.cgi?id=9624
 
Posts: 62 | Thanked: 97 times | Joined on Dec 2009 @ Finland, Kerava
#5
Originally Posted by jlebar View Post
Perhaps this bug is relevant?

https://bugs.maemo.org/show_bug.cgi?id=9624
Yes, this bug is relevant.
 
Posts: 46 | Thanked: 392 times | Joined on Apr 2010 @ Stanford University
#6
Great, thanks. That was the issue, and the fix listed in the bug took care of it.
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:08.