Re: [PATCH v1 4/4] LoongArch: Add tests for Loongson SX floating-point conversion instructions.

2023-09-06 Thread chenxiaolong
在 2023-09-06三的 18:56 +0800,Xi Ruoyao写道:
> On Wed, 2023-09-06 at 18:45 +0800, Xiaolong Chen wrote:
> > +  *((int*)& __m128_op0[3]) = 0x004200a0;
> > +  *((int*)& __m128_op0[2]) = 0x;
> > +  *((int*)& __m128_op0[1]) = 0x004200a0;
> > +  *((int*)& __m128_op0[0]) = 0x0021;
> 
> These are aliasing rule violation and they will suddenly blow up when
> GCC optimizer starts to optimize more aggressively based on the
> aliasing
> rule.
> 
> Try not to use these (you can write a helper function to memcpy()
> into a
> __m128).  Or use -fno-strict-alising in dg-options.
> 
Okay, thanks for the tip. After carefully reading the gcc manual, a new
addition -fno-strict-aliasing in dg-options is added.

Thanks.



Re: [PATCH v1 4/4] LoongArch: Add tests for Loongson SX floating-point conversion instructions.

2023-09-06 Thread Xi Ruoyao via Gcc-patches
On Wed, 2023-09-06 at 18:45 +0800, Xiaolong Chen wrote:
> +  *((int*)& __m128_op0[3]) = 0x004200a0;
> +  *((int*)& __m128_op0[2]) = 0x;
> +  *((int*)& __m128_op0[1]) = 0x004200a0;
> +  *((int*)& __m128_op0[0]) = 0x0021;

These are aliasing rule violation and they will suddenly blow up when
GCC optimizer starts to optimize more aggressively based on the aliasing
rule.

Try not to use these (you can write a helper function to memcpy() into a
__m128).  Or use -fno-strict-alising in dg-options.

-- 
Xi Ruoyao 
School of Aerospace Science and Technology, Xidian University