flat assembler
Message board for the users of flat assembler.

flat assembler > High Level Languages > Usefulness of Non-General Registries

Author
Thread Post new topic Reply to topic
Mino



Joined: 14 Jan 2018
Posts: 160
Hi, I would like to know if the registers of this type will be useful for the construction of my compiler:

    Segment
    FPU
    MMX
    SSE
    AVX
    AVX-512
    Opmask
    Bounds

(I would most likely not use segment, debug and control registers, unless you see an interest).

I would use general registers for... general things. But, should I "pay attention" to the use of the ESP, EBP and SP registers (that do not touche for some common actions (mov, add, ...))?

I would also like to know, by the way, how you would advise me to use the FASM variables (data directives). I had thought of using them only as a buffer (when necessary), and perhaps as values sent to a function.

Thank you Wink

_________________
The best way to predict the future is to invent it.
Post 08 May 2018, 19:51
View user's profile Send private message Reply with quote
Melissa



Joined: 12 Apr 2012
Posts: 60
AVX and AVX-512 you should use only if option is selected as majority of processors does not supports them. I am not sure if sse4.1 4.2 and ssse3 are supported as well. Safe bet is sse2, I think.
Post 09 May 2018, 02:56
View user's profile Send private message Reply with quote
vivik



Joined: 29 Oct 2016
Posts: 531
Just study the output of existing compilers. "Intel syntax" will produce something very simular to fasm. Or even better, you can study programs written in assembly, fasm source code for example. I don't know of many programs written in asm, and don't know which of them can be called good.

Segment was used in 16-bit processors for addressing (16 bits wasn't enough to address all memory). It's almost not used in 32-bit, it's only used for Structured Exception Handling on windows, maybe for something else.

FPU you still need for all operations on floating point numbers. It's probably partially "replaced" by SSE, but it probably still provides higher precision, 80-bit floating point numbers.

Bounds registers, I didn't knew those existed. This says https://cs.stackexchange.com/questions/86326/where-are-base-bounds-registers-located that it's something that is used by os, and not by user programs.

All simd instruction sets, MMX SSE SSE2 SSE3 AVX AVX-512, I'll recommend studying at least SSE2. It's more or less guaranteed to present on 32bit cpu, and is guaranteed on 64bit. You may play with AVX as well, but you probably should check cpuid first. https://en.wikibooks.org/wiki/X86_Assembly

Expecting you to waste tons of time for no much result. This is something a team should be doing.
Post 09 May 2018, 05:28
View user's profile Send private message Reply with quote
Mino



Joined: 14 Jan 2018
Posts: 160
Thanks for your answers Wink
vivik wrote:

Expecting you to waste tons of time for no much result. This is something a team should be doing.

What do you mean by that?
Otherwise, it's OK, I'll start with the general registers first, and then I'll deal with FPU.
After documentation, I realized that the MMX, AVX, AVX-512 and SSE registers were not recommended. They are for specific use (+ their instructions), and are not compatible with all processors.

_________________
The best way to predict the future is to invent it.
Post 09 May 2018, 11:35
View user's profile Send private message Reply with quote
vivik



Joined: 29 Oct 2016
Posts: 531
I mean writing a compiler is going to be difficult, it probably wouldn't worth the effort. And you need more than one person working on it.

MMX SSE and SSE2 seems to be supported almost everywhere by now.
Post 09 May 2018, 15:14
View user's profile Send private message Reply with quote
Mino



Joined: 14 Jan 2018
Posts: 160
vivik wrote:

I mean writing a compiler is going to be difficult, it probably wouldn't worth the effort. And you need more than one person working on it.

You're most likely right. But it's worth a try, no ? Wink

Thanks for your help otherwise.

_________________
The best way to predict the future is to invent it.
Post 09 May 2018, 16:19
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16108
Location: Squiddler's Patch
Mino wrote:
But it's worth a try, no ? Wink
Yes it is. Don't be discouraged. You'll never know if you can do something unless you try.
Post 10 May 2018, 02:38
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2311
Location: Usono (aka, USA)
Obligatory link to Wirth's Compiler Construction.
Post 15 May 2018, 00:52
View user's profile Send private message Visit poster's website Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 1302
Don't bother with Bounds registers: they are deprecated even in GCC, and they have some serious exploits/vulnerabilities (which is ironic since they were supposed to improve security).

It's by far the worst extension ever added to the arch -- doing the bound checks in software is faster AND more secure.
Post 16 May 2018, 20:30
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.