Commit Graph

1346 Commits

Author SHA1 Message Date
J. Gareth "Curious Kit" Moreton
1b8fc23dfd * x86: Code generation fixes where FLAGS
register is not properly allocated.

(cherry picked from commit 6f24c8b4ef)
2024-06-04 22:53:51 +02:00
florian
15194c6ee9 * correctly compile constant multiplications by 6 for 80386 (fix needed only for 3.2.x), resolves #40230 2023-04-02 22:52:10 +02:00
J. Gareth "Curious Kit" Moreton
2c75fb13b7 * i386: Corrections to IMUL -> LEA/LEA optimisastions (fixes_3_2 only) 2022-10-15 12:06:01 +00:00
nickysn
c9d2028ebd * handle LOC_(C)SUBSETREG/REF in second_NegNot_assign
* changed the way OP_NEG and OP_NOT are handled in op_reg_ref, in order to be
  consistent with op_reg_reg
* introduced op_reg,op_ref,op_subsetreg,op_subsetref and op_loc for the unary
  operations only (OP_NEG,OP_NOT)

git-svn-id: trunk@45302 -
(cherry picked from commit 0f6ab0de17)

# Conflicts:
#	compiler/cgobj.pas
2021-10-24 12:40:38 +02:00
Jonas Maebe
197f5cbec5 * let all the case code generation work with tconstexprint instead of aint,
so it also works for 32 bit targets and a high level code generator
    (where aint is still 32 bit, but 64 bit operations are not decomposed)

git-svn-id: trunk@41441 -
(cherry picked from commit 07bd4ba517)

With local change to fix compilation for x86_64 CPU
2021-08-26 23:28:28 +02:00
florian
f7f0d53604 * prefetch instructions read only the operand
git-svn-id: trunk@49089 -
(cherry picked from commit aa1a68000b)
2021-08-24 00:06:20 +02:00
florian
f58f92f005 * fix change information for popcnt
(cherry picked from commit a45123a87b)
2021-08-19 23:05:07 +02:00
florian
6847e7bfa8 * CMOV does not read the second operand
git-svn-id: trunk@49578 -
(cherry picked from commit 9377d9a029)
2021-08-08 17:10:11 +02:00
svenbarth
4b7f92a367 Merged revision(s) 48972, 49057 from trunk:
+ tx64tryfinallynode.dogetcopy properly implemented, resolves #37305
........
  * patch by Do-wan Kim: fix loop unrolling for try .. finally blocks in win32,
    similiar to r48972 for win64
........

git-svn-id: branches/fixes_3_2@49316 -
2021-05-01 15:48:45 +00:00
Jonas Maebe
76045bfc04 * merged macOS/AArch64 support + revisions these changes depended on
git-svn-id: branches/fixes_3_2@46866 -
2020-09-15 19:40:36 +00:00
joost
e70c001dad --- Merging r42115 into '.':
U    compiler/i386/n386flw.pas
--- Recording mergeinfo for merge of r42115 into '.':
 U   .
--- Merging r43830 into '.':
U    compiler/i386/cpunode.pas
U    compiler/options.pas
--- Recording mergeinfo for merge of r43830 into '.':
 G   .

git-svn-id: branches/fixes_3_2@43978 -
2020-01-19 12:48:36 +00:00
Jonas Maebe
c4bcb45fea --- Merging r43650 into '.':
U    compiler/i386/cpupi.pas
U    compiler/ncgcal.pas
U    compiler/ncgutil.pas
U    compiler/systems/i_bsd.pas
U    compiler/systems/i_linux.pas
U    compiler/systems.inc

git-svn-id: branches/fixes_3_2@43683 -
2019-12-14 16:20:28 +00:00
florian
319b575012 -- Aufzeichnung der Informationen für Zusammenführung von r43503 in ».«:
U   .
-- Zusammenführen von r43506 in ».«:
U    compiler/x86/cgx86.pas
-- Aufzeichnung der Informationen für Zusammenführung von r43506 in ».«:
 G   .
-- Zusammenführen von r43508 in ».«:
U    compiler/i386/n386cal.pas
-- Aufzeichnung der Informationen für Zusammenführung von r43508 in ».«:
 G   .

git-svn-id: branches/fixes_3_2@43510 -
2019-11-17 20:16:02 +00:00
florian
7cdb39b3f9 -- Aufzeichnung der Informationen für Zusammenführung von r43005 in ».«:
G   .
-- Aufzeichnung der Informationen für Zusammenführung von r43006 in ».«:
 G   .
-- Aufzeichnung der Informationen für Zusammenführung von r43007 in ».«:
 G   .
-- Aufzeichnung der Informationen für Zusammenführung von r43008 in ».«:
 G   .
-- Zusammenführen von r43000 in ».«:
U    compiler/pp.pas
-- Aufzeichnung der Informationen für Zusammenführung von r43000 in ».«:
 G   .
-- Zusammenführen von r43011 in ».«:
U    rtl/inc/system.inc
-- Aufzeichnung der Informationen für Zusammenführung von r43011 in ».«:
 G   .
-- Zusammenführen von r43012 in ».«:
U    rtl/i386/i386.inc
-- Aufzeichnung der Informationen für Zusammenführung von r43012 in ».«:
 G   .
-- Zusammenführen von r43013 in ».«:
U    rtl/linux/i386/si_c21.inc
-- Aufzeichnung der Informationen für Zusammenführung von r43013 in ».«:
 G   .
-- Zusammenführen von r43014 in ».«:
U    compiler/systems/i_linux.pas
-- Aufzeichnung der Informationen für Zusammenführung von r43014 in ».«:
 G   .
-- Zusammenführen von r43176 in ».«:
U    compiler/i386/cpupi.pas
U    compiler/i386/n386cal.pas
U    compiler/ncgcal.pas
U    compiler/ncgutil.pas
G    compiler/systems/i_linux.pas
U    compiler/systems.inc
C    compiler/systems.pas
G    tests/webtbs/tw7808.pp
-- Aufzeichnung der Informationen für Zusammenführung von r43176 in ».«:
 G   .
Konfliktübersicht:
  Textkonflikte: 1
Konfliktübersicht:
  Textkonflikte: 1

git-svn-id: branches/fixes_3_2@43434 -
2019-11-09 22:07:33 +00:00
Jonas Maebe
3ac703506c * rest of the previous accidental partial commit
git-svn-id: branches/fixes_3_2@41250 -
2019-02-07 19:56:21 +00:00
pierre
23b9dde397 Merge of commits 40142, 40189 and 40347
------------------------------------------------------------------------
r40142 | jonas | 2018-11-01 13:19:33 +0000 (Thu, 01 Nov 2018) | 2 lines

  * ttryfinallynode now inherits from tbinarynode instead of tloopnode, as its
    t1 field was always set to tnothingnode
------------------------------------------------------------------------
--- Merging r40142 into '.':
U    compiler/i386/n386flw.pas
U    compiler/nflw.pas
U    compiler/x86_64/nx64flw.pas
U    compiler/nutils.pas
U    compiler/ppu.pas
U    compiler/ncgflw.pas
U    compiler/psub.pas
--- Recording mergeinfo for merge of r40142 into '.':
 U   .
------------------------------------------------------------------------
r40189 | jonas | 2018-11-02 21:12:18 +0000 (Fri, 02 Nov 2018) | 2 lines

  * fixed overzealous removal of an assigned(t1) check in r40142 (it was for a
    ttryexceptnode instead of for a ttryfinally node)
------------------------------------------------------------------------
--- Merging r40189 into '.':
G    compiler/x86_64/nx64flw.pas
--- Recording mergeinfo for merge of r40189 into '.':
 G   .
------------------------------------------------------------------------
r40347 | pierre | 2018-11-18 10:32:13 +0000 (Sun, 18 Nov 2018) | 3 lines

  * Use getasizeint/putasizeint for tfieldvarsym.fieldoffset 
  * Change CurrentPPUVersion

------------------------------------------------------------------------
--- Merging r40347 into '.':
G    compiler/ppu.pas
U    compiler/utils/ppuutils/ppudump.pp
U    compiler/symsym.pas
--- Recording mergeinfo for merge of r40347 into '.':
 G   .

git-svn-id: branches/fixes_3_2@40717 -
2018-12-31 16:15:55 +00:00
florian
78943ea843 + patch by J. Gareth Moreton: x86 optimisations for Jcc and SETcc, resolves #33899
* optimization also added for i386

git-svn-id: trunk@39307 -
2018-06-25 20:40:05 +00:00
florian
af37ca8563 - remove SetccMovbLeaveRet2SetccLeaveRet optimization, this type of code is not generated anymore for years
git-svn-id: trunk@39306 -
2018-06-25 20:40:04 +00:00
nickysn
c530e031b1 * synchronize get_saved_registers_int and get_volatile_registers_int for all
calling conventions on i386
* generated code at the caller side for pocall_pascal routines on i386 no longer
  assumes the routine destroys all registers (except ebp) - instead now it
  assumes that it preserves the ebx,esi,edi and ebp registers. This is
  compatible with the pascal calling convention of 32-bit delphi and was already
  honoured by FPC on the callee side.
* updated the list of calling conventions that save all registers, used in
  tx86callnode.can_call_ref, so it is accurate on all x86 platforms - i8086,
  i386 and x86_64.

git-svn-id: trunk@38904 -
2018-05-04 16:16:24 +00:00
nickysn
80a9dab99a * introduce a case statement, based on the calling convention in i386's
tcpuparamanager.get_saved_registers_int

git-svn-id: trunk@38902 -
2018-05-04 15:03:01 +00:00
Jonas Maebe
d69ad8fa41 * removed temppos field again from parameter locations: they're not allocated
by the temp manager of the current procedure

git-svn-id: trunk@38858 -
2018-04-27 19:18:55 +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
nickysn
518cdf9674 * replaced the saved_XXX_registers arrays with virtual methods inside
tcpuparamanager, very similar to the existing get_volatile_registers_XXX. The
  new methods are called get_saved_registers_XXX, where XXX is the register
  type ("int", "address", "fpu" or "mm")

git-svn-id: trunk@38794 -
2018-04-19 21:22:16 +00:00
nickysn
3318703ece * moved nf_typedaddr to addrnodeflags (anf_typedaddr)
git-svn-id: trunk@38671 -
2018-04-03 16:41:01 +00:00
florian
8b0bbdcaab * fix flag subregs after r38206
git-svn-id: trunk@38502 -
2018-03-11 20:30:11 +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
47927f053a * factored out TX86AsmOptimizer.OptPass1SHLSAL
git-svn-id: trunk@38498 -
2018-03-11 14:35:19 +00:00
marco
f0042a4719 * vcmppd hardcoded primitives like vcmpeqpd.
* required increasing maxinfolen to 9 

git-svn-id: trunk@38404 -
2018-03-03 23:32:54 +00:00
marco
f21a141144 * mantis #32001, add 32 vcmpps variants.
git-svn-id: trunk@38403 -
2018-03-03 23:10:03 +00:00
florian
8c5606b41d + support mmx shifting
git-svn-id: trunk@38367 -
2018-02-27 21:40:12 +00:00
florian
91514da267 * factored out TX86AsmOptimizer.PostPeepholeOptCall
+ use TX86AsmOptimizer.PostPeepholeOptCall on x86-64

git-svn-id: trunk@38278 -
2018-02-17 23:25:01 +00:00
florian
c1de51454c ti386shlshrnode.second_64bit:
* do not reused register
  * copy data to a new register only if really necessary

git-svn-id: trunk@38266 -
2018-02-17 12:45:15 +00:00
florian
31f78ea2b6 + implementation of the vectorcall calling convention by J. Gareth Moreton
+ tests

git-svn-id: trunk@38206 -
2018-02-11 17:50:37 +00:00
florian
73fda1ccb6 * factored out OptPass1Sub
+ make use of OptPass1Sub on x86_64 and i8086 as well

git-svn-id: trunk@37572 -
2017-11-10 20:55:22 +00:00
nickysn
ae92973196 + added support for the retw, retnw, retfw, retd, retnd, retfd, retq, retnq and
retfq x86 instructions. These are variants of the ret instruction with the
  return offset size set explicitly, e.g. retfw is a 16-bit far ret (i.e. pops
  a 16-bit offset and a 16-bit segment), retfd is a 32-bit far ret (pops a
  32-bit offset, followed by a 16-bit segment), etc.

git-svn-id: trunk@37571 -
2017-11-10 16:53:29 +00:00
pierre
ba3afefa4c Regenerate register include files after commit 37564: Fix value of NR_DR6 and NR_DR7
git-svn-id: trunk@37565 -
2017-11-07 07:30:42 +00:00
florian
2140b586a6 * i386 building fixed
git-svn-id: trunk@37554 -
2017-11-04 19:42:08 +00:00
florian
4da4b768ec * factored out PostPeepholeOptTest
+ use PostPeepholeOptTest on x86-64

git-svn-id: trunk@37551 -
2017-11-04 19:10:14 +00:00
florian
3097eaf8ee * made PostPeepholeOptMov a function
git-svn-id: trunk@37550 -
2017-11-04 19:10:12 +00:00
florian
a7ea7fb569 * factored out PostPeepholeOptCmp
+ use PostPeepholeOptCmp for x86_64

git-svn-id: trunk@37549 -
2017-11-04 19:10:09 +00:00
nickysn
80226e3af4 + added an optimization pass, that optimizes x86 references
git-svn-id: trunk@37494 -
2017-10-20 15:55:55 +00:00
nickysn
e8bbc4eef9 + support the xlat x86 instruction syntax with a memory operand. This allows
specifying the address size (e.g. xlat byte ptr [bx] or xlat byte ptr [ebx])

git-svn-id: trunk@37478 -
2017-10-17 16:40:06 +00:00
nickysn
0fb79946a5 + added support for the parameterized versions of the x86 string instructions
(movs, cmps, scas, lods, stos, ins, outs) in the inline asm of the i8086, i386
  and x86_64 targets. Both intel and at&t syntax is supported.
* NEC V20/V30 instruction 'ins' (available only on the i8086 target, because it
  is incompatible with 386+ instructions) renamed 'nec_ins', to avoid conflict
  with the 186+ 'ins' instruction.

git-svn-id: trunk@37446 -
2017-10-12 00:07:02 +00:00
nickysn
92a52a9f4d + implemented support for instructions with non-native address size on i8086
(16-bit and 32-bit), i386 (16-bit and 32-bit) and x86_64 (32-bit and 64-bit).
  Known bug: 32-bit addresses with an offset have their offset truncated to its
  low 16-bits on i8086

git-svn-id: trunk@37409 -
2017-10-06 15:27:14 +00:00
florian
15b617546e + call TX86AsmOptimizer.OptPass1VOP for logical operations as well
git-svn-id: trunk@37367 -
2017-10-01 14:40:21 +00:00
nickysn
aec03309ef + added CPUX86_HAS_SSE2 to x86 tcpuflags
git-svn-id: trunk@37326 -
2017-09-26 16:02:56 +00:00
nickysn
e701fa8de1 * converted the x86 instruction flags to a set, so they can be extended more
easily and so that all the values are now available to the compiler
  (previously, there were several, which were mapped to the same value and thus
  were only used to make x86ins.dat easier to read)

git-svn-id: trunk@37299 -
2017-09-21 15:48:27 +00:00
nickysn
ab62e2237b * mark the sldt,syscall,sysenter,sysexit,sysret,andn,bextr,rorx,sarx,shlx and
shrx instructions as protected mode only

git-svn-id: trunk@37275 -
2017-09-20 15:43:23 +00:00
florian
05ecd784f2 * factored out OptPass1LEA and use it for x86-64 as well
+ LEAMov2LEA optimization

git-svn-id: trunk@37199 -
2017-09-13 20:40:32 +00:00
nickysn
aefa317474 + fast and branchless implementation of abs(int64) for i386
git-svn-id: trunk@37169 -
2017-09-10 17:25:47 +00:00