Timeline for compile time, but Not inlined function in C and C++
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 21 at 2:04 | comment | added | Vortex 2728182818 | @indi std::is_constant_evaluated() and if consteval will only evaluate an expression if it is manifestly-constant-evaluated. So constexpr int x = func(3) will be constant folded while int x = func(3) won't be. This causes test2 to emit a function call to gfx_Darken even though both arguments are constants godbolt.org/z/Woz64K3hP | |
| Apr 20 at 21:41 | comment | added | G. Sliepen | Oof, it seems Clang doesn't see that it can use the mlt instruction, and calls some function to do 16x16-bit multiplication instead. This then also affect register allocation and the whole thing becomes quite inefficient. Ideally you'd fix the compiler, so you can write C or C++ code and not have to hand-write assembly anymore. | |
| Apr 20 at 20:52 | comment | added | indi | There is std::is_constant_evaluated(), or just if consteval. | |
| Apr 20 at 20:14 | history | edited | Vortex 2728182818 | CC BY-SA 4.0 | added 888 characters in body |
| Apr 20 at 20:06 | history | asked | Vortex 2728182818 | CC BY-SA 4.0 |