在 2025/12/18 下午4:08, WANG Xuerui 写道:
On 12/18/25 15:32, Lulu Cheng wrote:
在 2025/12/18 下午3:13, WANG Xuerui 写道:
From: WANG Xuerui <[email protected]>
This helps writing portable code that needs to work across LA32R and
LA32S. The tests only work with the fix for PR123171 applied.
gcc/ChangeLog:
* config/loongarch/loongarch-c.cc (loongarch_update_cpp_builtins):
Define __loongarch_non_reduced iff the current base ISA is not
LA32R.
Hi,
We still need to discuss the builtin-in macro in this regard. So we
won't mergee this patch for now.
Sure, will wait. (I'd expect general agreement over the usefulness,
just that maybe some more bike-shedding is needed ;-) )
After discussion, we have decided to temporarily forgo adding macros to
distinguish between LA32R and LA32S instructions.
To ensure compatibility and simplify maintenance across both
architectures, we recommend that handwritten assembly code
in applications be implemented using LA32R instructions where such
compatibility is required.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/non-reduced-macro-1.c: New test.
* gcc.target/loongarch/non-reduced-macro-2.c: New test.
* gcc.target/loongarch/non-reduced-macro-3.c: New test.
Signed-off-by: WANG Xuerui <[email protected]>
---
/* snip */
+ loongarch_def_or_undef (la_target.isa.base != ISA_BASE_LA32R,
+ "__loongarch_non_reduced", pfile);
+
I think 'la_target.isa.base != ISA_BASE_LA32R' can be replaced with
'! TARGET_32BIT_R'.
This sounds better, will change in v2 after you have decided on the
above point.