From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) by sourceware.org (Postfix) with ESMTPS id D950B3858419 for ; Wed, 27 Oct 2021 13:12:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D950B3858419 Received: by mail-ua1-x92f.google.com with SMTP id e10so4871195uab.3 for ; Wed, 27 Oct 2021 06:12:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FUwZR9/VXnXDyp77l5wW9LCfKkAM0xynlJNxoDS5M/Q=; b=cwHx58f4W7vP5C2yH+yJDTz1UVXelKZLVmlxKHiuUcA9cAxaATI3xSEIbHfDmm1tWE ISvio08lNhX8txnLsP9iYzzpP6f/ZsM+6m0kZzl6DABpNqyCDEzmdOWQYF4rlGjvxYqh lHODwR05XU5JRrcD+KxbNhE4HsmB1FmN9tRj1kflAgKQTvkXASsLtGLoDqjN7O+WztyX Scos/5pzCkTDtP+NI11NJ8TQlbzetjMnQMnbVbKp9INYFyZ1gEVF+828trFz7UnvSzos mAwHDBnlET2SSbxZ7fQlsXMLROGB2y7XGZq6r6vUiyskurS+9weHNlZOr2Tpqddv11NS rB5Q== X-Gm-Message-State: AOAM530RuAB1yBoSeiWrDz7hfq3nXFh4UBTgGl7Zu0AT4xPeh7ku7joY ZjkHnzFJOCaIQlSzaiAJFAhPakNn79HEUAOvbQg= X-Google-Smtp-Source: ABdhPJwP/bg92/UXpDEuaqLUSLr4sRIYSfZUeWezF/pXdlaBAa4nzut40I7UanDdMZj680+1Lr68+jOgksWOUJmi6ro= X-Received: by 2002:ab0:5a30:: with SMTP id l45mr19475148uad.8.1635340377439; Wed, 27 Oct 2021 06:12:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Edelsohn Date: Wed, 27 Oct 2021 09:12:07 -0400 Message-ID: Subject: Re: [PATCH] rs6000: Fix ICE of vect cost related to V1TI [PR102767] To: "Kewen.Lin" Cc: GCC Patches , Segher Boessenkool , Bill Schmidt Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2021 13:12:59 -0000 On Sun, Oct 24, 2021 at 11:04 PM Kewen.Lin wrote: > > Hi, > > As PR102767 shows, the commit r12-3482 exposed one ICE in function > rs6000_builtin_vectorization_cost. We claims V1TI supports movmisalign > on rs6000 (See define_expand "movmisalign"), so it return true in > rs6000_builtin_support_vector_misalignment for misalign 8. Later in > the cost querying rs6000_builtin_vectorization_cost, we don't have > the arms to handle the V1TI input under (TARGET_VSX && > TARGET_ALLOW_MOVMISALIGN). > > The proposed fix is to add the consideration for V1TI, simply make it > as the cost for doubleword which is apparently bigger than the cost of > scalar, won't have the vectorization to happen, just to keep consistency > and avoid ICE. Another thought is to not support movmisalign for V1TI, > but it sounds like a bad idea since it doesn't match the reality. > > Bootstrapped and regtested on powerpc64le-linux-gnu P9 and > powerpc64-linux-gnu P8. > > Is it ok for trunk? > > BR, > Kewen > ----- > gcc/ChangeLog: > > PR target/102767 > * config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost): Consider > V1T1 mode for unaligned load and store. > > gcc/testsuite/ChangeLog: > > PR target/102767 > * gcc.target/powerpc/ppc-fortran/pr102767.f90: New file. > > diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c > index b7ea1483da5..73d3e06c3fc 100644 > --- a/gcc/config/rs6000/rs6000.c > +++ b/gcc/config/rs6000/rs6000.c > @@ -5145,7 +5145,8 @@ rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, > if (TARGET_VSX && TARGET_ALLOW_MOVMISALIGN) > { > elements = TYPE_VECTOR_SUBPARTS (vectype); > - if (elements == 2) > + /* See PR102767, consider V1TI to keep consistency. */ > + if (elements == 2 || elements == 1) > /* Double word aligned. */ > return 4; > > @@ -5184,10 +5185,11 @@ rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, > > if (TARGET_VSX && TARGET_ALLOW_MOVMISALIGN) > { > - elements = TYPE_VECTOR_SUBPARTS (vectype); > - if (elements == 2) > - /* Double word aligned. */ > - return 2; > + elements = TYPE_VECTOR_SUBPARTS (vectype); > + /* See PR102767, consider V1TI to keep consistency. */ > + if (elements == 2 || elements == 1) > + /* Double word aligned. */ > + return 2; This section of the patch incorrectly changes the indentation. Please use the correct indentation. > > if (elements == 4) > { > diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-fortran/pr102767.f90 b/gcc/testsuite/gcc.target/powerpc/ppc-fortran/pr102767.f90 > new file mode 100644 > index 00000000000..a4122482989 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/ppc-fortran/pr102767.f90 > @@ -0,0 +1,21 @@ > +! { dg-require-effective-target powerpc_vsx_ok } > +! { dg-options "-mvsx -O2 -ftree-vectorize -mno-efficient-unaligned-vsx" } > + > +INTERFACE > + FUNCTION elemental_mult (a, b, c) > + type(*), DIMENSION(..) :: a, b, c > + END > +END INTERFACE > + > +allocatable z > +integer, dimension(2,2) :: a, b > +call test_CFI_address > +contains > + subroutine test_CFI_address > + if (elemental_mult (z, x, y) .ne. 0) stop > + a = reshape ([4,3,2,1], [2,2]) > + b = reshape ([2,3,4,5], [2,2]) > + if (elemental_mult (i, a, b) .ne. 0) stop > + end > +end > + > The patch is okay with the indentation correction. Thanks, David