Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Splitting inline asm in to multiple blocks like shown in the article isn't a reliable way of using inline asm. Unless registers are specified in clobber list compiler isn't aware which registers are used by inline asm and may use them for other purpose. That can easily break by compiler overwriting them between inline asm blocks or other way around - inline asm overwriting values that compiler stored there.


This is true and is precisely why it doesn't work without modification on higher optimization levels. I was originally going to write this article entirely in assembly but it seems like nobody wants to read an assembly dump! Instead even though it is malpractice to do so, the way the code is written in the article is still very clear even to people who don't really know assembly that well (I hope) and the concept is more clear. I will make that more clear in the article.


Thanks for writing this. My mind is buzzing now with ideas for how I could reserve and misuse a vector register :).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: