Return Styles: Pseud0ch, Terminal, Valhalla, Blue Moon.

Pages: 1-4041-

It's 2016 and COMPILERS ARE STILL STUPID

Name: Cudder !cXCudderUE 2015-12-31 22:29

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:

shl ecx, 4
mov edx, ecx
shr ecx, 2
xor eax, eax
rep stosd
mov ecx, edx
and ecx, 3
rep stosb


:facepalm:

Name: Anonymous 2015-12-31 22:32

fuck off namefag

Name: Cudder !cXCudderUE 2015-12-31 22:46

"I have no idea how to use registers":

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.

Name: Cudder !cXCudderUE 2015-12-31 22:59

How much stupidity could a 5-instruction function have?

mov eax, ecx
lea edx, [eax+14Ch]
and dword [edx], 0FF000000h
mov byte [edx+3], 0
ret

Name: Anonymous 2015-12-31 23:33

It's actually 2015 still.

Name: Anonymous 2015-12-31 23:43

This is why modern programmers use JIT compilers instead. Such as javascript or haskell.

Name: Anonymous 2015-12-31 23:44

Perhaps it is some deep pipelining optimization that isn't obvious.

Name: Anonymous 2015-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 !cXCudderUE 2016-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...

Name: Anonymous 2016-01-01 0:36

>>6
Wrong, they tend to produce even more shit.

Name: Anonymous 2016-01-01 5:41

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: Anonymous 2016-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.

Name: Anonymous 2016-01-01 6:39

https://en.wikipedia.org/wiki/Post-PC_era

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: Anonymous 2016-01-01 6:45

I always ship my device drivers with debug symbols for maximum bloat.

Name: Cudder !cXCudderUE 2016-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.

http://bbs.progrider.org/prog/read/1438215413
http://bbs.progrider.org/prog/read/1436562973

Name: Anonymous 2016-01-01 14:47

>>15
What about djb's boringcc idea? Or suckless scc (simple c compiler).
Tell me. Tell me? Tell me!

Name: Cudder !cXCudderUE 2016-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: Anonymous 2016-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.

Name: Anonymous 2016-01-02 3:49

stop being a namefag

Name: Anonymous 2016-01-02 6:59

>>19
Who are you quoting?

Name: Anonymous 2016-01-02 8:42

>>20
These boards are shit enough without pieces of shit like you shitting it up more.

Name: Anonymous 2016-01-02 9:07

>>17
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.

Name: Anonymous 2016-01-02 16:58

>>21
le pedophile bump

Name: Cudder !cXCudderUE 2016-01-03 2:53

On the other hand, this bloat means I can patch these functions with ones having more functionality, but in the same amount of space.

Name: Anonymous 2016-01-03 3:02

stop being a namefag

Name: Anonymous 2016-01-03 3:15

>>24
If this is a Windows driver, won't that fuck up the signing? If it is some Unix driver, why are you using closed drivers?

Name: Anonymous 2016-01-03 4:36

Computing is stupid in general. All useful computing is still being done inside someone's head.

Name: Cudder !cXCudderUE 2016-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: Anonymous 2016-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: Anonymous 2016-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!

Name: Anonymous 2016-01-03 17:01

>>30
Go back to /g/.

Name: Anonymous 2016-01-04 1:05

Cudder is still on 32-bit,*snigger*!

Name: Anonymous 2016-01-04 1:33

stop being a namefag

Name: Cudder !cXCudderUE 2016-01-04 3:01

>>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".

>>32
32GET!

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: Anonymous 2016-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: Anonymous 2016-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!

// ==UserScript==
// @name Forced Anonymous
// @include https://bbs.progrider.org/*
// @include http://bbs.progrider.org/*
// @version 1
// @grant none
// ==/UserScript==

function force_anon() {
var names = document.querySelectorAll('.name');
var trips = document.querySelectorAll('.trip');

for (var i = 0; i < names.length; i++) {
names[i].innerHTML = 'Anonymous';
}
for (var i = 0; i < trips.length; i++) {
trips[i].innerHTML = '';
}
}

force_anon();

Name: Anonymous 2016-01-04 4:33

>>36
I always knew javashit kike was an ima/g/eredditor.

Name: Anonymous 2016-01-04 5:49

>>36
// ==UserScript==
// @name Remove Cudder
// @include https://bbs.progrider.org/*
// @include http://bbs.progrider.org/*
// @version 1
// @grant none
// ==/UserScript==

var trips = ['!cXCudderUE', '!MhMRSATORI'];
var posts = document.querySelectorAll('div.post');
for(var i = 0; i < posts.length; i++) {
var trip = posts[i].querySelector('div.posthead span.trip').innerHTML;
if(trips.indexOf(trip) !== -1) {
posts[i].querySelector('div.postbody').style.display = 'none';
}
}

Name: Anonymous 2016-01-04 5:51

>>33
There is no need for that much code.

// ==UserScript==
// @name NoUserTrip
// @namespace wiki
// @include https://bbs.progrider.org/*
// @include http://bbs.progrider.org/*
// @version 1
// @author FrozenVoid
// @grant GM_addStyle
// @run-at document-end
// ==/UserScript==
GM_addStyle('.name,.trip{display:none !important}.num::after{content:" Anonymous"}');

Name: Anonymous 2016-01-04 6:35

>>9
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.

Name: Anonymous 2016-01-04 8:39

>>40
buying compilers
buying manuals
assuming Intel doesn't cripple low-end hardware
X sucks, why its popular?

Name: Anonymous 2016-01-04 8:49

>>41
Who are you quoting?

Name: Anonymous 2016-01-04 8:55

Name: Anonymous 2016-01-04 12:47

>>42
It's not quoting, it's greentext.

Name: Anonymous 2016-01-04 14:13

>>44
Take your colorblind out of here.

Name: Anonymous 2016-01-04 14:16

It's 2016 and cudder is still cuddering. Cudder off, you mothercudder.

Name: Anonymous 2016-01-04 14:24

>>45
I'm not colourblind, I'm cis-eyed colourflexible and pantone.

Name: Cudder !cXCudderUE 2016-01-05 4:42

>>40
ICC is free for non-commercial use.

And it shows that the stupid wankers working on other compilers are barking up the wrong tree wrt optimisations.

Name: Anonymous 2016-01-05 5:31

>>48
Its true, but they have conditions on who they give it to.
https://software.intel.com/en-us/qualify-for-free-software

Name: Anonymous 2016-01-05 6:21

>>44
But who are you quoting?

>>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.
(https://software.intel.com/sites/default/files/managed/2a/bb/Master-EULA-for-Intel-Sw-Development-Products-September-2015.pdf), where they also extend their grip to the output binary ICC produces.

Name: Anonymous 2016-01-05 7:21

Also, ICC is closed source: it could contain anything,fatal bugs, backdoors and logic bombs.

Name: Cudder !cXCudderUE 2017-11-12 5:54

It's (almost) 2018 and COMPILERS ARE STILL STUPID

mov ebp, [edi+eax*4]
lea eax, [edi+eax*4]
inc ebp
mov [eax], ebp

Name: Anonymous 2017-11-12 9:19

>>52
Were you expecting 7 bytes of instructions using one temporary? Too bad! It was 9 bytes of instructions using two temporary all along!

Name: Anonymous 2017-11-12 13:44

>>52
I've got to admit, that's pretty stupid.

Name: Anonymous 2017-11-12 15:20

>>52
So how do we improve this, famberlam?

Name: Cudder !cXCudderUE 2017-11-12 16:17

>>53-55
That sequence could be replaced by one 3-byte instruction:

inc dword ptr [edi+eax*4]

The value in ebp is not used after this, so there's no point at all in getting it into a named register.

Name: Anonymous 2017-11-12 16:30

>>55
inc
can take memory operands.

Name: Cudder !cXCudderUE 2017-11-13 7:18

cmp dword ptr[esi], 0
setz dl
test dl, 4
jnz some_label


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) ...

Don't change these.
Name: Email:
Entire Thread Thread List