Bug 18542 – DMD could generate better assembly for common range check idioms

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2018-03-01T11:25:13Z
Last change time
2024-12-13T18:57:35Z
Keywords
performance
Assigned to
No Owner
Creator
Nathan S.
Moved to GitHub: dmd#19402 →

Comments

Comment #0 by n8sh.secondary — 2018-03-01T11:25:13Z
DMD could generate better assembly for common range check idioms. Take this program: --- bool isUpper(dchar c) @safe pure nothrow @nogc { // Identical code to current std.ascii : isUpper. return c <= 'Z' && 'A' <= c; } ​ void main(string[] args) { } --- Compiled with dmd -O -release, the code for isUpper is: push RBP mov RBP,RSP cmp EDI,05Ah ja LE cmp EDI,041h jae L12 LE: xor EAX,EAX jmp short L17 L12: mov EAX,1 L17: pop RBP ret Compiled with ldc2 -O1, the code for isUpper is: addl $-65, %edi cmpl $26, %edi setb %al retq
Comment #1 by robert.schadek — 2024-12-13T18:57:35Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19402 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB