This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH i386] Extend sibcall peepholes to allow source in %eax
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Jeff Law <law at redhat dot com>, Uros Bizjak <ubizjak at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Rich Felker <dalias at libc dot org>
- Date: Thu, 14 May 2015 20:35:23 +0300 (MSK)
- Subject: Re: [PATCH i386] Extend sibcall peepholes to allow source in %eax
- Authentication-results: sourceware.org; auth=none
- References: <1430757479-14241-1-git-send-email-amonakov at ispras dot ru> <1430757479-14241-4-git-send-email-amonakov at ispras dot ru> <20150510165402 dot GH9659 at atrey dot karlin dot mff dot cuni dot cz> <alpine dot LNX dot 2 dot 11 dot 1505112039590 dot 22867 at monopod dot intra dot ispras dot ru> <20150511180038 dot GA22960 at kam dot mff dot cuni dot cz> <CAFULd4aVBT6iLR4DZtAFRqYSg3ERzD5wKLRMgbN4K-X07sfSag at mail dot gmail dot com> <55510774 dot 5030107 at redhat dot com> <20150511201555 dot GA49471 at kam dot mff dot cuni dot cz> <alpine dot LNX dot 2 dot 11 dot 1505132122350 dot 22867 at monopod dot intra dot ispras dot ru> <20150513200225 dot GA20903 at kam dot mff dot cuni dot cz>
On Wed, 13 May 2015, Jan Hubicka wrote:
> Thank you! This looks fine. Please add also the testcase that should break if
> the new test was wrong andosmeone fixed postreload to allow use of the same register
> this check will prevent wrong code?
I'm checking in a patch with the following additional test.
diff --git a/gcc/testsuite/gcc.target/i386/sibcall-8.c b/gcc/testsuite/gcc.target/i386/sibcall-8.c
index e69de29..3ab3809 100644
--- a/gcc/testsuite/gcc.target/i386/sibcall-8.c
+++ b/gcc/testsuite/gcc.target/i386/sibcall-8.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+static int __attribute__((regparm(1)))
+bar(void *arg)
+{
+ return arg != bar;
+}
+
+static int __attribute__((noinline,noclone,regparm(1)))
+foo(int (__attribute__((regparm(1))) **bar)(void*))
+{
+ return (*bar)(*bar);
+}
+
+int main()
+{
+ int (__attribute__((regparm(1))) *p)(void*) = bar;
+ if (foo(&p))
+ abort();
+ return 0;
+}