Message ID | 20220822170244.670691-1-hjl.tools@gmail.com |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp587339wro; Mon, 22 Aug 2022 10:03:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Kl1fy0fVozaVddbZ8v+M1MXiS0Qcv4SDQyLKSvtWerUFtbCpTZWNo/f4ATtpRBmj+Lkhs X-Received: by 2002:a17:907:2be1:b0:73d:7ad9:6048 with SMTP id gv33-20020a1709072be100b0073d7ad96048mr4498468ejc.339.1661187813890; Mon, 22 Aug 2022 10:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661187813; cv=none; d=google.com; s=arc-20160816; b=0g7u2ZQhN0mRJ4v3hGbs+0dwJkC4YZm2aXfdYufWAT7Ofka8e+bsACOplE4MmguGDd 5RuR4mS9u3AADgbPiMMOrGcpZ0YWNigLmnI+Yauit2B374uMOvglAFusmKQwvBwUXalI y4PaMW4xZ/AHBca1Td7JK72knip7nFEtDjTh3K3fZwrWLRD+BIHvtgVJ1WQ8ta7T5TaO fsqcFJNrgYsINOqPxIT0oK0l+MaPPfIah9msiOziSWyzhsoQo3gPARs1Ag3LmiVS2m8C I9zm30m36qDfmQHYWjeb9lhPsIC8hyunrGQI9FxV6eMp1N0WCIkHkohkbeRcly6l4YGJ kcnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=V1cIvndkShya/5c0uyVmcpqSjey7Mb4jmBBh+uV+H3g=; b=SQmUhW2FcT7fwBLkI3+q1xKKL6rFYSrGsN64nrU7WQYNLIgVAfpcadOPhvg8hg7y2z K1uiovySM2idFSgPh1EgyTpddk9JocueoM2K6kX1WGJnVsk1phGQq0eXX28MDklb2JFq sQdzlz2D1L6Wu5mrDyAlPBDtG08WFg4P2Tr72U+jiJSpJ0y+5r27qkAT3QWSrlAOz/K+ PfrRGg82NM7KLLGMlYAHsaJzIIItPv9wMIbwGIjkEfFaIXmYhQ8dlWGUTf0QvPLDvwEB LphitTZMgMQ1jTeDkYB4G+GF7WMVQntpw5dfr6vU5sxDVNQgal24HA1PIGFgo+hdFC0g cmGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KlCwvuvo; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h13-20020a05640250cd00b00446f42b19a3si67706edb.58.2022.08.22.10.03.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 10:03:33 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KlCwvuvo; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51EEC3858282 for <ouuuleilei@gmail.com>; Mon, 22 Aug 2022 17:03:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51EEC3858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661187812; bh=V1cIvndkShya/5c0uyVmcpqSjey7Mb4jmBBh+uV+H3g=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=KlCwvuvoJqsSbfRk11HUwYH8ugKptTzqKD12XPrlsdg9+RshDNjKgdmAXuzhskwuT TE2Ur2x8j7gKta1UzI4ki/cn9GJbnnauaKcQnUGe5fV2NSOV9JPtxvlWSY/F8hwgs0 ZgQdH6sE/fclxoi/VLlJCib/MCbckMK4yCthlsb4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 0D9633858D32 for <gcc-patches@gcc.gnu.org>; Mon, 22 Aug 2022 17:02:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0D9633858D32 Received: by mail-pf1-x42a.google.com with SMTP id x15so10032416pfp.4 for <gcc-patches@gcc.gnu.org>; Mon, 22 Aug 2022 10:02:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=V1cIvndkShya/5c0uyVmcpqSjey7Mb4jmBBh+uV+H3g=; b=dy/DTCHX5PbqCH/MgfufNe7AKkoGeQu+fBmtqpOKStjIOniKdSmt1FWNQ/rJbLsrPL JXhMpn6hjZwg0XuKgxnPJecqv0l2iPtY9VRXtDeeJx/gOv2ohdnQhu4+4kbSX0UPf/Kt 6BukgOaKrb5qqnCy1V9dtG7MalmHSQTqqPRRKqPxewt5kmxUWp0+10kBbzLLAlrY/j8i wl/p5Pu5BgbUc2qUhf+3GStHaXSGhldMgokmmt2QLayz9tBFO5JnUOIQKIANjPvgOYq5 GuwZWf1BmTl0d7nNsatPP3POYDNzLe8ziQdFxJ/zj/ooAxszJu0RC/HR3/aIfMF1xY6B +/fg== X-Gm-Message-State: ACgBeo3vnODOKtJ9OvqniQMhpO//lINuSObOaZF7vdmp8pdO9KKVLjG3 BxEGUX2H+CjKRPXejUgzc+UZeOBeZiY= X-Received: by 2002:a05:6a00:14c7:b0:52e:efb7:bd05 with SMTP id w7-20020a056a0014c700b0052eefb7bd05mr21354377pfu.24.1661187765712; Mon, 22 Aug 2022 10:02:45 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.56.38.79]) by smtp.gmail.com with ESMTPSA id u16-20020a17090341d000b0016cf195eb16sm8696728ple.185.2022.08.22.10.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 10:02:45 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 28E13C021F; Mon, 22 Aug 2022 10:02:44 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] x86: Cast stride to __PTRDIFF_TYPE__ in AMX intrinsics Date: Mon, 22 Aug 2022 10:02:44 -0700 Message-Id: <20220822170244.670691-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3025.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: "H.J. Lu via Gcc-patches" <gcc-patches@gcc.gnu.org> Reply-To: "H.J. Lu" <hjl.tools@gmail.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1741881673028760345?= X-GMAIL-MSGID: =?utf-8?q?1741881673028760345?= |
Series |
x86: Cast stride to __PTRDIFF_TYPE__ in AMX intrinsics
|
|
Commit Message
H.J. Lu
Aug. 22, 2022, 5:02 p.m. UTC
On 64-bit Windows, long is 32 bits and can't be used as stride in memory operand when base is a pointer which is 64 bits. Cast stride to __PTRDIFF_TYPE__, instead of long. PR target/106714 * config/i386/amxtileintrin.h (_tile_loadd_internal): Cast to __PTRDIFF_TYPE__. (_tile_stream_loadd_internal): Likewise. (_tile_stored_internal): Likewise. --- gcc/config/i386/amxtileintrin.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On Tue, Aug 23, 2022 at 1:02 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > On 64-bit Windows, long is 32 bits and can't be used as stride in memory > operand when base is a pointer which is 64 bits. Cast stride to > __PTRDIFF_TYPE__, instead of long. Ok. > > PR target/106714 > * config/i386/amxtileintrin.h (_tile_loadd_internal): Cast to > __PTRDIFF_TYPE__. > (_tile_stream_loadd_internal): Likewise. > (_tile_stored_internal): Likewise. > --- > gcc/config/i386/amxtileintrin.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gcc/config/i386/amxtileintrin.h b/gcc/config/i386/amxtileintrin.h > index 7b5a39eba72..06f18aa9bfb 100644 > --- a/gcc/config/i386/amxtileintrin.h > +++ b/gcc/config/i386/amxtileintrin.h > @@ -62,7 +62,7 @@ _tile_release (void) > #define _tile_loadd_internal(dst,base,stride) \ > __asm__ volatile \ > ("{tileloadd\t(%0,%1,1), %%tmm"#dst"|tileloadd\t%%tmm"#dst", [%0+%1*1]}" \ > - :: "r" ((const void*) (base)), "r" ((long) (stride))) > + :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) > > #define _tile_stream_loadd(dst,base,stride) \ > _tile_stream_loadd_internal (dst, base, stride) > @@ -70,7 +70,7 @@ _tile_release (void) > #define _tile_stream_loadd_internal(dst,base,stride) \ > __asm__ volatile \ > ("{tileloaddt1\t(%0,%1,1), %%tmm"#dst"|tileloaddt1\t%%tmm"#dst", [%0+%1*1]}" \ > - :: "r" ((const void*) (base)), "r" ((long) (stride))) > + :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) > > #define _tile_stored(dst,base,stride) \ > _tile_stored_internal (dst, base, stride) > @@ -78,7 +78,7 @@ _tile_release (void) > #define _tile_stored_internal(src,base,stride) \ > __asm__ volatile \ > ("{tilestored\t%%tmm"#src", (%0,%1,1)|tilestored\t[%0+%1*1], %%tmm"#src"}" \ > - :: "r" ((void*) (base)), "r" ((long) (stride)) \ > + :: "r" ((void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)) \ > : "memory") > > #define _tile_zero(dst) \ > -- > 2.37.2 > -- BR, Hongtao
On Mon, Aug 22, 2022 at 7:05 PM Hongtao Liu <crazylht@gmail.com> wrote: > > On Tue, Aug 23, 2022 at 1:02 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > On 64-bit Windows, long is 32 bits and can't be used as stride in memory > > operand when base is a pointer which is 64 bits. Cast stride to > > __PTRDIFF_TYPE__, instead of long. > Ok. > > > > PR target/106714 > > * config/i386/amxtileintrin.h (_tile_loadd_internal): Cast to > > __PTRDIFF_TYPE__. > > (_tile_stream_loadd_internal): Likewise. > > (_tile_stored_internal): Likewise. > > --- > > gcc/config/i386/amxtileintrin.h | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/gcc/config/i386/amxtileintrin.h b/gcc/config/i386/amxtileintrin.h > > index 7b5a39eba72..06f18aa9bfb 100644 > > --- a/gcc/config/i386/amxtileintrin.h > > +++ b/gcc/config/i386/amxtileintrin.h > > @@ -62,7 +62,7 @@ _tile_release (void) > > #define _tile_loadd_internal(dst,base,stride) \ > > __asm__ volatile \ > > ("{tileloadd\t(%0,%1,1), %%tmm"#dst"|tileloadd\t%%tmm"#dst", [%0+%1*1]}" \ > > - :: "r" ((const void*) (base)), "r" ((long) (stride))) > > + :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) > > > > #define _tile_stream_loadd(dst,base,stride) \ > > _tile_stream_loadd_internal (dst, base, stride) > > @@ -70,7 +70,7 @@ _tile_release (void) > > #define _tile_stream_loadd_internal(dst,base,stride) \ > > __asm__ volatile \ > > ("{tileloaddt1\t(%0,%1,1), %%tmm"#dst"|tileloaddt1\t%%tmm"#dst", [%0+%1*1]}" \ > > - :: "r" ((const void*) (base)), "r" ((long) (stride))) > > + :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) > > > > #define _tile_stored(dst,base,stride) \ > > _tile_stored_internal (dst, base, stride) > > @@ -78,7 +78,7 @@ _tile_release (void) > > #define _tile_stored_internal(src,base,stride) \ > > __asm__ volatile \ > > ("{tilestored\t%%tmm"#src", (%0,%1,1)|tilestored\t[%0+%1*1], %%tmm"#src"}" \ > > - :: "r" ((void*) (base)), "r" ((long) (stride)) \ > > + :: "r" ((void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)) \ > > : "memory") > > > > #define _tile_zero(dst) \ > > -- > > 2.37.2 > > > > > -- > BR, > Hongtao OK to backport it to GCC 12 branch?
On Sat, Aug 27, 2022 at 12:51 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Mon, Aug 22, 2022 at 7:05 PM Hongtao Liu <crazylht@gmail.com> wrote: > > > > On Tue, Aug 23, 2022 at 1:02 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > > > On 64-bit Windows, long is 32 bits and can't be used as stride in memory > > > operand when base is a pointer which is 64 bits. Cast stride to > > > __PTRDIFF_TYPE__, instead of long. > > Ok. > > > > > > PR target/106714 > > > * config/i386/amxtileintrin.h (_tile_loadd_internal): Cast to > > > __PTRDIFF_TYPE__. > > > (_tile_stream_loadd_internal): Likewise. > > > (_tile_stored_internal): Likewise. > > > --- > > > gcc/config/i386/amxtileintrin.h | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/gcc/config/i386/amxtileintrin.h b/gcc/config/i386/amxtileintrin.h > > > index 7b5a39eba72..06f18aa9bfb 100644 > > > --- a/gcc/config/i386/amxtileintrin.h > > > +++ b/gcc/config/i386/amxtileintrin.h > > > @@ -62,7 +62,7 @@ _tile_release (void) > > > #define _tile_loadd_internal(dst,base,stride) \ > > > __asm__ volatile \ > > > ("{tileloadd\t(%0,%1,1), %%tmm"#dst"|tileloadd\t%%tmm"#dst", [%0+%1*1]}" \ > > > - :: "r" ((const void*) (base)), "r" ((long) (stride))) > > > + :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) > > > > > > #define _tile_stream_loadd(dst,base,stride) \ > > > _tile_stream_loadd_internal (dst, base, stride) > > > @@ -70,7 +70,7 @@ _tile_release (void) > > > #define _tile_stream_loadd_internal(dst,base,stride) \ > > > __asm__ volatile \ > > > ("{tileloaddt1\t(%0,%1,1), %%tmm"#dst"|tileloaddt1\t%%tmm"#dst", [%0+%1*1]}" \ > > > - :: "r" ((const void*) (base)), "r" ((long) (stride))) > > > + :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) > > > > > > #define _tile_stored(dst,base,stride) \ > > > _tile_stored_internal (dst, base, stride) > > > @@ -78,7 +78,7 @@ _tile_release (void) > > > #define _tile_stored_internal(src,base,stride) \ > > > __asm__ volatile \ > > > ("{tilestored\t%%tmm"#src", (%0,%1,1)|tilestored\t[%0+%1*1], %%tmm"#src"}" \ > > > - :: "r" ((void*) (base)), "r" ((long) (stride)) \ > > > + :: "r" ((void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)) \ > > > : "memory") > > > > > > #define _tile_zero(dst) \ > > > -- > > > 2.37.2 > > > > > > > > > -- > > BR, > > Hongtao > > OK to backport it to GCC 12 branch? Ok. > > > -- > H.J.
diff --git a/gcc/config/i386/amxtileintrin.h b/gcc/config/i386/amxtileintrin.h index 7b5a39eba72..06f18aa9bfb 100644 --- a/gcc/config/i386/amxtileintrin.h +++ b/gcc/config/i386/amxtileintrin.h @@ -62,7 +62,7 @@ _tile_release (void) #define _tile_loadd_internal(dst,base,stride) \ __asm__ volatile \ ("{tileloadd\t(%0,%1,1), %%tmm"#dst"|tileloadd\t%%tmm"#dst", [%0+%1*1]}" \ - :: "r" ((const void*) (base)), "r" ((long) (stride))) + :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) #define _tile_stream_loadd(dst,base,stride) \ _tile_stream_loadd_internal (dst, base, stride) @@ -70,7 +70,7 @@ _tile_release (void) #define _tile_stream_loadd_internal(dst,base,stride) \ __asm__ volatile \ ("{tileloaddt1\t(%0,%1,1), %%tmm"#dst"|tileloaddt1\t%%tmm"#dst", [%0+%1*1]}" \ - :: "r" ((const void*) (base)), "r" ((long) (stride))) + :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) #define _tile_stored(dst,base,stride) \ _tile_stored_internal (dst, base, stride) @@ -78,7 +78,7 @@ _tile_release (void) #define _tile_stored_internal(src,base,stride) \ __asm__ volatile \ ("{tilestored\t%%tmm"#src", (%0,%1,1)|tilestored\t[%0+%1*1], %%tmm"#src"}" \ - :: "r" ((void*) (base)), "r" ((long) (stride)) \ + :: "r" ((void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)) \ : "memory") #define _tile_zero(dst) \