From patchwork Fri Oct 2 07:56:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1375589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C2j4L0dWWz9sSC for ; Fri, 2 Oct 2020 17:56:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1EC9F388EC3F; Fri, 2 Oct 2020 07:56:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 953CC385EC4E for ; Fri, 2 Oct 2020 07:56:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 953CC385EC4E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=hubicka@kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 0743E282B6C; Fri, 2 Oct 2020 09:56:24 +0200 (CEST) Date: Fri, 2 Oct 2020 09:56:23 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, rguenther@suse.de Subject: Add streaming of poly_int64 Message-ID: <20201002075623.GA27397@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, this patch implements stremaing for poly int. Bootstrapped/regtested x86_64-linux, OK? gcc/ChangeLog: 2020-10-02 Jan Hubicka * data-streamer-in.c (streamer_read_poly_int64): New function. * data-streamer-out.c (streamer_write_poly_int64): New function. * data-streamer.h (streamer_write_poly_int64): Declare. (streamer_read_poly_int64): Declare. diff --git a/gcc/data-streamer-in.c b/gcc/data-streamer-in.c index d3ba634af92..7abb48af9b8 100644 --- a/gcc/data-streamer-in.c +++ b/gcc/data-streamer-in.c @@ -186,6 +186,17 @@ streamer_read_poly_uint64 (class lto_input_block *ib) return res; } +/* Read a poly_int64 from IB. */ + +poly_int64 +streamer_read_poly_int64 (class lto_input_block *ib) +{ + poly_int64 res; + for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i) + res.coeffs[i] = streamer_read_hwi (ib); + return res; +} + /* Read gcov_type value from IB. */ gcov_type diff --git a/gcc/data-streamer-out.c b/gcc/data-streamer-out.c index 66038390468..fb8a90ab2c0 100644 --- a/gcc/data-streamer-out.c +++ b/gcc/data-streamer-out.c @@ -229,6 +229,15 @@ streamer_write_poly_uint64 (struct output_block *ob, poly_uint64 work) streamer_write_uhwi_stream (ob->main_stream, work.coeffs[i]); } +/* Write a poly_int64 value WORK to OB->main_stream. */ + +void +streamer_write_poly_int64 (struct output_block *ob, poly_int64 work) +{ + for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i) + streamer_write_hwi_stream (ob->main_stream, work.coeffs[i]); +} + /* Write a gcov counter value WORK to OB->main_stream. */ void diff --git a/gcc/data-streamer.h b/gcc/data-streamer.h index 61fa3f9ed63..6ab586f8b11 100644 --- a/gcc/data-streamer.h +++ b/gcc/data-streamer.h @@ -54,6 +54,7 @@ void streamer_write_zero (struct output_block *); void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT); void streamer_write_hwi (struct output_block *, HOST_WIDE_INT); void streamer_write_poly_uint64 (struct output_block *, poly_uint64); +void streamer_write_poly_int64 (struct output_block *, poly_int64); void streamer_write_gcov_count (struct output_block *, gcov_type); void streamer_write_string (struct output_block *, struct lto_output_stream *, const char *, bool); @@ -84,6 +85,7 @@ const char *bp_unpack_string (class data_in *, struct bitpack_d *); unsigned HOST_WIDE_INT streamer_read_uhwi (class lto_input_block *); HOST_WIDE_INT streamer_read_hwi (class lto_input_block *); poly_uint64 streamer_read_poly_uint64 (class lto_input_block *); +poly_int64 streamer_read_poly_int64 (class lto_input_block *); gcov_type streamer_read_gcov_count (class lto_input_block *); wide_int streamer_read_wide_int (class lto_input_block *); widest_int streamer_read_widest_int (class lto_input_block *);