From 88ae53a3852dac73fdecb9cfcee2c5100cee832f Mon Sep 17 00:00:00 2001 From: Lulu Cheng Date: Mon, 28 Aug 2023 11:30:21 +0800 Subject: LoongArch: Enable '-free' starting at -O2. gcc/ChangeLog: * common/config/loongarch/loongarch-common.cc: Enable '-free' on O2 and above. * doc/invoke.texi: Modify the description information of the '-free' compilation option and add the LoongArch description. gcc/testsuite/ChangeLog: * gcc.target/loongarch/sign-extend.c: New test. --- gcc/testsuite/gcc.target/loongarch/sign-extend.c | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.target/loongarch/sign-extend.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/loongarch/sign-extend.c b/gcc/testsuite/gcc.target/loongarch/sign-extend.c new file mode 100644 index 0000000..3f339d0 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/sign-extend.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=lp64d -O2" } */ +/* { dg-final { scan-assembler-times "slli.w" 1 } } */ + +extern int PL_savestack_ix; +extern int PL_regsize; +extern int PL_savestack_max; +void Perl_savestack_grow_cnt (int need); +extern void Perl_croak (char *); + +int +S_regcppush(int parenfloor) +{ + int retval = PL_savestack_ix; + int paren_elems_to_push = (PL_regsize - parenfloor) * 4; + int p; + + if (paren_elems_to_push < 0) + Perl_croak ("panic: paren_elems_to_push < 0"); + + if (PL_savestack_ix + (paren_elems_to_push + 6) > PL_savestack_max) + Perl_savestack_grow_cnt (paren_elems_to_push + 6); + + return retval; +} -- cgit v1.1