| 1 |
/* Functions for Linux on PowerPC. |
| 2 |
Copyright (C) 2013-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 3, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with GCC; see the file COPYING3. If not see |
| 18 |
<http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
#define IN_TARGET_CODE 1 |
| 21 |
|
| 22 |
#include "config.h" |
| 23 |
#include "system.h" |
| 24 |
#include "coretypes.h" |
| 25 |
#include "tm.h" |
| 26 |
#include "target.h" |
| 27 |
#include "targhooks.h" |
| 28 |
#include "tree.h" |
| 29 |
#include "case-cfn-macros.h" |
| 30 |
|
| 31 |
/* Implement TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P. */ |
| 32 |
|
| 33 |
bool |
| 34 |
rs6000_linux_float_exceptions_rounding_supported_p (void) |
| 35 |
{ |
| 36 |
/* glibc has support for exceptions and rounding modes for software |
| 37 |
floating point. */ |
| 38 |
if (OPTION_GLIBC) |
| 39 |
return true; |
| 40 |
else |
| 41 |
return TARGET_HARD_FLOAT; |
| 42 |
} |
| 43 |
|
| 44 |
/* Implement TARGET_LIBM_FUNCTION_MAX_ERROR. */ |
| 45 |
|
| 46 |
unsigned |
| 47 |
rs6000_linux_libm_function_max_error (unsigned cfn, machine_mode mode, |
| 48 |
bool boundary_p) |
| 49 |
{ |
| 50 |
if (OPTION_GLIBC) |
| 51 |
{ |
| 52 |
int rnd = flag_rounding_math ? 4 : 0; |
| 53 |
switch (cfn) |
| 54 |
{ |
| 55 |
CASE_CFN_SQRT: |
| 56 |
CASE_CFN_SQRT_FN: |
| 57 |
if (!boundary_p && MODE_COMPOSITE_P (mode)) |
| 58 |
return 1 + rnd; |
| 59 |
break; |
| 60 |
CASE_CFN_COS: |
| 61 |
CASE_CFN_COS_FN: |
| 62 |
if (!boundary_p && mode == SFmode) |
| 63 |
return 3 + rnd; |
| 64 |
if (!boundary_p && MODE_COMPOSITE_P (mode)) |
| 65 |
return 4 + rnd; |
| 66 |
break; |
| 67 |
CASE_CFN_SIN: |
| 68 |
CASE_CFN_SIN_FN: |
| 69 |
if (!boundary_p && MODE_COMPOSITE_P (mode)) |
| 70 |
return 1 + rnd; |
| 71 |
break; |
| 72 |
default: |
| 73 |
break; |
| 74 |
} |
| 75 |
return glibc_linux_libm_function_max_error (cfn, mode, boundary_p); |
| 76 |
} |
| 77 |
return default_libm_function_max_error (cfn, mode, boundary_p); |
| 78 |
} |