From: Julian Seward Date: Fri, 18 Oct 2013 10:46:52 +0000 (+0000) Subject: Add test cases for PCMPxSTRx cases 0x30 and 0x40. Pertains to #320998. X-Git-Tag: svn/VALGRIND_3_9_0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f967a860bd71ed1f567e2844c8ec24e6f400222d;p=thirdparty%2Fvalgrind.git Add test cases for PCMPxSTRx cases 0x30 and 0x40. Pertains to #320998. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13654 --- diff --git a/none/tests/amd64/pcmpstr64.c b/none/tests/amd64/pcmpstr64.c index 9e53202160..d28c611708 100644 --- a/none/tests/amd64/pcmpstr64.c +++ b/none/tests/amd64/pcmpstr64.c @@ -206,6 +206,7 @@ Bool pcmpXstrX_WRK ( /*OUT*/V128* resV, case 0x00: case 0x02: case 0x08: case 0x0C: case 0x12: case 0x1A: case 0x38: case 0x3A: case 0x44: case 0x46: case 0x4A: + case 0x30: case 0x40: break; default: return False; @@ -1383,6 +1384,166 @@ void istri_46 ( void ) } +////////////////////////////////////////////////////////// +// // +// ISTRI_30 // +// // +////////////////////////////////////////////////////////// + +UInt h_pcmpistri_30 ( V128* argL, V128* argR ) +{ + V128 block[2]; + memcpy(&block[0], argL, sizeof(V128)); + memcpy(&block[1], argR, sizeof(V128)); + ULong res, flags; + __asm__ __volatile__( + "subq $1024, %%rsp" "\n\t" + "movdqu 0(%2), %%xmm2" "\n\t" + "movdqu 16(%2), %%xmm11" "\n\t" + "pcmpistri $0x30, %%xmm2, %%xmm11" "\n\t" + "pushfq" "\n\t" + "popq %%rdx" "\n\t" + "movq %%rcx, %0" "\n\t" + "movq %%rdx, %1" "\n\t" + "addq $1024, %%rsp" "\n\t" + : /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0]) + : "rcx","rdx","xmm0","xmm2","xmm11","cc","memory" + ); + return ((flags & 0x8D5) << 16) | (res & 0xFFFF); +} + +UInt s_pcmpistri_30 ( V128* argLU, V128* argRU ) +{ + V128 resV; + UInt resOSZACP, resECX; + Bool ok + = pcmpXstrX_WRK( &resV, &resOSZACP, argLU, argRU, + zmask_from_V128(argLU), + zmask_from_V128(argRU), + 0x30, False/*!isSTRM*/ + ); + assert(ok); + resECX = resV.uInt[0]; + return (resOSZACP << 16) | resECX; +} + +void istri_30 ( void ) +{ + char* wot = "30"; + UInt(*h)(V128*,V128*) = h_pcmpistri_30; + UInt(*s)(V128*,V128*) = s_pcmpistri_30; + + try_istri(wot,h,s, "abcdacbdabcdabcd", "000000000000000a"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000000b"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "00000000000000ab"); + try_istri(wot,h,s, "abcdabc0abcdabcd", "000000000000abcd"); + + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd"); + try_istri(wot,h,s, "0bcdabcdabcdabcd", "000000000000abcd"); + try_istri(wot,h,s, "abcdabcdabcda0cd", "000000000000abcd"); + try_istri(wot,h,s, "abcdabcdabcdab0d", "000000000000abcd"); + try_istri(wot,h,s, "abcdabcdabcdabc0", "000000000000abcd"); + + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000a0cd"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000ab0d"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abc0"); + + try_istri(wot,h,s, "0000000000000000", "0000000000000000"); + try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa"); + + try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000abcd"); + try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000dcba"); + try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000bbbb"); + try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000baba"); + + try_istri(wot,h,s, "0000abcdabcdabcd", "00000000000baba0"); + + try_istri(wot,h,s, "0ddc0ffeebadf00d", "00000000cafebabe"); + try_istri(wot,h,s, "0ddc0ffeebadfeed", "00000000cafebabe"); +} + + +////////////////////////////////////////////////////////// +// // +// ISTRI_40 // +// // +////////////////////////////////////////////////////////// + +UInt h_pcmpistri_40 ( V128* argL, V128* argR ) +{ + V128 block[2]; + memcpy(&block[0], argL, sizeof(V128)); + memcpy(&block[1], argR, sizeof(V128)); + ULong res, flags; + __asm__ __volatile__( + "subq $1024, %%rsp" "\n\t" + "movdqu 0(%2), %%xmm2" "\n\t" + "movdqu 16(%2), %%xmm11" "\n\t" + "pcmpistri $0x40, %%xmm2, %%xmm11" "\n\t" + "pushfq" "\n\t" + "popq %%rdx" "\n\t" + "movq %%rcx, %0" "\n\t" + "movq %%rdx, %1" "\n\t" + "addq $1024, %%rsp" "\n\t" + : /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0]) + : "rcx","rdx","xmm0","xmm2","xmm11","cc","memory" + ); + return ((flags & 0x8D5) << 16) | (res & 0xFFFF); +} + +UInt s_pcmpistri_40 ( V128* argLU, V128* argRU ) +{ + V128 resV; + UInt resOSZACP, resECX; + Bool ok + = pcmpXstrX_WRK( &resV, &resOSZACP, argLU, argRU, + zmask_from_V128(argLU), + zmask_from_V128(argRU), + 0x40, False/*!isSTRM*/ + ); + assert(ok); + resECX = resV.uInt[0]; + return (resOSZACP << 16) | resECX; +} + +void istri_40 ( void ) +{ + char* wot = "40"; + UInt(*h)(V128*,V128*) = h_pcmpistri_40; + UInt(*s)(V128*,V128*) = s_pcmpistri_40; + + try_istri(wot,h,s, "abcdacbdabcdabcd", "000000000000000a"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000000b"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "00000000000000ab"); + try_istri(wot,h,s, "abcdabc0abcdabcd", "000000000000abcd"); + + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd"); + try_istri(wot,h,s, "0bcdabcdabcdabcd", "000000000000abcd"); + try_istri(wot,h,s, "abcdabcdabcda0cd", "000000000000abcd"); + try_istri(wot,h,s, "abcdabcdabcdab0d", "000000000000abcd"); + try_istri(wot,h,s, "abcdabcdabcdabc0", "000000000000abcd"); + + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000a0cd"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000ab0d"); + try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abc0"); + + try_istri(wot,h,s, "0000000000000000", "0000000000000000"); + try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa"); + + try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000abcd"); + try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000dcba"); + try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000bbbb"); + try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000baba"); + + try_istri(wot,h,s, "0000abcdabcdabcd", "00000000000baba0"); + + try_istri(wot,h,s, "0ddc0ffeebadf00d", "00000000cafebabe"); + try_istri(wot,h,s, "0ddc0ffeebadfeed", "00000000cafebabe"); +} + + ////////////////////////////////////////////////////////// // // // main // @@ -1402,5 +1563,7 @@ int main ( void ) istri_00(); istri_38(); istri_46(); + istri_30(); + istri_40(); return 0; } diff --git a/none/tests/amd64/pcmpstr64.stdout.exp b/none/tests/amd64/pcmpstr64.stdout.exp index e326d16cd4..58acb7fc36 100644 --- a/none/tests/amd64/pcmpstr64.stdout.exp +++ b/none/tests/amd64/pcmpstr64.stdout.exp @@ -288,3 +288,47 @@ istri 46 163887ec041a9b72 fcd75adb9b3e895a -> 08410006 08410006 istri 46 fc937cbfbf53f8e2 0d136bcb024d3fb7 -> 0881000f 0881000f istri 46 2ca34182c29a82ab 302ebd646775ab54 -> 0081000f 0081000f istri 46 3f2987608c11be6f a9ecb661f8e0a8cb -> 00c10007 00c10007 +istri 30 abcdacbdabcdabcd 000000000000000a -> 08810000 08810000 +istri 30 abcdabcdabcdabcd 000000000000000b -> 08810000 08810000 +istri 30 abcdabcdabcdabcd 00000000000000ab -> 08810000 08810000 +istri 30 abcdabc0abcdabcd 000000000000abcd -> 00c00010 00c00010 +istri 30 abcdabcdabcdabcd 000000000000abcd -> 00800010 00800010 +istri 30 0bcdabcdabcdabcd 000000000000abcd -> 00c00010 00c00010 +istri 30 abcdabcdabcda0cd 000000000000abcd -> 00c00010 00c00010 +istri 30 abcdabcdabcdab0d 000000000000abcd -> 00c00010 00c00010 +istri 30 abcdabcdabcdabc0 000000000000abcd -> 00c00010 00c00010 +istri 30 abcdabcdabcdabcd 000000000000abcd -> 00800010 00800010 +istri 30 abcdabcdabcdabcd 000000000000a0cd -> 00810002 00810002 +istri 30 abcdabcdabcdabcd 000000000000ab0d -> 00810001 00810001 +istri 30 abcdabcdabcdabcd 000000000000abc0 -> 08810000 08810000 +istri 30 0000000000000000 0000000000000000 -> 00c00010 00c00010 +istri 30 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000010 00000010 +istri 30 0000abcdabcdabcd 000000000000abcd -> 00c00010 00c00010 +istri 30 0000abcdabcdabcd 000000000000dcba -> 00c00010 00c00010 +istri 30 0000abcdabcdabcd 000000000000bbbb -> 08c10000 08c10000 +istri 30 0000abcdabcdabcd 000000000000baba -> 08c10000 08c10000 +istri 30 0000abcdabcdabcd 00000000000baba0 -> 08c10000 08c10000 +istri 30 0ddc0ffeebadf00d 00000000cafebabe -> 08c10000 08c10000 +istri 30 0ddc0ffeebadfeed 00000000cafebabe -> 08c10000 08c10000 +istri 40 abcdacbdabcdabcd 000000000000000a -> 0081000f 0081000f +istri 40 abcdabcdabcdabcd 000000000000000b -> 0081000e 0081000e +istri 40 abcdabcdabcdabcd 00000000000000ab -> 0081000f 0081000f +istri 40 abcdabc0abcdabcd 000000000000abcd -> 08c10007 08c10007 +istri 40 abcdabcdabcdabcd 000000000000abcd -> 0881000f 0881000f +istri 40 0bcdabcdabcdabcd 000000000000abcd -> 08c1000e 08c1000e +istri 40 abcdabcdabcda0cd 000000000000abcd -> 08c10001 08c10001 +istri 40 abcdabcdabcdab0d 000000000000abcd -> 08c10000 08c10000 +istri 40 abcdabcdabcdabc0 000000000000abcd -> 00c00010 00c00010 +istri 40 abcdabcdabcdabcd 000000000000abcd -> 0881000f 0881000f +istri 40 abcdabcdabcdabcd 000000000000a0cd -> 0881000d 0881000d +istri 40 abcdabcdabcdabcd 000000000000ab0d -> 0881000c 0881000c +istri 40 abcdabcdabcdabcd 000000000000abc0 -> 00800010 00800010 +istri 40 0000000000000000 0000000000000000 -> 00c00010 00c00010 +istri 40 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 0801000f 0801000f +istri 40 0000abcdabcdabcd 000000000000abcd -> 08c1000b 08c1000b +istri 40 0000abcdabcdabcd 000000000000dcba -> 08c1000b 08c1000b +istri 40 0000abcdabcdabcd 000000000000bbbb -> 00c1000a 00c1000a +istri 40 0000abcdabcdabcd 000000000000baba -> 00c1000b 00c1000b +istri 40 0000abcdabcdabcd 00000000000baba0 -> 00c00010 00c00010 +istri 40 0ddc0ffeebadf00d 00000000cafebabe -> 00c00010 00c00010 +istri 40 0ddc0ffeebadfeed 00000000cafebabe -> 00c1000a 00c1000a