|
From: <sv...@va...> - 2005-08-08 00:33:44
|
Author: sewardj
Date: 2005-08-08 01:33:37 +0100 (Mon, 08 Aug 2005)
New Revision: 1321
Log:
Don't emit cmovl since older x86s don't support it; instead emit a
conditional jump over an unconditional move.
Modified:
trunk/priv/host-x86/hdefs.c
trunk/pub/libvex.h
Modified: trunk/priv/host-x86/hdefs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/priv/host-x86/hdefs.c 2005-08-07 14:48:03 UTC (rev 1320)
+++ trunk/priv/host-x86/hdefs.c 2005-08-08 00:33:37 UTC (rev 1321)
@@ -2204,7 +2204,9 @@
=20
case Xin_CMov32:
vassert(i->Xin.CMov32.cond !=3D Xcc_ALWAYS);
+
/* This generates cmov, which is illegal on P54/P55. */
+ /*
*p++ =3D 0x0F;
*p++ =3D toUChar(0x40 + (0xF & i->Xin.CMov32.cond));
if (i->Xin.CMov32.src->tag =3D=3D Xrm_Reg) {
@@ -2215,6 +2217,37 @@
p =3D doAMode_M(p, i->Xin.CMov32.dst, i->Xin.CMov32.src->Xrm.Me=
m.am);
goto done;
}
+ */
+
+ /* Alternative version which works on any x86 variant. */
+ /* jmp fwds if !condition */
+ *p++ =3D 0x70 + (i->Xin.CMov32.cond ^ 1);
+ *p++ =3D 0; /* # of bytes in the next bit, which we don't know yet=
*/
+ ptmp =3D p;
+
+ switch (i->Xin.CMov32.src->tag) {
+ case Xrm_Reg:
+ /* Big sigh. This is movl E -> G ... */
+ *p++ =3D 0x89;
+ p =3D doAMode_R(p, i->Xin.CMov32.src->Xrm.Reg.reg,
+ i->Xin.CMov32.dst);
+
+ break;
+ case Xrm_Mem:
+ /* ... whereas this is movl G -> E. That's why the args
+ to doAMode_R appear to be the wrong way round in the
+ Xrm_Reg case. */
+ *p++ =3D 0x8B;
+ p =3D doAMode_M(p, i->Xin.CMov32.dst,
+ i->Xin.CMov32.src->Xrm.Mem.am);
+ break;
+ default:
+ goto bad;
+ }
+ /* Fill in the jump offset. */
+ *(ptmp-1) =3D p - ptmp;
+ goto done;
+
break;
=20
case Xin_LoadEX:
Modified: trunk/pub/libvex.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/pub/libvex.h 2005-08-07 14:48:03 UTC (rev 1320)
+++ trunk/pub/libvex.h 2005-08-08 00:33:37 UTC (rev 1321)
@@ -74,7 +74,7 @@
enum {
VexSubArch_INVALID,
VexSubArch_NONE, /* Arch has no variants */
- VexSubArchX86_sse0, /* has SSE state but no insns (Pentium II)=
*/
+ VexSubArchX86_sse0, /* no SSE state; or SSE state but no insns=
*/
VexSubArchX86_sse1, /* SSE1 support (Pentium III) */
VexSubArchX86_sse2, /* SSE2 support (Pentium 4) */
VexSubArchARM_v4, /* ARM version 4 */
|