On Fri, Jan 8, 2021 at 6:43 AM H.J. Lu <hjl.to...@gmail.com> wrote: > > On Fri, Jan 8, 2021 at 6:31 AM Uros Bizjak <ubiz...@gmail.com> wrote: > > > > On Fri, Jan 8, 2021 at 2:28 PM H.J. Lu <hjl.to...@gmail.com> wrote: > > > > > > On Fri, Jan 8, 2021 at 4:50 AM H.J. Lu <hjl.to...@gmail.com> wrote: > > > > > > > > On Fri, Jan 8, 2021 at 1:24 AM Uros Bizjak <ubiz...@gmail.com> wrote: > > > > > > > > > > > Since R10 is preserved when calling mcount, R10 can be used a > > > > > > scratch > > > > > > register to call mcount in large model. > > > > > > > > > > Please mention that R10 can be used as a static chain registers and is > > > > > preserved when calling mcount for nested functions. > > > > > > > > > > > gcc/ > > > > > > > > > > > > PR target/98482 > > > > > > * config/i386/i386.c (x86_function_profiler): Use R10 to call > > > > > > mcount in large model. Sorry for large model with PIC. > > > > > > > > > > > > gcc/testsuite/ > > > > > > > > > > > > PR target/98482 > > > > > > * gcc.target/i386/pr98482-1.c: New test. > > > > > > * gcc.target/i386/pr98482-1.c: Likewise. > > > > > > > > > > OK with comment fixes. > > > > > > > > > > Thanks, > > > > > Uros. > > > > > > > > > > + case CM_LARGE: > > > > > + /* NB: R10 can be used as a scratch register here since > > > > > + R10 is preserved when calling mcount. */ > > > > > > > > > > Also mention that R10 can be used as a static chain register and is > > > > > preserved when calling mcount for nested functions. > > > > > > > > > > + fprintf (file, "1:\tmovabsq\t$%s, %%r10\n\tcall\t*%%r10\n", > > > > > + mcount_name); > > > > > + break; > > > > > > > > This is the patch I am checking in. > > > > > > > > > > For NO_PROFILE_COUNTERS targets, R11 is a scratch register. We can use > > > R10 and R11 to call mcount in large model with PIC. > > > > > > OK for master? > > > > + fprintf (file, "\tmovabsq\t$%s@PLTOFF, %%r11\n", > > + mcount_name); > > > > Please put mcount_name in the same line (and please do the same for > > case CM_MEDIUM_PIC). > > Fixed. > > > OK with the above fixes. > > > > Thanks, > > Uros. > > Here is the updated patch I am checking in. >
I am checking in this patch since -mcmodel=large is isn't supported for x32. -- H.J.
From e7797264b2b8bee6b9a429385d91af0858ee0c8a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" <hjl.to...@gmail.com> Date: Fri, 8 Jan 2021 08:41:38 -0800 Subject: [PATCH] x86-64: Require lp64 for PR target/98482 tests Require lp64 for PR target/98482 tests since -mcmodel=large is isn't supported for x32. PR target/98482 * gcc.target/i386/pr98482-1.c: Require lp64. * gcc.target/i386/pr98482-1.c: Likewise. --- gcc/testsuite/gcc.target/i386/pr98482-1.c | 2 +- gcc/testsuite/gcc.target/i386/pr98482-2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/pr98482-1.c b/gcc/testsuite/gcc.target/i386/pr98482-1.c index 72d5ccb269c..912cbe09191 100644 --- a/gcc/testsuite/gcc.target/i386/pr98482-1.c +++ b/gcc/testsuite/gcc.target/i386/pr98482-1.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-do compile { target { *-*-linux* && lp64 } } } */ /* { dg-require-effective-target mfentry } */ /* { dg-options "-fprofile -mfentry -O2 -mcmodel=large" } */ /* { dg-final { scan-assembler "movabsq\t\\\$__fentry__, %r10\n\tcall\t\\*%r10" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98482-2.c b/gcc/testsuite/gcc.target/i386/pr98482-2.c index 0ee142db12c..03c62a4b67b 100644 --- a/gcc/testsuite/gcc.target/i386/pr98482-2.c +++ b/gcc/testsuite/gcc.target/i386/pr98482-2.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-do compile { target { *-*-linux* && lp64 } } } */ /* { dg-require-effective-target mfentry } */ /* { dg-require-effective-target fpic } */ /* { dg-options "-fpic -fprofile -mfentry -O2 -mcmodel=large" } */ -- 2.29.2