From patchwork Thu Apr 2 15:07:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 457718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AC51F1400A0 for ; Fri, 3 Apr 2015 02:09:33 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=S8cFmC4r; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=ZVaOOAncQFm24mKoMhdhUusdB3zH06TkVjkRjMV3YwpKEY6bEo jNiTJED54O4CnJ273Q4KG4srswJIITcUHL4NJot5YBIfFTRxnLU1Z2ZDAod3fRy+ vFYFc/Haix0f1j3kiI07FyxOy7r6xJ+OB0+JZYcfk3nNCHcY2YHm7Bkrw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=ze3pKfqOjnhdhTreUD/pGg3VKYk=; b=S8cFmC4rj4Jj0RtPOBRp qLFoQCuEWo+y6d2P8gTXwAizCGnIMUOAGM7VkakrtIGWG7WLvNhL674pWwjrI5Lh kx4WXYge8K6bDIYTqGujKdPCexADqFVG1N2NTbSVFD7m5nlD/MsdT79n3sVHG5zI yGE/svQR/U+AEtdvcURUoNQ= Received: (qmail 19150 invoked by alias); 2 Apr 2015 15:09:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 18127 invoked by uid 89); 2 Apr 2015 15:09:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f174.google.com Received: from mail-ig0-f174.google.com (HELO mail-ig0-f174.google.com) (209.85.213.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 02 Apr 2015 15:09:24 +0000 Received: by igbqf9 with SMTP id qf9so75503126igb.1 for ; Thu, 02 Apr 2015 08:09:22 -0700 (PDT) X-Received: by 10.50.49.43 with SMTP id r11mr20925644ign.18.1427987362192; Thu, 02 Apr 2015 08:09:22 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by mx.google.com with ESMTPSA id lq9sm14426740igb.15.2015.04.02.08.09.20 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Apr 2015 08:09:21 -0700 (PDT) Date: Thu, 2 Apr 2015 18:07:59 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Cc: ubizjak@gmail.com Subject: [PATCH, CHKP, i386] Fix retval generated for instrumented calls returning values on multiple registers Message-ID: <20150402150759.GA6244@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, This patch fixes nested PARALLEL in retval for isntrumented calls. Current possible call: (call_insn:TI 6 30 17 2 (set (parallel [ (expr_list:REG_DEP_TRUE (parallel:TI [ (expr_list:REG_DEP_TRUE (reg:DF 21 xmm0) (const_int 0 [0])) (expr_list:REG_DEP_TRUE (reg:DF 22 xmm1) (const_int 8 [0x8])) ]) (const_int 0 [0])) (expr_list:REG_DEP_TRUE (reg:BND64 77 bnd0) (const_int 0 [0])) (expr_list:REG_DEP_TRUE (reg:BND64 78 bnd1) (const_int 0 [0])) ]) (call/j (mem:QI (symbol_ref:DI ("test1") [flags 0x41] ) [0 test1.chkp S1 A8]) (const_int 0 [0]))) complex.c:11 670 {*call_value} Such construction causes DF analysis problems. This patch tranforms it to: (call_insn:TI 6 30 17 2 (set (parallel:TI [ (expr_list:REG_DEP_TRUE (reg:DF 21 xmm0) (const_int 0 [0])) (expr_list:REG_DEP_TRUE (reg:DF 22 xmm1) (const_int 8 [0x8])) (expr_list:REG_DEP_TRUE (reg:BND64 77 bnd0) (const_int 0 [0])) (expr_list:REG_DEP_TRUE (reg:BND64 78 bnd1) (const_int 0 [0])) ]) (call/j (mem:QI (symbol_ref:DI ("test1") [flags 0x41] ) [0 test1.chkp S1 A8]) (const_int 0 [0]))) complex.c:11 670 {*call_value} Only MPX target is affected. Bootstrapped and tested on x86_64-unknown-linux-gnu. Does it look OK? Thanks, Ilya --- 2015-04-02 Ilya Enkovich * config/i386/i386.c (ix86_expand_call): Avoid nested PARALLEL in returned call value. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 744642c..1d821cd 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -25624,8 +25624,19 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1, { rtx b0 = gen_rtx_REG (BND64mode, FIRST_BND_REG); rtx b1 = gen_rtx_REG (BND64mode, FIRST_BND_REG + 1); - retval = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (3, retval, b0, b1)); - chkp_put_regs_to_expr_list (retval); + if (GET_CODE (retval) == PARALLEL) + { + b0 = gen_rtx_EXPR_LIST (VOIDmode, b0, const0_rtx); + b1 = gen_rtx_EXPR_LIST (VOIDmode, b1, const0_rtx); + rtx par = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, b0, b1)); + retval = chkp_join_splitted_slot (retval, par); + } + else + { + retval = gen_rtx_PARALLEL (VOIDmode, + gen_rtvec (3, retval, b0, b1)); + chkp_put_regs_to_expr_list (retval); + } } call = gen_rtx_SET (VOIDmode, retval, call);