On Tue, 2023-04-04 at 11:01 +0800, Lulu Cheng wrote: /* snip */
> > +unsigned long f10 (unsigned long x) { return x - 0x80000000l * 2; } > > +unsigned long f11 (unsigned long x) { return x - 0x80000000l * 2; } > These two test cases are duplicates. /* snip */ > > > +unsigned int g10 (unsigned int x) { return x - 0x80000000l * 2; } > > +unsigned int g11 (unsigned int x) { return x - 0x80000000l * 2; } > Ditto. I'll fix them in V2. > I found that adding this log test case > gcc.target/loongarch/stack-check-cfa-1.c and > gcc.target/loongarch/stack-check-cfa-2.c test failed. > Although the test fails, the generated assembly code is better, and there is > no problem with the logic of the assembly code. I haven't checked the reason > for this yet. Looks like the change hides PR109035 (like -fpie) for some reason. (But I still don't understand the root cause of PR109035 anyway.) f_test: .LFB0 = . .cfi_startproc lu12i.w $r14,65536>>12 # 0x10000 sub.d $r3,$r3,$r14 st.d $r0,$r3,0 sub.d $r3,$r3,$r14 st.d $r0,$r3,0 .cfi_def_cfa_offset 131072 lu12i.w $r13,131072>>12 # 0x20000 or $r12,$r3,$r0 ldx.b $r4,$r12,$r4 add.d $r3,$r3,$r13 .cfi_def_cfa_offset 0 jr $r1 .cfi_endproc Technically there should be "addu16i.d $r3,$r3,-1" in the prologue and "addu16i.d $r3,$r3,2" in the epilogue, so we can avoid using r14/r13. I'll try modifying loongarch_expand_{pro,epi}logue for this. -- Xi Ruoyao <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University