English 中文(简体)
如何从标准C中获取`gcc'来为x86-64提供`bts'指示?
原标题:How to get `gcc` to generate `bts` instruction for x86-64 from standard C?
  • 时间:2010-01-11 04:07:24
  •  标签:
  • c
  • gcc
  • x86-64
问题回答

它是第一个环节的第一个答案——在大事计划中是多少。 试测点的唯一部分是:

  • Low level drivers. However if you are writing one you probably know ASM, it is sufficient tided to the system 以及 probably most delays are on I/O
  • Testing for flags. It is usually either on initialisation (one time only at the beginning) or on some shared computation (which takes much more time).

即使微观基准显示改进,对应用和宏观基准的总体影响可能很小。

<<>Edit>部分——使用<条码>bts 单靠自己并不能保证行动的原样。 它的所有保证是,它将是原样的。 (详情见or。 在多加工单位(uncommon)或多计单位(非常常见)方面,你仍须与其他加工单位同步。

由于同步是昂贵得多的,因此我的生活是:

asm("lock bts %0, %1" : "+m" (*array) : "r" (bit));

以及

asm("lock or %0, %1" : "+m" (*array) : "r" (1 << bit));

最低。 其次是:

  • Can set several flag at once
  • Have nice __sync_fetch_以及_or (array, 1 << bit) form (working on gcc 以及 intel compiler as far as I remember).

我认为(但并非确定)C++或C标准都没有建立此类协调机制的机制。 各个标准化州都支持更高层次的同步机制,但我甚至不认为其中之一会允许你获得你之后的首选。

您是否制定24小时无数据结构,这些结构锁不足?

你可能要走到前面,使用高功能的非标准延伸和(或)运行系统或图书馆提供同步价格。 我会有一个图书馆,可以提供您重新研究是否对使用编辑的内在内容感到关切的类型。 (尽管确实,我认为大多数人只是 bullet击子弹,在需要时使用特定物体代码。) 并非理想,但标准实际上并未跟上。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...