This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
MMX comparison behavior
- From: Bin Gan <bingan at cs dot umd dot edu>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Sun, 10 Aug 2003 21:23:36 -0400 (EDT)
- Subject: MMX comparison behavior
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