so first the foreword:
i learned assembly as a hobby and find it suitable for my way of thinking (its not THAT hard to learn)
anyway..
few weeks ago i actually found a use for my knowledge in the form of writing an sse loop for an OSS program, that can not be written in other languages
firstly ofc my plan was to write it in inline assembly
my thought process was "i write it in nasm where i can debug and benchmark it, then i just copy/paste it"
and ofc that plan failed fast
the only problem with the plan was GCC's idea of what inline assembly is
to be more precise, GCC's "we dont care about inline assembly"
GCC inline asm by default is AT&T syntax, what is to be honest ugly
they did add ".intel_syntax" switch, but you still have to put every instruction in quotes and append a "\n" at the end, what is utterly useless and again ugly
(also probably incompatible with other compilers)
to work with the incompatible GCC/GAS intel syntax you also have to append an ".noprefix" that eliminates the need for an AT&T "%" prefix infront of registers, something that should be implied with the ".intel_syntax" switch
and to add insult to injury, you also have to put a ".att_syntax" at the end of your "intel syntax" inline assembly or the compiler wont compile the C/C++ code that comes after the inline part
but thats not all;
GCC/GAS inline assembly has the ugliest parameter passing (C code to asm code) known to exist
and even using the just on paper intel syntax, the gcc ".intel_syntax", you cant even pass parameters at all (unless your implementing your code as a separate call, what im not)
all this reasons make writing cross OS inline assembly one of the dumbest things you can think of, and it should/could be simple and really easy to do
(icc and msvc use the sane/normal syntax and the most simple and easy parameter passing, icc even went out of their way to make it reasonably compatible with gcc's att syntax(dont know about M$))
to be fair as i should be considering i use gcc and programs compiled with gcc;
i did send an email at [email protected] explaining my problem and asking why is it like that when it should be much simpler
what i got in return not a minute later was:
i used standard ascii character set, not even unicode what everything today should support
and ofc, i didnt attach anything to my email
was it because i sent the email from my hotmail account i have since i was 14yo ?
i have respect for anyone who can make an optimized compiler, but this is pure bullshit
i wrote here as i dont know where else to write
only other idea where to write about this was the gcc bug-list thingy, but it feels like it would be ignored there
PS: to all those thinking this is some complicated and unsolvable problem, it is not
the syntax problem could be solved with a sed script, only the parameter passing is a bit harder but shouldn't be that hard to do (idk C so i wont even look at the milion of GCC source code lines)
i learned assembly as a hobby and find it suitable for my way of thinking (its not THAT hard to learn)
anyway..
few weeks ago i actually found a use for my knowledge in the form of writing an sse loop for an OSS program, that can not be written in other languages
firstly ofc my plan was to write it in inline assembly
my thought process was "i write it in nasm where i can debug and benchmark it, then i just copy/paste it"
and ofc that plan failed fast
the only problem with the plan was GCC's idea of what inline assembly is
to be more precise, GCC's "we dont care about inline assembly"
GCC inline asm by default is AT&T syntax, what is to be honest ugly
they did add ".intel_syntax" switch, but you still have to put every instruction in quotes and append a "\n" at the end, what is utterly useless and again ugly
(also probably incompatible with other compilers)
to work with the incompatible GCC/GAS intel syntax you also have to append an ".noprefix" that eliminates the need for an AT&T "%" prefix infront of registers, something that should be implied with the ".intel_syntax" switch
and to add insult to injury, you also have to put a ".att_syntax" at the end of your "intel syntax" inline assembly or the compiler wont compile the C/C++ code that comes after the inline part
but thats not all;
GCC/GAS inline assembly has the ugliest parameter passing (C code to asm code) known to exist
and even using the just on paper intel syntax, the gcc ".intel_syntax", you cant even pass parameters at all (unless your implementing your code as a separate call, what im not)
all this reasons make writing cross OS inline assembly one of the dumbest things you can think of, and it should/could be simple and really easy to do
(icc and msvc use the sane/normal syntax and the most simple and easy parameter passing, icc even went out of their way to make it reasonably compatible with gcc's att syntax(dont know about M$))
to be fair as i should be considering i use gcc and programs compiled with gcc;
i did send an email at [email protected] explaining my problem and asking why is it like that when it should be much simpler
what i got in return not a minute later was:
Code:
Hi. This is the qmail-send program at sourceware.org. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. <[email protected]>: Invalid mime type "text/html" detected in message text or attachment. Please send plain text messages only.
and ofc, i didnt attach anything to my email
was it because i sent the email from my hotmail account i have since i was 14yo ?
i have respect for anyone who can make an optimized compiler, but this is pure bullshit
i wrote here as i dont know where else to write
only other idea where to write about this was the gcc bug-list thingy, but it feels like it would be ignored there
PS: to all those thinking this is some complicated and unsolvable problem, it is not
the syntax problem could be solved with a sed script, only the parameter passing is a bit harder but shouldn't be that hard to do (idk C so i wont even look at the milion of GCC source code lines)
Comment