commit b4ead6dd41c3234b491c803fe513580363f38998
Author: sewardj <sewardj@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Wed Jul 20 16:35:55 2016 +0000
Enable PCMPxSTRx cases 0x70 and 0x19. Fixes #359952.
git-svn-id: svn://svn.valgrind.org/vex/trunk@3228 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c
index 936d16f..4c9a122 100644
--- a/VEX/priv/guest_amd64_toIR.c
+++ b/VEX/priv/guest_amd64_toIR.c
@@ -18671,10 +18671,11 @@ static Long dis_PCMPxSTRx ( const VexAbiInfo* vbi, Prefix pfx,
case 0x12: case 0x14: case 0x18: case 0x1A:
case 0x30: case 0x34: case 0x38: case 0x3A:
case 0x40: case 0x42: case 0x44: case 0x46: case 0x4A:
+ case 0x70:
break;
// the 16-bit character versions of the above
case 0x01: case 0x03: case 0x09: case 0x0B: case 0x0D:
- case 0x13: case 0x1B:
+ case 0x13: case 0x19: case 0x1B:
case 0x39: case 0x3B:
case 0x45: case 0x4B:
break;
diff --git a/VEX/priv/guest_generic_x87.c b/VEX/priv/guest_generic_x87.c
index 2c9b25b..9a3c603 100644
--- a/VEX/priv/guest_generic_x87.c
+++ b/VEX/priv/guest_generic_x87.c
@@ -799,6 +799,7 @@ Bool compute_PCMPxSTRx ( /*OUT*/V128* resV,
case 0x12: case 0x14: case 0x18: case 0x1A:
case 0x30: case 0x34: case 0x38: case 0x3A:
case 0x40: case 0x42: case 0x44: case 0x46: case 0x4A:
+ case 0x70:
break;
default:
return False;
@@ -1047,7 +1048,7 @@ Bool compute_PCMPxSTRx_wide ( /*OUT*/V128* resV,
unvalidated cases in the code base. */
switch (imm8) {
case 0x01: case 0x03: case 0x09: case 0x0B: case 0x0D:
- case 0x13: case 0x1B:
+ case 0x13: case 0x19: case 0x1B:
case 0x39: case 0x3B:
case 0x45: case 0x4B:
break;
commit b5ca153e38556e9e4bef0a79c99e3ab6a7e47056
Author: sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Jul 20 16:37:09 2016 +0000
Add test cases for PCMPxSTRx cases 0x70 and 0x19. Pertains to #359952.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15910 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/amd64/pcmpstr64.c b/none/tests/amd64/pcmpstr64.c
index 0694012..2b48c72 100644
--- a/none/tests/amd64/pcmpstr64.c
+++ b/none/tests/amd64/pcmpstr64.c
@@ -207,6 +207,7 @@ Bool pcmpXstrX_WRK ( /*OUT*/V128* resV,
case 0x12: case 0x14: case 0x18: case 0x1A:
case 0x30: case 0x34: case 0x38: case 0x3A:
case 0x40: case 0x42: case 0x44: case 0x46: case 0x4A:
+ case 0x70:
break;
default:
return False;
@@ -1971,6 +1972,86 @@ void istri_14 ( void )
//////////////////////////////////////////////////////////
// //
+// ISTRI_70 //
+// //
+//////////////////////////////////////////////////////////
+
+UInt h_pcmpistri_70 ( 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 $0x70, %%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_70 ( 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),
+ 0x70, False/*!isSTRM*/
+ );
+ assert(ok);
+ resECX = resV.uInt[0];
+ return (resOSZACP << 16) | resECX;
+}
+
+void istri_70 ( void )
+{
+ char* wot = "70";
+ UInt(*h)(V128*,V128*) = h_pcmpistri_70;
+ UInt(*s)(V128*,V128*) = s_pcmpistri_70;
+
+ 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 //
// //
//////////////////////////////////////////////////////////
@@ -1995,5 +2076,6 @@ int main ( void )
istri_0E();
istri_14();
istri_34();
+ istri_70();
return 0;
}
diff --git a/none/tests/amd64/pcmpstr64.stdout.exp b/none/tests/amd64/pcmpstr64.stdout.exp
index 4921586..55d7fe0 100644
--- a/none/tests/amd64/pcmpstr64.stdout.exp
+++ b/none/tests/amd64/pcmpstr64.stdout.exp
@@ -458,3 +458,25 @@ istri 34 163887ec041a9b72 fcd75adb9b3e895a -> 08410000 08410000
istri 34 fc937cbfbf53f8e2 0d136bcb024d3fb7 -> 08810000 08810000
istri 34 2ca34182c29a82ab 302ebd646775ab54 -> 08810000 08810000
istri 34 3f2987608c11be6f a9ecb661f8e0a8cb -> 08c10000 08c10000
+istri 70 abcdacbdabcdabcd 000000000000000a -> 0881000e 0881000e
+istri 70 abcdabcdabcdabcd 000000000000000b -> 0881000f 0881000f
+istri 70 abcdabcdabcdabcd 00000000000000ab -> 0881000d 0881000d
+istri 70 abcdabc0abcdabcd 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcdabcd 000000000000abcd -> 00800010 00800010
+istri 70 0bcdabcdabcdabcd 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcda0cd 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcdab0d 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcdabc0 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcdabcd 000000000000abcd -> 00800010 00800010
+istri 70 abcdabcdabcdabcd 000000000000a0cd -> 0081000f 0081000f
+istri 70 abcdabcdabcdabcd 000000000000ab0d -> 0081000f 0081000f
+istri 70 abcdabcdabcdabcd 000000000000abc0 -> 0881000f 0881000f
+istri 70 0000000000000000 0000000000000000 -> 00c00010 00c00010
+istri 70 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000010 00000010
+istri 70 0000abcdabcdabcd 000000000000abcd -> 00c00010 00c00010
+istri 70 0000abcdabcdabcd 000000000000dcba -> 00c00010 00c00010
+istri 70 0000abcdabcdabcd 000000000000bbbb -> 08c1000b 08c1000b
+istri 70 0000abcdabcdabcd 000000000000baba -> 08c10009 08c10009
+istri 70 0000abcdabcdabcd 00000000000baba0 -> 08c1000b 08c1000b
+istri 70 0ddc0ffeebadf00d 00000000cafebabe -> 08c10000 08c10000
+istri 70 0ddc0ffeebadfeed 00000000cafebabe -> 08c10004 08c10004
diff --git a/none/tests/amd64/pcmpstr64w.c b/none/tests/amd64/pcmpstr64w.c
index 858cfd8..6a1adad 100644
--- a/none/tests/amd64/pcmpstr64w.c
+++ b/none/tests/amd64/pcmpstr64w.c
@@ -209,7 +209,7 @@ Bool pcmpXstrX_WRK_wide ( /*OUT*/V128* resV,
unvalidated cases in the code base. */
switch (imm8) {
case 0x01: case 0x03: case 0x09: case 0x0B: case 0x0D:
- case 0x13: case 0x1B:
+ case 0x13: case 0x19: case 0x1B:
case 0x39: case 0x3B:
case 0x45: case 0x4B:
break;
@@ -1255,6 +1255,99 @@ void istri_39 ( void )
//////////////////////////////////////////////////////////
// //
+// ISTRI_19 //
+// //
+//////////////////////////////////////////////////////////
+
+UInt h_pcmpistri_19 ( 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 $0x19, %%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_19 ( V128* argLU, V128* argRU )
+{
+ V128 resV;
+ UInt resOSZACP, resECX;
+ Bool ok
+ = pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
+ zmask_from_V128(argLU),
+ zmask_from_V128(argRU),
+ 0x19, False/*!isSTRM*/
+ );
+ assert(ok);
+ resECX = resV.uInt[0];
+ return (resOSZACP << 16) | resECX;
+}
+
+void istri_19 ( void )
+{
+ char* wot = "19";
+ UInt(*h)(V128*,V128*) = h_pcmpistri_19;
+ UInt(*s)(V128*,V128*) = s_pcmpistri_19;
+
+ try_istri(wot,h,s, "0000000000000000", "0000000000000000");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaa2aaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaa2aaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaa2aa", "aaaaaaaaaaaaaaaa");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaa2aaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaa2aaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa2a");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "baaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "b9aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+
+ try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaa7aaa");
+ try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaa2aaa4aaa");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
+ try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaa00aa");
+
+ try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
+ try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaa00aa");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaa00aaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaa00aaaaaa");
+
+ try_istri(wot,h,s, "0000000000000000", "aaaaaaaa00aaaaaa");
+ try_istri(wot,h,s, "8000000000000000", "aaaaaaaa00aaaaaa");
+ try_istri(wot,h,s, "0000000000000001", "aaaaaaaa00aaaaaa");
+
+ try_istri(wot,h,s, "0000000000000000", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "0000000000000000");
+}
+
+
+
+//////////////////////////////////////////////////////////
+// //
// main //
// //
//////////////////////////////////////////////////////////
@@ -1271,5 +1364,6 @@ int main ( void )
istri_45();
istri_01();
istri_39();
+ istri_19();
return 0;
}
diff --git a/none/tests/amd64/pcmpstr64w.stdout.exp b/none/tests/amd64/pcmpstr64w.stdout.exp
index 77d555d..c18184c 100644
--- a/none/tests/amd64/pcmpstr64w.stdout.exp
+++ b/none/tests/amd64/pcmpstr64w.stdout.exp
@@ -258,3 +258,33 @@ istri 39 8000000000000000 aaaaaaaa00aaaaaa -> 00c10003 00c10003
istri 39 0000000000000001 aaaaaaaa00aaaaaa -> 08c10000 08c10000
istri 39 0000000000000000 aaaaaaaaaaaaaaaa -> 00400008 00400008
istri 39 aaaaaaaaaaaaaaaa 0000000000000000 -> 08810000 08810000
+istri 19 0000000000000000 0000000000000000 -> 00c00008 00c00008
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000008 00000008
+istri 19 aaaa2aaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010005 00010005
+istri 19 aaaaaaaaa2aaaaaa aaaaaaaaaaaaaaaa -> 00010003 00010003
+istri 19 aaaaaaaaaaaaa2aa aaaaaaaaaaaaaaaa -> 00010001 00010001
+istri 19 aaaaaaaaaaaaaaaa aaaa2aaaaaaaaaaa -> 00010005 00010005
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaa2aaaaaa -> 00010003 00010003
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaa2a -> 08010000 08010000
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000008 00000008
+istri 19 baaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010007 00010007
+istri 19 b9aaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010007 00010007
+istri 19 b9baaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010006 00010006
+istri 19 b9baaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010006 00010006
+istri 19 b9baaaaaaaaaaaaa aaaaaaaaaaaa7aaa -> 00010001 00010001
+istri 19 b9baaaaaaaaaaaaa aaaaaaaa2aaa4aaa -> 00010001 00010001
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000008 00000008
+istri 19 aaaaaaaaaaaa00aa aaaaaaaaaaaaaaaa -> 00410001 00410001
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaa00aa -> 00810001 00810001
+istri 19 aaaaaaaaaaaa00aa aaaaaaaaaaaa00aa -> 00c00008 00c00008
+istri 19 aaaaaaaa00aaaaaa aaaaaaaaaaaaaaaa -> 00410003 00410003
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaa00aa -> 00810001 00810001
+istri 19 aaaaaaaa00aaaaaa aaaaaaaaaaaa00aa -> 00c10001 00c10001
+istri 19 aaaaaaaaaaaa00aa aaaaaaaaaaaaaaaa -> 00410001 00410001
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaa00aaaaaa -> 00810003 00810003
+istri 19 aaaaaaaaaaaa00aa aaaaaaaa00aaaaaa -> 00c10001 00c10001
+istri 19 0000000000000000 aaaaaaaa00aaaaaa -> 08c10000 08c10000
+istri 19 8000000000000000 aaaaaaaa00aaaaaa -> 08c10000 08c10000
+istri 19 0000000000000001 aaaaaaaa00aaaaaa -> 08c10000 08c10000
+istri 19 0000000000000000 aaaaaaaaaaaaaaaa -> 08410000 08410000
+istri 19 aaaaaaaaaaaaaaaa 0000000000000000 -> 08810000 08810000