From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 24C9D3858416 for ; Wed, 31 Jan 2024 11:31:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 24C9D3858416 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 24C9D3858416 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706700665; cv=none; b=IaVFv4e/QLP1aOpWtBrIBTOXf+MhK4rNMc5s2Ma/0539ZGec6ht8fRf2f0estxacMKTAIj8ItL1/W/Lpu1Q9OJ+NuxOCvQitI+TJ6VucrWL0CL1nT5yww9/ykZI1c3G8iGiWKIHSusSA/nUZ0qEGvZp+9/OjKlrhD3HSPsKdAv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706700665; c=relaxed/simple; bh=8OmvAIosZe6HK9rcAo2Gxf45HZqSNGxnIJpBk814Azw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=MophYUnKw9otdMP/yH562Lo9B5thuxAQY8iCCKrmqXWAjarrdCxD/+rpOJoTmMsgWKplMzomuIgKIlWDIK8ahMqkjElEig96Qqyb8SansTWHXJOaHJJPVYvB+6E/Q0pBovL20909xLnrGJLIBopTAxC/zqbaBPExVE+eqWcC5go= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40e76626170so52953835e9.2 for ; Wed, 31 Jan 2024 03:31:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1706700661; x=1707305461; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qRk9lC92/MECeGxxFZYJXmuUCs1vxo3a6ldGx5x986k=; b=xxRY968QiZvDcOv2FOQpc0iUBOYwecuPRZOh6IgUuluIRuaRNyvOBguck+mgJrrmiB xSpRSm4dP/9uSRw6zaIXz40h93eiGEWB3sjjqxIiTEqYcu/TkooNhjQSkkGx5MoRS/Jm Fp4J8iw7vjxVShv3yktngWElwFAHaz2wBgCGjLVLn4AX/C4zGoFGAnHE92aJK6sowb0y DNrFEjjqmOF8UpQzogNGSH/e6sj8bOJhsPEPJt69vmU9AWvZsJ3vWmjaOBHj7+QvNojv KtkAiv0NL/BROcpiHI7qWRe7YjjXzX2/PQLqLhM0ugocn6f6Gs13h0jgKjiHjfTdMgut TBKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706700661; x=1707305461; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qRk9lC92/MECeGxxFZYJXmuUCs1vxo3a6ldGx5x986k=; b=SHk3Nlo9RjFlH45itz4+UpSoAUzJHF5+NdHLzaD0Y4IA25xP0f8HrAlPnxScqKtdIY 9kj6k9DwHWRKxsYlk6ZrnOiuYb8ZIY3YOQkwVPQ9VX/vk8VEBqev0wO1vk7sIveDLaZQ HyVBk2Nv3hUjmfpRa2lUsfWQgQFZkgEhaY/wU99mnDsC6y2LVV8KDrxJ2ZBHTwgPtxae gGuVdHhkBcjhiMmyfiCMxy+DJkuCkdNtfMYIHEYfA0Rx4hcvU/Nde88Cdg+lzXJX1TPU WWo1WBcA3MCTQstfpPE/DBZsHKA9IGI+b29QefYkkia1znBREOOlrOJjuEBKTpmUkbpi gIQg== X-Gm-Message-State: AOJu0Yx0Mw+T4lQXDChE4/2Qy1CZozW48dY2SClZEfecinncOC5ImiZK R/SuoTPBLdf6phhX3lFAqux24Dvv+I8tuQ54P1QgbQmrrI4ItaoopGQ7+FNvrNk= X-Google-Smtp-Source: AGHT+IE8ZYdynOA0421tdg7e4He+mgshsVOJKGqOL9jhidLaNuRwZYfE0Re21LKptyAB+ajxozk39g== X-Received: by 2002:a05:600c:5251:b0:40e:f222:9e52 with SMTP id fc17-20020a05600c525100b0040ef2229e52mr945320wmb.40.1706700660898; Wed, 31 Jan 2024 03:31:00 -0800 (PST) Received: from [192.168.0.113] (hawk-18-b2-v4wan-167765-cust1304.vm26.cable.virginm.net. [82.41.69.25]) by smtp.gmail.com with ESMTPSA id iv18-20020a05600c549200b0040e76b60235sm1338362wmb.8.2024.01.31.03.31.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 Jan 2024 03:31:00 -0800 (PST) Message-ID: <4ebcbae0-1d49-4226-aee8-192c9c738b4b@baylibre.com> Date: Wed, 31 Jan 2024 11:31:00 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: GCN, RDNA 3: Adjust 'sync_compare_and_swap_lds_insn' Content-Language: en-GB To: Thomas Schwinge , gcc-patches@gcc.gnu.org References: <87plxhlrgr.fsf@euler.schwinge.ddns.net> From: Andrew Stubbs In-Reply-To: <87plxhlrgr.fsf@euler.schwinge.ddns.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 31/01/2024 10:36, Thomas Schwinge wrote: > Hi! > > OK to push "GCN, RDNA 3: Adjust 'sync_compare_and_swap_lds_insn'", > see attached? > > In pre-RDNA 3 ISA manuals, there are notes for 'DS_CMPST_[...]', like: > > Caution, the order of src and cmp are the *opposite* of the BUFFER_ATOMIC_CMPSWAP opcode. > > ..., and conversely in the RDNA 3 ISA manual, for 'DS_CMPSTORE_[...]': > > In this architecture the order of src and cmp agree with the BUFFER_ATOMIC_CMPSWAP opcode. > > Is my understanding correct, that this isn't something we have to worry > about at the GCC machine description level; that's resolved at the > assembler level? Right, the IR uses GCC's operand order and has nothing to do with the assembler syntax; the output template does the mapping. > --- a/gcc/config/gcn/gcn.md > +++ b/gcc/config/gcn/gcn.md > @@ -2095,7 +2095,12 @@ > (match_operand:SIDI 3 "register_operand" " v")] > UNSPECV_ATOMIC))] > "" > - "ds_cmpst_rtn_b %0, %1, %2, %3\;s_waitcnt\tlgkmcnt(0)" > + { > + if (TARGET_RDNA3) > + return "ds_cmpstore_rtn_b %0, %1, %2, %3\;s_waitcnt\tlgkmcnt(0)"; > + else > + return "ds_cmpst_rtn_b %0, %1, %2, %3\;s_waitcnt\tlgkmcnt(0)"; > + } > [(set_attr "type" "ds") > (set_attr "length" "12")]) I think you need to swap %2 and %3 in the new format. ds_cmpst matches GCC operand order, but ds_cmpstore has "cmp" and "src" reversed. Andrew