MMX comparison behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am confused about the behavior by _mm_cmpgt_pi8 for GCC 3.2 on red hat
linux 8.

here is the sample code,
------------------------------------------------------------------
#include <mmintrin.h>

int main(){
        __m64 four,testhi, testlo,result;
        int Truth = 0xFFFFFFFF;
	_mm_empty();
        four  = _mm_set1_pi8(4);

        testhi  = _mm_set_pi8(5,5,5,5,3,3,3,3);
        testlo = _mm_set_pi8(3,3,3,3,5,5,5,5);

        printf("testhi = 5,5,5,5,3,3,3,3\n");
        printf("testlo = 3,3,3,3,5,5,5,5\n");
        printf("four = 4,4,4,4,4,4,4,4\n");
        printf("TRUE = %08x\nFalse = %08x\n\n",(int) 0xFFFFFFFF, 0);

        printf("four > testhi ? %08x\n", _mm_cmpgt_pi8(four,testhi));
        printf("testhi > four ? %08x\n", _mm_cmpgt_pi8(testhi,four));

        printf("four > testlo ? %08x\n", _mm_cmpgt_pi8(four,testlo));
        printf("testlo > four ? %08x\n", _mm_cmpgt_pi8(testlo,four));
	_mm_empty();
        return 0;
}
---------------------------------file end here--------------------------
the result i get is
testhi = 5,5,5,5,3,3,3,3
testlo = 3,3,3,3,5,5,5,5
four = 4,4,4,4,4,4,4,4
TRUE = ffffffff
False = 00000000

four > testhi ? ffffffff
testhi > four ? 00000000
four > testlo ? 00000000
testlo > four ? ffffffff

so, is there a reason that

[3,3,3,3,5,5,5,5] >[4,4,4,4,4,4,4,4] and
[4,4,4,4,4,4,4,4] > [5,5,5,5,3,3,3,3]

-bin


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux