Commit Graph

915 Commits

Author SHA1 Message Date
nickysn
12b2f86e99 + added function requires_fwait_on_8087(), which checks whether a given
instruction needs adding a FWAIT prefix on the i8087.

git-svn-id: trunk@26106 -
2013-11-18 23:38:57 +00:00
sergei
bca2c464da * Don't generate x87 instructions for sin and cos on win64, somehow managed to not commit this part in r25995. Mantis #17273.
git-svn-id: trunk@26094 -
2013-11-15 10:37:59 +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
sergei
2b1e5f7014 * Mantis #17273: don't generate x87 instructions on win64 target.
git-svn-id: trunk@25995 -
2013-11-08 13:31:07 +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
f132a804d6 + handle 32 bit references on x86-64 so lea can be used for 32 bit arithmetics
git-svn-id: trunk@25909 -
2013-11-01 19:01:39 +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
f56d2d4b09 * be able to replace lea by add when spilling
git-svn-id: trunk@25901 -
2013-11-01 19:01:20 +00:00
florian
3c58cad96b * make use of lea if possible
git-svn-id: trunk@25898 -
2013-11-01 19:01:11 +00:00
sergei
486a7ef81e * tx86inlinenode.second_popcnt: use emit_ref_reg instead of appending instruction directly, this provides proper PIC handling of the reference. emit_reg_reg part is not strictly necessary, but done for consistency.
git-svn-id: trunk@25878 -
2013-10-28 16:40:42 +00:00
nickysn
9f979eb5c6 * put the i8086-msdos dwarf debug sections in USE32 class=DWARF segments because
wlink wants them this way

git-svn-id: trunk@25873 -
2013-10-27 20:28:43 +00:00
nickysn
e6a4435330 + support the aitconst_XXbit_unaligned const types in the NASM asm writer. This
fixes DWARF support when using NASM.

git-svn-id: trunk@25866 -
2013-10-27 15:21:30 +00:00
nickysn
0f69362edd - rm LEA reg,imm from x86ins.dat, as that's not a valid x86 instruction,
using it in inline asm causes an internal error and removing it didn't show
  any regressions after running the testsuite on i386-linux.

git-svn-id: trunk@25827 -
2013-10-18 23:26:58 +00:00
nickysn
4aa010eedc + support LEA with 16-bit operand size
git-svn-id: trunk@25808 -
2013-10-17 16:11:08 +00:00
nickysn
f6e846c574 + added the NEC V20/V30 instructions
git-svn-id: trunk@25750 -
2013-10-11 21:27:56 +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
sergei
5af873ee5b * x86 targets: Profiling shows that quite a bit of time is spent in findreg_by_number(), despite it uses binary search. Worse, it is repeated for every piece of register information. Trying to get rid of some of these calls: rearranged registers so that their "opcode" matches 3 LSBs of superregister number (with a few exceptions described at the beginning of x86reg.dat). This allows to lookup opcodes in regval() with O(1) complexity, and removes need in rXXXop.inc files.
git-svn-id: trunk@25627 -
2013-10-03 08:08:04 +00:00
sergei
2c79314d59 * IF_SANDYBRIDGE designates CPU family, not feature. Mostly a cosmetic change, since we don't use these flags for anything.
git-svn-id: trunk@25626 -
2013-10-03 06:06:34 +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
nickysn
661e11ecb8 * on i8086 added section .fpc to the group 'dgroup'. This fixes a bug that caused the bss section to not be left out from the executable in tiny model, which caused, ironically, tiny model executables to be larger than the small model executables
git-svn-id: trunk@25525 -
2013-09-21 11:28:01 +00:00
nickysn
8608969eb8 * tx86casenode.genjumptable: explicitly emit near pointers in the case jump table on i8086, regardless of the memory model
git-svn-id: trunk@25503 -
2013-09-16 19:58:45 +00:00
sergei
5de4bdac40 * tx86addnode.second_cmpfloat: use getresflags() to reduce code duplication.
git-svn-id: trunk@25443 -
2013-09-09 11:25:49 +00:00
nickysn
4f96e8a20d * convert i8086 inline asm instruction 'call symbol' to 'call far symbol' in memory models with far code
git-svn-id: trunk@25438 -
2013-09-08 16:34:12 +00:00
sergei
7e6a7f20cc - Removed unused variables and dead assignments.
git-svn-id: trunk@25424 -
2013-09-05 09:05:56 +00:00
Jonas Maebe
1a78ec1f11 * workaround for bug in Apple's assembler regarding movq/vmovq and integer
registers

git-svn-id: trunk@25396 -
2013-09-02 14:39:26 +00:00
nickysn
f9d0caa7c7 * pass the option -w-orphan-labels to nasm to avoid the spurious warnings about labels without a trailing colon and without an instruction on the same line
git-svn-id: trunk@25358 -
2013-08-23 23:40:24 +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
sergei
ea65e272dd * Changed global variable into field.
git-svn-id: trunk@25217 -
2013-08-05 16:32:37 +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
nickysn
58b22adaf1 + added function cpubase.segment_regs_equal, which checks whether 2 segment regs are equal in the current memory model
git-svn-id: trunk@24949 -
2013-06-23 11:27:00 +00:00
florian
fc72490166 * handle LOC_*FPUREGISTER correctly when using sse2 sqr, resolve #26408
git-svn-id: trunk@24909 -
2013-06-16 18:48:08 +00:00
florian
9b6094a58c + added a few BMI instructions to see if they can be encoded
git-svn-id: trunk@24907 -
2013-06-16 09:35:21 +00:00
florian
0a84f1f10c + avx uses add to multiply by 2
* formatting

git-svn-id: trunk@24906 -
2013-06-15 21:18:40 +00:00
florian
d8ff85846f * don't reuse mm registers used by child nodes
git-svn-id: trunk@24897 -
2013-06-14 20:52:36 +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
svenbarth
b6bfa864d4 Disallow the usage of the inline assembler inside generics, because there are currently two problems:
1. At least on x86 the assembler reader initializes the parameter location informations which results in InternalError 200301231
2. Assembler tokens are not stored in the token stream and thus won't be reproduced during specialization

x86/rax86int.pas, tx86intreader.Assemble:
  * check for "parse_generic" before calling generate_parameter_info
pstatmnt.pas, assembler_block & statement:
  * generate an error message if an asm statement should be parsed inside a generic

+ added test

git-svn-id: trunk@24892 -
2013-06-13 19:42:49 +00:00
nickysn
4840a33b80 * also return true in is_calljmp() for the A_JCXZ instruction on the i8086
git-svn-id: trunk@24886 -
2013-06-12 23:42:45 +00:00
nickysn
511b1f37c1 * write the segment of aitconst_farptr on a separate line to avoid long symbol truncation, due to line length limit; this fixes compilation of sysutils in the medium memory model
git-svn-id: trunk@24879 -
2013-06-12 01:32:18 +00:00
nickysn
9dbbffba61 + added trefaddr.addr_seg for referencing the segment of a symbol
git-svn-id: trunk@24859 -
2013-06-10 01:16:37 +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
e4a1230356 + added support for far pointer constants in the assembly output
git-svn-id: trunk@24854 -
2013-06-09 22:01:04 +00:00