From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 26333385841C; Tue, 13 Jun 2023 17:14:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26333385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686676466; bh=YGJvrCBV1oBk/PzdeRibSknY+8F3RGLBlLRPB7vuDW4=; h=From:To:Subject:Date:From; b=Q2+ND41sqsffQxvs6+8atUJzyIUCVlNYYwgHY3v4gh+LmknaYOk9LiDO8I5N9yUd7 QwM7P6ZyEL+XGn60rRo2xtT9qMIv300sirizfFsqFlviaNBhLbVQoT9uclCaRLSjaC uj47SfukndsbmnDjuFsvgAUCl4yhpcnk6vAK3dnA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1793] Remove sh5media divtab code X-Act-Checkin: gcc X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: 1c188877bfc5a4aee3f777f0d4d60500bc222b54 X-Git-Newrev: 99dec205a12f7dfa39fd43fc7c36d9974aaec526 Message-Id: <20230613171426.26333385841C@sourceware.org> Date: Tue, 13 Jun 2023 17:14:26 +0000 (GMT) List-Id: https://gcc.gnu.org/g:99dec205a12f7dfa39fd43fc7c36d9974aaec526 commit r14-1793-g99dec205a12f7dfa39fd43fc7c36d9974aaec526 Author: Jeff Law Date: Tue Jun 13 11:10:21 2023 -0600 Remove sh5media divtab code Spurred by Akari Takahashi's patch to config/sh/divtab.cc, this removes divtab.cc completely. divtab.cc was used to calculate a division table for the sh5 media processor. GCC dropped support for that (unmanufactured) chip back in 2016 and this file simply got missed AFAICT. gcc/ * config/sh/divtab.cc: Remove. Diff: --- gcc/config/sh/divtab.cc | 203 ------------------------------------------------ 1 file changed, 203 deletions(-) diff --git a/gcc/config/sh/divtab.cc b/gcc/config/sh/divtab.cc deleted file mode 100644 index a69dd541370..00000000000 --- a/gcc/config/sh/divtab.cc +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright (C) 2003-2023 Free Software Foundation, Inc. - -This file is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3, or (at your option) any -later version. - -This file is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - - -/* Calculate division table for SH5Media integer division - Contributed by Joern Rennecke - joern.rennecke@superh.com */ - -#include -#include - -#define BITS 5 -#define N_ENTRIES (1 << BITS) -#define CUTOFF_BITS 20 - -#define BIAS (-330) - -double max_defect = 0.; -double max_defect_x; - -double min_defect = 1e9; -double min_defect_x; - -double max_defect2 = 0.; -double max_defect2_x; - -double min_defect2 = 0.; -double min_defect2_x; - -double min_defect3 = 01e9; -double min_defect3_x; -int min_defect3_val; - -double max_defect3 = 0.; -double max_defect3_x; -int max_defect3_val; - -static double -note_defect3 (int val, double d2, double y2d, double x) -{ - int cutoff_val = val >> CUTOFF_BITS; - double cutoff; - double defect; - - if (val < 0) - cutoff_val++; - cutoff = (cutoff_val * (1< max_defect3) - { - max_defect3 = defect; - max_defect3_x = x; - max_defect3_val = val; - } - if (defect < min_defect3) - { - min_defect3 = defect; - min_defect3_x = x; - min_defect3_val = val; - } -} - -/* This function assumes 32-bit integers. */ -static double -calc_defect (double x, int constant, int factor) -{ - double y0 = (constant - (int) floor ((x * factor * 64.))) / 16384.; - double y1 = 2 * y0 -y0 * y0 * (x + BIAS / (1.*(1LL<<30))); - double y2d0, y2d; - int y2d1; - double d, d2; - - y1 = floor (y1 * (1024 * 1024 * 1024)) / (1024 * 1024 * 1024); - d = y1 - 1 / x; - if (d > max_defect) - { - max_defect = d; - max_defect_x = x; - } - if (d < min_defect) - { - min_defect = d; - min_defect_x = x; - } - y2d0 = floor (y1 * x * (1LL << 60-16)); - y2d1 = (int) (long long) y2d0; - y2d = - floor ((y1 - y0 / (1<<30-14)) * y2d1) / (1LL<<44); - d2 = y1 + y2d - 1/x; - if (d2 > max_defect2) - { - max_defect2 = d2; - max_defect2_x = x; - } - if (d2 < min_defect2) - { - min_defect2 = d2; - min_defect2_x = x; - } - /* zero times anything is trivially zero. */ - note_defect3 ((1 << CUTOFF_BITS) - 1, d2, y2d, x); - note_defect3 (1 << CUTOFF_BITS, d2, y2d, x); - note_defect3 ((1U << 31) - (1 << CUTOFF_BITS), d2, y2d, x); - note_defect3 ((1U << 31) - 1, d2, y2d, x); - note_defect3 (-1, d2, y2d, x); - note_defect3 (-(1 << CUTOFF_BITS), d2, y2d, x); - note_defect3 ((1U << 31) - (1 << CUTOFF_BITS) + 1, d2, y2d, x); - note_defect3 (-(1U << 31), d2, y2d, x); - return d; -} - -int -main () -{ - int i; - unsigned char factors[N_ENTRIES]; - short constants[N_ENTRIES]; - int steps = N_ENTRIES / 2; - double step = 1. / steps; - double eps30 = 1. / (1024 * 1024 * 1024); - - for (i = 0; i < N_ENTRIES; i++) - { - double x_low = (i < steps ? 1. : -3.) + i * step; - double x_high = x_low + step - eps30; - double x_med; - int factor, constant; - double low_defect, med_defect, high_defect, max_defect; - - factor = (1./x_low- 1./x_high) / step * 256. + 0.5; - if (factor == 256) - factor = 255; - factors[i] = factor; - /* Use minimum of error function for x_med. */ - x_med = sqrt (256./factor); - if (x_low < 0) - x_med = - x_med; - low_defect = 1. / x_low + x_low * factor / 256.; - high_defect = 1. / x_high + x_high * factor / 256.; - med_defect = 1. / x_med + x_med * factor / 256.; - max_defect - = ((low_defect > high_defect) ^ (x_med < 0)) ? low_defect : high_defect; - constant = (med_defect + max_defect) * 0.5 * 16384. + 0.5; - if (constant < -32768 || constant > 32767) - abort (); - constants[i] = constant; - calc_defect (x_low, constant, factor); - calc_defect (x_med, constant, factor); - calc_defect (x_high, constant, factor); - } - printf ("/* This table has been generated by divtab.cc .\n"); - printf ("Defects for bias %d:\n", BIAS); - printf (" Max defect: %e at %e\n", max_defect, max_defect_x); - printf (" Min defect: %e at %e\n", min_defect, min_defect_x); - printf (" Max 2nd step defect: %e at %e\n", max_defect2, max_defect2_x); - printf (" Min 2nd step defect: %e at %e\n", min_defect2, min_defect2_x); - printf (" Max div defect: %e at %d:%e\n", max_defect3, max_defect3_val, - max_defect3_x); - printf (" Min div defect: %e at %d:%e\n", min_defect3, min_defect3_val, - min_defect3_x); - printf (" Defect at 1: %e\n", - calc_defect (1., constants[0], factors[0])); - printf (" Defect at -2: %e */\n", - calc_defect (-2., constants[steps], factors[steps])); - printf ("\t.section\t.rodata\n"); - printf ("\t.balign 2\n"); - printf ("/* negative division constants */\n"); - for (i = steps; i < 2 * steps; i++) - printf ("\t.word\t%d\n", constants[i]); - printf ("/* negative division factors */\n"); - for (i = steps; i < 2*steps; i++) - printf ("\t.byte\t%d\n", factors[i]); - printf ("\t.skip %d\n", steps); - printf ("\t.global GLOBAL(div_table):\n"); - printf ("GLOBAL(div_table):\n"); - printf ("\t.skip %d\n", steps); - printf ("/* positive division factors */\n"); - for (i = 0; i < steps; i++) - printf ("\t.byte\t%d\n", factors[i]); - printf ("/* positive division constants */\n"); - for (i = 0; i < steps; i++) - printf ("\t.word\t%d\n", constants[i]); - exit (0); -}