* [PATCH 0/2] PIC cleanup @ 2022-08-30 17:48 Vineet Gupta 2022-08-30 17:48 ` [PATCH 1/2] RISC-V: remove deprecate pic code model macro Vineet Gupta 2022-08-30 17:48 ` [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much Vineet Gupta 0 siblings, 2 replies; 17+ messages in thread From: Vineet Gupta @ 2022-08-30 17:48 UTC (permalink / raw) To: gcc-patches Cc: kito.cheng, jim.wilson.gcc, Palmer Dabbelt, Philipp Tomsich, Christoph Müllner, collison, gnu-toolchain, Vineet Gupta Hi, A couple of cleanup patches when trying to understand -mexplicit-relocs and code model. - 1/2 should be strightfwd - 2/2 might be slightly controversial. Tested with a bunch of rv32/rv64 configs: same results before after, granted pic might not really be getting tested here. ========= Summary of gcc testsuite ========= | # of unexpected case / # of unique unexpected case | gcc | g++ | gfortran | rv64imafdc/ lp64d/ medlow | 12 / 10 |11016 / 2776 | 0 / 0 | rv32imafdc/ ilp32d/ medlow | 9 / 7 |10959 / 2764 | 0 / 0 | rv32imac/ ilp32/ medlow | 9 / 7 |10959 / 2764 | 0 / 0 | rv64imac/ lp64/ medlow | 13 / 11 |11016 / 2776 | 0 / 0 | Thx, -Vineet Vineet Gupta (2): RISC-V: remove deprecate pic code model macro RISC-V: remove CM_PIC as it doesn't do much gcc/config/riscv/riscv-c.cc | 7 ------- gcc/config/riscv/riscv-opts.h | 3 +-- gcc/config/riscv/riscv.cc | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) -- 2.32.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] RISC-V: remove deprecate pic code model macro 2022-08-30 17:48 [PATCH 0/2] PIC cleanup Vineet Gupta @ 2022-08-30 17:48 ` Vineet Gupta 2022-08-31 14:57 ` Palmer Dabbelt 2022-08-30 17:48 ` [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much Vineet Gupta 1 sibling, 1 reply; 17+ messages in thread From: Vineet Gupta @ 2022-08-30 17:48 UTC (permalink / raw) To: gcc-patches Cc: kito.cheng, jim.wilson.gcc, Palmer Dabbelt, Philipp Tomsich, Christoph Müllner, collison, gnu-toolchain, Vineet Gupta Came across this deprecated symbol when looking around for -mexplicit-relocs handling in code Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> --- gcc/config/riscv/riscv-c.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc index eb7ef09297e9..bba72cf77a82 100644 --- a/gcc/config/riscv/riscv-c.cc +++ b/gcc/config/riscv/riscv-c.cc @@ -93,9 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) break; case CM_PIC: - /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release. - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ - builtin_define ("__riscv_cmodel_pic"); /* FALLTHROUGH. */ case CM_MEDANY: -- 2.32.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/2] RISC-V: remove deprecate pic code model macro 2022-08-30 17:48 ` [PATCH 1/2] RISC-V: remove deprecate pic code model macro Vineet Gupta @ 2022-08-31 14:57 ` Palmer Dabbelt 2022-08-31 15:35 ` Kito Cheng 2022-08-31 20:36 ` [PATCH 1/2] " Vineet Gupta 0 siblings, 2 replies; 17+ messages in thread From: Palmer Dabbelt @ 2022-08-31 14:57 UTC (permalink / raw) To: Vineet Gupta Cc: gcc-patches, Kito Cheng, Jim Wilson, philipp.tomsich, christoph.muellner, collison, gnu-toolchain, Vineet Gupta On Tue, 30 Aug 2022 10:48:29 PDT (-0700), Vineet Gupta wrote: > Came across this deprecated symbol when looking around for > -mexplicit-relocs handling in code > > Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> > --- > gcc/config/riscv/riscv-c.cc | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc > index eb7ef09297e9..bba72cf77a82 100644 > --- a/gcc/config/riscv/riscv-c.cc > +++ b/gcc/config/riscv/riscv-c.cc > @@ -93,9 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) > break; > > case CM_PIC: > - /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release. > - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ > - builtin_define ("__riscv_cmodel_pic"); > /* FALLTHROUGH. */ > > case CM_MEDANY: It looks like some of the tests (gcc/testsuite/gcc.target/riscv/predef-3.c, for example) are checking for __riscv_cmodel_pic. From looking at them I'd expect them to fail, but even if they're not we should clean them up. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/2] RISC-V: remove deprecate pic code model macro 2022-08-31 14:57 ` Palmer Dabbelt @ 2022-08-31 15:35 ` Kito Cheng 2022-09-02 20:33 ` [PATCH v2] " Vineet Gupta 2022-08-31 20:36 ` [PATCH 1/2] " Vineet Gupta 1 sibling, 1 reply; 17+ messages in thread From: Kito Cheng @ 2022-08-31 15:35 UTC (permalink / raw) To: Palmer Dabbelt Cc: Vineet Gupta, collison, gnu-toolchain, Philipp Tomsich, GCC Patches Could you also clean up all __riscv_cmodel_pic checking in gcc/testsuite/gcc.target/riscv/predef-*.c? On Wed, Aug 31, 2022 at 10:58 PM Palmer Dabbelt <palmer@rivosinc.com> wrote: > > On Tue, 30 Aug 2022 10:48:29 PDT (-0700), Vineet Gupta wrote: > > Came across this deprecated symbol when looking around for > > -mexplicit-relocs handling in code > > > > Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> > > --- > > gcc/config/riscv/riscv-c.cc | 3 --- > > 1 file changed, 3 deletions(-) > > > > diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc > > index eb7ef09297e9..bba72cf77a82 100644 > > --- a/gcc/config/riscv/riscv-c.cc > > +++ b/gcc/config/riscv/riscv-c.cc > > @@ -93,9 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) > > break; > > > > case CM_PIC: > > - /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release. > > - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ > > - builtin_define ("__riscv_cmodel_pic"); > > /* FALLTHROUGH. */ > > > > case CM_MEDANY: > > It looks like some of the tests > (gcc/testsuite/gcc.target/riscv/predef-3.c, for example) are checking > for __riscv_cmodel_pic. From looking at them I'd expect them to fail, > but even if they're not we should clean them up. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2] RISC-V: remove deprecate pic code model macro 2022-08-31 15:35 ` Kito Cheng @ 2022-09-02 20:33 ` Vineet Gupta 2022-09-02 21:03 ` Andreas Schwab 0 siblings, 1 reply; 17+ messages in thread From: Vineet Gupta @ 2022-09-02 20:33 UTC (permalink / raw) To: gcc-patches Cc: kito.cheng, jim.wilson.gcc, Palmer Dabbelt, Philipp Tomsich, Christoph Müllner, collison, gnu-toolchain, Vineet Gupta Came across this deprecated symbol when looking around for -mexplicit-relocs handling in code Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> --- gcc/config/riscv/riscv-c.cc | 3 --- gcc/testsuite/gcc.target/riscv/predef-1.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-2.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-3.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-4.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-5.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-6.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-7.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-8.c | 3 --- 9 files changed, 27 deletions(-) diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc index eb7ef09297e9..bba72cf77a82 100644 --- a/gcc/config/riscv/riscv-c.cc +++ b/gcc/config/riscv/riscv-c.cc @@ -93,9 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) break; case CM_PIC: - /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release. - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ - builtin_define ("__riscv_cmodel_pic"); /* FALLTHROUGH. */ case CM_MEDANY: diff --git a/gcc/testsuite/gcc.target/riscv/predef-1.c b/gcc/testsuite/gcc.target/riscv/predef-1.c index 2e57ce6b3954..9dddc1849635 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-1.c +++ b/gcc/testsuite/gcc.target/riscv/predef-1.c @@ -57,9 +57,6 @@ int main () { #endif #if defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-2.c b/gcc/testsuite/gcc.target/riscv/predef-2.c index c85b3c9fd32a..755fe4ef7d8a 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-2.c +++ b/gcc/testsuite/gcc.target/riscv/predef-2.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-3.c b/gcc/testsuite/gcc.target/riscv/predef-3.c index 82a89d415809..513645351c09 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-3.c +++ b/gcc/testsuite/gcc.target/riscv/predef-3.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medany" -#endif -#if !defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_pic" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-4.c b/gcc/testsuite/gcc.target/riscv/predef-4.c index 5868d39eb67a..76b6feec6b6f 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-4.c +++ b/gcc/testsuite/gcc.target/riscv/predef-4.c @@ -57,9 +57,6 @@ int main () { #endif #if defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-5.c b/gcc/testsuite/gcc.target/riscv/predef-5.c index 4b2bd3835061..54a51508afbd 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-5.c +++ b/gcc/testsuite/gcc.target/riscv/predef-5.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-6.c b/gcc/testsuite/gcc.target/riscv/predef-6.c index 8e5ea366bd5e..f61709f7bf32 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-6.c +++ b/gcc/testsuite/gcc.target/riscv/predef-6.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medany" -#endif -#if !defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medpic" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-7.c b/gcc/testsuite/gcc.target/riscv/predef-7.c index 0bde299aef1a..41217554c4db 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-7.c +++ b/gcc/testsuite/gcc.target/riscv/predef-7.c @@ -57,9 +57,6 @@ int main () { #endif #if defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-8.c b/gcc/testsuite/gcc.target/riscv/predef-8.c index 18aa591a6039..982056a53438 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-8.c +++ b/gcc/testsuite/gcc.target/riscv/predef-8.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; -- 2.32.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2] RISC-V: remove deprecate pic code model macro 2022-09-02 20:33 ` [PATCH v2] " Vineet Gupta @ 2022-09-02 21:03 ` Andreas Schwab 2022-09-02 21:05 ` [PATCH v3] " Vineet Gupta 0 siblings, 1 reply; 17+ messages in thread From: Andreas Schwab @ 2022-09-02 21:03 UTC (permalink / raw) To: Vineet Gupta Cc: gcc-patches, collison, gnu-toolchain, kito.cheng, Philipp Tomsich On Sep 02 2022, Vineet Gupta wrote: > diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc > index eb7ef09297e9..bba72cf77a82 100644 > --- a/gcc/config/riscv/riscv-c.cc > +++ b/gcc/config/riscv/riscv-c.cc > @@ -93,9 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) > break; > > case CM_PIC: > - /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release. > - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ > - builtin_define ("__riscv_cmodel_pic"); > /* FALLTHROUGH. */ > > case CM_MEDANY: If there is nothing left between the case labels the fallthrough comment is no longer needed. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3] RISC-V: remove deprecate pic code model macro 2022-09-02 21:03 ` Andreas Schwab @ 2022-09-02 21:05 ` Vineet Gupta 2022-09-23 18:07 ` Vineet Gupta 0 siblings, 1 reply; 17+ messages in thread From: Vineet Gupta @ 2022-09-02 21:05 UTC (permalink / raw) To: gcc-patches Cc: kito.cheng, jim.wilson.gcc, Palmer Dabbelt, Philipp Tomsich, Christoph Müllner, collison, gnu-toolchain, Vineet Gupta Came across this deprecated symbol when looking around for -mexplicit-relocs handling in code Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> --- gcc/config/riscv/riscv-c.cc | 5 ----- gcc/testsuite/gcc.target/riscv/predef-1.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-2.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-3.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-4.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-5.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-6.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-7.c | 3 --- gcc/testsuite/gcc.target/riscv/predef-8.c | 3 --- 9 files changed, 29 deletions(-) diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc index eb7ef09297e9..8d55ad598a9c 100644 --- a/gcc/config/riscv/riscv-c.cc +++ b/gcc/config/riscv/riscv-c.cc @@ -93,11 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) break; case CM_PIC: - /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release. - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ - builtin_define ("__riscv_cmodel_pic"); - /* FALLTHROUGH. */ - case CM_MEDANY: builtin_define ("__riscv_cmodel_medany"); break; diff --git a/gcc/testsuite/gcc.target/riscv/predef-1.c b/gcc/testsuite/gcc.target/riscv/predef-1.c index 2e57ce6b3954..9dddc1849635 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-1.c +++ b/gcc/testsuite/gcc.target/riscv/predef-1.c @@ -57,9 +57,6 @@ int main () { #endif #if defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-2.c b/gcc/testsuite/gcc.target/riscv/predef-2.c index c85b3c9fd32a..755fe4ef7d8a 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-2.c +++ b/gcc/testsuite/gcc.target/riscv/predef-2.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-3.c b/gcc/testsuite/gcc.target/riscv/predef-3.c index 82a89d415809..513645351c09 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-3.c +++ b/gcc/testsuite/gcc.target/riscv/predef-3.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medany" -#endif -#if !defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_pic" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-4.c b/gcc/testsuite/gcc.target/riscv/predef-4.c index 5868d39eb67a..76b6feec6b6f 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-4.c +++ b/gcc/testsuite/gcc.target/riscv/predef-4.c @@ -57,9 +57,6 @@ int main () { #endif #if defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-5.c b/gcc/testsuite/gcc.target/riscv/predef-5.c index 4b2bd3835061..54a51508afbd 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-5.c +++ b/gcc/testsuite/gcc.target/riscv/predef-5.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-6.c b/gcc/testsuite/gcc.target/riscv/predef-6.c index 8e5ea366bd5e..f61709f7bf32 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-6.c +++ b/gcc/testsuite/gcc.target/riscv/predef-6.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medany" -#endif -#if !defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medpic" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-7.c b/gcc/testsuite/gcc.target/riscv/predef-7.c index 0bde299aef1a..41217554c4db 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-7.c +++ b/gcc/testsuite/gcc.target/riscv/predef-7.c @@ -57,9 +57,6 @@ int main () { #endif #if defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; diff --git a/gcc/testsuite/gcc.target/riscv/predef-8.c b/gcc/testsuite/gcc.target/riscv/predef-8.c index 18aa591a6039..982056a53438 100644 --- a/gcc/testsuite/gcc.target/riscv/predef-8.c +++ b/gcc/testsuite/gcc.target/riscv/predef-8.c @@ -57,9 +57,6 @@ int main () { #endif #if !defined(__riscv_cmodel_medany) #error "__riscv_cmodel_medlow" -#endif -#if defined(__riscv_cmodel_pic) -#error "__riscv_cmodel_medlow" #endif return 0; -- 2.32.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] RISC-V: remove deprecate pic code model macro 2022-09-02 21:05 ` [PATCH v3] " Vineet Gupta @ 2022-09-23 18:07 ` Vineet Gupta 2022-10-05 2:24 ` Kito Cheng 0 siblings, 1 reply; 17+ messages in thread From: Vineet Gupta @ 2022-09-23 18:07 UTC (permalink / raw) To: gcc-patches; +Cc: collison, gnu-toolchain, kito.cheng, Philipp Tomsich On 9/2/22 14:05, Vineet Gupta wrote: > Came across this deprecated symbol when looking around for > -mexplicit-relocs handling in code > > Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> No rush but looks like this got lost in the bigger thread about LOAD_ADDRESS_MACRO. Thx, -Vineet > --- > gcc/config/riscv/riscv-c.cc | 5 ----- > gcc/testsuite/gcc.target/riscv/predef-1.c | 3 --- > gcc/testsuite/gcc.target/riscv/predef-2.c | 3 --- > gcc/testsuite/gcc.target/riscv/predef-3.c | 3 --- > gcc/testsuite/gcc.target/riscv/predef-4.c | 3 --- > gcc/testsuite/gcc.target/riscv/predef-5.c | 3 --- > gcc/testsuite/gcc.target/riscv/predef-6.c | 3 --- > gcc/testsuite/gcc.target/riscv/predef-7.c | 3 --- > gcc/testsuite/gcc.target/riscv/predef-8.c | 3 --- > 9 files changed, 29 deletions(-) > > diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc > index eb7ef09297e9..8d55ad598a9c 100644 > --- a/gcc/config/riscv/riscv-c.cc > +++ b/gcc/config/riscv/riscv-c.cc > @@ -93,11 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) > break; > > case CM_PIC: > - /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release. > - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ > - builtin_define ("__riscv_cmodel_pic"); > - /* FALLTHROUGH. */ > - > case CM_MEDANY: > builtin_define ("__riscv_cmodel_medany"); > break; > diff --git a/gcc/testsuite/gcc.target/riscv/predef-1.c b/gcc/testsuite/gcc.target/riscv/predef-1.c > index 2e57ce6b3954..9dddc1849635 100644 > --- a/gcc/testsuite/gcc.target/riscv/predef-1.c > +++ b/gcc/testsuite/gcc.target/riscv/predef-1.c > @@ -57,9 +57,6 @@ int main () { > #endif > #if defined(__riscv_cmodel_medany) > #error "__riscv_cmodel_medlow" > -#endif > -#if defined(__riscv_cmodel_pic) > -#error "__riscv_cmodel_medlow" > #endif > > return 0; > diff --git a/gcc/testsuite/gcc.target/riscv/predef-2.c b/gcc/testsuite/gcc.target/riscv/predef-2.c > index c85b3c9fd32a..755fe4ef7d8a 100644 > --- a/gcc/testsuite/gcc.target/riscv/predef-2.c > +++ b/gcc/testsuite/gcc.target/riscv/predef-2.c > @@ -57,9 +57,6 @@ int main () { > #endif > #if !defined(__riscv_cmodel_medany) > #error "__riscv_cmodel_medlow" > -#endif > -#if defined(__riscv_cmodel_pic) > -#error "__riscv_cmodel_medlow" > #endif > > return 0; > diff --git a/gcc/testsuite/gcc.target/riscv/predef-3.c b/gcc/testsuite/gcc.target/riscv/predef-3.c > index 82a89d415809..513645351c09 100644 > --- a/gcc/testsuite/gcc.target/riscv/predef-3.c > +++ b/gcc/testsuite/gcc.target/riscv/predef-3.c > @@ -57,9 +57,6 @@ int main () { > #endif > #if !defined(__riscv_cmodel_medany) > #error "__riscv_cmodel_medany" > -#endif > -#if !defined(__riscv_cmodel_pic) > -#error "__riscv_cmodel_pic" > #endif > > return 0; > diff --git a/gcc/testsuite/gcc.target/riscv/predef-4.c b/gcc/testsuite/gcc.target/riscv/predef-4.c > index 5868d39eb67a..76b6feec6b6f 100644 > --- a/gcc/testsuite/gcc.target/riscv/predef-4.c > +++ b/gcc/testsuite/gcc.target/riscv/predef-4.c > @@ -57,9 +57,6 @@ int main () { > #endif > #if defined(__riscv_cmodel_medany) > #error "__riscv_cmodel_medlow" > -#endif > -#if defined(__riscv_cmodel_pic) > -#error "__riscv_cmodel_medlow" > #endif > > return 0; > diff --git a/gcc/testsuite/gcc.target/riscv/predef-5.c b/gcc/testsuite/gcc.target/riscv/predef-5.c > index 4b2bd3835061..54a51508afbd 100644 > --- a/gcc/testsuite/gcc.target/riscv/predef-5.c > +++ b/gcc/testsuite/gcc.target/riscv/predef-5.c > @@ -57,9 +57,6 @@ int main () { > #endif > #if !defined(__riscv_cmodel_medany) > #error "__riscv_cmodel_medlow" > -#endif > -#if defined(__riscv_cmodel_pic) > -#error "__riscv_cmodel_medlow" > #endif > > return 0; > diff --git a/gcc/testsuite/gcc.target/riscv/predef-6.c b/gcc/testsuite/gcc.target/riscv/predef-6.c > index 8e5ea366bd5e..f61709f7bf32 100644 > --- a/gcc/testsuite/gcc.target/riscv/predef-6.c > +++ b/gcc/testsuite/gcc.target/riscv/predef-6.c > @@ -57,9 +57,6 @@ int main () { > #endif > #if !defined(__riscv_cmodel_medany) > #error "__riscv_cmodel_medany" > -#endif > -#if !defined(__riscv_cmodel_pic) > -#error "__riscv_cmodel_medpic" > #endif > > return 0; > diff --git a/gcc/testsuite/gcc.target/riscv/predef-7.c b/gcc/testsuite/gcc.target/riscv/predef-7.c > index 0bde299aef1a..41217554c4db 100644 > --- a/gcc/testsuite/gcc.target/riscv/predef-7.c > +++ b/gcc/testsuite/gcc.target/riscv/predef-7.c > @@ -57,9 +57,6 @@ int main () { > #endif > #if defined(__riscv_cmodel_medany) > #error "__riscv_cmodel_medlow" > -#endif > -#if defined(__riscv_cmodel_pic) > -#error "__riscv_cmodel_medlow" > #endif > > return 0; > diff --git a/gcc/testsuite/gcc.target/riscv/predef-8.c b/gcc/testsuite/gcc.target/riscv/predef-8.c > index 18aa591a6039..982056a53438 100644 > --- a/gcc/testsuite/gcc.target/riscv/predef-8.c > +++ b/gcc/testsuite/gcc.target/riscv/predef-8.c > @@ -57,9 +57,6 @@ int main () { > #endif > #if !defined(__riscv_cmodel_medany) > #error "__riscv_cmodel_medlow" > -#endif > -#if defined(__riscv_cmodel_pic) > -#error "__riscv_cmodel_medlow" > #endif > > return 0; ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] RISC-V: remove deprecate pic code model macro 2022-09-23 18:07 ` Vineet Gupta @ 2022-10-05 2:24 ` Kito Cheng 2022-10-05 3:33 ` Vineet Gupta 0 siblings, 1 reply; 17+ messages in thread From: Kito Cheng @ 2022-10-05 2:24 UTC (permalink / raw) To: Vineet Gupta; +Cc: gcc-patches, Philipp Tomsich, gnu-toolchain Committed, and added ChangeLog, remember to add that next time :) On Sat, Sep 24, 2022 at 2:08 AM Vineet Gupta <vineetg@rivosinc.com> wrote: > > On 9/2/22 14:05, Vineet Gupta wrote: > > Came across this deprecated symbol when looking around for > > -mexplicit-relocs handling in code > > > > Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> > > No rush but looks like this got lost in the bigger thread about > LOAD_ADDRESS_MACRO. > > Thx, > -Vineet > > > --- > > gcc/config/riscv/riscv-c.cc | 5 ----- > > gcc/testsuite/gcc.target/riscv/predef-1.c | 3 --- > > gcc/testsuite/gcc.target/riscv/predef-2.c | 3 --- > > gcc/testsuite/gcc.target/riscv/predef-3.c | 3 --- > > gcc/testsuite/gcc.target/riscv/predef-4.c | 3 --- > > gcc/testsuite/gcc.target/riscv/predef-5.c | 3 --- > > gcc/testsuite/gcc.target/riscv/predef-6.c | 3 --- > > gcc/testsuite/gcc.target/riscv/predef-7.c | 3 --- > > gcc/testsuite/gcc.target/riscv/predef-8.c | 3 --- > > 9 files changed, 29 deletions(-) > > > > diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc > > index eb7ef09297e9..8d55ad598a9c 100644 > > --- a/gcc/config/riscv/riscv-c.cc > > +++ b/gcc/config/riscv/riscv-c.cc > > @@ -93,11 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) > > break; > > > > case CM_PIC: > > - /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release. > > - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ > > - builtin_define ("__riscv_cmodel_pic"); > > - /* FALLTHROUGH. */ > > - > > case CM_MEDANY: > > builtin_define ("__riscv_cmodel_medany"); > > break; > > diff --git a/gcc/testsuite/gcc.target/riscv/predef-1.c b/gcc/testsuite/gcc.target/riscv/predef-1.c > > index 2e57ce6b3954..9dddc1849635 100644 > > --- a/gcc/testsuite/gcc.target/riscv/predef-1.c > > +++ b/gcc/testsuite/gcc.target/riscv/predef-1.c > > @@ -57,9 +57,6 @@ int main () { > > #endif > > #if defined(__riscv_cmodel_medany) > > #error "__riscv_cmodel_medlow" > > -#endif > > -#if defined(__riscv_cmodel_pic) > > -#error "__riscv_cmodel_medlow" > > #endif > > > > return 0; > > diff --git a/gcc/testsuite/gcc.target/riscv/predef-2.c b/gcc/testsuite/gcc.target/riscv/predef-2.c > > index c85b3c9fd32a..755fe4ef7d8a 100644 > > --- a/gcc/testsuite/gcc.target/riscv/predef-2.c > > +++ b/gcc/testsuite/gcc.target/riscv/predef-2.c > > @@ -57,9 +57,6 @@ int main () { > > #endif > > #if !defined(__riscv_cmodel_medany) > > #error "__riscv_cmodel_medlow" > > -#endif > > -#if defined(__riscv_cmodel_pic) > > -#error "__riscv_cmodel_medlow" > > #endif > > > > return 0; > > diff --git a/gcc/testsuite/gcc.target/riscv/predef-3.c b/gcc/testsuite/gcc.target/riscv/predef-3.c > > index 82a89d415809..513645351c09 100644 > > --- a/gcc/testsuite/gcc.target/riscv/predef-3.c > > +++ b/gcc/testsuite/gcc.target/riscv/predef-3.c > > @@ -57,9 +57,6 @@ int main () { > > #endif > > #if !defined(__riscv_cmodel_medany) > > #error "__riscv_cmodel_medany" > > -#endif > > -#if !defined(__riscv_cmodel_pic) > > -#error "__riscv_cmodel_pic" > > #endif > > > > return 0; > > diff --git a/gcc/testsuite/gcc.target/riscv/predef-4.c b/gcc/testsuite/gcc.target/riscv/predef-4.c > > index 5868d39eb67a..76b6feec6b6f 100644 > > --- a/gcc/testsuite/gcc.target/riscv/predef-4.c > > +++ b/gcc/testsuite/gcc.target/riscv/predef-4.c > > @@ -57,9 +57,6 @@ int main () { > > #endif > > #if defined(__riscv_cmodel_medany) > > #error "__riscv_cmodel_medlow" > > -#endif > > -#if defined(__riscv_cmodel_pic) > > -#error "__riscv_cmodel_medlow" > > #endif > > > > return 0; > > diff --git a/gcc/testsuite/gcc.target/riscv/predef-5.c b/gcc/testsuite/gcc.target/riscv/predef-5.c > > index 4b2bd3835061..54a51508afbd 100644 > > --- a/gcc/testsuite/gcc.target/riscv/predef-5.c > > +++ b/gcc/testsuite/gcc.target/riscv/predef-5.c > > @@ -57,9 +57,6 @@ int main () { > > #endif > > #if !defined(__riscv_cmodel_medany) > > #error "__riscv_cmodel_medlow" > > -#endif > > -#if defined(__riscv_cmodel_pic) > > -#error "__riscv_cmodel_medlow" > > #endif > > > > return 0; > > diff --git a/gcc/testsuite/gcc.target/riscv/predef-6.c b/gcc/testsuite/gcc.target/riscv/predef-6.c > > index 8e5ea366bd5e..f61709f7bf32 100644 > > --- a/gcc/testsuite/gcc.target/riscv/predef-6.c > > +++ b/gcc/testsuite/gcc.target/riscv/predef-6.c > > @@ -57,9 +57,6 @@ int main () { > > #endif > > #if !defined(__riscv_cmodel_medany) > > #error "__riscv_cmodel_medany" > > -#endif > > -#if !defined(__riscv_cmodel_pic) > > -#error "__riscv_cmodel_medpic" > > #endif > > > > return 0; > > diff --git a/gcc/testsuite/gcc.target/riscv/predef-7.c b/gcc/testsuite/gcc.target/riscv/predef-7.c > > index 0bde299aef1a..41217554c4db 100644 > > --- a/gcc/testsuite/gcc.target/riscv/predef-7.c > > +++ b/gcc/testsuite/gcc.target/riscv/predef-7.c > > @@ -57,9 +57,6 @@ int main () { > > #endif > > #if defined(__riscv_cmodel_medany) > > #error "__riscv_cmodel_medlow" > > -#endif > > -#if defined(__riscv_cmodel_pic) > > -#error "__riscv_cmodel_medlow" > > #endif > > > > return 0; > > diff --git a/gcc/testsuite/gcc.target/riscv/predef-8.c b/gcc/testsuite/gcc.target/riscv/predef-8.c > > index 18aa591a6039..982056a53438 100644 > > --- a/gcc/testsuite/gcc.target/riscv/predef-8.c > > +++ b/gcc/testsuite/gcc.target/riscv/predef-8.c > > @@ -57,9 +57,6 @@ int main () { > > #endif > > #if !defined(__riscv_cmodel_medany) > > #error "__riscv_cmodel_medlow" > > -#endif > > -#if defined(__riscv_cmodel_pic) > > -#error "__riscv_cmodel_medlow" > > #endif > > > > return 0; > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] RISC-V: remove deprecate pic code model macro 2022-10-05 2:24 ` Kito Cheng @ 2022-10-05 3:33 ` Vineet Gupta 0 siblings, 0 replies; 17+ messages in thread From: Vineet Gupta @ 2022-10-05 3:33 UTC (permalink / raw) To: Kito Cheng; +Cc: gcc-patches, Philipp Tomsich, gnu-toolchain On 10/4/22 19:24, Kito Cheng wrote: > Committed, and added ChangeLog, remember to add that next time:) Oops sorry, I will. Thx, -Vineet ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/2] RISC-V: remove deprecate pic code model macro 2022-08-31 14:57 ` Palmer Dabbelt 2022-08-31 15:35 ` Kito Cheng @ 2022-08-31 20:36 ` Vineet Gupta 1 sibling, 0 replies; 17+ messages in thread From: Vineet Gupta @ 2022-08-31 20:36 UTC (permalink / raw) To: Palmer Dabbelt Cc: gcc-patches, Kito Cheng, Jim Wilson, philipp.tomsich, christoph.muellner, collison, gnu-toolchain On 8/31/22 07:57, Palmer Dabbelt wrote: > On Tue, 30 Aug 2022 10:48:29 PDT (-0700), Vineet Gupta wrote: >> Came across this deprecated symbol when looking around for >> -mexplicit-relocs handling in code >> >> Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> >> --- >> gcc/config/riscv/riscv-c.cc | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc >> index eb7ef09297e9..bba72cf77a82 100644 >> --- a/gcc/config/riscv/riscv-c.cc >> +++ b/gcc/config/riscv/riscv-c.cc >> @@ -93,9 +93,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) >> break; >> >> case CM_PIC: >> - /* __riscv_cmodel_pic is deprecated, and will removed in next >> GCC release. >> - see https://github.com/riscv/riscv-c-api-doc/pull/11 */ >> - builtin_define ("__riscv_cmodel_pic"); >> /* FALLTHROUGH. */ >> >> case CM_MEDANY: > > It looks like some of the tests > (gcc/testsuite/gcc.target/riscv/predef-3.c, for example) are checking > for __riscv_cmodel_pic. From looking at them I'd expect them to fail, > but even if they're not we should clean them up. Aah, I did miss removing them and looks like there was a snafu in my test setup as well. I'm rerunning the tests with the fix and will post a v2 after tests come out clean. Thx, -Vineet ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much 2022-08-30 17:48 [PATCH 0/2] PIC cleanup Vineet Gupta 2022-08-30 17:48 ` [PATCH 1/2] RISC-V: remove deprecate pic code model macro Vineet Gupta @ 2022-08-30 17:48 ` Vineet Gupta 2022-08-31 14:57 ` Palmer Dabbelt 1 sibling, 1 reply; 17+ messages in thread From: Vineet Gupta @ 2022-08-30 17:48 UTC (permalink / raw) To: gcc-patches Cc: kito.cheng, jim.wilson.gcc, Palmer Dabbelt, Philipp Tomsich, Christoph Müllner, collison, gnu-toolchain, Vineet Gupta CM_PIC is no longer doing anything directly. Removing it might potentially affect USE_LOAD_ADDRESS_MACRO() but seems unlikely. Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> --- gcc/config/riscv/riscv-c.cc | 4 ---- gcc/config/riscv/riscv-opts.h | 3 +-- gcc/config/riscv/riscv.cc | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc index bba72cf77a82..7064fcf142fe 100644 --- a/gcc/config/riscv/riscv-c.cc +++ b/gcc/config/riscv/riscv-c.cc @@ -92,13 +92,9 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) builtin_define ("__riscv_cmodel_medlow"); break; - case CM_PIC: - /* FALLTHROUGH. */ - case CM_MEDANY: builtin_define ("__riscv_cmodel_medany"); break; - } if (TARGET_MIN_VLEN != 0) diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index 85e869e62e3a..ce3237beca7a 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -34,8 +34,7 @@ extern enum riscv_abi_type riscv_abi; enum riscv_code_model { CM_MEDLOW, - CM_MEDANY, - CM_PIC + CM_MEDANY }; extern enum riscv_code_model riscv_cmodel; diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 7c120eaa8e33..a239fe43047c 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -5162,7 +5162,7 @@ riscv_option_override (void) init_machine_status = &riscv_init_machine_status; if (flag_pic) - riscv_cmodel = CM_PIC; + riscv_cmodel = CM_MEDANY; /* We get better code with explicit relocs for CM_MEDLOW, but worse code for the others (for now). Pick the best default. */ -- 2.32.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much 2022-08-30 17:48 ` [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much Vineet Gupta @ 2022-08-31 14:57 ` Palmer Dabbelt 2022-08-31 20:39 ` Vineet Gupta 0 siblings, 1 reply; 17+ messages in thread From: Palmer Dabbelt @ 2022-08-31 14:57 UTC (permalink / raw) To: Vineet Gupta Cc: gcc-patches, Kito Cheng, Jim Wilson, philipp.tomsich, christoph.muellner, collison, gnu-toolchain, Vineet Gupta On Tue, 30 Aug 2022 10:48:30 PDT (-0700), Vineet Gupta wrote: > CM_PIC is no longer doing anything directly. Removing it might > potentially affect USE_LOAD_ADDRESS_MACRO() but seems unlikely. At least in the short term, there's kind of a mess here that needs to get sorted out but just removing CM_PIC doesn't really get us there. > Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> > --- > gcc/config/riscv/riscv-c.cc | 4 ---- > gcc/config/riscv/riscv-opts.h | 3 +-- > gcc/config/riscv/riscv.cc | 2 +- > 3 files changed, 2 insertions(+), 7 deletions(-) > > diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc > index bba72cf77a82..7064fcf142fe 100644 > --- a/gcc/config/riscv/riscv-c.cc > +++ b/gcc/config/riscv/riscv-c.cc > @@ -92,13 +92,9 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) > builtin_define ("__riscv_cmodel_medlow"); > break; > > - case CM_PIC: > - /* FALLTHROUGH. */ > - > case CM_MEDANY: > builtin_define ("__riscv_cmodel_medany"); > break; > - > } > > if (TARGET_MIN_VLEN != 0) > diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h > index 85e869e62e3a..ce3237beca7a 100644 > --- a/gcc/config/riscv/riscv-opts.h > +++ b/gcc/config/riscv/riscv-opts.h > @@ -34,8 +34,7 @@ extern enum riscv_abi_type riscv_abi; > > enum riscv_code_model { > CM_MEDLOW, > - CM_MEDANY, > - CM_PIC > + CM_MEDANY > }; > extern enum riscv_code_model riscv_cmodel; > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > index 7c120eaa8e33..a239fe43047c 100644 > --- a/gcc/config/riscv/riscv.cc > +++ b/gcc/config/riscv/riscv.cc > @@ -5162,7 +5162,7 @@ riscv_option_override (void) > init_machine_status = &riscv_init_machine_status; > > if (flag_pic) > - riscv_cmodel = CM_PIC; > + riscv_cmodel = CM_MEDANY; > > /* We get better code with explicit relocs for CM_MEDLOW, but > worse code for the others (for now). Pick the best default. */ I'm fine either way on this one: having CM_PIC gone makes it a bit more likely to confuse CM_MEDANY with PIC, but flag_pic is overriding riscv_cmodel anyway so this isn't really used and deleting code is always a plus. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much 2022-08-31 14:57 ` Palmer Dabbelt @ 2022-08-31 20:39 ` Vineet Gupta 2022-09-02 20:38 ` Vineet Gupta 0 siblings, 1 reply; 17+ messages in thread From: Vineet Gupta @ 2022-08-31 20:39 UTC (permalink / raw) To: Palmer Dabbelt Cc: gcc-patches, Kito Cheng, Jim Wilson, philipp.tomsich, christoph.muellner, collison, gnu-toolchain On 8/31/22 07:57, Palmer Dabbelt wrote: >> if (flag_pic) >> - riscv_cmodel = CM_PIC; >> + riscv_cmodel = CM_MEDANY; >> >> /* We get better code with explicit relocs for CM_MEDLOW, but >> worse code for the others (for now). Pick the best default. */ > > I'm fine either way on this one: having CM_PIC gone makes it a bit > more likely to confuse CM_MEDANY with PIC, but flag_pic is overriding > riscv_cmodel anyway so this isn't really used and deleting code is > always a plus. Indeed this was the most contentious part of removing CM_PIC, but it seems this is the way fwd. I'll add Kito's comment from [1] in code to make it more explicit. [1]https://github.com/riscv-non-isa/riscv-c-api-doc/pull/11#issuecomment-686385585 Thx, -Vineett ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much 2022-08-31 20:39 ` Vineet Gupta @ 2022-09-02 20:38 ` Vineet Gupta 2022-09-02 23:08 ` [PATCH] RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand Vineet Gupta 0 siblings, 1 reply; 17+ messages in thread From: Vineet Gupta @ 2022-09-02 20:38 UTC (permalink / raw) To: Palmer Dabbelt Cc: collison, gnu-toolchain, Kito Cheng, philipp.tomsich, gcc-patches On 8/31/22 13:39, Vineet Gupta wrote: > > > On 8/31/22 07:57, Palmer Dabbelt wrote: >>> if (flag_pic) >>> - riscv_cmodel = CM_PIC; >>> + riscv_cmodel = CM_MEDANY; >>> >>> /* We get better code with explicit relocs for CM_MEDLOW, but >>> worse code for the others (for now). Pick the best default. */ >> >> I'm fine either way on this one: having CM_PIC gone makes it a bit >> more likely to confuse CM_MEDANY with PIC, but flag_pic is overriding >> riscv_cmodel anyway so this isn't really used and deleting code is >> always a plus. > > Indeed this was the most contentious part of removing CM_PIC, but it > seems this is the way fwd. I'll add Kito's comment from [1] in code to > make it more explicit. > > [1]https://github.com/riscv-non-isa/riscv-c-api-doc/pull/11#issuecomment-686385585 I think I'll punt on this one, in the short-term. The reason being it affects USE_LOAD_ADDRESS_MACRO. #define USE_LOAD_ADDRESS_MACRO(sym) \ (!TARGET_EXPLICIT_RELOCS && \ ((flag_pic \ && ((SYMBOL_REF_P (sym) && SYMBOL_REF_LOCAL_P (sym)) \ || ((GET_CODE (sym) == CONST) \ && SYMBOL_REF_P (XEXP (XEXP (sym, 0),0)) \ && SYMBOL_REF_LOCAL_P (XEXP (XEXP (sym, 0),0))))) \ || riscv_cmodel == CM_MEDANY)) With the patch, PIC implies CM_MEDANY and thus will change codegen for pic non-local symbols to also use the load address macro. I think we want to go in the opposite direction, i.e. wean away from the asm macros and have gcc codegen natively. It seems there are bugs in that area so once we flush them out (after creating a few as I don't know of any existing documented ones) this will get cleaned out. Thx -Vineet ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand 2022-09-02 20:38 ` Vineet Gupta @ 2022-09-02 23:08 ` Vineet Gupta 2022-09-23 16:01 ` Kito Cheng 0 siblings, 1 reply; 17+ messages in thread From: Vineet Gupta @ 2022-09-02 23:08 UTC (permalink / raw) To: gcc-patches Cc: kito.cheng, jim.wilson.gcc, Palmer Dabbelt, Philipp Tomsich, Christoph Müllner, collison, gnu-toolchain, Vineet Gupta The current macro has several && and || making it really hard to understand the first time. Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> --- Since we are on this topic, perhaps get this simplification too. But I'm not sure if the current checking of local symbol can be simplified a bit. Isn't the first line enough for GET_CODE == const case too ? --- gcc/config/riscv/riscv.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index eb1284e56d69..3e3f67ef8270 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -749,18 +749,19 @@ typedef struct { #define CASE_VECTOR_MODE SImode #define CASE_VECTOR_PC_RELATIVE (riscv_cmodel != CM_MEDLOW) +#define LOCAL_SYM(sym) \ + ((SYMBOL_REF_P (sym) && SYMBOL_REF_LOCAL_P (sym)) \ + || ((GET_CODE (sym) == CONST) \ + && SYMBOL_REF_P (XEXP (XEXP (sym, 0),0)) \ + && SYMBOL_REF_LOCAL_P (XEXP (XEXP (sym, 0),0)))) + /* The load-address macro is used for PC-relative addressing of symbols that bind locally. Don't use it for symbols that should be addressed via the GOT. Also, avoid it for CM_MEDLOW, where LUI addressing currently results in more opportunities for linker relaxation. */ #define USE_LOAD_ADDRESS_MACRO(sym) \ (!TARGET_EXPLICIT_RELOCS && \ - ((flag_pic \ - && ((SYMBOL_REF_P (sym) && SYMBOL_REF_LOCAL_P (sym)) \ - || ((GET_CODE (sym) == CONST) \ - && SYMBOL_REF_P (XEXP (XEXP (sym, 0),0)) \ - && SYMBOL_REF_LOCAL_P (XEXP (XEXP (sym, 0),0))))) \ - || riscv_cmodel == CM_MEDANY)) + ((flag_pic && LOCAL_SYM(sym)) || riscv_cmodel == CM_MEDANY)) /* Define this as 1 if `char' should by default be signed; else as 0. */ #define DEFAULT_SIGNED_CHAR 0 -- 2.32.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand 2022-09-02 23:08 ` [PATCH] RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand Vineet Gupta @ 2022-09-23 16:01 ` Kito Cheng 0 siblings, 0 replies; 17+ messages in thread From: Kito Cheng @ 2022-09-23 16:01 UTC (permalink / raw) To: Vineet Gupta; +Cc: GCC Patches, collison, gnu-toolchain, Philipp Tomsich Committed with ChangeLog and minor naming tweaking. > But I'm not sure if the current checking of local symbol can be simplified > a bit. Isn't the first line enough for GET_CODE == const case too ? SYMBOL_REF_P not work for CONST, SYMBOL_REF_P is just checking GET_CODE is SYMBOL_REF, and SYMBOL_REF_LOCAL_P will also ICE if you feed something other than SYMBOL_REF when checking enabled... On Sat, Sep 3, 2022 at 7:08 AM Vineet Gupta <vineetg@rivosinc.com> wrote: > > The current macro has several && and || making it really hard to understand > the first time. > > Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> > --- > Since we are on this topic, perhaps get this simplification too. > > But I'm not sure if the current checking of local symbol can be simplified > a bit. Isn't the first line enough for GET_CODE == const case too ? > > --- > gcc/config/riscv/riscv.h | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h > index eb1284e56d69..3e3f67ef8270 100644 > --- a/gcc/config/riscv/riscv.h > +++ b/gcc/config/riscv/riscv.h > @@ -749,18 +749,19 @@ typedef struct { > #define CASE_VECTOR_MODE SImode > #define CASE_VECTOR_PC_RELATIVE (riscv_cmodel != CM_MEDLOW) > > +#define LOCAL_SYM(sym) \ > + ((SYMBOL_REF_P (sym) && SYMBOL_REF_LOCAL_P (sym)) \ > + || ((GET_CODE (sym) == CONST) \ > + && SYMBOL_REF_P (XEXP (XEXP (sym, 0),0)) \ > + && SYMBOL_REF_LOCAL_P (XEXP (XEXP (sym, 0),0)))) > + > /* The load-address macro is used for PC-relative addressing of symbols > that bind locally. Don't use it for symbols that should be addressed > via the GOT. Also, avoid it for CM_MEDLOW, where LUI addressing > currently results in more opportunities for linker relaxation. */ > #define USE_LOAD_ADDRESS_MACRO(sym) \ > (!TARGET_EXPLICIT_RELOCS && \ > - ((flag_pic \ > - && ((SYMBOL_REF_P (sym) && SYMBOL_REF_LOCAL_P (sym)) \ > - || ((GET_CODE (sym) == CONST) \ > - && SYMBOL_REF_P (XEXP (XEXP (sym, 0),0)) \ > - && SYMBOL_REF_LOCAL_P (XEXP (XEXP (sym, 0),0))))) \ > - || riscv_cmodel == CM_MEDANY)) > + ((flag_pic && LOCAL_SYM(sym)) || riscv_cmodel == CM_MEDANY)) > > /* Define this as 1 if `char' should by default be signed; else as 0. */ > #define DEFAULT_SIGNED_CHAR 0 > -- > 2.32.0 > ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2022-10-05 3:33 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-08-30 17:48 [PATCH 0/2] PIC cleanup Vineet Gupta 2022-08-30 17:48 ` [PATCH 1/2] RISC-V: remove deprecate pic code model macro Vineet Gupta 2022-08-31 14:57 ` Palmer Dabbelt 2022-08-31 15:35 ` Kito Cheng 2022-09-02 20:33 ` [PATCH v2] " Vineet Gupta 2022-09-02 21:03 ` Andreas Schwab 2022-09-02 21:05 ` [PATCH v3] " Vineet Gupta 2022-09-23 18:07 ` Vineet Gupta 2022-10-05 2:24 ` Kito Cheng 2022-10-05 3:33 ` Vineet Gupta 2022-08-31 20:36 ` [PATCH 1/2] " Vineet Gupta 2022-08-30 17:48 ` [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much Vineet Gupta 2022-08-31 14:57 ` Palmer Dabbelt 2022-08-31 20:39 ` Vineet Gupta 2022-09-02 20:38 ` Vineet Gupta 2022-09-02 23:08 ` [PATCH] RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand Vineet Gupta 2022-09-23 16:01 ` Kito Cheng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).