From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 77E813858D39 for ; Mon, 19 Sep 2022 07:52:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 77E813858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62e.google.com with SMTP id u9so62598627ejy.5 for ; Mon, 19 Sep 2022 00:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=zpPTb92kpWegreAxTd3tZkwN1e0x1U3ZNgtRULVhEGU=; b=D3SjYFOhywXAX7jI6vQqxVdXqZONSmAUCVEFA9IZAoiW9tsUxdPelYz1+0WBMtHAIf F/h76x1nZUhA+O+iDs5bxNcO3qTUYR3osmDrpS8f0hrmoq479W4Nw3+mk6Y33LF5L8/R UXeYBZhifdwg6HsaKzxT1pyo1Et2CKg+wj1vGzKVqF7ZfgpLrc+E95Wbho7FZApI+f1+ w5+8fQFsLNsqGsF/Bsh0oggZw840d2+B0KIbcrs597LIO9ZtHVQv4eCgyVrLjtKrtFyH Skp382PLCySsPw1s6W/7+/H+cRl1j9cVWz0KpAkIv8Bk9vkKAxEYBrDO+J0jt2f2KoHW 90Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=zpPTb92kpWegreAxTd3tZkwN1e0x1U3ZNgtRULVhEGU=; b=h5lDNl6h7M5Qj0LVsMO9h0XIMlBjNgMSCAcr6j8is2xBGQQgFfBu79as5+IrcjwbEh E4hmQxHRCwaQOydRp2rvjwlCyu6zzmdsHL9qTCHXkEtSKeB0NMEvMzUuORCTO10c6z1u pMzmLp3twkR69Mktpc+Ld7HVpkUq9Un72GeLRSI8P47g5Z7KekVWGMV2lYqfkyHqLSE9 5lTo48Gx68ZQ4I/gK81W0pQJ15dWGPFU6MdqaGD8YUqvePJpzTWds4w72C6C5TGuseGg u7D4ZsVHyUY0AVG0bdRnIc6S9fvqcKT8yxxux6hP9T8+28lqVXQkIBkEFG08mcf1Bmw9 xtkg== X-Gm-Message-State: ACrzQf3WuxNmv0Vb6wh5E1mb4Wq0HNAy8ZdXyEXx4vU2T5/Kq08s7EcC OYnxPmT6xKk2Y+jvGEXNE3PBwPUUxC7Ic2YmI9w= X-Google-Smtp-Source: AMsMyM5pKNi1GThXprSYXFh7HOJWFJdtpcbekTCs1JoIJ2JkxDxykqC6ZzmRrY0EVf7HHhU44wzO5aH+PW5oil3rzr0= X-Received: by 2002:a17:906:8a4c:b0:780:a2b6:90f7 with SMTP id gx12-20020a1709068a4c00b00780a2b690f7mr11252772ejc.29.1663573924195; Mon, 19 Sep 2022 00:52:04 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Mon, 19 Sep 2022 09:51:52 +0200 Message-ID: Subject: Re: [patch, avr] Fix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints. To: Georg Johann Lay Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sun, Sep 18, 2022 at 7:40 PM Georg Johann Lay wrote: > > Hello, > > this patch fixed PR target/99184 which incorrectly rounded during 64-bit > (long) double to 16-bit and 32-bit integers. > > The patch just removes the respective roundings from > libf7-asm.sx::to_integer and ::to_unsigned. Luckily, LibF7 does nowhere > use respective functions internally, the only user is in libf7.c::f7_exp > > which reads > > f7_round (qq, qq); > int16_t q = f7_get_s16 (qq); > > so that f7_get_s16() operates on an already rounded value, and therefore > this code works unaltered with or without rounding in to_integer. > > The patch applies to directory > > ./libgcc/config/avr/libf7/ > > and is the same for all GCC versions v10+. > > Please someone with write permissions commit it to trunk and backport to > v12, v11, and v10 as it is a wrong-code issue. > > The patch will fit without problems (except for ChangeLog) because there > is no traffic on that folder. Thanks, I've pushed the change. Please in future try to send patches that can be applied with git am, thus use git format-patch Richard. > > Thanks, Johann > > > libgcc/config/avr/libf7/ > PR target/99184 > Remove rounding from double to [u]int16 and [u]int32 casts. > > * libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit > and 32-bit integers. >