Commit Graph

106 Commits

Author SHA1 Message Date
florian
fca4d3315b * let the operation do the type conversion for x87 floating point operations
git-svn-id: trunk@43867 -
2020-01-05 17:47:23 +00:00
florian
3c16324f80 * x86: avoid to put variables into registers if they are handled by the x87-FPU
git-svn-id: trunk@43856 -
2020-01-03 22:23:49 +00:00
florian
91f3f022fe * MM registers which might not be changed can be still used in 3 op mathematical operations as source
git-svn-id: trunk@43509 -
2019-11-17 14:48:45 +00:00
florian
5f3050961f * load left properly into a register in tx86addnode.second_addordinal, resolves #36287
git-svn-id: trunk@43449 -
2019-11-10 21:45:57 +00:00
florian
c8f746b881 * do not allocate an extra register for some integer operations if not needed
git-svn-id: trunk@43412 -
2019-11-07 21:08:08 +00:00
Jonas Maebe
ce598c15ec * factored out the conditions under which add nodes need to perform
overflow checks
   o in particular ensure that cpu-specific overrides don't perform overflow
     checks when nf_internal is set

git-svn-id: trunk@42573 -
2019-08-03 12:19:50 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
pierre
9c90f593ab Add global range check disable for i8086 cgcpu and x86 nx86add units
git-svn-id: trunk@40124 -
2018-10-31 23:20:29 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
    (e.g. in case of array indexing or record field accesses) (mantis #33628)

git-svn-id: trunk@38814 -
2018-04-22 17:03:16 +00:00
florian
088af633ba Fix casing, bug ID #38660
git-svn-id: trunk@38660 -
2018-04-02 08:53:31 +00:00
florian
9b18e39c81 * enable Lea2AddBase and Lea2AddIndex in TX86AsmOptimizer.PostPeepholeOptLea as we have flag tracking now
* some flag allocations fixed

git-svn-id: trunk@38501 -
2018-03-11 20:30:09 +00:00
florian
d86ffb9bfb + tcg.a_op_loc_reg
+ optimized tx86addnode.second_ordinal for x86

git-svn-id: trunk@38500 -
2018-03-11 16:32:26 +00:00
nickysn
efc5e339d0 * use an enum instead of integer constants to represent inline numbers
* compinnr.inc include file converted to a unit
* inline number field size stored in ppu increased from byte to longint
* inlines in the parse tree (when written with the -vp option) now printed with
  their enum name, instead of number

git-svn-id: trunk@36174 -
2017-05-10 14:41:43 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
o separate information for reading and writing, because e.g. in a
     try-block, only the writes to local variables and parameters are
     volatile (they have to be committed immediately in case the next
     instruction causes an exception)
   o for now, only references to absolute memory addresses are marked
     as volatile
   o the volatily information is (should be) properly maintained throughout
     all code generators for all archictures with this patch
   o no optimizers or other compiler infrastructure uses the volatility
     information yet
   o this functionality is not (yet) exposed at the language level, it
     is only for internal code generator use right now

git-svn-id: trunk@34996 -
2016-11-27 18:17:37 +00:00
Jonas Maebe
da696057ab * converted register_maybe_adjust_setbase() to the high level code generator
git-svn-id: trunk@32591 -
2015-12-05 18:03:37 +00:00
nickysn
457107d165 * check UseIncDec before generating an INC instruction in tx86addnode.emit_generic_code
git-svn-id: trunk@32057 -
2015-10-15 13:11:47 +00:00
yury
e04a3b4ac6 * Removed unused vars for x86 compiler.
git-svn-id: trunk@31743 -
2015-09-17 15:20:15 +00:00
florian
c9b1df2c91 * the test $-1,%reg optimization shall be done not only if the cpu type is i386, but for the i386 compiler
git-svn-id: trunk@31474 -
2015-08-31 20:03:56 +00:00
Károly Balogh
249a60b28b x86: fix a variable op not initialized warning. This hopefully fixes our x86 testsuite run.
git-svn-id: trunk@28496 -
2014-08-20 10:21:06 +00:00
florian
499dd078e3 + automatically insert fma inlines into floating point code if possible and fastmath is activated
git-svn-id: trunk@28382 -
2014-08-11 20:50:21 +00:00
sergei
2ee0c8de45 * i386: For integer comparisons with zero, emit "test $-1,%reg" instead of "test %reg,%reg". It is more spilling-friendly, because it transforms into "test $-1,spilltemp" and does not require a register.
* Improved peephole optimizer to remove these instructions if preceded by flag-setting instruction that operates on same location and followed by conditional jump, and change them back into "test %reg,%reg" otherwise.

git-svn-id: trunk@27617 -
2014-04-20 19:16:58 +00:00
sergei
07e90aaa24 + Implemented IEEE 754-compliant checking for unordered results of floating-point compares on x86 targets. Mantis #9362.
git-svn-id: trunk@27581 -
2014-04-14 12:36:11 +00:00
sergei
3e20a136f3 * tx86addnode.second_addfloat: use single and double-precision memory locations without loading them on FPU stack if possible.
git-svn-id: trunk@27558 -
2014-04-13 12:37:30 +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
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
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
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
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
florian
3c58cad96b * make use of lea if possible
git-svn-id: trunk@25898 -
2013-11-01 19:01:11 +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
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
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
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
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
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
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
6345aee80b * revert r19643: FloatToStr has to handle Nan correctly and should not cause
any exceptions (silent or not), FloatToStr has been fixed in r19783

git-svn-id: trunk@22877 -
2012-10-29 22:00:42 +00:00
Jonas Maebe
edd42aa42a * moved subsetref/reg and bit_set/test support from cgobj to hlcgobj for
future use by high level code generator targets
   o this in turn required that all a_load*_loc* methods are called via
     hlcg rather than via cg, since a location can be a subsetref/reg and
     and those are no longer handled in tcg
   o that then required moving several force_location_* routines into
     thlcg because they use a_load_loc*, but did not take tdef size
     parameters (which are required by the thlcg a_load_loc* routines)
   o the only practical consequence is that from now on, you have to
     use hlcg.location_force_mem/reg() (fpureg not yet) and
     hlcg.gen_load_loc_cgpara() instead of the removed versions from ncgutil,
     and hlcg.a_load*loc*() instead of cg.a_load*loc* if a subsetref/reg
     might be involved

git-svn-id: trunk@21287 -
2012-05-13 12:33:10 +00:00
pierre
85862e476b Fix for test tw19368
git-svn-id: trunk@19643 -
2011-11-16 22:04:28 +00:00
florian
46cc0209de * make use of mulps/mulpd and haddps/haddpd/hsubpd/hsubps to optimze x*x+y*y and x*x-y*y where x and y might be single or double
git-svn-id: trunk@18790 -
2011-08-20 12:34:37 +00:00
Jonas Maebe
44178f41b6 * don't overwrite register variables when evaluating <=/>= expressions with
smallsets (left is overwritten by an "and", so it cannot be const; mantis
    #18013)

git-svn-id: trunk@16400 -
2010-11-22 12:58:08 +00:00