Handmade Hero»Forums»Code
Furkan
6 posts
Question regarding /Oi flag
Edited by Furkan on
If i am not mistaken the /Oi flag signals the compiler to replace functions with intrinsic versions. Also at some point Casey talked about rewriting sinf himself instead of using the c runtime library's version of it.

My question is, if we were to do that and implement sinf ourselves, do we give up on /Oi optimization or is there a way to give a hint to compiler that the function we wrote can be replaced with intrinsic sin?
10 posts
Question regarding /Oi flag
According to MSDN: http://msdn.microsoft.com/en-us/library/tzkfha43.aspx , you can additionally "use /fp:strict or /Za flags to to override generation of true intrinsic floating-point options".
Furkan
6 posts
Question regarding /Oi flag
I guess i've found my answer. Intrinsics are built-in to compilers. This means which functions are intrinsics is predefined so there is no language construct to hint the compiler that the function we wrote is an intrinsic.

For example; memcpy is an intrinsic funtion. If i were to write my version of it, say frkn_memcpy, i can't tell the compiler to make the same /Oi optimization it makes for memcpy. And if i name it memcpy instead of frkn_memcpy, it will cause a compiler error saying "intrinsic functions can't be defined" if i try to compile with intrinsic optimizations enabled.

Helpful reading
http://msdn.microsoft.com/en-us/library/26td21ds.aspx