Commit Graph

316 Commits

Author SHA1 Message Date
nickysn
1f7b14f38e * fixed the conversion of powerof2 mul/imuls to lea in tcgx86.a_op_const_reg_reg
git-svn-id: trunk@26509 -
2014-01-18 17:58:31 +00:00
nickysn
cc1faad3d2 + make use of the 3-operand form of IMUL on i386 and x86_64
git-svn-id: trunk@26508 -
2014-01-18 17:04:57 +00:00
nickysn
5d75bf4f92 * always use IMUL instead of MUL on i386, when doing a 32->32 multiplication
without overflow checking

git-svn-id: trunk@26498 -
2014-01-18 02:56:51 +00:00
nickysn
820b667e1b - rm the OP_IMUL to SHL optimization from tcgx86.a_op_const_reg and tcgx86.a_op_const_ref, because it's already done in optimize_op_const, which is called in the beginning of both methods.
git-svn-id: trunk@26491 -
2014-01-17 18:34:13 +00:00
florian
e210d5f30e + cpu_capabilites for x86_64 and i386
* take advantage of bmi2 instruction rorx

git-svn-id: trunk@26482 -
2014-01-16 21:47:28 +00:00
sergei
f2096de53a * tcg386.g_proc_exit: instead of recalculating stack size, use current_procinfo.final_localsize which was calculated in g_proc_entry.
* tcgx86.g_proc_entry: don't over-allocate stack in SEH finalizer procedures.

git-svn-id: trunk@26251 -
2013-12-19 10:32:32 +00:00
sergei
179586f589 + SEH support for Win32. Enable by cycling with OPT=-dTEST_WIN32_SEH.
Although basic things work (no regressions in test suite, also with TEST_OPT=-O2), there are some secondary issues/TODOs:
- Exception frame around PASCALMAIN is not properly removed in DLLs
- No stack traces yet
- Stack overallocated in finalizer procedures, their entry/exit code needs cleanup
- Signals unit is probably completely broken.

git-svn-id: trunk@26225 -
2013-12-12 12:43:46 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
nickysn
7ae59a62c5 * emit a FWAIT after a floating point store, when targeting the 8087 and 80287
git-svn-id: trunk@26109 -
2013-11-19 23:11:26 +00:00
nickysn
dea947f87b * fixed tcgx86.a_op_const_ref for shl/shr/sar/rol/ror on i8086 and x86_64
git-svn-id: trunk@26018 -
2013-11-10 20:39:47 +00:00
nickysn
d0f988f7a8 * don't use LEA in the code generator on i8086, as this breaks it quite badly.
While it is possible to use 16-bit LEA on the i8086, it's probably not worth
  doing it in the code generator, because of the unpleasant register
  restrictions that 16-bit references have.

git-svn-id: trunk@25989 -
2013-11-07 17:00:58 +00:00
florian
7fc1d70e49 * do reg2=reg1*const by lea if possible
git-svn-id: trunk@25908 -
2013-11-01 19:01:36 +00:00
florian
3c58cad96b * make use of lea if possible
git-svn-id: trunk@25898 -
2013-11-01 19:01:11 +00:00
nickysn
67fdcb02f2 * in tcgx86.make_simple_ref, on the i8086, emit 'mov es, reg', instead of
'push reg/pop es', since that is a lot faster on 8088..80386

git-svn-id: trunk@25700 -
2013-10-06 19:52:38 +00:00
nickysn
6be9627e74 * use all kinds of copy and not just copy_string in Tcgx86.g_concatcopy, when
segments are specified on the i8086

git-svn-id: trunk@25698 -
2013-10-06 19:04:13 +00:00
nickysn
bd0585274e * tsettings.enablecld converted to a targetswitch ts_cld
git-svn-id: trunk@25592 -
2013-09-28 13:41:58 +00:00
nickysn
52fcc0a407 + added a new x86-specific compiler option 'enablecld', which controls whether
the compiler should emit a CLD before using the x86 string instructions.

git-svn-id: trunk@25590 -
2013-09-28 11:54:02 +00:00
Jonas Maebe
3b9b6a0cd7 * explicitly define the asmsymbols for Darwin call stubs as local
git-svn-id: trunk@25264 -
2013-08-16 10:07:46 +00:00
sergei
e1550e1aed * Restore registers in correct order (for push/pop it *does* matter), fixes crashes caused by r25224.
git-svn-id: trunk@25228 -
2013-08-08 05:35:51 +00:00
sergei
5c4abfa75a + Implemented saving/restoring registers using PUSH/POP instructions on i386 targets with non-fixed stack. Provides some advantage in code size (e.g. the compiler becomes about 20KBytes smaller).
* This should be applicable to i8086 targets as well (but needs testing), by copying changes from i386/cgcpu.pas to i8086/cgcpu.pas and removing "$ifdef i386" lines in cgx86.pas.

git-svn-id: trunk@25224 -
2013-08-07 09:59:07 +00:00
sergei
a21a20d559 + i8086-specific version of g_stackpointer_alloc.
git-svn-id: trunk@25219 -
2013-08-06 08:11:39 +00:00
sergei
1f72143eef * In preparation for fixing Mantis #24791: Copy related code from tcgx86.g_proc_entry to tcgx86_64.g_proc_entry, and remove win64-specific stuff from tcgx86 version.
git-svn-id: trunk@25218 -
2013-08-06 07:34:50 +00:00
florian
507edb16de * use add/sub instead of inc/dec on modern CPUs when optimizing for speed
git-svn-id: trunk@25057 -
2013-07-07 19:50:13 +00:00
nickysn
7e70a5f763 * i8086 fix after r25010: i8086 doesn't support lea sp,[sp-XXX]
git-svn-id: trunk@25012 -
2013-06-29 12:21:15 +00:00
florian
94cf650d9a * use lea to adjust stack pointer, this is equal or faster on all modern CPUs than add/sub
git-svn-id: trunk@25010 -
2013-06-28 17:06:57 +00:00
florian
466eb4c684 * use MOVAPS/MOVAPD for reg -> reg moves to reduce data dependencies
git-svn-id: trunk@24967 -
2013-06-24 20:55:04 +00:00
florian
e81d2d1f3b * basic avx support for floating point operations (use -Cfavx to activate)
git-svn-id: trunk@24896 -
2013-06-14 20:03:01 +00:00
nickysn
62316da236 * a_call_reg moved to a_call_reg_near
git-svn-id: trunk@24855 -
2013-06-09 22:09:39 +00:00
nickysn
604b7c9deb + added cg.a_call_ref_near and a_call_ref_far
git-svn-id: trunk@24853 -
2013-06-09 20:22:47 +00:00
nickysn
ec497ae11e + the regular tcgx86.a_call_name and .a_call_name_static moved to .a_call_name_near and .a_call_name_static_near, because a_call_name and a_call_name_static are going to be overriden in tcg8086
git-svn-id: trunk@24827 -
2013-06-09 10:42:39 +00:00
nickysn
ec76b2cf40 * refactored the segment-in-integer-register reference support, so it's handled in make_simple_ref, instead of all over the place in the code generator
git-svn-id: trunk@24752 -
2013-06-01 22:18:09 +00:00
nickysn
c9c882c30a * always use 16-bit pushes for pushing/popping the segment registers on i8086 in Tcgx86.g_concatcopy
git-svn-id: trunk@24735 -
2013-06-01 17:49:49 +00:00
nickysn
e243b6b869 * never use the 66h prefix when pushing/popping segment registers on i8086, as the stack is aligned on 2 bytes there
git-svn-id: trunk@24729 -
2013-06-01 16:03:14 +00:00
nickysn
c2e3fb5918 + emit proper interrupt procedure entry/exit code on i8086
git-svn-id: trunk@24728 -
2013-06-01 15:50:11 +00:00
nickysn
0a8e008a0d + the ES register made volatile on i8086 as per the 16-bit x86 calling conventions
git-svn-id: trunk@24462 -
2013-05-07 14:27:21 +00:00
nickysn
e4f3dd1264 * do not emit shl/shr with a const different than 1 on 8086
git-svn-id: trunk@24382 -
2013-04-29 23:02:09 +00:00
nickysn
fbc41991f9 * i8086 fixes in tcgx86.a_op_reg_reg for 16-bit OP_SHR,OP_SHL,OP_SAR,OP_ROL,OP_ROR
git-svn-id: branches/i8086@23881 -
2013-03-17 00:05:05 +00:00
florian
edd4c1ce4b * proper fix to avoid sp relative adressing as r23867 tries
git-svn-id: branches/i8086@23868 -
2013-03-16 16:51:31 +00:00
florian
b321f867c6 + trgintcpu.add_cpu_interferences for i8086 so references are properly build
* empty make_simple_ref code path for i8086

git-svn-id: branches/i8086@23782 -
2013-03-10 18:51:42 +00:00
nickysn
95b15d15bd another nested ifdef cleaned up
git-svn-id: branches/i8086@23741 -
2013-03-09 11:35:42 +00:00
nickysn
981f0a5c6c nested ifdefs converted to series of elseif + some other ifdefs cleaned up
git-svn-id: branches/i8086@23740 -
2013-03-09 11:25:25 +00:00
nickysn
5f7d432ff9 i8086 fixes in Tcgx86.g_concatcopy and TCGSize2OpSize
git-svn-id: branches/i8086@23720 -
2013-03-08 00:13:02 +00:00
Jonas Maebe
5d628b29bb * set the subregsize of OS_M64 SSE registers to R_SUBQ so we can
differentiate between 64 bit and 128 bit (R_SUBMMWHOLE) SSE vector regs,
    and support spilling/assembling for R_SUBQ SSE registers (8 bytes)
    (mantis #23962)

    We currently never use the full 128 bit of an SSE register, and
    spilling for those hasn't been implemented yet either (R_SUBMMWHOLE
    SSE regs are spilled into a 4-byte temp currently -> can overwrite data)

git-svn-id: trunk@23700 -
2013-03-06 12:42:46 +00:00
yury
e13e2e1697 * Turn off special handling of interrupt calling convention for i386-android.
git-svn-id: branches/targetandroid@23492 -
2013-01-22 14:43:42 +00:00
yury
0960ee2034 * Add missing checks for android target.
git-svn-id: branches/targetandroid@23477 -
2013-01-21 12:08:25 +00:00
sergei
7530fb3352 * tcgx86.make_simple_ref: handle references to absolute addresses (these are quite rare on x86_64, but still worth to handle correctly).
* If possible, use reference base instead of index, this yields shorter instructions.
* Added comment about offset limits for rip-relative addressing.
- Removed code related to taking threadvar address on win32, it is incorrect because Windows TLS is not directly accessible via segment registers (fs:0x2c points to array of pointers to TLS storages of each module, so at least double indirection is needed).

git-svn-id: trunk@23342 -
2013-01-07 16:00:12 +00:00
florian
d7e0f07aab + UseAVX check
git-svn-id: trunk@22642 -
2012-10-14 14:04:31 +00:00
florian
283ff05127 * merged avx support in inline assembler developed by Torsten Grundke
git-svn-id: trunk@22568 -
2012-10-06 19:47:18 +00:00
florian
8818b58e5d * Bsf/Bsr on x86 handle now correctly 0 as argument, resolves #22783
* generic Bsf implementations handle now correctly 0 as argument
* test extended

git-svn-id: trunk@22327 -
2012-09-05 13:51:45 +00:00
Jonas Maebe
b1dc518ac4 * removed systems_need_16_byte_stack_alignment and use target_info.stackalign instead
git-svn-id: trunk@22279 -
2012-09-02 14:32:21 +00:00