diff options
author | Joe Ramsay <Joe.Ramsay@arm.com> | 2022-11-15 12:31:04 +0000 |
---|---|---|
committer | Joe Ramsay <joe.ramsay@arm.com> | 2022-11-15 12:31:04 +0000 |
commit | 3560d66f2efb0164821681e5006280b2f6dadd07 (patch) | |
tree | 44c594cc7c53547caa26025d4f2b40b3b4df8b3b /math | |
parent | 3031a49fc90924206242cca12acfeeada1a98488 (diff) | |
download | arm-optimized-routines-3560d66f2efb0164821681e5006280b2f6dadd07.tar.gz |
math/test: Allow user to set control element of input vector
argf and argd have been designed such that non-special input is
tested, optionally followed by a vector with one special lane. To be
able to test that vector functions have correct behaviour w.r.t. fenv
exceptions, we need to be able to choose a different value for the
last lane, as using 1 leads to false negatives when testing a function
for which 1 is a special value. We add an option, -c, for the user to
provide a different control value.
Diffstat (limited to 'math')
-rw-r--r-- | math/test/ulp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/math/test/ulp.c b/math/test/ulp.c index 24185a2..e011ae3 100644 --- a/math/test/ulp.c +++ b/math/test/ulp.c @@ -223,8 +223,9 @@ static int secondcall; #if __aarch64__ && WANT_VMATH typedef __f32x4_t v_float; typedef __f64x2_t v_double; -static const float fv[2] = {1.0f, -INFINITY}; -static const double dv[2] = {1.0, -INFINITY}; +/* First element of fv and dv may be changed by -c argument. */ +static float fv[2] = {1.0f, -INFINITY}; +static double dv[2] = {1.0, -INFINITY}; static inline v_float argf(float x) { return (v_float){x,x,x,fv[secondcall]}; } static inline v_double argd(double x) { return (v_double){x,dv[secondcall]}; } #if WANT_SVE_MATH @@ -633,6 +634,9 @@ usage (void) puts ("-q: quiet."); puts ("-m: use mpfr even if faster method is available."); puts ("-f: disable fenv testing (rounding modes and exceptions)."); + puts ("-c: neutral 'control value' to test behaviour when one lane can affect another. \n" + " This should be different from tested input in other lanes, and non-special \n" + " (i.e. should not trigger fenv exceptions). Default is 1."); puts ("Supported func:"); for (const struct fun *f = fun; f->name; f++) printf ("\t%s\n", f->name); @@ -800,6 +804,12 @@ main (int argc, char *argv[]) conf.rc = argv[0][0]; } break; + case 'c': + argc--; + argv++; + fv[0] = strtof(argv[0], 0); + dv[0] = strtod(argv[0], 0); + break; default: usage (); } |