[fpc-devel] SSE/AVX instruction encodings

2020-10-01 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I've decided to take on https://bugs.freepascal.org/view.php?id=37785 - I've noticed that the compiler isn't too good at working out the sizes of SSE and AVX instructions.  If you look at Tx86Instruction.SetInstructionOpsize in compiler/x86/rax86.pas, it checks for individual pro

Re: [fpc-devel] SSE/AVX instruction encodings

2020-10-01 Thread avx512--- via fpc-devel
Hi, look at the function "MemRefInfo(aAsmop: TAsmOp)" in "compiler/x86/aasmcpu.pas". Torsten -Original-Nachricht- Betreff: [fpc-devel] SSE/AVX instruction encodings Datum: 2020-10-01T13:57:05+0200 Von: "J. Gareth Moreton via fpc-devel" An: "FPC developers' list" Hi everyone, I've

Re: [fpc-devel] SSE/AVX instruction encodings

2020-10-01 Thread J. Gareth Moreton via fpc-devel
Hi Torsten, I've done that already actually, although only to grab the value of the ExistsSSEAVX field.  I'm currently testing a new nested function in Tx86Instruction.SetInstructionOpsize:   function CheckSSEAVX: Boolean;     begin   Result := False;   if not MemRefInfo(opcode).Exis

[fpc-devel] Proposal/discussion: Simple nested functions and 'outlining'

2020-10-01 Thread J. Gareth Moreton via fpc-devel
Hi everyone, This is an idea that sprung to mind while looking at fixing an unrelated bug, and that's to do with nested functions. In situations where a nested function has no parameters, is it feasible and beneficial to programmatically merge it into the main procedure in some circumstances

[fpc-devel] x86_64 question

2020-10-01 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I have a small question with assembler size optimisation that maybe one of you guys can give me a second opinion on: If you are using the "test" instruction to test some of the lower bits of an instruction, e.g. TEST RCX, $2, is there a penalty with calling TEST CL, $2 instead?

Re: [fpc-devel] x86_64 question

2020-10-01 Thread Nikolay Nikolov via fpc-devel
On 10/1/20 8:17 PM, J. Gareth Moreton via fpc-devel wrote: Hi everyone, I have a small question with assembler size optimisation that maybe one of you guys can give me a second opinion on: If you are using the "test" instruction to test some of the lower bits of an instruction, e.g. TEST RC

[fpc-devel] r63899 breaks build of FpDebug

2020-10-01 Thread Pascal Riekenberg via fpc-devel
C:\Users\public\freepascal\laz\components\fpdebug\fpdbgdwarf.pas(265,15) Error: (3058) There is no method in an ancestor class to be overridden: "SetAsInteger(Int64);" C:\Users\public\freepascal\laz\components\fpdebug\fpdbgdwarf.pas(275,15) Error: (3058) There is no method in an ancestor class t

Re: [fpc-devel] r63899 breaks build of FpDebug

2020-10-01 Thread Pascal Riekenberg via fpc-devel
Sorry, wrong list. Pascal > Pascal Riekenberg via fpc-devel hat am > 01.10.2020 22:17 geschrieben: > > > C:\Users\public\freepascal\laz\components\fpdebug\fpdbgdwarf.pas(265,15) > Error: (3058) There is no method in an ancestor class to be overridden: > "SetAsInteger(Int64);" >

Re: [fpc-devel] x86_64 question

2020-10-01 Thread J. Gareth Moreton via fpc-devel
I thought that might be the case - thanks Nikolay.  And I meant to say lower bits of a REGISTER, not an instruction! Admittedly I'm cycle-counting and byte-counting again!  I was looking for ways to reduce 13 bytes of padding in one of my pure assembly language routines and realised I could ma

Re: [fpc-devel] Proposal/discussion: Simple nested functions and 'outlining'

2020-10-01 Thread Ryan Joseph via fpc-devel
> On Oct 1, 2020, at 10:37 AM, J. Gareth Moreton via fpc-devel > wrote: > > In situations where a nested function has no parameters, is it feasible and > beneficial to programmatically merge it into the main procedure What do you mean by "merge"? Like inlining? Regards, Ryan Joseph

Re: [fpc-devel] Proposal/discussion: Simple nested functions and 'outlining'

2020-10-01 Thread J. Gareth Moreton via fpc-devel
In a way, yes, but not quite the same, since multiple calls to the nested function would still redirect to the same block of code rather than being inlined at each call.  I suppose more similar to the old GOSUB; RETURN combination in old versions of Basic, and the nested routine slotted either

Re: [fpc-devel] SSE/AVX instruction encodings

2020-10-01 Thread avx512--- via fpc-devel
Hi Gareth, in my opinion it is not a good idea to introduce a new function to calculate the operand size. The risk of breaking existing code (fpc and user code) is very high. I introduced the system with memrefinfo for sse and avx opcodes to protect the existing user code. The basis of this c

Re: [fpc-devel] Proposal/discussion: Simple nested functions and 'outlining'

2020-10-01 Thread Martin Frb via fpc-devel
On 01/10/2020 23:22, J. Gareth Moreton via fpc-devel wrote: In a way, yes, but not quite the same, since multiple calls to the nested function would still redirect to the same block of code rather than being inlined at each call.  I suppose more similar to the old GOSUB; RETURN combination in o

Re: [fpc-devel] x86_64 question

2020-10-01 Thread Nikolay Nikolov via fpc-devel
On 10/1/20 11:36 PM, J. Gareth Moreton via fpc-devel wrote: I thought that might be the case - thanks Nikolay.  And I meant to say lower bits of a REGISTER, not an instruction! Admittedly I'm cycle-counting and byte-counting again!  I was looking for ways to reduce 13 bytes of padding in one