This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix x86_64 pushsf_rex64 constraints (PR target/31507)
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jakub Jelinek" <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 31 Oct 2007 23:16:45 +0100
- Subject: Re: [PATCH] Fix x86_64 pushsf_rex64 constraints (PR target/31507)
- References: <20071031211018.GV5451@devserv.devel.redhat.com>
On 10/31/07, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> As push for -m64 is always 64-bit, but SFmode is 32-bit, a pushsf_rex64
> first operand doesn't match the < constraint (it is neither pre nor post
> decrement, but pre_modify, which subtracts 8 bytes from sp).
> All other i386.md push* patterns which have smaller mode than
> PUSH_ROUNDING(1) use:
> (define_insn "*pushqi2"
> [(set (match_operand:QI 0 "push_operand" "=X")
> (define_insn "*pushqi2_rex64"
> [(set (match_operand:QI 0 "push_operand" "=X")
> (define_insn "*pushhi2"
> [(set (match_operand:HI 0 "push_operand" "=X")
> (define_insn "*pushhi2_rex64"
> [(set (match_operand:HI 0 "push_operand" "=X")
> (define_insn "*pushsi2_rex64"
> [(set (match_operand:SI 0 "push_operand" "=X")
> and < constraints are used just for pushes with modes equal (or multiple of)
> PUSH_ROUNDING(1), pushsf_rex64 is the only exception and therefore I'd guess
> just an omission.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux.
>
> Ok for trunk?
Yes, that looks obvious.
Thanks,
Richard.
> 2007-10-31 Jakub Jelinek <jakub@redhat.com>
>
> PR target/31507
> * config/i386/i386.md (pushsf_rex64): Use X instead of < constraints
> for the first push_operand.
>
> * gcc.dg/pr31507-1.c: New test.
> * gcc.dg/pr31507-2.c: New test.
>
> --- gcc/config/i386/i386.md.jj 2007-10-26 13:45:44.000000000 +0200
> +++ gcc/config/i386/i386.md 2007-10-31 14:32:02.000000000 +0100
> @@ -2486,7 +2486,7 @@
> (set_attr "mode" "SF,SI,SF")])
>
> (define_insn "*pushsf_rex64"
> - [(set (match_operand:SF 0 "push_operand" "=<,<,<")
> + [(set (match_operand:SF 0 "push_operand" "=X,X,X")
> (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
> "TARGET_64BIT"
> {
> --- gcc/testsuite/gcc.dg/pr31507-1.c.jj 2007-10-31 14:48:25.000000000 +0100
> +++ gcc/testsuite/gcc.dg/pr31507-1.c 2007-10-31 14:50:14.000000000 +0100
> @@ -0,0 +1,41 @@
> +/* PR target/31507 */
> +/* { dg-do run } */
> +/* { dg-options "-Os -fno-omit-frame-pointer" } */
> +
> +extern void abort (void);
> +
> +__attribute__((noinline)) void
> +foo (double d0, double d1, double d2, double d3,
> + double d4, double d5, double d6, double d7,
> + float f0, float f1, float f2, float f3,
> + char *p)
> +{
> + if (d0 != 0 || d1 != 1 || d2 != 2 || d3 != 3)
> + abort ();
> + if (d4 != 4 || d5 != 5 || d6 != 6 || d7 != 7)
> + abort ();
> + if (f0 != 10 || f1 != 11 || f2 != 12 || f3 != 13)
> + abort ();
> + if (__builtin_memcmp (p, "foo", 4) != 0)
> + abort ();
> + __builtin_memcpy (p, "bar", 4);
> +}
> +
> +__attribute__((noinline)) void
> +bar (int x)
> +{
> + char p[x];
> + if (x >= sizeof "foo")
> + __builtin_memcpy (p, "foo", 4);
> + foo (0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0,
> + 10.0f, 11.0f, 12.0f, 13.0f, p);
> + if (x >= sizeof "bar" && __builtin_memcmp (p, "bar", 4) != 0)
> + abort ();
> +}
> +
> +int
> +main (void)
> +{
> + bar (128);
> + return 0;
> +}
> --- gcc/testsuite/gcc.dg/pr31507-2.c.jj 2007-10-31 14:48:39.000000000 +0100
> +++ gcc/testsuite/gcc.dg/pr31507-2.c 2007-10-31 14:49:45.000000000 +0100
> @@ -0,0 +1,14 @@
> +/* PR target/31507 */
> +/* { dg-do compile } */
> +/* { dg-options "-Os -fno-omit-frame-pointer" } */
> +
> +typedef int (*closure_test_type3)(float, float, float, float, float, float,
> + float, float, double, int, float, float, int,
> + float, float, int);
> +int f (closure_test_type3 pcl)
> +{
> + int res;
> + res = (pcl)
> + (1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13,
> + 19.19, 21.21, 1);
> +}
>
> Jakub
>