Thread overview
[Bug 293] Utilize assert (ptr == (ptr & -align)) to assume alignment
Jun 21, 2018
ARaspiK
Jun 29, 2018
ARaspiK
Jun 29, 2018
Iain Buclaw
June 21, 2018
https://bugzilla.gdcproject.org/show_bug.cgi?id=293

--- Comment #1 from ARaspiK <araspik@protonmail.com> ---
General pseudocode:
void* dst = ...;

Possible D code for alignment assumption:

assert ((dst & -0x10) == dst);
assert ((dst & 0xf) == 0);

Possible C code for alignment assumption:

dst = __builtin_assume_aligned(dst, 16);

Here is a StackOverflow (capitalization?) question on it:
https://stackoverflow.com/q/9608171/9781227

-- 
You are receiving this mail because:
You are watching all bug changes.
June 29, 2018
https://bugzilla.gdcproject.org/show_bug.cgi?id=293

--- Comment #2 from ARaspiK <araspik@protonmail.com> ---
Welp, I just discovered gcc.builtins. __builtin_assume_aligned did the trick.

For anybody wondering:
`import gcc.builtins` will pull in all (most?) GCC builtin functions.
__builtin_assume_aligned is among them.

-- 
You are receiving this mail because:
You are watching all bug changes.
June 29, 2018
https://bugzilla.gdcproject.org/show_bug.cgi?id=293

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #3 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Asserts that have no side effects are given as hints for the optimizer, otherwise generally having any kind of pattern matching in the that results in emitting details like "assume aligned" is really out of scope for what a front-end should do.

-- 
You are receiving this mail because:
You are watching all bug changes.