Just analysing a device driver for hardware few months old... as usual, it's as bloated as a week-old dead pig overall but then I come across pieces like this:
call SomeFunc mov edx, eax test edx, edx mov [esi+48], edx jnz loc1 ... loc1: mov edi, edx ...
Instead of just moving the return value in eax to edi where it eventually gets used in one of the stupid sequences in OP, the compiler somehow decides to thread it through edx, before realising that edx needs to be used for something else and then moves it into edi.
This would be unacceptable even at O0, but this is released code presumably compiled with O2 or better and in active use by millions or more machines worldwide. WTF.
This is why modern programmers use JIT compilers instead. Such as javascript or haskell.
Name:
Anonymous2015-12-31 23:44
Perhaps it is some deep pipelining optimization that isn't obvious.
Name:
Anonymous2015-12-31 23:58
>>7 As usual, op is dishonestly cherrypicking the common case of compilers not particularly optimizing for instruction count - doing so would restrict the freedom to do pipelining/ssa trace optimizations, so they dont even bother (except ICC to a degree).
Also why litter another thread, op, weren't the fib() one good enough for you?
Name:
Cudder !cXCudderUE2016-01-01 0:28
>>7 Which one? All I see is that the sequences in >>3,4 are creating more dependency chains than necessary, and I'll let you figure out what's wrong with >>1.
>>8 What the fuck are you blabbering on about? Your vague abstract bullshite means nothing. Are you one of those stupid academics who focuses on idiotic microbenchmark optimsations?
except ICC to a degree
Does the fact that ICC pwns the shit out of every other compiler mean anything? Maybe you should see what the real leaders are doing instead of sticking your head in the sand and preaching abour your theoretical "optimizations" that don't actually make a winner. Instruction count is always important for anything else. Incidentally, that's what lead to http://funroll-loops.info/
Here's another fun one I found:
movzx ecx, word [ecx] mov eax, ecx shr eax, 15 shl eax, 1 mov edx, ecx shr edx, 14 and edx, 1 or eax, edx mov edx, ecx shr edx, 13 shl eax, 1 and edx, 1 or eax, edx mov edx, ecx shl eax, 9 shr edx, 4 and edx, 511 or eax, edx shl eax, 4 and ecx, 15 or eax, ecx ret
What does this 22-instruction-function do? Nothing. Absolutely nothing. I'll let the reader decide whether the compiler or programmer is the stupid one here...
In late 2010, AMD settled a US Federal Trade Commission antitrust investigation against Intel.[17]
The FTC settlement included a disclosure provision where Intel must:[18] “ ...publish clearly that its compiler discriminates against non-Intel processors (such as AMD's designs), not fully utilizing their features and producing inferior code. ”
In compliance with this rule, Intel added an "optimization notice" to its compiler descriptions stating that they "may or may not optimize to the same degree for non-Intel microprocessors" and that "certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors."
Name:
Anonymous2016-01-01 6:11
This is Intel's fault. The x86 architecture is so bad that compiler developers still struggle to generate decent assembly after 40 years of constant work.
Windows Store is the primary means of distributing Windows Store apps to users. Although sideloading apps from outside the store is supported, not all computers running Windows 8 can do it. Out-of-box sideloading support is only available for Windows 8 Enterprise computers that have joined a Windows domain. Sideloading on Windows RT and Windows 8 Pro computers as well as Windows 8 Enterprise computers without a domain affiliation requires purchase of additional licenses through volume licensing.[17]
Name:
Anonymous2016-01-01 6:45
I always ship my device drivers with debug symbols for maximum bloat.
Name:
Cudder !cXCudderUE2016-01-01 13:10
>>12 Then how the fuck do Intel's compiler and all the Asm programmers manage to do it? Blaming the architecture for your shitty codegen is just a poor excuse for your stupidity being at fault. I've elaborated before on this board and the old one, it seems the majority of compiler writers are stuck in some sort of academic cargo-cult especially around things like register allocation and instruction selection. Maybe when they stop acting like mindless sheep, so will their compiler output.
>>15 What about djb's boringcc idea? Or suckless scc (simple c compiler). Tell me. Tell me? Tell me!
Name:
Cudder !cXCudderUE2016-01-01 23:41
>>16 No real comments about those projects in particular, but another datapoint to consider: The fact that Intel's compiler has been solidly beating the others even without being as aggressive with undefined-behaviour-enabling-optimisations (UBEOs) is a great demonstration of just how much UBEOs actually help. Instruction selection and register allocation is where all the important bits are.
Name:
Anonymous2016-01-02 0:24
>>15 Kiketel employees teams of dorks to work out all sorts of shit and assembly programmers are autistic virgins who use Intel manuals as a masturbation aid. GCC is more focused on writing code so shitty no one wants to steal it, MSVC is kept shitty so dotNET looks competitive, and Clang\LLVM is Apple's NIH project.
The fact that Intel's compiler has been solidly beating the others even without being as aggressive with undefined-behaviour-enabling-optimisations (UBEOs) is a great demonstration of just how much UBEOs actually help.
Hang on Grandpa, I can't read your reply before enabling my A20 line.
Computing is stupid in general. All useful computing is still being done inside someone's head.
Name:
Cudder !cXCudderUE2016-01-03 6:32
>>26 Yes and I don't care because I've obviously patched that check out. Nevertheless, fuckings to MS for trying to stop people from fixing their bugs.
Name:
Anonymous2016-01-03 6:48
>>28 I think they are more interested in preventing rootkits and forcing driver writers to make sure the quality is merely horrible and not so catastrophic that it crashes the entire OS half the time.
Name:
Anonymous2016-01-03 12:10
>>13 I'd just like to interject for moment. What you're refering to as Windows, is in fact, NSA/Windows, or as I've recently taken to calling it, NSA plus Windows. Windows is not an operating system unto itself, but rather another free component of a fully functioning NSA system made useful by the NSA servers, remote control utilities and vital "telemetery" components comprising a full OS as defined by NSA.
Many computer users run a modified version of the NSA system every day, without realizing it. Through a peculiar turn of events, the version of NSA which is widely used today is often called Windows, and many of its users are not aware that it is basically the NSA system, developed by NSA and Microsoft.
There really is a Windows, and these people are using it, but it is just a part of the system they use. Windows is the GUI: the program in the system that receives instructions from NSA servers to manage and survey the programs you run. The GUI is an essential part of on operating system, but useless by itself; it can only function in the context of a complete surveillance system. Windows is normally used in combination with the NSA surveillance system: the whole system is basically NSA with Windows added, or NSA/Windows. All the so-called Windows systems are really NSA/Windows surveillance systems!
>>29 Ostensibly. They're really just trying to force people to pay them for the privilege of WRITING SOFTWARE FOR THE HARDWARE THEY ALREADY OWN. These days you can justify just about anything in the name of "security".
I have no need for anything more. As I write this my system has 39 processes and 393MB of RAM used. At this level 64-bit is just bloat. Besides, I like my pointers and integers being the same size.
Name:
Anonymous2016-01-04 3:13
>>34 Lol at little babby with his little babby process list and little babby datasets. And you think you have any right or reason to judge the development of modern software. Fuck off.
Name:
Anonymous2016-01-04 4:00
Hi all, you might be pleased to know that I have found a solution to the problem of people with unwarranted levels of self importance, which manifests itself as seeing users with unironic and persistent names and tripcodes. As a solution to this problem, I have written a simple greasemonkey script to prevent us god-fearing /prog/-riders from having to experience the most visible and noticable parts of their pathological personality disorders, namely their use of the name and tripcode fields. I hope you all use it so these antisocial jerks will fail to recieve the attention they so desire and everyone else won't have to experience directed response at tripcode users. Please remember also to share this with anyone else who responds to tripcode users. Thank you!
Does the fact that ICC pwns the shit out of every other compiler mean anything?
Yes, it means that it costs $700. If Intel wanted it to be used, they would make it free, or at least cheaper. As it stands, Intel clearly wants most software to be as shitty as possible (why else keep their most useful manuals proprietary) so that they can sell more chips, while still milking the high end market's addiction to their bloated instruction set by selling morbidly expensive compilers and manuals.
Intel will be punished one day, and AMD as well for inventing x64 and letting everyone beat that dead horse even more.
>>48 All software where performance is likely to matter will always be commercially developed. It helps no one that
You may use the Materials only for non-commercial use where You receive no fee, salary or any other form of compensation. The Materials may not be used for any other purpose, whether "for profit" or "not for profit." Any work performed or produced as a result of use of the Materials cannot be performed or produced for the benefit of other parties for a fee, compensation or any other reimbursement or remuneration.
I have a feeling this time the programmer was the stupid one, because I can't otherwise see how a compiler would generate that unless the input was really if((*foo == 0) & 4) ...
Name:
Cudder!cXCudderUE2017-11-26 6:54
sub ecx, 0 jz ... dec ecx jz ... dec ecx jnz ... Wait... what?
>>87,88 The two pieces of code aren't equivalent since d, s and t can overlap; the SIMD code would be wrong for add4. This is why languages that require you to break down every operation on arrays into detailed loops are stupid by the way.
This is why languages that require you to break down every operation on arrays into detailed loops are stupid by the way.
I agree, but only because of the qualifier about 'every operation'. most things people use loops for could be expressed with map/filter/reduce without losing readability - and it would be better for the more advanced compiler optimizations. still, most things are not the same as all things - there are things that are just plain easier to understand with loops: writing something like a multimedia codec (or even that ASCII->GSM-7 converter from a /prog/ challenge) with just map would require an anal deformation of your brain far worse than the one required to program in Forth