How to get `gcc` to generate `bts` instruction for x86-64 from standard C?

前端 未结 3 2012
谎友^
谎友^ 2020-12-16 13:41

Inspired by a recent question, I\'d like to know if anyone knows how to get gcc to generate the x86-64 bts instruction (bit test and set) on the Li

3条回答
  •  遥遥无期
    2020-12-16 14:13

    I use the gcc atomic builtins such as __sync_lock_test_and_set( http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html ). Changing the -march flag will directly affect what is generated. I'm using it with i686 right now, but http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options shows all the possibilities.

    I realize it's not exactly what you are asking for, but I found those two web pages very useful when I was looking for mechanisms like that.

提交回复
热议问题