I just started learning altivec. It's quite easy, actually easier than I expected, I can only recommend you to try.
What you need :
And voilà, you are ready to use altivec
Now let's talk about documentation. At first, I recommend reading the wikipedia article if you don't know anything about altivec. Then, nothing is better than starting with a small Hello world. I followed the instructions given in this document, about PMON on a pegasos. I didn't care about PMON, but the document starts with a 'hello world' in altivec.
Then, after following the basic instructions, I downloaded the complete
AltiVec Technology Programming Interface Manual, it's simple to read, and explains every single altivec commands. By the way, you might need to register on the freescale to have access to the documents.
OK for really lazy people, here is a dummy source code, calculating 1+2+3+4+5. Useless, but I like that
The source code is at the end, here is the result :
vec_int1 = (1,2,3,4)
vec_int2 = (0,0,0,5)
vec_int3 = (0,0,0,15)
Now I need to find something interesting to do in altivec, and more important, train myself on algorithm optimization, data prefetching, and so on. Maybe I'll post more about altivec later.
Here is the dummy source code, compile it with :
gcc -maltivec -mabi=altivec test.c -o test
#include <altivec.h>
#include <stdio.h>
void print_char_vector(vector unsigned char *this_one);
void print_int_vector(vector int *this_one);
vector int vec_int1;
vector int vec_int2;
vector int vec_int3;
int main() {
unsigned int a1[8] __attribute__ ((aligned (16)))
= {1,2,3,4, 0,0,0,5};
vec_int1 = vec_ld(0, (vector int*)a1);
vec_int2 = vec_ld(16, (vector int*)a1);
vec_int3 = vec_sums(vec_int1, vec_int2);
printf("vec_int1 = ");
print_int_vector(&vec_int1);
printf("\n");
printf("vec_int2 = ");
print_int_vector(&vec_int2);
printf("\n");
printf("vec_int3 = ");
print_int_vector(&vec_int3);
printf("\n");
}
void print_int_vector(vector int *this_one) {
printf("(%d,%d,%d,%d)",
((int*)this_one)[0],
((int*)this_one)[1],
((int*)this_one)[2],
((int*)this_one)[3]);
}
Tiens, je me suis dit tout à l'heure : c'est bizarre, en français, le seul mot que j'utilise couramment pour dénommer un africain est "black". Les autres mots sont à connotation raciste, du moins c'est l'impression que ça me donne. Je préfère dire "Ah zut j'ai oublié comment il s'appelle mon voisin black" plutot que "mon voisin noir". La langue française n'est pas très sympatique pour certaines choses. J'ai l'impression qu'à force de racisme ambiant culturel, c'est passé dans la langue, à tel point qu'il est nécessaire d'importer des mots étrangers vierges de toute dérive raciste. Des mots immigrés en quelque sorte ![]()
L'immigration, en plus de diversifier notre culture, assainie notre langue, c'est cool.
Today I went to a shop near the office and made them print the gentoo poster for the upcoming Libre Software Meeting, where kernelsensei and I will organize the gentoo booth. Feel free to use it for your needs, it's a simple A0 poster of the official gentoo logo.
Hello there,
My blog has finally moved here, this place should be its final location.
Let's start with some Perl. I needed to build a small robot to fake human interaction on a web site. Perl provides great tools for that :
that, with the firefox LiveHTTPheader extension, and ethereal, gives you great power.
My small contribution : a trivial patch to add basic authentication in mech-dump, as it is available in lwp-request.
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
| Current | > >> | |||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | ||