Skip to content

Commit bb5e52f

Browse files
author
sewardj
committed
Add test cases for PCMPxSTRx cases 0x62 and 0x72, and reformat the associated
switch statements a bit more consistently. Pertains to #353384 and #353727. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15913 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 7a40394 commit bb5e52f

File tree

2 files changed

+216
-5
lines changed

2 files changed

+216
-5
lines changed

none/tests/amd64/pcmpstr64.c

Lines changed: 172 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,16 @@ Bool pcmpXstrX_WRK ( /*OUT*/V128* resV,
203203
even if they would probably work. Life is too short to have
204204
unvalidated cases in the code base. */
205205
switch (imm8) {
206-
case 0x00: case 0x02: case 0x08: case 0x0A: case 0x0C: case 0x0E:
207-
case 0x12: case 0x14: case 0x18: case 0x1A:
208-
case 0x30: case 0x34: case 0x38: case 0x3A:
209-
case 0x40: case 0x42: case 0x44: case 0x46: case 0x4A:
210-
case 0x70:
206+
case 0x00: case 0x02:
207+
case 0x08: case 0x0A: case 0x0C: case 0x0E:
208+
case 0x12: case 0x14:
209+
case 0x18: case 0x1A:
210+
case 0x30: case 0x34:
211+
case 0x38: case 0x3A:
212+
case 0x40: case 0x42: case 0x44: case 0x46:
213+
case 0x4A:
214+
case 0x62:
215+
case 0x70: case 0x72:
211216
break;
212217
default:
213218
return False;
@@ -2050,6 +2055,166 @@ void istri_70 ( void )
20502055
}
20512056

20522057

2058+
//////////////////////////////////////////////////////////
2059+
// //
2060+
// ISTRI_62 //
2061+
// //
2062+
//////////////////////////////////////////////////////////
2063+
2064+
UInt h_pcmpistri_62 ( V128* argL, V128* argR )
2065+
{
2066+
V128 block[2];
2067+
memcpy(&block[0], argL, sizeof(V128));
2068+
memcpy(&block[1], argR, sizeof(V128));
2069+
ULong res, flags;
2070+
__asm__ __volatile__(
2071+
"subq $1024, %%rsp" "\n\t"
2072+
"movdqu 0(%2), %%xmm2" "\n\t"
2073+
"movdqu 16(%2), %%xmm11" "\n\t"
2074+
"pcmpistri $0x62, %%xmm2, %%xmm11" "\n\t"
2075+
"pushfq" "\n\t"
2076+
"popq %%rdx" "\n\t"
2077+
"movq %%rcx, %0" "\n\t"
2078+
"movq %%rdx, %1" "\n\t"
2079+
"addq $1024, %%rsp" "\n\t"
2080+
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
2081+
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
2082+
);
2083+
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
2084+
}
2085+
2086+
UInt s_pcmpistri_62 ( V128* argLU, V128* argRU )
2087+
{
2088+
V128 resV;
2089+
UInt resOSZACP, resECX;
2090+
Bool ok
2091+
= pcmpXstrX_WRK( &resV, &resOSZACP, argLU, argRU,
2092+
zmask_from_V128(argLU),
2093+
zmask_from_V128(argRU),
2094+
0x62, False/*!isSTRM*/
2095+
);
2096+
assert(ok);
2097+
resECX = resV.uInt[0];
2098+
return (resOSZACP << 16) | resECX;
2099+
}
2100+
2101+
void istri_62 ( void )
2102+
{
2103+
char* wot = "62";
2104+
UInt(*h)(V128*,V128*) = h_pcmpistri_62;
2105+
UInt(*s)(V128*,V128*) = s_pcmpistri_62;
2106+
2107+
try_istri(wot,h,s, "abcdacbdabcdabcd", "000000000000000a");
2108+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000000b");
2109+
try_istri(wot,h,s, "abcdabcdabcdabcd", "00000000000000ab");
2110+
try_istri(wot,h,s, "abcdabc0abcdabcd", "000000000000abcd");
2111+
2112+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd");
2113+
try_istri(wot,h,s, "0bcdabcdabcdabcd", "000000000000abcd");
2114+
try_istri(wot,h,s, "abcdabcdabcda0cd", "000000000000abcd");
2115+
try_istri(wot,h,s, "abcdabcdabcdab0d", "000000000000abcd");
2116+
try_istri(wot,h,s, "abcdabcdabcdabc0", "000000000000abcd");
2117+
2118+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd");
2119+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000a0cd");
2120+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000ab0d");
2121+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abc0");
2122+
2123+
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
2124+
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
2125+
2126+
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000abcd");
2127+
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000dcba");
2128+
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000bbbb");
2129+
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000baba");
2130+
2131+
try_istri(wot,h,s, "0000abcdabcdabcd", "00000000000baba0");
2132+
2133+
try_istri(wot,h,s, "0ddc0ffeebadf00d", "00000000cafebabe");
2134+
try_istri(wot,h,s, "0ddc0ffeebadfeed", "00000000cafebabe");
2135+
}
2136+
2137+
2138+
//////////////////////////////////////////////////////////
2139+
// //
2140+
// ISTRI_72 //
2141+
// //
2142+
//////////////////////////////////////////////////////////
2143+
2144+
UInt h_pcmpistri_72 ( V128* argL, V128* argR )
2145+
{
2146+
V128 block[2];
2147+
memcpy(&block[0], argL, sizeof(V128));
2148+
memcpy(&block[1], argR, sizeof(V128));
2149+
ULong res, flags;
2150+
__asm__ __volatile__(
2151+
"subq $1024, %%rsp" "\n\t"
2152+
"movdqu 0(%2), %%xmm2" "\n\t"
2153+
"movdqu 16(%2), %%xmm11" "\n\t"
2154+
"pcmpistri $0x72, %%xmm2, %%xmm11" "\n\t"
2155+
"pushfq" "\n\t"
2156+
"popq %%rdx" "\n\t"
2157+
"movq %%rcx, %0" "\n\t"
2158+
"movq %%rdx, %1" "\n\t"
2159+
"addq $1024, %%rsp" "\n\t"
2160+
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
2161+
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
2162+
);
2163+
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
2164+
}
2165+
2166+
UInt s_pcmpistri_72 ( V128* argLU, V128* argRU )
2167+
{
2168+
V128 resV;
2169+
UInt resOSZACP, resECX;
2170+
Bool ok
2171+
= pcmpXstrX_WRK( &resV, &resOSZACP, argLU, argRU,
2172+
zmask_from_V128(argLU),
2173+
zmask_from_V128(argRU),
2174+
0x72, False/*!isSTRM*/
2175+
);
2176+
assert(ok);
2177+
resECX = resV.uInt[0];
2178+
return (resOSZACP << 16) | resECX;
2179+
}
2180+
2181+
void istri_72 ( void )
2182+
{
2183+
char* wot = "72";
2184+
UInt(*h)(V128*,V128*) = h_pcmpistri_72;
2185+
UInt(*s)(V128*,V128*) = s_pcmpistri_72;
2186+
2187+
try_istri(wot,h,s, "abcdacbdabcdabcd", "000000000000000a");
2188+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000000b");
2189+
try_istri(wot,h,s, "abcdabcdabcdabcd", "00000000000000ab");
2190+
try_istri(wot,h,s, "abcdabc0abcdabcd", "000000000000abcd");
2191+
2192+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd");
2193+
try_istri(wot,h,s, "0bcdabcdabcdabcd", "000000000000abcd");
2194+
try_istri(wot,h,s, "abcdabcdabcda0cd", "000000000000abcd");
2195+
try_istri(wot,h,s, "abcdabcdabcdab0d", "000000000000abcd");
2196+
try_istri(wot,h,s, "abcdabcdabcdabc0", "000000000000abcd");
2197+
2198+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd");
2199+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000a0cd");
2200+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000ab0d");
2201+
try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abc0");
2202+
2203+
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
2204+
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
2205+
2206+
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000abcd");
2207+
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000dcba");
2208+
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000bbbb");
2209+
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000baba");
2210+
2211+
try_istri(wot,h,s, "0000abcdabcdabcd", "00000000000baba0");
2212+
2213+
try_istri(wot,h,s, "0ddc0ffeebadf00d", "00000000cafebabe");
2214+
try_istri(wot,h,s, "0ddc0ffeebadfeed", "00000000cafebabe");
2215+
}
2216+
2217+
20532218
//////////////////////////////////////////////////////////
20542219
// //
20552220
// main //
@@ -2077,5 +2242,7 @@ int main ( void )
20772242
istri_14();
20782243
istri_34();
20792244
istri_70();
2245+
istri_62();
2246+
istri_72();
20802247
return 0;
20812248
}

none/tests/amd64/pcmpstr64.stdout.exp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,3 +480,47 @@ istri 70 0000abcdabcdabcd 000000000000baba -> 08c10009 08c10009
480480
istri 70 0000abcdabcdabcd 00000000000baba0 -> 08c1000b 08c1000b
481481
istri 70 0ddc0ffeebadf00d 00000000cafebabe -> 08c10000 08c10000
482482
istri 70 0ddc0ffeebadfeed 00000000cafebabe -> 08c10004 08c10004
483+
istri 62 abcdacbdabcdabcd 000000000000000a -> 0081000f 0081000f
484+
istri 62 abcdabcdabcdabcd 000000000000000b -> 0081000e 0081000e
485+
istri 62 abcdabcdabcdabcd 00000000000000ab -> 0081000f 0081000f
486+
istri 62 abcdabc0abcdabcd 000000000000abcd -> 08c10007 08c10007
487+
istri 62 abcdabcdabcdabcd 000000000000abcd -> 0881000f 0881000f
488+
istri 62 0bcdabcdabcdabcd 000000000000abcd -> 08c1000e 08c1000e
489+
istri 62 abcdabcdabcda0cd 000000000000abcd -> 08c10001 08c10001
490+
istri 62 abcdabcdabcdab0d 000000000000abcd -> 08c10000 08c10000
491+
istri 62 abcdabcdabcdabc0 000000000000abcd -> 00c00010 00c00010
492+
istri 62 abcdabcdabcdabcd 000000000000abcd -> 0881000f 0881000f
493+
istri 62 abcdabcdabcdabcd 000000000000a0cd -> 0881000d 0881000d
494+
istri 62 abcdabcdabcdabcd 000000000000ab0d -> 0881000c 0881000c
495+
istri 62 abcdabcdabcdabcd 000000000000abc0 -> 00800010 00800010
496+
istri 62 0000000000000000 0000000000000000 -> 00c00010 00c00010
497+
istri 62 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 0801000f 0801000f
498+
istri 62 0000abcdabcdabcd 000000000000abcd -> 08c1000b 08c1000b
499+
istri 62 0000abcdabcdabcd 000000000000dcba -> 08c1000b 08c1000b
500+
istri 62 0000abcdabcdabcd 000000000000bbbb -> 00c1000a 00c1000a
501+
istri 62 0000abcdabcdabcd 000000000000baba -> 00c1000b 00c1000b
502+
istri 62 0000abcdabcdabcd 00000000000baba0 -> 00c00010 00c00010
503+
istri 62 0ddc0ffeebadf00d 00000000cafebabe -> 00c00010 00c00010
504+
istri 62 0ddc0ffeebadfeed 00000000cafebabe -> 00c1000a 00c1000a
505+
istri 72 abcdacbdabcdabcd 000000000000000a -> 0881000e 0881000e
506+
istri 72 abcdabcdabcdabcd 000000000000000b -> 0881000f 0881000f
507+
istri 72 abcdabcdabcdabcd 00000000000000ab -> 0881000d 0881000d
508+
istri 72 abcdabc0abcdabcd 000000000000abcd -> 00c00010 00c00010
509+
istri 72 abcdabcdabcdabcd 000000000000abcd -> 00800010 00800010
510+
istri 72 0bcdabcdabcdabcd 000000000000abcd -> 00c00010 00c00010
511+
istri 72 abcdabcdabcda0cd 000000000000abcd -> 00c00010 00c00010
512+
istri 72 abcdabcdabcdab0d 000000000000abcd -> 00c00010 00c00010
513+
istri 72 abcdabcdabcdabc0 000000000000abcd -> 00c00010 00c00010
514+
istri 72 abcdabcdabcdabcd 000000000000abcd -> 00800010 00800010
515+
istri 72 abcdabcdabcdabcd 000000000000a0cd -> 0081000f 0081000f
516+
istri 72 abcdabcdabcdabcd 000000000000ab0d -> 0081000f 0081000f
517+
istri 72 abcdabcdabcdabcd 000000000000abc0 -> 0881000f 0881000f
518+
istri 72 0000000000000000 0000000000000000 -> 00c00010 00c00010
519+
istri 72 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000010 00000010
520+
istri 72 0000abcdabcdabcd 000000000000abcd -> 00c00010 00c00010
521+
istri 72 0000abcdabcdabcd 000000000000dcba -> 00c00010 00c00010
522+
istri 72 0000abcdabcdabcd 000000000000bbbb -> 08c1000b 08c1000b
523+
istri 72 0000abcdabcdabcd 000000000000baba -> 08c10009 08c10009
524+
istri 72 0000abcdabcdabcd 00000000000baba0 -> 08c1000b 08c1000b
525+
istri 72 0ddc0ffeebadf00d 00000000cafebabe -> 08c10000 08c10000
526+
istri 72 0ddc0ffeebadfeed 00000000cafebabe -> 08c10004 08c10004

0 commit comments

Comments
 (0)