|
From: <sv...@va...> - 2012-08-23 23:42:59
|
sewardj 2012-08-24 00:42:46 +0100 (Fri, 24 Aug 2012)
New Revision: 12889
Log:
Add tests for MOVBE in 32 bit mode. See 304867. (Ambroz Bizjak,
am...@gm...)
Added files:
trunk/none/tests/x86/movbe.c
trunk/none/tests/x86/movbe.stderr.exp
trunk/none/tests/x86/movbe.stdout.exp
trunk/none/tests/x86/movbe.vgtest
Modified files:
trunk/none/tests/x86/Makefile.am
Added: trunk/none/tests/x86/movbe.c (+77 -0)
===================================================================
--- trunk/none/tests/x86/movbe.c 2012-08-23 21:58:08 +01:00 (rev 12888)
+++ trunk/none/tests/x86/movbe.c 2012-08-24 00:42:46 -23:00 (rev 12889)
@@ -0,0 +1,77 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <malloc.h>
+
+typedef unsigned char UChar;
+typedef unsigned int UInt;
+typedef unsigned long int UWord;
+typedef unsigned long long int ULong;
+
+
+typedef struct { UChar cs[40]; } Block;
+
+void showBlock ( char* msg, Block* b )
+{
+ int i;
+ printf(" %s ", msg);
+ for (i = 0; i < 40; i++)
+ printf("%02x", (UInt)b->cs[i]);
+ printf("\n");
+}
+
+UChar randUChar ( void )
+{
+ static UInt seed = 80021;
+ seed = 1103515245 * seed + 12345;
+ return (seed >> 17) & 0xFF;
+}
+
+void randBlock ( Block* b )
+{
+ int i;
+ UChar* p = (UChar*)b;
+ for (i = 0; i < sizeof(Block); i++)
+ p[i] = randUChar();
+}
+
+/* Generate a function test_NAME, that tests the given insn.
+ The insn may only mention (%eax) and esi. */
+
+#define GEN_test_Monly(_name, _mem_form) \
+ \
+ __attribute__ ((noinline)) static void test_##_name ( void ) \
+ { \
+ Block* b = memalign(32, sizeof(Block)); \
+ randBlock(b); \
+ printf("%s\n", #_name); \
+ showBlock("before", b); \
+ __asm__ __volatile__( \
+ "leal 16(%0),%%eax" "\n\t" \
+ "movl 24(%0),%%esi" "\n\t" \
+ _mem_form "\n\t" \
+ "movl %%esi, 32(%0)" "\n\t" \
+ : /*OUT*/ \
+ : /*IN*/"r"(b) \
+ : /*TRASH*/"esi","eax","memory","cc" \
+ ); \
+ showBlock("after ", b); \
+ printf("\n"); \
+ free(b); \
+ }
+
+GEN_test_Monly( MOVBE_RtoM_32, "movbel %%esi,1(%%eax)")
+GEN_test_Monly( MOVBE_RtoM_16, "movbew %%si,1(%%eax)")
+
+GEN_test_Monly( MOVBE_MtoR_32, "movbel 1(%%eax), %%esi")
+GEN_test_Monly( MOVBE_MtoR_16, "movbew 1(%%eax), %%si")
+
+int main ( void )
+{
+ test_MOVBE_RtoM_32();
+ test_MOVBE_RtoM_16();
+ test_MOVBE_MtoR_32();
+ test_MOVBE_MtoR_16();
+ return 0;
+}
Modified: trunk/none/tests/x86/Makefile.am (+4 -0)
===================================================================
--- trunk/none/tests/x86/Makefile.am 2012-08-23 21:58:08 +01:00 (rev 12888)
+++ trunk/none/tests/x86/Makefile.am 2012-08-24 00:42:46 -23:00 (rev 12889)
@@ -53,6 +53,7 @@
looper.stderr.exp looper.stdout.exp looper.vgtest \
lzcnt32.stderr.exp lzcnt32.stdout.exp lzcnt32.vgtest \
movx.stderr.exp movx.stdout.exp movx.vgtest \
+ movbe.stderr.exp movbe.stdout.exp movbe.vgtest \
pushpopseg.stderr.exp pushpopseg.stdout.exp pushpopseg.vgtest \
sbbmisc.stderr.exp sbbmisc.stdout.exp sbbmisc.vgtest \
shift_ndep.stderr.exp shift_ndep.stdout.exp shift_ndep.vgtest \
@@ -104,6 +105,9 @@
if !VGCONF_OS_IS_DARWIN
check_PROGRAMS += cse_fail faultstatus
endif
+if BUILD_MOVBE_TESTS
+ check_PROGRAMS += movbe
+endif
AM_CFLAGS += @FLAG_M32@ $(FLAG_MMMX) $(FLAG_MSSE)
Added: trunk/none/tests/x86/movbe.stdout.exp (+16 -0)
===================================================================
--- trunk/none/tests/x86/movbe.stdout.exp 2012-08-23 21:58:08 +01:00 (rev 12888)
+++ trunk/none/tests/x86/movbe.stdout.exp 2012-08-24 00:42:46 -23:00 (rev 12889)
@@ -0,0 +1,16 @@
+MOVBE_RtoM_32
+ before 00571784494af2981ecac9199de375513bd127afa6e9c3690d6a95fac528657d501eefeec0d8b847
+ after 00571784494af2981ecac9199de375513bfa956a0de9c3690d6a95fac528657d0d6a95fac0d8b847
+
+MOVBE_RtoM_16
+ before 84c4457d8560b160b244a056e51599fe2751bca75afbd2b6382dccdbc2829139fd673a5c2148a319
+ after 84c4457d8560b160b244a056e51599fe272d38a75afbd2b6382dccdbc2829139382dccdb2148a319
+
+MOVBE_MtoR_32
+ before 179e655064dc2a846b3e625d19775d06e540bc6839c44b4a36ed3550df9899d8979b83b70eb840d7
+ after 179e655064dc2a846b3e625d19775d06e540bc6839c44b4a36ed3550df9899d83968bc400eb840d7
+
+MOVBE_MtoR_16
+ before 856c13b8709950cb8315cab0121ab056db93c0f8294addf95df605a7d127a7d31f195c53c95bf85f
+ after 856c13b8709950cb8315cab0121ab056db93c0f8294addf95df605a7d127a7d3c09305a7c95bf85f
+
Added: trunk/none/tests/x86/movbe.vgtest (+3 -0)
===================================================================
--- trunk/none/tests/x86/movbe.vgtest 2012-08-23 21:58:08 +01:00 (rev 12888)
+++ trunk/none/tests/x86/movbe.vgtest 2012-08-24 00:42:46 -23:00 (rev 12889)
@@ -0,0 +1,3 @@
+prereq: test -e movbe
+prog: movbe
+vgopts: -q
Added: trunk/none/tests/x86/movbe.stderr.exp (+0 -0)
===================================================================
|