English 中文(简体)
为什么海合会再次将已经零期的登记册移至零延伸?
原标题:Why does GCC use movzbl again to zero-extend a register that s already zero-extended?

我很想知道这一法典为何:

size_t hash_word(const char* c, size_t size) {
    size_t hash = uchar(c[0]);
    hash ^= uchar(c[size - 1]);
    hash ^= uchar(c[size - 2]);
    return hash;
}

编辑时:

    movzbl  -1(%rcx,%rdx), %eax
    xorb    -2(%rcx,%rdx), %al
    xorb    (%rcx), %al
    movzbl  %al, %eax            <-
    ret

第二行的结果。

页: 1 - Wall -O3 -S file.cpp

我的理解是,从第一笔废墟中,所有金的上限都应当定为零。 之后,以下两条xorb的斜线修改了上层轨道,因为它只触及了百分数。 因此,为什么需要附加指示? 在前三个阶段之后是否应该这样做?

问题回答

P6-family CPUs would have a partial-register stall when the caller read RAX after xorb wrote AL.

但在Sandybridge,一个低级登记册上的RMW是整个登记册上的RMW,而不是将其与诸如<代码>上流星号”等全方位名称重新命名。 在Ivy Bridge或Haswell,完全放弃了独立于整个登记册的低频登记册的重新命名(仅保留AH/BH/CH/DH的高度重新命名,因为这仍然足以独立使用AL和AH。) 因此,即便是<条码>冲重m,%al是负荷+缩微薄的ALU uop,在现代英特尔P核心和其他一切方面合并低 by。 部分注册的重新命名从来不是其他微型产权家庭的事情,如P4、Silmont或AMD。


The default -mtune=generic shouldn t care much if at all about Nehalem and earlier. And GCC/Clang nightly builds still use movzbl (aka Intel movzx) with -mtune=skylake, -march=skylake, or -mtune=znver1 (Godbolt), so presumably this code-gen choice is baked in, not a matter of updating tune=generic settings.

也许从历史上看,P6是如何工作的,现在没有人会变换,因为CPU是不同的。 这类事情并不罕见。 或者说,他们不知道如何做这种优化,而没有犯错误,例如只写低8个登记点,在其他一些案件中制造错误的附属地。

海湾合作委员会和部族确实知道,<代码>hash < 0x100<>/code>是一个固定的<代码>1,因此,如果它们想这样做,它们确实有足够的价值-距离追踪,以知道该数值已经是零延伸。


www.un.org/Depts/DGACM/index_spanish.htm 您可在上报告这一报告,同时在Clang 发行人https/>。

缩略语 感到可以自由引用你汇编者报告撰写的任何文章,并将这一Q&与A联系起来。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

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->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签