summaryrefslogtreecommitdiff
path: root/tests/test-i386-shift.h
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-03-04 01:14:13 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-03-04 01:14:13 +0000
commitd57c4e01206ebc8b21702c243e7a19638f783b43 (patch)
tree6dff6ab33996f766a8917835fed0c4f57d98da02 /tests/test-i386-shift.h
parent4b74fe1f0013c622693b26141c0ed031a284a45a (diff)
downloadqemu-d57c4e01206ebc8b21702c243e7a19638f783b43.tar.gz
added shiftd support - improved auto test
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@20 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests/test-i386-shift.h')
-rw-r--r--tests/test-i386-shift.h85
1 files changed, 72 insertions, 13 deletions
diff --git a/tests/test-i386-shift.h b/tests/test-i386-shift.h
index af892f6c7d..f3795d9f36 100644
--- a/tests/test-i386-shift.h
+++ b/tests/test-i386-shift.h
@@ -4,7 +4,19 @@
#define exec_opw glue(glue(exec_, OP), w)
#define exec_opb glue(glue(exec_, OP), b)
-#define EXECSHIFT(size, res, s1, flags) \
+#ifndef OP_SHIFTD
+
+#ifdef OP_NOBYTE
+#define EXECSHIFT(size, res, s1, s2, flags) \
+ asm ("push %4\n\t"\
+ "popf\n\t"\
+ stringify(OP) size " %" size "2, %" size "0\n\t" \
+ "pushf\n\t"\
+ "popl %1\n\t"\
+ : "=g" (res), "=g" (flags)\
+ : "r" (s1), "0" (res), "1" (flags));
+#else
+#define EXECSHIFT(size, res, s1, s2, flags) \
asm ("push %4\n\t"\
"popf\n\t"\
stringify(OP) size " %%cl, %" size "0\n\t" \
@@ -12,13 +24,14 @@
"popl %1\n\t"\
: "=q" (res), "=g" (flags)\
: "c" (s1), "0" (res), "1" (flags));
+#endif
-void exec_opl(int s0, int s1, int iflags)
+void exec_opl(int s2, int s0, int s1, int iflags)
{
int res, flags;
res = s0;
flags = iflags;
- EXECSHIFT("", res, s1, flags);
+ EXECSHIFT("", res, s1, s2, flags);
/* overflow is undefined if count != 1 */
if (s1 != 1)
flags &= ~CC_O;
@@ -26,12 +39,12 @@ void exec_opl(int s0, int s1, int iflags)
stringify(OP) "l", s0, s1, res, iflags, flags & CC_MASK);
}
-void exec_opw(int s0, int s1, int iflags)
+void exec_opw(int s2, int s0, int s1, int iflags)
{
int res, flags;
res = s0;
flags = iflags;
- EXECSHIFT("w", res, s1, flags);
+ EXECSHIFT("w", res, s1, s2, flags);
/* overflow is undefined if count != 1 */
if (s1 != 1)
flags &= ~CC_O;
@@ -39,27 +52,69 @@ void exec_opw(int s0, int s1, int iflags)
stringify(OP) "w", s0, s1, res, iflags, flags & CC_MASK);
}
+#else
+#define EXECSHIFT(size, res, s1, s2, flags) \
+ asm ("push %4\n\t"\
+ "popf\n\t"\
+ stringify(OP) size " %%cl, %" size "5, %" size "0\n\t" \
+ "pushf\n\t"\
+ "popl %1\n\t"\
+ : "=g" (res), "=g" (flags)\
+ : "c" (s1), "0" (res), "1" (flags), "r" (s2));
+
+void exec_opl(int s2, int s0, int s1, int iflags)
+{
+ int res, flags;
+ res = s0;
+ flags = iflags;
+ EXECSHIFT("", res, s1, s2, flags);
+ /* overflow is undefined if count != 1 */
+ if (s1 != 1)
+ flags &= ~CC_O;
+ printf("%-10s A=%08x B=%08x C=%08x R=%08x CCIN=%04x CC=%04x\n",
+ stringify(OP) "l", s0, s2, s1, res, iflags, flags & CC_MASK);
+}
+
+void exec_opw(int s2, int s0, int s1, int iflags)
+{
+ int res, flags;
+ res = s0;
+ flags = iflags;
+ EXECSHIFT("w", res, s1, s2, flags);
+ /* overflow is undefined if count != 1 */
+ if (s1 != 1)
+ flags &= ~CC_O;
+ printf("%-10s A=%08x B=%08x C=%08x R=%08x CCIN=%04x CC=%04x\n",
+ stringify(OP) "w", s0, s2, s1, res, iflags, flags & CC_MASK);
+}
+
+#endif
+
+#ifndef OP_NOBYTE
void exec_opb(int s0, int s1, int iflags)
{
int res, flags;
res = s0;
flags = iflags;
- EXECSHIFT("b", res, s1, flags);
+ EXECSHIFT("b", res, s1, 0, flags);
/* overflow is undefined if count != 1 */
if (s1 != 1)
flags &= ~CC_O;
printf("%-10s A=%08x B=%08x R=%08x CCIN=%04x CC=%04x\n",
stringify(OP) "b", s0, s1, res, iflags, flags & CC_MASK);
}
+#endif
-void exec_op(int s0, int s1)
+void exec_op(int s2, int s0, int s1)
{
- exec_opl(s0, s1, 0);
- exec_opw(s0, s1, 0);
+ exec_opl(s2, s0, s1, 0);
+ exec_opw(s2, s0, s1, 0);
+#ifndef OP_NOBYTE
exec_opb(s0, s1, 0);
+#endif
#ifdef OP_CC
- exec_opl(s0, s1, CC_C);
- exec_opw(s0, s1, CC_C);
+ exec_opl(s2, s0, s1, CC_C);
+ exec_opw(s2, s0, s1, CC_C);
exec_opb(s0, s1, CC_C);
#endif
}
@@ -68,12 +123,16 @@ void glue(test_, OP)(void)
{
int i;
for(i = 0; i < 32; i++)
- exec_op(0x12345678, i);
+ exec_op(0x21ad3d34, 0x12345678, i);
for(i = 0; i < 32; i++)
- exec_op(0x82345678, i);
+ exec_op(0x813f3421, 0x82345678, i);
}
void *glue(_test_, OP) __init_call = glue(test_, OP);
#undef OP
#undef OP_CC
+#undef OP_SHIFTD
+#undef OP_NOBYTE
+#undef EXECSHIFT
+