https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91883

David Stone <davidfromonline at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davidfromonline at gmail dot 
com

--- Comment #2 from David Stone <davidfromonline at gmail dot com> ---
Here's another example:

```c++
int baseline(int x) {
        return x / 3;
}

int assumed(int x) {
        [[assume(x >= 0)]];
        return x / 3;
}

int goal(unsigned x) {
        return x / 3;
}
```

when compiled with gcc at -O3 generates

```
baseline(int):
        movsx   rax, edi
        sar     edi, 31
        imul    rax, rax, 1431655766
        shr     rax, 32
        sub     eax, edi
        ret
assumed(int):
        movsx   rax, edi
        sar     edi, 31
        imul    rax, rax, 1431655766
        shr     rax, 32
        sub     eax, edi
        ret
goal(unsigned int):
        mov     eax, edi
        mov     edx, 2863311531
        imul    rax, rdx
        shr     rax, 33
        ret
```

See it live: https://godbolt.org/z/nMPfxchM4
  • [Bug middle-end/91883] Divis... davidfromonline at gmail dot com via Gcc-bugs

Reply via email to