From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id C5889386FC09 for ; Fri, 21 May 2021 21:09:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C5889386FC09 Received: by mail-pj1-x1033.google.com with SMTP id b13-20020a17090a8c8db029015cd97baea9so7717938pjo.0 for ; Fri, 21 May 2021 14:09:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZfFhFm5ERikp2yvl3k2ewCasxYqg7TFBY8/nnvIq8w0=; b=rMCzHPTXn4UyyPtKXXV44wmlIcedCdEKp9guUYFlP2PV06NomXFSfISZyARFYfr9tq vKsfjszhbHV0ILc5fAgJi7/2IJsmZFGB+0YqLS2rnaGf79vSvk7fu3PZL5joaISz5yRd kURu+VsrLmqqGlpQi8vvkB4T7NLTlFJ+3WhMT6gVyeWeco9VqTUW5po2APTJ6m3MfNvW 9RqElnkBH8415Db8ky3VLS1k+edm8cSDfsvLCOKHL6k/Vc5ea/PEwCOQRg3wVX3DAUXE AnAiFK8OttVKzUmb3RMYjFpv2NveBa+KTS0bdeYPXvJg1kbNqvXMotwuTbt0/rdoLf1q vxRw== X-Gm-Message-State: AOAM533wNceCnSgsKfzUW4xBamhd2gXrcE7AQjYMT9sNHWoRglXCbqlQ RlOSTCvuDMpVQtugzUDs8idnHu/XjqVmtojmzbg= X-Google-Smtp-Source: ABdhPJwQ93EVezXawJH/fJFUJ/jUvKTdl9CDrXCfF3nkaCpuT3f8NpLjwfW38q9/WCeRVeqi6pfzx8t6B5JcskOcXDI= X-Received: by 2002:a17:90b:4d82:: with SMTP id oj2mr12342990pjb.61.1621631375658; Fri, 21 May 2021 14:09:35 -0700 (PDT) MIME-Version: 1.0 References: <20210521140340.GC2295059@embecosm.com> <4319e88e-4f22-fce6-8678-07e27fb043d4@amd.com> In-Reply-To: <4319e88e-4f22-fce6-8678-07e27fb043d4@amd.com> From: vaibhav kurhe Date: Sat, 22 May 2021 02:39:23 +0530 Message-ID: Subject: Re: Re: GDB | DWARF expression | Extracting a range of bits from an 'xmm' register To: "Zaric, Zoran (Zare)" Cc: "gdb@sourceware.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 21:09:38 -0000 On Fri, May 21, 2021 at 10:36 PM Zaric, Zoran (Zare) via Gdb wrote: > > On 5/21/21 3:03 PM, Andrew Burgess wrote: > > * vaibhav kurhe via Gdb [2021-05-21 14:27:15 +0530]: > > > >> Hello all, > >> For a use case, I am trying to build a DWARF expression which represents > >> the value of an arbitrary range of bits (e.g. 96-127 bits) in an *128-bit > >> xmm register* to be used as a *location attribute value* for a variable DIE. > >> I am using GDB to consume the debug info and test it. > >> > >> Following is the expression I started with to test out a shift operation on > >> an 128-bit xmm0 register using Typed DWARF stack :- > >> > >> *"DW_OP_GNU_regval_type: 21 (xmm0) <0x30>; DW_OP_GNU_const_type: <0x30> 16 > >> byte block: 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; DW_OP_shl; > > > > I'm probably just not understanding correctly, but I'm confused by the > > use of DW_OP_GNU_const_type. Isn't this providing the number of bits > > to shift? I'd have expected something like 'DW_OP_const1u 96'. > > > > Thanks, > > Andrew > > > > Hi Vaibhav, > > Maybe I am missing something, but what is the end goal that you are > trying to accomplish? > > The way how you formed your expression, you can only get a read only > stack value location description. > > Why not use the DW_OP_bit_piece with your register being the only piece > inside of it and then use that as your end location description? > > Thanks, > Zoran Hi Zoran, Thanks for the reply! Actually I am trying to improve an object file's debug info in case of a vectorized transformation by the compiler. e.g. when a source variable, 'sum' = (xmm0[0-31] + xmm0[32-63] + xmm0[64-95] + xmm0[96-127]). Thanks for pointing out the DW_OP_bit_piece operation! It worked in a setting where a source variable resides directly in a 32-bit chunk of an 128-bit xmm register. But, I think it won't be possible for the above example(?). Here, we'll have to do 128-bit operations (such as DW_OP_shl) on the register to get its 32-bit chunks. Is that correct? Regards, Vaibhav