On Wed, Jan 23, 2019 at 09:05:15PM -0500, Warren D Smith wrote:
> The x=x "initialization" idea by [email protected]
> failed to turn off the warning for me.
>
> Joe Buck may be right that gcc "already does the right thing"
> but actually I was dealing with not a 64-bit wide, but
> actually a 128-bit-wide type, which might
> later become 256-wide or even 512; and to load it with 0s actually needs a lot
> of loading of constants from the instruction stream.
Do you mean vectors or aggregates or something else?
GCC doesn't support integral scalar types with 256 or higher bit precision.
And we vectors gcc does use xor internally too:
typedef int V __attribute__((vector_size (64)));
struct S { __int128_t x, y; };
V
foo (void)
{
return (V) {};
}
struct S
bar (void)
{
return (struct S) {};
}
emits
vpxor %xmm0, %xmm0, %xmm0
with -O2 -mavx512f in foo and
vpxor %xmm0, %xmm0, %xmm0
movq %rdi, %rax
vmovaps %xmm0, (%rdi)
vmovaps %xmm0, 16(%rdi)
in bar.
As has been said, the recommendation by Intel is for compiler developers and
assembly writers.
Jakub