From patchwork Tue Feb 24 16:26:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 443048 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 6E96F140157 for ; Wed, 25 Feb 2015 03:26:37 +1100 (AEDT) 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:subject:message-id:mime-version:content-type; q=dns; s= default; b=jelqciZcxu/vGpoIxCry/3Oqyfjsk5Aupqeu4/LUb3OF5XCPqf/s8 6K0VGeHpqB9KYcSa8ULJPTc7VYtbvROfeNpL0PXVmxxuPpGtP6IITxnhTY+Lhubm rRoQr/NVDcnjfJrqf958osqwVbWHzgkI5dkGwZOZ5NuZNLZY0TQwBc= 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:subject:message-id:mime-version:content-type; s= default; bh=9ebOOaeXtbSKVzdQsFz7bxHcUvw=; b=Bhgbfq7RA14pyVg6Oh0s 7pGOlx/5H2mmKNKdBnre1JjMxr5WuRJHzNBTGS61xmRZKON2DggcOaMVSE6rN/Ko GLrrUbUSL6L4ZGwUKk7pya1IwPm6whXnU8BGVekHNVgLs7+HVNtQRqgTTMXBWjtr 5B3JrWczvfsJFD/6nUTfsXE= Received: (qmail 30943 invoked by alias); 24 Feb 2015 16:26:29 -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 30931 invoked by uid 89); 24 Feb 2015 16:26:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp10.uk.ibm.com Received: from e06smtp10.uk.ibm.com (HELO e06smtp10.uk.ibm.com) (195.75.94.106) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 24 Feb 2015 16:26:28 +0000 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Feb 2015 16:26:25 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 24 Feb 2015 16:26:22 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 277AC219005F for ; Tue, 24 Feb 2015 16:26:15 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1OGQLdh11600158 for ; Tue, 24 Feb 2015 16:26:21 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1OGQLK4008407 for ; Tue, 24 Feb 2015 09:26:21 -0700 Received: from bart (dyn-9-152-212-204.boeblingen.de.ibm.com [9.152.212.204]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id t1OGQKmI008364 for ; Tue, 24 Feb 2015 09:26:20 -0700 Received: by bart (sSMTP sendmail emulation); Tue, 24 Feb 2015 17:26:20 +0100 Date: Tue, 24 Feb 2015 17:26:20 +0100 From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/3] S/390: Implement two new builtins for efpc and sfpc Message-ID: <20150224162620.GB30246@maggie> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15022416-0041-0000-0000-0000035AA7AF X-IsSubscribed: yes Hi, this patch defines two new S/390 target specific macros: __builtin_s390_efpc __builtin_s390_sfpc for extracting and setting the floating point control register. I'll commit this to mainline after waiting a few days for comments. Bye, -Andreas- 2015-02-24 Andreas Krebbel * config/s390/s390.c (enum s390_builtin): Add S390_BUILTIN_S390_SFPC and S390_BUILTIN_S390_EFPC. (code_for_builtin): Add CODE_FOR_s390_sfpc and CODE_FOR_s390_efpc. (s390_init_builtins): Generate new builtin functions. * config/s390/s390.md (UNSPECV_SFPC, UNSPECV_EFPC): New constants. (s390_sfpc, s390_efpc): New pattern definitions. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index a4fb4c7..f4709da 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -9982,6 +9982,9 @@ enum s390_builtin S390_BUILTIN_TX_NESTING_DEPTH, S390_BUILTIN_TX_ASSIST, + S390_BUILTIN_S390_SFPC, + S390_BUILTIN_S390_EFPC, + S390_BUILTIN_MAX }; @@ -9997,7 +10000,10 @@ static enum insn_code const code_for_builtin[S390_BUILTIN_MAX] = { CODE_FOR_tabort, CODE_FOR_ntstg, CODE_FOR_etnd, - CODE_FOR_tx_assist + CODE_FOR_tx_assist, + + CODE_FOR_s390_sfpc, + CODE_FOR_s390_efpc }; static void @@ -10025,6 +10031,12 @@ s390_init_builtins (void) add_builtin_function ("__builtin_tx_assist", ftype, S390_BUILTIN_TX_ASSIST, BUILT_IN_MD, NULL, NULL_TREE); + /* void foo (unsigned) */ + ftype = build_function_type_list (void_type_node, unsigned_type_node, + NULL_TREE); + s390_builtin_decls[S390_BUILTIN_S390_SFPC] = + add_builtin_function ("__builtin_s390_sfpc", ftype, + S390_BUILTIN_S390_SFPC, BUILT_IN_MD, NULL, NULL_TREE); /* int foo (void *) */ ftype = build_function_type_list (integer_type_node, ptr_type_node, @@ -10061,6 +10073,11 @@ s390_init_builtins (void) add_builtin_function ("__builtin_tend", ftype, S390_BUILTIN_TEND, BUILT_IN_MD, NULL, NULL_TREE); + /* unsigned foo (void) */ + ftype = build_function_type_list (unsigned_type_node, NULL_TREE); + s390_builtin_decls[S390_BUILTIN_S390_EFPC] = + add_builtin_function ("__builtin_s390_efpc", ftype, + S390_BUILTIN_S390_EFPC, BUILT_IN_MD, NULL, NULL_TREE); /* void foo (uint64_t *, uint64_t) */ if (TARGET_64BIT) diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index f5ba132..bf698b1 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -162,6 +162,10 @@ UNSPECV_ETND UNSPECV_NTSTG UNSPECV_PPA + + ; Set and get floating point control register + UNSPECV_SFPC + UNSPECV_EFPC ]) ;; @@ -10300,3 +10304,18 @@ "TARGET_HTM && INTVAL (operands[2]) < 16" "ppa\t%0,%1,%2" [(set_attr "op_type" "RRF")]) + + +; Set and get floating point control register + +(define_insn "s390_sfpc" + [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")] + UNSPECV_SFPC)] + "TARGET_HARD_FLOAT" + "sfpc\t%0") + +(define_insn "s390_efpc" + [(set (match_operand:SI 0 "register_operand" "=d") + (unspec_volatile:SI [(const_int 0)] UNSPECV_EFPC))] + "TARGET_HARD_FLOAT" + "efpc\t%0")