From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79983 invoked by alias); 5 Apr 2019 14:44:21 -0000 Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org Received: (qmail 79972 invoked by uid 89); 5 Apr 2019 14:44:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HTo:U*cgen, paulo, Paulo, H*r:sk:cgen@so X-HELO: box.linki.tools Received: from box.linki.tools (HELO box.linki.tools) (88.198.125.222) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 Apr 2019 14:44:18 +0000 Received: from authenticated-user (box.linki.tools [88.198.125.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by box.linki.tools (Postfix) with ESMTPSA id 608D04005B for ; Fri, 5 Apr 2019 16:44:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=linki.tools; s=mail; t=1554475456; bh=w0scV/BOnLroCH2CbtaxOnWqrvvGc8ZTYC7+tiIFX4c=; h=To:From:Subject:Date:From; b=KZFIGo0T0N2IOaIu/+4o2/TaspTqhGqB5sfGwVjRgPCLv/5GN/UfhHpufZt2g/3az B1hG0Wjfs+JYH2JNgMpe7RD35gTLRwwgLC7SYTnCqXeIZlGh2l5RfW4GHVQD7aoyey ThC3InkMolT100YfxfspfjuUHUN415qabY3mLF39Lru5gm8FZy8NPHErIsauSIIS24 EOlsoHybPYRCX/dxVFM7FvcOXaWu9Dj9PdftyXqs0f1dFEpK1E7AkjfIuVE4EeMJ86 Wb/Zd1XrcG5HqsTuTBPu9Y0On+QsyDlb9H3BU9mEvjntPlwxiGP8XNKBxoUFP3tvJX fKy/fqszjLCyQ== To: cgen@sourceware.org From: Paulo Matos Subject: Macro with same operands is misbehaving Openpgp: preference=signencrypt Message-ID: <2978b83b-e5eb-434d-f39b-b763782c11cf@linki.tools> Date: Fri, 05 Apr 2019 14:44:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-q2/txt/msg00000.txt.bz2 Hi, Before going ahead and start modifying CGEN I wanted to confirm if one can implement something like this with the current CGEN. Take a floating point instruction like the RISC-V `fsgnj.s f0, f1, 2`. `fmv.s` is a floating point move instruction that can be defined in terms of `fsgnj.s` as: `fmv.s f0, f1` == `fsgnj.s f0, f1, f1`. If I define the instruction fsgnj.s and followed by fmv.s macro, during disassembly `fsgnj.s` is always chosen, although assembly works fine. If on the other hand I define `fmv.s` macro followed by the instruction, assembly works fine again but all disassembly is broken because the instruction `fsgnj.s ft0, ft1, ft2` will be disassembled as `fmv.s ft0, ft1` - i.e. ft2 is ignored. I can't find a way to say: `fmv.s` matches for disassembly but only if `f1` == `f2` in `fsgnj.s f0, f1, f2`. I tried to actually define `fmv.s` as a new instruction instead of a macro but it doesn't work. Actually the same problem occurs because bitwise `fmv.s` is going to be the same as a `fsgnj.s` with two registers being the same. How can I tell the disassembler in CGEN about this `fmv.s` constraint? -- Paulo Matos