florian
c38e52bb27
* create shorter code for -<single/double> when generating avx code
...
git-svn-id: trunk@27347 -
2014-03-29 19:35:41 +00:00
sergei
e4819e863b
+ Consider target_info.cprefix in symbol names.
...
git-svn-id: trunk@27315 -
2014-03-28 09:07:58 +00:00
sergei
ebdbf21650
* tx86addnode.second_cmpfloatsse and tx86addnode.second_cmpfloatavx are identical except instruction opcodes -> merged into second_cmpfloatvector, cleaned up, and allowed constant operands at both sides.
...
git-svn-id: trunk@27314 -
2014-03-28 09:04:28 +00:00
sergei
965540eab3
* Let tx86addnode.check_left_and_right_fpureg() act as when its argument was=true (removed argument and renamed to force_left_and_right_fpureg). Its action when force_fpureg=false is now coded separately.
...
git-svn-id: trunk@27299 -
2014-03-27 11:42:24 +00:00
florian
842e027a9f
+ prove of concept how FMA4 could be supported in inline assembler
...
git-svn-id: trunk@27214 -
2014-03-20 21:25:38 +00:00
florian
a79be2b05c
+ support for FMA instructions in inline assembler
...
+ extended avx test code with FMA
git-svn-id: trunk@27209 -
2014-03-20 20:06:56 +00:00
florian
aa107b914c
* merged avx2 branch, developed by Torsten Grundke
...
git-svn-id: trunk@27200 -
2014-03-20 12:03:52 +00:00
Jonas Maebe
80863a8361
* fixed warning/compilation
...
git-svn-id: trunk@27166 -
2014-03-16 19:46:10 +00:00
Jonas Maebe
4065483a50
* completed thlcgobj.location_force_fpureg(), use it everywhere and removed
...
ncgutil/thlcg2ll.location_force_fpureg()
git-svn-id: trunk@27071 -
2014-03-10 09:01:05 +00:00
pierre
044891fd94
Avoid range check error in a_op_const_reg_reg
...
git-svn-id: trunk@27060 -
2014-03-09 19:49:29 +00:00
sergei
9c54cdc85d
* x86: Cleaned out addr_far,addr_far_ref used to encode far calls/jumps. NASM (and FPC x86 assembler based on it) already have opsize=S_FAR for this purpose.
...
git-svn-id: trunk@27037 -
2014-03-08 22:54:43 +00:00
Jonas Maebe
81427523ab
* pass a list of (pointers to) the paralocs to hlcgobj.a_call/g_call*, as
...
required for the LLVM support (LLVM parameter support is not yet
included)
* always return the function return loc from a_call*, again as required
for the LLVM support
git-svn-id: branches/hlcgllvm@26992 -
2014-03-06 21:40:57 +00:00
Jonas Maebe
e9268a0a14
* synchronised with trunk up till r26975
...
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
sergei
5e8f8f4755
* Use GOT-relative constants for i386 PIC jump tables, they don't need runtime relocations. Now almost ABI-compliant on Linux/BSD (Darwin targets unchanged). Also clean up i8086-specific stuff: using tai_const.create_type_sym(aitconst_ptr,...) generates near pointers on i8086, which is the desired goal.
...
git-svn-id: trunk@26942 -
2014-03-03 21:06:49 +00:00
sergei
d613ab8578
* x86: improve x87 qword to float conversion, using single-precision constants saves space and removes need in separate load on FPU stack. No precision loss occurs because 2**64 is representable exactly even in single precision.
...
git-svn-id: trunk@26941 -
2014-03-03 20:41:42 +00:00
nickysn
229ebf33a8
+ support getting the address of far references on i8086 in
...
tcgx86.a_loadaddr_ref_reg
git-svn-id: trunk@26932 -
2014-03-02 22:21:16 +00:00
sergei
f69e6ec389
* Some fixes to NASM writer:
...
* Correctly output names of sec_user sections and sec_threadvar on Windows targets
* Use ALIGNB directive to align without warnings in bss and alike sections.
* Do not output 'begin/end asmlist x' for empty asmlists.
git-svn-id: trunk@26898 -
2014-02-27 13:37:03 +00:00
nickysn
c00b56ae49
* added the -w-orphan-labels parameter to all tasminfo instances for nasm.
...
The -w-oprhan-labels option prevents the 'label alone on a line without a
colon might be in error' warning.
git-svn-id: trunk@26889 -
2014-02-26 20:54:38 +00:00
sergei
31d160aaf5
* x86: clean up and place jump tables into sec_rodata on all targets. Effectively it does not change anything, because sec_rodata with relocations still go into writable data at assembler level.
...
git-svn-id: trunk@26885 -
2014-02-26 11:06:22 +00:00
florian
13cb468a8e
* fixed modification information for some avx instructions
...
git-svn-id: trunk@26840 -
2014-02-22 15:52:33 +00:00
florian
c00d752813
+ create avx code in abs as well
...
* improved abs code generation with sse(2)
git-svn-id: trunk@26838 -
2014-02-22 15:35:14 +00:00
florian
1882ab8d5a
* i8086 has no cpu_capabilites
...
git-svn-id: trunk@26791 -
2014-02-16 08:27:29 +00:00
florian
84f7f5f934
* popcnt has a separate cpuid flag so we should separate it from sse
...
git-svn-id: trunk@26789 -
2014-02-16 08:27:24 +00:00
florian
75a13f7e47
* do not allow VCOMISD/VCOMISS to use a memory location as target
...
git-svn-id: trunk@26774 -
2014-02-14 21:26:51 +00:00
florian
37b34edbc6
* do not reuse registers when calculating addresses in pic mode
...
git-svn-id: trunk@26743 -
2014-02-09 21:12:07 +00:00
florian
a8643410c4
* fix trgx86.do_spill_replace for bmi rotating/shifting instructions
...
git-svn-id: trunk@26739 -
2014-02-08 21:38:23 +00:00
florian
be0a29da95
* fix modification information for bmi instructions
...
git-svn-id: trunk@26738 -
2014-02-08 21:38:21 +00:00
florian
9d84b83475
* fix comment
...
git-svn-id: trunk@26737 -
2014-02-08 21:38:18 +00:00
Jonas Maebe
a1eb9a0f99
* fixed spilling of CMOVcc instruction: it "reads" operand two (in the sense
...
that the value of operand two is used/kept in case the condition is false)
(fixes mantis #25672 )
git-svn-id: trunk@26674 -
2014-02-05 00:27:21 +00:00
sergei
9c1f917e3a
* a_call_ref functionality cannot be implemented efficiently at code generator level, because references need specific preparations at earlier points. Moved this support to tcgcallnode and its x86 descendants, and got rid of all ifdef's around.
...
+ x86 targets now directly call procedure variables located in references.
- a_call_ref method removed from tcg and thlcgobj.
git-svn-id: trunk@26666 -
2014-02-03 13:28:56 +00:00
sergei
0d3f36eebf
- Remove references to global variable 'cg' from methods of tcg and some of its descendants.
...
git-svn-id: trunk@26665 -
2014-02-03 12:27:48 +00:00
florian
28a8dc42c6
* fix tcgx86.a_op_reg_reg on x86-64 and make use of it
...
git-svn-id: trunk@26636 -
2014-01-30 20:24:41 +00:00
florian
7d7bf1d877
+ make use of SHLX/SHRX on CPUs supporting BMI2
...
git-svn-id: trunk@26635 -
2014-01-30 20:24:39 +00:00
florian
8989a40b4f
* more flags to mark changes fixed
...
git-svn-id: trunk@26626 -
2014-01-30 17:34:28 +00:00
florian
48ae2d215a
+ concatcopy variants using sse and avx, only activated if optimization for size is done because at least on an i7-4770 it has shown no benefit
...
git-svn-id: trunk@26588 -
2014-01-26 12:37:54 +00:00
florian
2ec5a649d7
* set Ch_* for more operations
...
* Ch_* flags for VMOVSD and VMOVSS are now set for the 2 operand variants
git-svn-id: trunk@26586 -
2014-01-26 12:37:50 +00:00
nickysn
85dd9e5789
+ added a size parameter to optimize_op_const and do a sign extension of the 'a' parameter up from the specified size, so that things like (i and $ffffffff) get optimized away the same way as (i and -1)
...
git-svn-id: trunk@26561 -
2014-01-22 15:00:34 +00:00
pierre
045f161012
Separate out nasm assembler for i8086, i386 and x86_64 cpus, also separte based on target object format
...
git-svn-id: trunk@26547 -
2014-01-21 00:26:08 +00:00
sergei
6b1f021fcf
- Removed remaining optimizations that duplicate functionality of tcg.optimize_op_const.
...
- Don't call make_simple_ref if operation will be optimized away or replaced with another one, which calls make_simple_ref itself.
git-svn-id: trunk@26515 -
2014-01-19 01:19:01 +00:00
nickysn
c83032992d
* more fixes to the 3-op IMUL spilling:
...
o Return the correct operation type for all forms of IMUL in
taicpu.spilling_get_operation_type
o Properly support 3-op IMUL in trgx86.do_spill_replace
git-svn-id: trunk@26514 -
2014-01-18 21:46:13 +00:00
sergei
e6a9f3b15b
* Fixed spilling of 3-operand IMUL instruction (went unnoticed this far because such instructions were not emitted by compiler).
...
git-svn-id: trunk@26510 -
2014-01-18 19:21:48 +00:00
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
florian
7028210817
+ tzcnt assembler instruction
...
git-svn-id: trunk@26506 -
2014-01-18 12:11:50 +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
sergei
6168f563c2
* x86 compares: compare references with constants directly (without loading to register) if possible, this helps to reduce register pressure.
...
git-svn-id: trunk@26492 -
2014-01-17 19:42:09 +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
nickysn
270444508a
* fixed not(boolean32) and not(boolean64) on i8086
...
git-svn-id: trunk@26369 -
2014-01-03 15:18:07 +00:00
sergei
36d0c8a5a7
* x86 and SPARC: fixed handling 64-bit (qwordbool) values in tcgnotnode (partial fix for Mantis #25255 ).
...
* Moved handling LOC_JUMP locations to helper method of base class, it appears to be the same for all targets.
git-svn-id: trunk@26353 -
2014-01-02 10:29:44 +00:00
nickysn
39c54bf077
* handle ait_varloc in the nasm writer. This allows compiling the system unit
...
for i8086 with regvars and -sr for debugging purposes.
git-svn-id: trunk@26271 -
2013-12-23 13:27:22 +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
nickysn
be5f49b3e5
* tx86addnode.second_cmpfloat: on i8086 only load the high byte of the FPU
...
status word after fstsw (and before sahf), because 8-bit memory transfers are
faster on the i8088, due to the 8-bit data bus
git-svn-id: trunk@26245 -
2013-12-16 23:52:28 +00:00
nickysn
ada9ccf6a6
* tx86addnode.second_cmpfloat: do not emit a fwait after fstsw as my own testing
...
on a true i8087 showed that the fwait isn't necessary
git-svn-id: trunk@26244 -
2013-12-16 23:17:44 +00:00
nickysn
a7b4953795
+ proper (i.e. not broken) implementation of arctan() for the 8087 and 80287
...
git-svn-id: trunk@26226 -
2013-12-12 23:46:51 +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
nickysn
09a3fc74e3
* use the fwait prefixed FSTCW, followed by FWAIT, instead of FNSTCW in
...
tx86inlinenode.second_trunc_real, when generating code for the 8087
git-svn-id: trunk@26186 -
2013-12-05 23:33:33 +00:00
nickysn
2d45ea43af
* use the 'wait' prefix (on the same line as the instruction), instead of
...
'db 09bh' (on the previous line) for the fwait prefixed 8087 instructions in
the nasm assembly output, because it looks prettier this way :)
git-svn-id: trunk@26185 -
2013-12-05 21:31:16 +00:00
nickysn
3555b76495
- rm FDISI,FENI,FSAVE,FSTCW,FSTENV and FSTSW from the requires_fwait_on_8087()
...
list, because these instructions already have a built in FWAIT prefix even
when targeting the 287/387+ both with the internal asm writer and with the
NASM back end.
git-svn-id: trunk@26178 -
2013-12-03 23:56:45 +00:00
nickysn
e9a4896565
- rm the 287/387+ FPU instructions from the requires_fwait_on_8087() list
...
git-svn-id: trunk@26176 -
2013-12-03 22:48:52 +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
6fdadb6248
* 8087 fixes in tx86addnode.second_cmpfloat:
...
- use FSTSW instead of FNSTSW
- insert a FWAIT after the FSTSW, because the value is immediately loaded
afterwards by the integer unit of the CPU
git-svn-id: trunk@26110 -
2013-11-19 23:22:49 +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
0020a2ed10
+ when targeting the i8087, emit FWAIT prefix manually for the 8087 instructions
...
that require it in the NASM asm writer, since NASM doesn't do it itself.
git-svn-id: trunk@26107 -
2013-11-19 01:26:57 +00:00
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
Jonas Maebe
25fab5b0b6
+ support for array vecnodes on the llvm target, both for regular and for
...
bitpacked arrays:
o separate the element size from the index when constructing the memory
references, so we can easily use the llvm getelementptr instruction
o handle conversion of s80real values from their array declaration
as array elements to floating point values when loading them
git-svn-id: branches/hlcgllvm@26050 -
2013-11-11 11:16:09 +00:00
Jonas Maebe
5ef93e85b8
+ added extra "orgsupreg" parameter to do_spill_read/do_spill_written/
...
do_spill_replace routines, will be necessary by llvm register
allocator to determine the tdef corresponding to that register
* replaced uses of taicpu with tai_cpu_abstract_sym in the register
allocator so that it can work both with taicpu and taillvm instructions
git-svn-id: branches/hlcgllvm@26043 -
2013-11-11 11:15:43 +00:00
Jonas Maebe
1df3039424
+ LLVM temp allocator based on new R_TEMPREGISTER register class. For every
...
temp we allocate, we set the base register to a newly allocated
R_TEMPREGISTER. This allows for uniquely identifying a temp even if its
offset is modified.
git-svn-id: branches/hlcgllvm@26033 -
2013-11-11 11:14: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
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
3631198b34
+ declare the text segment with class=code in the nasm header for far code memory models also
...
git-svn-id: trunk@24834 -
2013-06-09 13:01:40 +00:00
nickysn
9a6c242f97
+ emit proper far calls/jmps for addr_far in the nasm assembly output
...
git-svn-id: trunk@24833 -
2013-06-09 12:59:44 +00:00
nickysn
3280514d2b
* in i8086 far code models, put the code in a section called module_name+'_TEXT', so each unit gets a separate code segment
...
git-svn-id: trunk@24831 -
2013-06-09 12:26:33 +00:00
nickysn
b74af9fda0
* declare the text segment with class=code on i8086-msdos
...
git-svn-id: trunk@24830 -
2013-06-09 12:13:52 +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
2279e51a95
+ added trefaddr.addr_far for emitting far calls
...
git-svn-id: trunk@24826 -
2013-06-09 10:24:06 +00:00
nickysn
b409d600ee
+ implemented the tiny memory model for i8086-msdos; we now produce working dos .com files as well
...
git-svn-id: trunk@24793 -
2013-06-02 23:02:10 +00:00
nickysn
90ecd72286
* x86_64 compilation fixed after r24752
...
git-svn-id: trunk@24755 -
2013-06-01 22:38:07 +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
Jonas Maebe
2dd75e707e
* renamed thlcgobj.tcgsize2orddef to defutil.cgsize_orddef
...
git-svn-id: trunk@24743 -
2013-06-01 18:28:15 +00:00
nickysn
525246f61b
* support i8086 far references in tx86addnode.emit_op_right_left
...
git-svn-id: trunk@24737 -
2013-06-01 17:51:58 +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
Jonas Maebe
5051453806
+ support for LOC_(C)MMREGISTER in hlcg
...
o migrated location_force_mmregister_scalar from ncgutil to hlcgobj
git-svn-id: trunk@24661 -
2013-05-31 12:05:14 +00:00
nickysn
db5573b395
* fixed the nasm assembly output for SAR/SAL with a memory reference
...
git-svn-id: trunk@24656 -
2013-05-31 08:21:42 +00:00
nickysn
125a6a8720
* register id of (e)flags changed, so it doesn't overlap with dr0
...
git-svn-id: trunk@24647 -
2013-05-30 16:40:59 +00:00
Jonas Maebe
d6180b1e70
* properly propagate PIC-related suffixes from the x86 assembler reader in
...
case the operand was parsed as a symbol
git-svn-id: trunk@24638 -
2013-05-30 12:20:48 +00:00
nickysn
1797c8b803
* i8086 fixes for the handling of large sets in tx86innode.pass_generate_code; test/cg/tin.pp works now
...
git-svn-id: trunk@24634 -
2013-05-30 10:16:05 +00:00
nickysn
de345ac191
* added missing setbase fixup in tx86innode.pass_generate_code for the case of LOC_CONSTANT in LOC_REFERENCE for large sets
...
git-svn-id: trunk@24619 -
2013-05-26 10:53:42 +00:00
nickysn
533bd30094
* some more i8086 bug fixes in tx86innode.pass_generate_code
...
git-svn-id: trunk@24618 -
2013-05-26 09:08:28 +00:00
nickysn
967e10ea95
* i8086 fixes in tx86innode.pass_generate_code
...
git-svn-id: trunk@24617 -
2013-05-25 22:46:50 +00:00
nickysn
f3ad9ce9ce
* i8086 fixes in tx86typeconvnode.second_int_to_bool; this fixes tcnvint2.pp
...
git-svn-id: trunk@24615 -
2013-05-25 21:19:55 +00:00
nickysn
b43c4c4aca
* i8086 fixes in tx86typeconvnode.second_int_to_real
...
git-svn-id: trunk@24606 -
2013-05-25 16:37:41 +00:00
nickysn
2b583bb265
* do not use fsin and fcos on 286-, since they're 387+
...
git-svn-id: trunk@24596 -
2013-05-25 15:24:53 +00:00
nickysn
09249b31b8
* use the generic implementation of second_IncludeExclude in case the cpu is earlier than 386, since then it does not support BTR and BTS
...
git-svn-id: trunk@24593 -
2013-05-25 14:18:55 +00:00
florian
2ec15deaba
* more readable register allocation comments
...
git-svn-id: trunk@24585 -
2013-05-24 19:03:50 +00:00
nickysn
fd429612f8
+ initial (and not yet fully complete) implementation of far pointers on the i8086
...
git-svn-id: trunk@24553 -
2013-05-22 16:26:33 +00:00
nickysn
f571aebdd0
* tx86pointertyp moved from unit symdef to symconst, so it can be used by ppudump
...
git-svn-id: trunk@24547 -
2013-05-21 14:18:48 +00:00
nickysn
b9084a22ca
* in the nasm writer only declare labels as global if they have labsym.bind=AB_GLOBAL; this fixes compilation of i8086-msdos programs that use multiple units
...
git-svn-id: trunk@24529 -
2013-05-19 17:51:29 +00:00
nickysn
ecb5a4866d
* refactored the int64 result passing in ax:bx:cx:dx to use 4 paralocs, instead of the GetNextReg hack
...
git-svn-id: trunk@24527 -
2013-05-19 12:50:15 +00:00
nickysn
9f0c23bd4c
* fixed round() on i8086 after r24502
...
git-svn-id: trunk@24503 -
2013-05-15 00:45:08 +00:00
nickysn
3665ed4b03
+ enabled returning int64 in ax:bx:cx:dx for the i8086
...
git-svn-id: trunk@24502 -
2013-05-14 22:45:57 +00:00
nickysn
6b2f59c3e0
+ preparations for returning int64 in ax:bx:cx:dx on i8086
...
git-svn-id: trunk@24498 -
2013-05-14 22:19:17 +00:00
nickysn
e2cd2813ce
+ stop with an internal error if GetNextReg is called with a non-imaginary register
...
git-svn-id: trunk@24493 -
2013-05-13 22:34:13 +00:00
nickysn
92afd7cccd
+ R_SUBH support added in x86/aasmcpu.spilling_create_load and spilling_create_store
...
git-svn-id: trunk@24477 -
2013-05-09 14:10:45 +00:00
nickysn
2a9d38d878
+ proper spilling support for R_SUBH (i.e. AH,BH,CH,DH) x86 registers in trgx86.do_spill_replace
...
git-svn-id: trunk@24476 -
2013-05-09 11:57:00 +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
b0f7786782
+ added support for special versions of near data pointers associated with a x86 segment register. They are supported on all x86 platforms: i8086, i386 and x86_64
...
git-svn-id: trunk@24453 -
2013-05-05 17:22:37 +00:00
nickysn
fe275c4f47
* set nasm cpu type according to the current cpu level set by -Cp
...
git-svn-id: trunk@24402 -
2013-05-01 15:47:23 +00:00
nickysn
4c95592e08
* don't use 'fnstsw ax' if the current cpu level is below 286
...
git-svn-id: trunk@24401 -
2013-05-01 15:42:02 +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
99d3b453a4
* got rid of the i8086 nasm warning 'segment attributes specified on redeclaration of segment'
...
git-svn-id: trunk@24336 -
2013-04-26 22:17:42 +00:00
florian
0e41df598e
* merge i8086 branch by Nikolay Nikolov
...
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
florian
926dd1b41e
* command line compilation of i8086 fixed
...
git-svn-id: branches/i8086@24291 -
2013-04-21 18:32:09 +00:00
nickysn
fef3732884
* i8086 compilation fixes
...
git-svn-id: branches/i8086@24244 -
2013-04-14 16:34:02 +00:00
nickysn
3152df6e7f
* fixed bugs in tx86inlinenode, introduced in r24237
...
git-svn-id: branches/i8086@24243 -
2013-04-14 16:16:47 +00:00
nickysn
97ca0fa323
- removed ti8086inlinenode.second_round_real, second_trunc_real and load_fpu_location as they mostly repeat the code in tx86inlinenode.load_fpu_location; tx86inlinenode.load_fpu_location adapted for i8086 instead
...
git-svn-id: branches/i8086@24237 -
2013-04-14 14:25:22 +00:00
nickysn
107a6f6552
* i8086 versions of i386*.inc and r386*.inc renamed to i8086*.inc and r8086*.inc
...
git-svn-id: branches/i8086@24232 -
2013-04-12 12:06:28 +00:00
Jonas Maebe
8b8a786823
* moved ARM/x86 ifdef'ed code from ncgcal to virtual methods
...
git-svn-id: trunk@24179 -
2013-04-07 13:42:06 +00:00
nickysn
59976c3ac8
* use FixNonCommutativeOpcodes in agx86int.pas as well (fixes compilation for i386)
...
git-svn-id: branches/i8086@24168 -
2013-04-06 23:23:25 +00:00
florian
ad0b0455d8
* extended comment
...
git-svn-id: branches/i8086@24152 -
2013-04-04 21:06:10 +00:00
nickysn
c3aaa37c0c
* fixed a bug which caused non commutative fpu instructions to be wrong when using an intel-style external assembler and compiling a smartlinked unit
...
git-svn-id: branches/i8086@24151 -
2013-04-04 20:17:50 +00:00
nickysn
324b4a8a0a
* declare the .bss sections with class=bss, so wlink treats them as bss sections and leaves them out of the executable
...
git-svn-id: branches/i8086@24064 -
2013-03-30 00:49:11 +00:00
nickysn
e16e08b2b6
+ added CPU 286 nasm directive to the i8086 assembly output in order to catch 386+ instructions; the RTL now compiles without generating any 386+ instructions
...
git-svn-id: branches/i8086@24010 -
2013-03-26 00:57:38 +00:00
nickysn
44ef72e1a4
* use the generic implementation of abs for the i8086
...
git-svn-id: branches/i8086@24004 -
2013-03-25 21:43:47 +00:00
nickysn
8d75441b6e
* do not generate prefetchnt instructions on the i8086
...
git-svn-id: branches/i8086@24003 -
2013-03-25 19:18:18 +00:00
nickysn
eefc9eed90
* do not use 'NEAR' conditional jumps on the i8086, because they are 386+
...
git-svn-id: branches/i8086@23993 -
2013-03-25 00:24:35 +00:00
nickysn
1f5d384a1e
* i8086 fix in tx86casenode.genlinearlist
...
git-svn-id: branches/i8086@23990 -
2013-03-24 23:03:06 +00:00
nickysn
1646f53d59
* fixed the 'unresolved externals' linker error when smartlinking msdos executables
...
git-svn-id: branches/i8086@23968 -
2013-03-23 00:47:12 +00:00
florian
24f9d0d770
* cancel warning on i8086 because it stops compilation (the compiler is normally build with -Sew)
...
git-svn-id: branches/i8086@23933 -
2013-03-19 20:10:52 +00:00
nickysn
b930c9a0db
* all the remaining cases of the 'in' operator fixed (hopefully) for i8086
...
git-svn-id: branches/i8086@23905 -
2013-03-17 20:38:44 +00:00
nickysn
8ca0b443b8
* another case of the 'in' operator fixed for i8086 ('x in const', when use_small=false and genjumps=false)
...
git-svn-id: branches/i8086@23903 -
2013-03-17 20:18:57 +00:00
nickysn
d7c9603351
* i8086 fixes for the 'in' operator in the case of 'unsigned,small,non_constant IN smallset'
...
git-svn-id: branches/i8086@23901 -
2013-03-17 17:40:15 +00:00
nickysn
e6c8ac6694
* use the generic tcgaddnode.second_addsmallset on i8086, because the BTx instructions are 386+
...
git-svn-id: branches/i8086@23895 -
2013-03-17 15:40:54 +00:00
florian
20a534e63f
* fixed code which causes range check errors when compiled with -Cr
...
git-svn-id: trunk@23889 -
2013-03-17 14:24:50 +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
d6f0a1a0df
* do not generate scaled indicies for case table jumps for i8086
...
git-svn-id: branches/i8086@23872 -
2013-03-16 19:52:53 +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
c467035a1c
added group directive, so that the .data, .rodata and .bss sections go to the same segment
...
git-svn-id: branches/i8086@23754 -
2013-03-09 18:30:11 +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
nickysn
eff0894a66
all the extra i8086 units added
...
git-svn-id: branches/i8086@23718 -
2013-03-08 00:04:45 +00:00
nickysn
4440015db3
added i8086 specific adaptations to the NASM assembly writer
...
git-svn-id: branches/i8086@23714 -
2013-03-07 22:51:42 +00:00
nickysn
a4b1a9011b
i8086 specific stuff added to x86/cpubase.pas
...
git-svn-id: branches/i8086@23713 -
2013-03-07 22:49:35 +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
8ae7c5784c
* Sync with trunk r23500.
...
git-svn-id: branches/targetandroid@23501 -
2013-01-23 07:53:13 +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
paul
5d74e0578a
compiler: remove unused variables and unneeded assignments
...
git-svn-id: trunk@23467 -
2013-01-21 01:24:36 +00:00