This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

illegal instruction?


I'm trying to  write a program that uses the  mmx intrinsic instructions
in order to get a faster code but I'm having some problems...

The little test code is

#include <mmintrin.h>
                                                                                                               
int main(void) {
        __m64 temp, soglie_minime;
        unsigned char rossomin = 1;
        unsigned char verdemin = 2;
        unsigned char blumin = 2;
        unsigned char rossomax = 3;
        unsigned char verdemax = 4;
        unsigned char blumax = 5;
                                                                                                               
        temp = _mm_cvtsi32_si64 ( (unsigned int) (blumin << 16) + (verdemin << 8) + rossomin);
        soglie_minime = _mm_slli_si64 (temp, 32);
        _mm_add_si64 (temp, soglie_minime);
                                                                                                               
        return 0;
}

which is compiled with gcc-3.3 -mmmx -g test.c -o test

If I run it I get illegal instruction, with gdb I see this:

14              _mm_add_si64 (temp, soglie_minime);
(gdb) step
_mm_add_si64 (__m1={131585, 0}, __m2={0, 131585}) at /usr/lib/gcc-lib/i386-linux/3.3/include/mmintrin.h:192
192       return (__m64) __builtin_ia32_paddq ((long long)__m1, (long long)__m2);
(gdb) step
 
Program received signal SIGILL, Illegal instruction.
0x080483e0 in _mm_add_si64 (__m1={131585, 0}, __m2={0, 131585})
    at /usr/lib/gcc-lib/i386-linux/3.3/include/mmintrin.h:192
192       return (__m64) __builtin_ia32_paddq ((long long)__m1, (long long)__m2);
(gdb)

What's the meaning of it? what's wrong?

Thank you.

PS: I don't understand if I have to do
_mm_add_si64 (temp, soglie_minime); or soglie_minime = _mm_add_si64 (temp, soglie_minime);
which is correct? They both give the same error.

PPS: I don't know if it ca be interesting, my pc has got 2 athlon mp 2000.

-- 
Non c'è più forza nella normalità, c'è solo monotonia.

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]