Beispiel #1
0
 def get_default_args(cls, **kw):
     """ Return a structure containing the arguments for MetaAtan,
             builtin from a default argument mapping overloaded with @p kw
     """
     arg_dict = cls.default_args_atan.copy()
     arg_dict.update(kw)
     return DefaultArgTemplate(**arg_dict)
Beispiel #2
0
 def get_default_args(**kw):
     """ generate default argument structure for OpUnitBench """
     default_values = {
         "precision": ML_Int32,
     }
     default_values.update(kw)
     return DefaultArgTemplate(**default_values)
Beispiel #3
0
 def get_default_args(**kw):
     default_arg = {
         "function_name": "new_lzcnt",
         "output_file": "ut_lzcnt.c",
         "precision": ML_Int32
     }
     default_arg.update(**kw)
     return DefaultArgTemplate(**default_arg)
Beispiel #4
0
 def get_default_args(**kw):
     default_args_sin = {
         "output_file": "ml2_wide_sin.c",
         "function_name": "ml2_wide_sin",
         "precision": ML_Binary64,
         "poly_degree": 1,
         "skip_reduction": False,
     }
     default_args_sin.update(kw)
     return DefaultArgTemplate(**default_args_sin)
Beispiel #5
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for ML_HyperbolicSine,
             builtin from a default argument mapping overloaded with @p kw """
     default_args_sinh = {
             "output_file": "my_sinh.c",
             "function_name": "my_sinh",
             "precision": ML_Binary32,
             "accuracy": ML_Faithful,
             "target": GenericProcessor.get_target_instance()
     }
     default_args_sinh.update(kw)
     return DefaultArgTemplate(**default_args_sinh)
Beispiel #6
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for current class,
     builtin from a default argument mapping overloaded with @p kw """
     default_args = {
         "output_file": "ut_block_lzcnt.c",
         "function_name": "ut_lzcnt",
         "precision": ML_Int32,
         "auto_test_range": Interval(0, 2**31),
         "auto_test_execute": 1000,
     }
     default_args.update(kw)
     return DefaultArgTemplate(**default_args)
Beispiel #7
0
 def get_default_args(cls, **kw):
     """ Return a structure containing the arguments for MetaAtan,
             builtin from a default argument mapping overloaded with @p kw
     """
     arg_dict = cls.default_args_atan.copy()
     arg_dict.update({
         "output_file": "my_atan2.c",
         "function_name": "my_atan2",
         "input_intervals": [Interval(-5, 5)] * 2,
     })
     arg_dict.update(kw)
     return DefaultArgTemplate(**arg_dict)
Beispiel #8
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for ML_Exponential,
         builtin from a default argument mapping overloaded with @p kw """
     default_args_exp = {
         "output_file": "ml_exp.c",
         "function_name": "ml_exp",
         "precision": ML_Binary32,
         "accuracy": ML_Faithful,
         "target": GenericProcessor()
     }
     default_args_exp.update(kw)
     return DefaultArgTemplate(**default_args_exp)
Beispiel #9
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for ML_Log1p,
             builtin from a default argument mapping overloaded with @p kw """
     default_args_log1p = {
             "output_file": "my_log1p.c",
             "function_name": "my_log1pf",
             "precision": ML_Binary32,
             "accuracy": ML_Faithful,
             "target": GenericProcessor.get_target_instance(),
             "passes": [("start:instantiate_abstract_prec"), ("start:instantiate_prec"), ("start:basic_legalization"), ("start:expand_multi_precision")],
     }
     default_args_log1p.update(kw)
     return DefaultArgTemplate(**default_args_log1p)
Beispiel #10
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for MetaFMOD,
         builtin from a default argument mapping overloaded with @p kw """
     default_args_exp = {
         "output_file": "ml_fmod.c",
         "function_name": "ml_fmod",
         "input_intervals": (Interval(-100, 100), Interval(-100, 100)),
         "precision": ML_Binary32,
         "accuracy": ML_Faithful,
         "target": GenericProcessor.get_target_instance(),
     }
     default_args_exp.update(kw)
     return DefaultArgTemplate(**default_args_exp)
Beispiel #11
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for ML_GenericLog,
         builtin from a default argument mapping overloaded with @p kw """
     default_args_log = {
         "output_file": "ml_genlog.c",
         "function_name": "ml_genlog",
         "precision": ML_Binary32,
         "accuracy": ML_Faithful,
         "target": GenericProcessor(),
         "basis": exp(1),
     }
     default_args_log.update(kw)
     return DefaultArgTemplate(**default_args_log)
Beispiel #12
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for MetalibmSqrt,
         builtin from a default argument mapping overloaded with @p kw """
     default_args_sqrt = {
         "output_file": "my_sqrtf.c",
         "function_name": "my_sqrtf",
         "num_iter": 3,
         "precision": ML_Binary32,
         "accuracy": ML_Faithful,
         "target": GenericProcessor()
     }
     default_args_sqrt.update(kw)
     return DefaultArgTemplate(**default_args_sqrt)
Beispiel #13
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for ML_ImplementPoly """
     default_args_log = {
         "output_file": "POLY.c",
         "function_name": "POLY",
         "precision": ML_Binary64,
         "target": GenericProcessor(),
         "function": None,
         "interval": None,
         "epsilon": None
     }
     default_args_log.update(kw)
     return DefaultArgTemplate(**default_args_log)
Beispiel #14
0
 def get_default_args(**kw):
     """ Return a structure containing the arguments for ML_SinCos,
     builtin from a default argument mapping overloaded with @p kw """
     default_args_sincos = {
         "output_file": "my_sincos.c",
         "function_name": "my_sincos",
         "precision": ML_Binary32,
         "accuracy": ML_Faithful,
         "target": GenericProcessor(),
         "sin_output": False
     }
     default_args_sincos.update(kw)
     return DefaultArgTemplate(**default_args_sincos)
Beispiel #15
0
 def get_default_args(**args):
     """ Generate a default argument structure set specifically for
     the Hyperbolic Cosine """
     default_cosh_args = {
         "precision": ML_Binary32,
         "accuracy": ML_Faithful,
         "target": GenericProcessor.get_target_instance(),
         "output_file": "my_cosh.c",
         "function_name": "my_cosh",
         "language": C_Code,
         "vector_size": 1
     }
     default_cosh_args.update(args)
     return DefaultArgTemplate(**default_cosh_args)
 def get_default_args(**kw):
   """ Return a structure containing the arguments for ML_Log,
       builtin from a default argument mapping overloaded with @p kw """
   default_args_log = {
       "output_file": "LOG.c",
       "function_name": "LOG",
       "precision": ML_Binary32,
       "accuracy": ML_Faithful,
       "target": GenericProcessor(),
       "cgpe_index": 0,
       "tbl_index_size": 7,
       "no_subnormal": False,
       "no_fma": False,
       "no_rcp": False,
       "log_radix": "e",
       "force_division": False,
   }
   default_args_log.update(kw)
   return DefaultArgTemplate(**default_args_log)
 def get_default_args(**kw):
     """ Return a structure containing the arguments for ML_Exponential,
         builtin from a default argument mapping overloaded with @p kw """
     default_args = {
         "output_file":
         "ut_num_simplification.c",
         "function_name":
         "ut_num_simplification",
         "passes": [
             "beforecodegen:dump", "beforecodegen:numerical_simplification",
             "beforecodegen:dump"
         ],
         "precision":
         ML_Binary32,
         "accuracy":
         ML_Faithful,
         "target":
         GenericProcessor.get_target_instance()
     }
     default_args.update(kw)
     return DefaultArgTemplate(**default_args)
Beispiel #18
0
    )


  @staticmethod
  def get_default_args(**kw):
    """ Return a structure containing the arguments for ML_Cosine,
        builtin from a default argument mapping overloaded with @p kw """
    default_args_cos = {
        "output_file": "my_cosf.c",
        "function_name": "my_cosf",
        "precision": ML_Binary32,
        "accuracy": ML_Faithful,
        "target": GenericProcessor()
    }
    default_args_cos.update(kw)
    return DefaultArgTemplate(**default_args_cos)


  def generate_emulate(self, result, mpfr_x, mpfr_rnd):
    """ generate the emulation code for ML_Log2 functions
        mpfr_x is a mpfr_t variable which should have the right precision
        mpfr_rnd is the rounding mode
    """
    emulate_func_name = "mpfr_cos"
    emulate_func_op = FunctionOperator(emulate_func_name, arg_map = {0: FO_Result(0), 1: FO_Arg(0), 2: FO_Arg(1)}, require_header = ["mpfr.h"]) 
    emulate_func   = FunctionObject(emulate_func_name, [ML_Mpfr_t, ML_Int32], ML_Mpfr_t, emulate_func_op)
    mpfr_call = Statement(ReferenceAssign(result, emulate_func(mpfr_x, mpfr_rnd)))

    return mpfr_call

Beispiel #19
0
 def get_default_args(**kw):
     arg_template = DefaultArgTemplate(precision=ML_Binary32,
                                       output_file="ut_out.c",
                                       function_name="ut_test")
     return arg_template