Skip to content
Snippets Groups Projects

Reduction Support

Open Richard Angersbach requested to merge rangersbach/reductions into v2.0-dev
Viewing commit 4ae330dc
Show latest version
1 file
+ 6
3
Preferences
Compare changes
@@ -3,8 +3,8 @@ from typing import Sequence
from pystencils.backend.ast.expressions import PsCall
from ..functions import CFunction, PsMathFunction, MathFunctions
from ...types import PsIntegerType, PsIeeeFloatType
from ..functions import CFunction, PsMathFunction, MathFunctions, NumericLimitsFunctions
from ...types import PsIntegerType, PsIeeeFloatType, PsScalarType
from .platform import Platform
from ..exceptions import MaterializationError
@@ -62,7 +62,10 @@ class GenericCpu(Platform):
dtype = call.get_dtype()
arg_types = (dtype,) * func.num_args
# TODO: numeric limits
if isinstance(dtype, PsScalarType) and func in (NumericLimitsFunctions.Min, NumericLimitsFunctions.Max):
cfunc = CFunction(f"{dtype.c_string()}_{func.function_name}".capitalize(), arg_types, dtype)
call.function = cfunc
return call
if isinstance(dtype, PsIeeeFloatType) and dtype.width in (32, 64):
cfunc: CFunction