Does anyone use assembly




















Despite available in mainstream CPUs for couple decades now Pentium 3 launched in , modern compilers can only auto-vectorize very simple code. Supported by all modern compilers and quite portable in practice across different compilers building for the same architecture. GPUs have way more raw computing power.

Programming models are entirely different between them. Can you share what you do for a living? Const-me on June 24, parent next [—]. I've been developing software for living since Before that worked in game development, HPC have not coded for supercomputers, just commodity servers i. How so? Const-me on June 23, parent [—].

If you need performance, you must embrace vector nature of the hardware. They also provide decent documentation. Intel doesn't support any golang or rust packages or language extensions. They also sponsor Rust conferences. Active 6 years, 4 months ago. Viewed 24k times. Improve this question. Why would anyone write a complete project solely in assembly language today? Or are you asking about a mixed-language environment, which is how assembly is typically used today?

Note that there are areas of non-[PC web enterprise] programming, where Assembly is predominant or very popular. I'm talking micro-controllers, industrial automation or robotics. Sure, there are high level languages in these areas too, but you see Assembly a lot. I would have guessed that it's very uncommon to use assembly exclusively. Actually in industrial automation you can meet a whole branch of languages that simply do not exist outside of that field.

Part of that comes from differences in hardware Harvard architecture as opposed to von Neumann architecture we're so used to. That's how LD en. See the linked article for some more languages used in automation. I've got a small installer that I support now that's in assembly. It was as easy to write in assembly with Windows API as anything else, so why not? I've also got a credit card swiper interface written in assembly. Started in high level languages, but had so many difficulties getting it to work that I rewrote in assembly to get better control of all the bits flowing Add a comment.

Active Oldest Votes. Yes - but not often. I think in , the main uses for assembly would be: To read disassembly dumps when debugging, which I occasionally do even today.

Dealing with non-standard CPU features, like that funky graphics mode. Compiler writing - it provides an intermediate, human-readable format to translate higher-level languages into.

Improve this answer. Bob Murphy Bob Murphy As an example, the entirety of Roller Coaster Tycoon was written in assembly minus the graphics which were done in c and was amazingly powerful for it's time. Hundreds of individual AIs acting independently, almost seamlessly, when most game had a few 16x16 pixel sprites doing predefined motions. I always like to use that to show the power of assembly. Show 1 more comment. While the border moves, there is always room for assembly.

How many folks would rather pay twice as much for something that the batteries last half as long just because java or something was used as the development platform? Look at groupon and all the other ways folks look to save money, look at the green movement saving resources.

Why drive the cost and power up on all embedded products just to avoid assembly? A lot of people think embedded is an excuse for assembler, but their controllers have more CPU power than the machines Unix was developed on.

However a lot people are stuck with legacy, since changing microchip architecture is not easy. So there are sometimes good reasons to keep maintaining a project in assembler I was lucky to be able to setup affairs on a new architecture from scratch. But often people kid themselves that they really need the assembler.

Please submit the essay with your results. I've used that as a guiding principle for lowlevel features. Don't be too cramped to use it, but make sure you motivate it properly. Even throw up an artificial barrier or two like the essay to avoid convoluted reasoning as justification.

For example, checking for overflow on x86 is the simple overflow flag. This option is not available in C. Defects tend to run per-line statement, code point, etc. Most of these cases involve the usual suspects, such as drivers and bit-banging in embedded systems.

If you were around for all the Y2K remediation efforts, you could have made a lot of money if you knew Assembly. There's still plenty of legacy code around that was written in it, and that code occasionally needs maintenance. Another reason could be when the available compiler just isn't good enough for an architecture and the amount of code needed in the program is not that long or complex as for the programmer to get lost in it. Try programming a microcontroller for an embedded system, usually assembly will be much easier.

Beside other mentioned things, all higher languages have certain limitations. Thats why some people choose to programm in ASM, to have full control over their code. In my collection I have more then 20 such gold controls from Excell like ssheets to html renders. Most games I know of use as little assembly as at all possible. In some cases none at all, and at worst, one or two loops or functions. If you are programming a low end 8 bit microcontroller with bytes of RAM and 4K of program memory you don't have much choice about using assembly.

Sometimes though when using a more powerful microcontroller you need a certain action to take place at an exact time. Assembly language comes in useful then as you can count the instructions and so measure the clock cycles used by your code. Games are pretty performance hungry and although in the meantime the optimizers are pretty good a "master programmer" is still able to squeeze out some more performance by hand coding the right parts in assembly.

Never ever start optimizing your program without profiling it first. After profiling should be able to identify bottlenecks and if finding better algorithms and the like don't cut it anymore you can try to hand code some stuff in assembly. Aside from very small projects on very small CPUs, I would not set out to ever program an entire project in assembly.

However, it is common to find that a performance bottleneck can be relieved with the strategic hand coding of some inner loops. In some cases, all that is really required is to replace some language construct with an instruction that the optimizer cannot be expected to figure out how to use.

A typical example is in DSP applications where vector operations and multiply-accumulate operations are difficult for an optimizer to discover, but easy to hand code. For example certain models of the SH4 contain 4x4 matrix and 4 vector instructions.

I saw a huge performance improvement in a color correction algorithm by replacing equivalent C operations on a 3x3 matrix with the appropriate instructions, at the tiny cost of enlarging the correction matrix to 4x4 to match the hardware assumption. That was achieved by writing no more than a dozen lines of assembly, and carrying matching adjustments to the related data types and storage into a handful of places in the surrounding C code.

It doesn't seem to be mentioned, so I thought I'd add it: in modern games development, I think at least some of the assembly being written isn't for the CPU at all.

It's for the GPU, in the form of shader programs. This might be needed for all sorts of reasons, sometimes simply because whatever higher-level shading language used doesn't allow the exact operation to be expressed in the exact number of instructions wanted, to fit some size-constraint, speed, or any combination.

Just as usual with assembly-language programming, I guess. Almost every medium-to-large game engine or library I've seen to date has some hand-optimized assembly versions available for matrix operations like 4x4 matrix concatenation.

It seems that compilers inevitably miss some of the clever optimizations reusing registers, unrolling loops in a maximally efficient way, taking advantage of machine-specific instructions, etc when working with large matrices.

These matrix manipulation functions are almost always "hotspots" on the profile, too. I've also seen hand-coded assembly used a lot for custom dispatch -- things like FastDelegate, but compiler and machine specific. Finally, if you have Interrupt Service Routines, asm can make all the difference in the world -- there are certain operations you just don't want occurring under interrupt, and you want your interrupt handlers to "get in and get out fast" I have only personally talked to one developer about his use of assembly.

He was working on the firmware that dealt with the controls for a portable mp3 player. Doing the work in assembly had 2 purposes:. The only assembler coding I continue to do is for embedded hardware with scant resources. As leander mentions, assembly is still well suited to ISR s where the code needs to be fast and well understood. A secondary reason for me is to keep my knowledge of assembly functional. Being able to examine and understand the steps which the CPU is taking to do my bidding just feels good.

Last time I wrote in assembler was when I could not convince the compiler to generate libc-free, position independent code. Of course, I used to have other reasons. A lot of people love to denigrate assembly language because they've never learned to code with it and have only vaguely encountered it and it has left them either aghast or somewhat intimidated.

True talented programmers will understand that it is senseless to bash C or Assembly because they are complimentary. The organized syntaxic rules of C improves clarity but at the same gives up all the power assembly has from being free of any structural rules! C code instruction are made to create non-blocking code which could be argued forces clarity of programming intent but this is a power loss.

I have myself written code that cannot be written in C code without becoming hugely inefficient because of the above mentionned limitations. And i have not yet talked about speed which most people think is the main reason for writting in assembly, well it is if you mind is limited to thinking in C then you are the slave of you compiler forever. I always thought chess players masters would be ideal assembly programmers while the C programmers just play "Dames".

No longer speed, but Control. Not really, but I'm writing C code and reading the asm with the expectation of seeing exactly the asm I expect. About the only major thing I want from the compiler is register allocation and scheduling, but it's way more maintainable to let the compiler make these decisions based on its machine model than have me do it.

Note that I'm a heavy user of intrinsics and SIMD, so I'm writing a lot of code where I've pretty much already done instruction selection, often at algorithm design time. In embedded, using a cheaper microcontroller or HW offloading can bring big benefits. The former might boost profit a lit across high volume of units sold.



0コメント

  • 1000 / 1000