"Fossies" - the Fresh Open Source Software Archive

Member "stress-ng-0.09.56/stress-funccall.c" (15 Mar 2019, 22818 Bytes) of package /linux/privat/stress-ng-0.09.56.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "stress-funccall.c" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 0.09.54_vs_0.09.55.

    1 /*
    2  * Copyright (C) 2013-2019 Canonical, Ltd.
    3  *
    4  * This program is free software; you can redistribute it and/or
    5  * modify it under the terms of the GNU General Public License
    6  * as published by the Free Software Foundation; either version 2
    7  * of the License, or (at your option) any later version.
    8  *
    9  * This program is distributed in the hope that it will be useful,
   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12  * GNU General Public License for more details.
   13  *
   14  * You should have received a copy of the GNU General Public License
   15  * along with this program; if not, write to the Free Software
   16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
   17  *
   18  * This code is a complete clean re-write of the stress tool by
   19  * Colin Ian King <colin.king@canonical.com> and attempts to be
   20  * backwardly compatible with the stress tool by Amos Waterland
   21  * <apw@rossby.metr.ou.edu> but has more stress tests and more
   22  * functionality.
   23  *
   24  */
   25 #include "stress-ng.h"
   26 
   27 typedef void (*stress_funccall_func)(const args_t *argse);
   28 
   29 typedef struct {
   30     const char              *name;  /* human readable form of stressor */
   31     const stress_funccall_func   func;   /* the funccall method function */
   32 } stress_funccall_method_info_t;
   33 
   34 static const stress_funccall_method_info_t funccall_methods[];
   35 
   36 #define uint8_t_put uint8_put
   37 #define uint16_t_put    uint16_put
   38 #define uint32_t_put    uint32_put
   39 #define uint64_t_put    uint64_put
   40 #define __uint128_t_put uint128_put
   41 #define long_double_t_put long_double_put
   42 
   43 typedef long double     long_double_t;
   44 
   45 #define stress_funccall_1(type)         \
   46 type NOINLINE stress_funccall_ ## type ## _1(   \
   47     const type a);              \
   48                         \
   49 type NOINLINE stress_funccall_ ## type ## _1(   \
   50     const type a)               \
   51 {                       \
   52     type ## _put(a);            \
   53     return a;               \
   54 }                       \
   55 
   56 #define stress_funccall_2(type)         \
   57 type  NOINLINE stress_funccall_ ## type ## _2(  \
   58     const type a,               \
   59     const type b);              \
   60                         \
   61 type NOINLINE stress_funccall_ ## type ## _2(   \
   62     const type a,               \
   63     const type b)               \
   64 {                       \
   65     type ## _put(a);            \
   66     type ## _put(b);            \
   67     return a + b;               \
   68 }                       \
   69 
   70 #define stress_funccall_3(type)         \
   71 type NOINLINE stress_funccall_ ## type ## _3(   \
   72     const type a,               \
   73     const type b,               \
   74     const type c);              \
   75                         \
   76 type NOINLINE stress_funccall_ ## type ## _3(   \
   77     const type a,               \
   78     const type b,               \
   79     const type c)               \
   80 {                       \
   81     type ## _put(a);            \
   82     type ## _put(b);            \
   83     type ## _put(c);            \
   84     return a + b + c;           \
   85 }                       \
   86 
   87 #define stress_funccall_4(type)         \
   88 type NOINLINE stress_funccall_ ## type ## _4(   \
   89     const type a,               \
   90     const type b,               \
   91     const type c,               \
   92     const type d);              \
   93                         \
   94 type NOINLINE stress_funccall_ ## type ## _4(   \
   95     const type a,               \
   96     const type b,               \
   97     const type c,               \
   98     const type d)               \
   99 {                       \
  100     type ## _put(a);            \
  101     type ## _put(b);            \
  102     type ## _put(c);            \
  103     type ## _put(d);            \
  104     return a + b + c + d;           \
  105 }                       \
  106 
  107 #define stress_funccall_5(type)         \
  108 type NOINLINE stress_funccall_ ## type ## _5(   \
  109     const type a,               \
  110     const type b,               \
  111     const type c,               \
  112     const type d,               \
  113     const type e);              \
  114                         \
  115 type NOINLINE stress_funccall_ ## type ## _5(   \
  116     const type a,               \
  117     const type b,               \
  118     const type c,               \
  119     const type d,               \
  120     const type e)               \
  121 {                       \
  122     type ## _put(a);            \
  123     type ## _put(b);            \
  124     type ## _put(c);            \
  125     type ## _put(d);            \
  126     type ## _put(e);            \
  127     return a + b + c + d + e;       \
  128 }                       \
  129 
  130 #define stress_funccall_6(type)         \
  131 type NOINLINE stress_funccall_ ## type ## _6(   \
  132     const type a,               \
  133     const type b,               \
  134     const type c,               \
  135     const type d,               \
  136     const type e,               \
  137     const type f);              \
  138                         \
  139 type NOINLINE stress_funccall_ ## type ## _6(   \
  140     const type a,               \
  141     const type b,               \
  142     const type c,               \
  143     const type d,               \
  144     const type e,               \
  145     const type f)               \
  146 {                       \
  147     type ## _put(a);            \
  148     type ## _put(b);            \
  149     type ## _put(c);            \
  150     type ## _put(d);            \
  151     type ## _put(e);            \
  152     type ## _put(f);            \
  153     return a + b + c + d + e + f;       \
  154 }                       \
  155 
  156 #define stress_funccall_7(type)         \
  157 type NOINLINE stress_funccall_ ## type ## _7(   \
  158     const type a,               \
  159     const type b,               \
  160     const type c,               \
  161     const type d,               \
  162     const type e,               \
  163     const type f,               \
  164     const type g);              \
  165                         \
  166 type NOINLINE stress_funccall_ ## type ## _7(   \
  167     const type a,               \
  168     const type b,               \
  169     const type c,               \
  170     const type d,               \
  171     const type e,               \
  172     const type f,               \
  173     const type g)               \
  174 {                       \
  175     type ## _put(a);            \
  176     type ## _put(b);            \
  177     type ## _put(c);            \
  178     type ## _put(d);            \
  179     type ## _put(e);            \
  180     type ## _put(f);            \
  181     type ## _put(g);            \
  182     return a + b + c + d + e + f + g;   \
  183 }                       \
  184 
  185 #define stress_funccall_8(type)         \
  186 type NOINLINE stress_funccall_ ## type ## _8(   \
  187     const type a,               \
  188     const type b,               \
  189     const type c,               \
  190     const type d,               \
  191     const type e,               \
  192     const type f,               \
  193     const type g,               \
  194     const type h);              \
  195                         \
  196 type NOINLINE stress_funccall_ ## type ## _8(   \
  197     const type a,               \
  198     const type b,               \
  199     const type c,               \
  200     const type d,               \
  201     const type e,               \
  202     const type f,               \
  203     const type g,               \
  204     const type h)               \
  205 {                       \
  206     type ## _put(a);            \
  207     type ## _put(b);            \
  208     type ## _put(c);            \
  209     type ## _put(d);            \
  210     type ## _put(e);            \
  211     type ## _put(f);            \
  212     type ## _put(g);            \
  213     type ## _put(h);            \
  214     return a + b + c + d + e + f + g + h;   \
  215 }                       \
  216 
  217 #define stress_funccall_9(type)         \
  218 type NOINLINE stress_funccall_ ## type ## _9(   \
  219     const type a,               \
  220     const type b,               \
  221     const type c,               \
  222     const type d,               \
  223     const type e,               \
  224     const type f,               \
  225     const type g,               \
  226     const type h,               \
  227     const type i);              \
  228                         \
  229 type NOINLINE stress_funccall_ ## type ## _9(   \
  230     const type a,               \
  231     const type b,               \
  232     const type c,               \
  233     const type d,               \
  234     const type e,               \
  235     const type f,               \
  236     const type g,               \
  237     const type h,               \
  238     const type i)               \
  239 {                       \
  240     type ## _put(a);            \
  241     type ## _put(b);            \
  242     type ## _put(c);            \
  243     type ## _put(d);            \
  244     type ## _put(e);            \
  245     type ## _put(f);            \
  246     type ## _put(g);            \
  247     type ## _put(h);            \
  248     type ## _put(i);            \
  249     return a + b + c + d + e + f + g + h + i;\
  250 }                       \
  251 
  252 #define stress_funcdeep_2(type)         \
  253 type NOINLINE stress_funcdeep_ ## type ## _2(   \
  254     const type a,               \
  255     const type b);              \
  256                         \
  257 type NOINLINE stress_funcdeep_ ## type ## _2(   \
  258     const type a,               \
  259     const type b)               \
  260 {                       \
  261     return                  \
  262     stress_funccall_ ## type ## _1(b) +     \
  263     stress_funccall_ ## type ## _1(a);  \
  264 }                       \
  265 
  266 #define stress_funcdeep_3(type)         \
  267 type NOINLINE stress_funcdeep_ ## type ## _3(   \
  268     const type a,               \
  269     const type b,               \
  270     const type c);              \
  271                         \
  272 type NOINLINE stress_funcdeep_ ## type ## _3(   \
  273     const type a,               \
  274     const type b,               \
  275     const type c)               \
  276 {                       \
  277     return                  \
  278     stress_funcdeep_ ## type ## _2(c, b) +  \
  279     stress_funccall_ ## type ## _1(a);  \
  280 }                       \
  281 
  282 #define stress_funcdeep_4(type)         \
  283 type NOINLINE stress_funcdeep_ ## type ## _4(   \
  284     const type a,               \
  285     const type b,               \
  286     const type c,               \
  287     const type d);              \
  288                         \
  289 type NOINLINE stress_funcdeep_ ## type ## _4(   \
  290     const type a,               \
  291     const type b,               \
  292     const type c,               \
  293     const type d)               \
  294 {                       \
  295     return                  \
  296     stress_funcdeep_ ## type ## _3(d, c, b) + \
  297     stress_funccall_ ## type ## _1(a);  \
  298 }                       \
  299 
  300 #define stress_funcdeep_5(type)         \
  301 type NOINLINE stress_funcdeep_ ## type ## _5(   \
  302     const type a,               \
  303     const type b,               \
  304     const type c,               \
  305     const type d,               \
  306     const type e);              \
  307                         \
  308 type NOINLINE stress_funcdeep_ ## type ## _5(   \
  309     const type a,               \
  310     const type b,               \
  311     const type c,               \
  312     const type d,               \
  313     const type e)               \
  314 {                       \
  315     return                  \
  316     stress_funcdeep_ ## type ## _4(e, d, c, b) + \
  317     stress_funccall_ ## type ## _1(a);  \
  318 }                       \
  319 
  320 #define stress_funcdeep_6(type)         \
  321 type NOINLINE stress_funcdeep_ ## type ## _6(   \
  322     const type a,               \
  323     const type b,               \
  324     const type c,               \
  325     const type d,               \
  326     const type e,               \
  327     const type f);              \
  328                         \
  329 type NOINLINE stress_funcdeep_ ## type ## _6(   \
  330     const type a,               \
  331     const type b,               \
  332     const type c,               \
  333     const type d,               \
  334     const type e,               \
  335     const type f)               \
  336 {                       \
  337     return                  \
  338     stress_funcdeep_ ## type ## _5(f, e, d, c, b) + \
  339     stress_funccall_ ## type ## _1(a);  \
  340 }                       \
  341 
  342 #define stress_funcdeep_7(type)         \
  343 type NOINLINE stress_funcdeep_ ## type ## _7(   \
  344     const type a,               \
  345     const type b,               \
  346     const type c,               \
  347     const type d,               \
  348     const type e,               \
  349     const type f,               \
  350     const type g);              \
  351                         \
  352 type NOINLINE stress_funcdeep_ ## type ## _7(   \
  353     const type a,               \
  354     const type b,               \
  355     const type c,               \
  356     const type d,               \
  357     const type e,               \
  358     const type f,               \
  359     const type g)               \
  360 {                       \
  361     return                  \
  362     stress_funcdeep_ ## type ## _6(g, f, e, d, c, b) + \
  363     stress_funccall_ ## type ## _1(a);  \
  364 }                       \
  365 
  366 #define stress_funcdeep_8(type)         \
  367 type NOINLINE stress_funcdeep_ ## type ## _8(   \
  368     const type a,               \
  369     const type b,               \
  370     const type c,               \
  371     const type d,               \
  372     const type e,               \
  373     const type f,               \
  374     const type g,               \
  375     const type h);              \
  376                         \
  377 type NOINLINE stress_funcdeep_ ## type ## _8(   \
  378     const type a,               \
  379     const type b,               \
  380     const type c,               \
  381     const type d,               \
  382     const type e,               \
  383     const type f,               \
  384     const type g,               \
  385     const type h)               \
  386 {                       \
  387     return                  \
  388     stress_funcdeep_ ## type ## _7(h, g, f, e, d, c, b) + \
  389     stress_funccall_ ## type ## _1(a);  \
  390 }                       \
  391 
  392 #define stress_funcdeep_9(type)         \
  393 type NOINLINE stress_funcdeep_ ## type ## _9(   \
  394     const type a,               \
  395     const type b,               \
  396     const type c,               \
  397     const type d,               \
  398     const type e,               \
  399     const type f,               \
  400     const type g,               \
  401     const type h,               \
  402     const type i);              \
  403                         \
  404 type NOINLINE stress_funcdeep_ ## type ## _9(   \
  405     const type a,               \
  406     const type b,               \
  407     const type c,               \
  408     const type d,               \
  409     const type e,               \
  410     const type f,               \
  411     const type g,               \
  412     const type h,               \
  413     const type i)               \
  414 {                       \
  415     return                  \
  416     stress_funccall_ ## type ## _1(b) +     \
  417     stress_funcdeep_ ## type ## _2(c, b) +  \
  418     stress_funcdeep_ ## type ## _3(d, c, b) + \
  419     stress_funcdeep_ ## type ## _4(e, d, c, b) + \
  420     stress_funcdeep_ ## type ## _5(f, e, d, c, b) + \
  421     stress_funcdeep_ ## type ## _6(g, f, e, d, c, b) + \
  422     stress_funcdeep_ ## type ## _7(h, g, f, e, d, c, b) + \
  423     stress_funcdeep_ ## type ## _8(i, h, g, f, e, d, c, b) + \
  424     stress_funcdeep_ ## type ## _8(a, b, c, d, e, f, g, h) + \
  425     stress_funcdeep_ ## type ## _7(b, c, d, e, f, g, h) + \
  426     stress_funcdeep_ ## type ## _6(c, d, e, f, g, h) + \
  427     stress_funcdeep_ ## type ## _5(d, e, f, g, h) + \
  428     stress_funcdeep_ ## type ## _4(e, f, g, h) + \
  429     stress_funcdeep_ ## type ## _3(f, g, h) + \
  430     stress_funcdeep_ ## type ## _2(g, h) +  \
  431     stress_funccall_ ## type ## _1(h);  \
  432 }                       \
  433 
  434 stress_funccall_1(uint8_t)
  435 stress_funccall_2(uint8_t)
  436 stress_funccall_3(uint8_t)
  437 stress_funccall_4(uint8_t)
  438 stress_funccall_5(uint8_t)
  439 stress_funccall_6(uint8_t)
  440 stress_funccall_7(uint8_t)
  441 stress_funccall_8(uint8_t)
  442 stress_funccall_9(uint8_t)
  443 
  444 stress_funcdeep_2(uint8_t)
  445 stress_funcdeep_3(uint8_t)
  446 stress_funcdeep_4(uint8_t)
  447 stress_funcdeep_5(uint8_t)
  448 stress_funcdeep_6(uint8_t)
  449 stress_funcdeep_7(uint8_t)
  450 stress_funcdeep_8(uint8_t)
  451 stress_funcdeep_9(uint8_t)
  452 
  453 stress_funccall_1(uint16_t)
  454 stress_funccall_2(uint16_t)
  455 stress_funccall_3(uint16_t)
  456 stress_funccall_4(uint16_t)
  457 stress_funccall_5(uint16_t)
  458 stress_funccall_6(uint16_t)
  459 stress_funccall_7(uint16_t)
  460 stress_funccall_8(uint16_t)
  461 stress_funccall_9(uint16_t)
  462 
  463 stress_funcdeep_2(uint16_t)
  464 stress_funcdeep_3(uint16_t)
  465 stress_funcdeep_4(uint16_t)
  466 stress_funcdeep_5(uint16_t)
  467 stress_funcdeep_6(uint16_t)
  468 stress_funcdeep_7(uint16_t)
  469 stress_funcdeep_8(uint16_t)
  470 stress_funcdeep_9(uint16_t)
  471 
  472 stress_funccall_1(uint32_t)
  473 stress_funccall_2(uint32_t)
  474 stress_funccall_3(uint32_t)
  475 stress_funccall_4(uint32_t)
  476 stress_funccall_5(uint32_t)
  477 stress_funccall_6(uint32_t)
  478 stress_funccall_7(uint32_t)
  479 stress_funccall_8(uint32_t)
  480 stress_funccall_9(uint32_t)
  481 
  482 stress_funcdeep_2(uint32_t)
  483 stress_funcdeep_3(uint32_t)
  484 stress_funcdeep_4(uint32_t)
  485 stress_funcdeep_5(uint32_t)
  486 stress_funcdeep_6(uint32_t)
  487 stress_funcdeep_7(uint32_t)
  488 stress_funcdeep_8(uint32_t)
  489 stress_funcdeep_9(uint32_t)
  490 
  491 stress_funccall_1(uint64_t)
  492 stress_funccall_2(uint64_t)
  493 stress_funccall_3(uint64_t)
  494 stress_funccall_4(uint64_t)
  495 stress_funccall_5(uint64_t)
  496 stress_funccall_6(uint64_t)
  497 stress_funccall_7(uint64_t)
  498 stress_funccall_8(uint64_t)
  499 stress_funccall_9(uint64_t)
  500 
  501 stress_funcdeep_2(uint64_t)
  502 stress_funcdeep_3(uint64_t)
  503 stress_funcdeep_4(uint64_t)
  504 stress_funcdeep_5(uint64_t)
  505 stress_funcdeep_6(uint64_t)
  506 stress_funcdeep_7(uint64_t)
  507 stress_funcdeep_8(uint64_t)
  508 stress_funcdeep_9(uint64_t)
  509 
  510 #if defined(HAVE_INT128_T)
  511 stress_funccall_1(__uint128_t)
  512 stress_funccall_2(__uint128_t)
  513 stress_funccall_3(__uint128_t)
  514 stress_funccall_4(__uint128_t)
  515 stress_funccall_5(__uint128_t)
  516 stress_funccall_6(__uint128_t)
  517 stress_funccall_7(__uint128_t)
  518 stress_funccall_8(__uint128_t)
  519 stress_funccall_9(__uint128_t)
  520 
  521 stress_funcdeep_2(__uint128_t)
  522 stress_funcdeep_3(__uint128_t)
  523 stress_funcdeep_4(__uint128_t)
  524 stress_funcdeep_5(__uint128_t)
  525 stress_funcdeep_6(__uint128_t)
  526 stress_funcdeep_7(__uint128_t)
  527 stress_funcdeep_8(__uint128_t)
  528 stress_funcdeep_9(__uint128_t)
  529 #endif
  530 
  531 stress_funccall_1(float)
  532 stress_funccall_2(float)
  533 stress_funccall_3(float)
  534 stress_funccall_4(float)
  535 stress_funccall_5(float)
  536 stress_funccall_6(float)
  537 stress_funccall_7(float)
  538 stress_funccall_8(float)
  539 stress_funccall_9(float)
  540 
  541 stress_funcdeep_2(float)
  542 stress_funcdeep_3(float)
  543 stress_funcdeep_4(float)
  544 stress_funcdeep_5(float)
  545 stress_funcdeep_6(float)
  546 stress_funcdeep_7(float)
  547 stress_funcdeep_8(float)
  548 stress_funcdeep_9(float)
  549 
  550 stress_funccall_1(double)
  551 stress_funccall_2(double)
  552 stress_funccall_3(double)
  553 stress_funccall_4(double)
  554 stress_funccall_5(double)
  555 stress_funccall_6(double)
  556 stress_funccall_7(double)
  557 stress_funccall_8(double)
  558 stress_funccall_9(double)
  559 
  560 stress_funcdeep_2(double)
  561 stress_funcdeep_3(double)
  562 stress_funcdeep_4(double)
  563 stress_funcdeep_5(double)
  564 stress_funcdeep_6(double)
  565 stress_funcdeep_7(double)
  566 stress_funcdeep_8(double)
  567 stress_funcdeep_9(double)
  568 
  569 stress_funccall_1(long_double_t)
  570 stress_funccall_2(long_double_t)
  571 stress_funccall_3(long_double_t)
  572 stress_funccall_4(long_double_t)
  573 stress_funccall_5(long_double_t)
  574 stress_funccall_6(long_double_t)
  575 stress_funccall_7(long_double_t)
  576 stress_funccall_8(long_double_t)
  577 stress_funccall_9(long_double_t)
  578 
  579 stress_funcdeep_2(long_double_t)
  580 stress_funcdeep_3(long_double_t)
  581 stress_funcdeep_4(long_double_t)
  582 stress_funcdeep_5(long_double_t)
  583 stress_funcdeep_6(long_double_t)
  584 stress_funcdeep_7(long_double_t)
  585 stress_funcdeep_8(long_double_t)
  586 stress_funcdeep_9(long_double_t)
  587 
  588 #if defined(HAVE_FLOAT_DECIMAL32) && !defined(__clang__)
  589 static inline void ALWAYS_INLINE _Decimal32_put(const _Decimal32 a)
  590 {
  591         g_put_val.double_val = (double)a;
  592 }
  593 
  594 stress_funccall_1(_Decimal32)
  595 stress_funccall_2(_Decimal32)
  596 stress_funccall_3(_Decimal32)
  597 stress_funccall_4(_Decimal32)
  598 stress_funccall_5(_Decimal32)
  599 stress_funccall_6(_Decimal32)
  600 stress_funccall_7(_Decimal32)
  601 stress_funccall_8(_Decimal32)
  602 stress_funccall_9(_Decimal32)
  603 
  604 stress_funcdeep_2(_Decimal32)
  605 stress_funcdeep_3(_Decimal32)
  606 stress_funcdeep_4(_Decimal32)
  607 stress_funcdeep_5(_Decimal32)
  608 stress_funcdeep_6(_Decimal32)
  609 stress_funcdeep_7(_Decimal32)
  610 stress_funcdeep_8(_Decimal32)
  611 stress_funcdeep_9(_Decimal32)
  612 #endif
  613 
  614 #if defined(HAVE_FLOAT_DECIMAL64) && !defined(__clang__)
  615 static inline void ALWAYS_INLINE _Decimal64_put(const _Decimal64 a)
  616 {
  617         g_put_val.double_val = (double)a;
  618 }
  619 
  620 stress_funccall_1(_Decimal64)
  621 stress_funccall_2(_Decimal64)
  622 stress_funccall_3(_Decimal64)
  623 stress_funccall_4(_Decimal64)
  624 stress_funccall_5(_Decimal64)
  625 stress_funccall_6(_Decimal64)
  626 stress_funccall_7(_Decimal64)
  627 stress_funccall_8(_Decimal64)
  628 stress_funccall_9(_Decimal64)
  629 
  630 stress_funcdeep_2(_Decimal64)
  631 stress_funcdeep_3(_Decimal64)
  632 stress_funcdeep_4(_Decimal64)
  633 stress_funcdeep_5(_Decimal64)
  634 stress_funcdeep_6(_Decimal64)
  635 stress_funcdeep_7(_Decimal64)
  636 stress_funcdeep_8(_Decimal64)
  637 stress_funcdeep_9(_Decimal64)
  638 #endif
  639 
  640 #if defined(HAVE_FLOAT_DECIMAL128) && !defined(__clang__)
  641 static inline void ALWAYS_INLINE _Decimal128_put(const _Decimal128 a)
  642 {
  643         g_put_val.double_val = (double)a;
  644 }
  645 
  646 stress_funccall_1(_Decimal128)
  647 stress_funccall_2(_Decimal128)
  648 stress_funccall_3(_Decimal128)
  649 stress_funccall_4(_Decimal128)
  650 stress_funccall_5(_Decimal128)
  651 stress_funccall_6(_Decimal128)
  652 stress_funccall_7(_Decimal128)
  653 stress_funccall_8(_Decimal128)
  654 stress_funccall_9(_Decimal128)
  655 
  656 stress_funcdeep_2(_Decimal128)
  657 stress_funcdeep_3(_Decimal128)
  658 stress_funcdeep_4(_Decimal128)
  659 stress_funcdeep_5(_Decimal128)
  660 stress_funcdeep_6(_Decimal128)
  661 stress_funcdeep_7(_Decimal128)
  662 stress_funcdeep_8(_Decimal128)
  663 stress_funcdeep_9(_Decimal128)
  664 #endif
  665 
  666 #if defined(HAVE_FLOAT80) && !defined(__clang__)
  667 static inline void ALWAYS_INLINE __float80_put(const __float80 a)
  668 {
  669         g_put_val.double_val = (double)a;
  670 }
  671 
  672 stress_funccall_1(__float80)
  673 stress_funccall_2(__float80)
  674 stress_funccall_3(__float80)
  675 stress_funccall_4(__float80)
  676 stress_funccall_5(__float80)
  677 stress_funccall_6(__float80)
  678 stress_funccall_7(__float80)
  679 stress_funccall_8(__float80)
  680 stress_funccall_9(__float80)
  681 
  682 stress_funcdeep_2(__float80)
  683 stress_funcdeep_3(__float80)
  684 stress_funcdeep_4(__float80)
  685 stress_funcdeep_5(__float80)
  686 stress_funcdeep_6(__float80)
  687 stress_funcdeep_7(__float80)
  688 stress_funcdeep_8(__float80)
  689 stress_funcdeep_9(__float80)
  690 #endif
  691 
  692 #if defined(HAVE_FLOAT128) && !defined(__clang__)
  693 static inline void ALWAYS_INLINE __float128_put(const __float128 a)
  694 {
  695         g_put_val.double_val = (double)a;
  696 }
  697 
  698 stress_funccall_1(__float128)
  699 stress_funccall_2(__float128)
  700 stress_funccall_3(__float128)
  701 stress_funccall_4(__float128)
  702 stress_funccall_5(__float128)
  703 stress_funccall_6(__float128)
  704 stress_funccall_7(__float128)
  705 stress_funccall_8(__float128)
  706 stress_funccall_9(__float128)
  707 
  708 stress_funcdeep_2(__float128)
  709 stress_funcdeep_3(__float128)
  710 stress_funcdeep_4(__float128)
  711 stress_funcdeep_5(__float128)
  712 stress_funcdeep_6(__float128)
  713 stress_funcdeep_7(__float128)
  714 stress_funcdeep_8(__float128)
  715 stress_funcdeep_9(__float128)
  716 #endif
  717 
  718 #define stress_funcall_type(type, rndfunc)          \
  719 void NOINLINE stress_funccall_ ## type(const args_t *args); \
  720                                 \
  721 void NOINLINE stress_funccall_ ## type(const args_t *args)  \
  722 {                               \
  723     register int ii;                    \
  724     type a, b, c, d, e, f, g, h, i;             \
  725                                 \
  726     a = rndfunc();                      \
  727     b = rndfunc();                      \
  728     c = rndfunc();                      \
  729     d = rndfunc();                      \
  730     e = rndfunc();                      \
  731     f = rndfunc();                      \
  732     g = rndfunc();                      \
  733     h = rndfunc();                      \
  734     i = rndfunc();                      \
  735                                 \
  736     do {                            \
  737         for (ii = 0; ii < 1000; ii++) {         \
  738             type res =              \
  739             (stress_funccall_ ## type ## _1(a) +    \
  740              stress_funccall_ ## type ## _2(a, b) + \
  741              stress_funccall_ ## type ## _3(a, b,   \
  742                 c) +                \
  743              stress_funccall_ ## type ## _4(a, b,   \
  744                 c, d) +             \
  745              stress_funccall_ ## type ## _5(a, b,   \
  746                 c, d, e) +          \
  747              stress_funccall_ ## type ## _6(a, b,   \
  748                 c, d, e, f) +           \
  749              stress_funccall_ ## type ## _7(a, b,   \
  750                 c, d, e, f, g) +        \
  751              stress_funccall_ ## type ## _8(a, b,   \
  752                 c, d, e, f, g, h) +         \
  753              stress_funccall_ ## type ## _9(a, b,   \
  754                 c, d, e, f, g, h, i));      \
  755                                 \
  756             res +=                  \
  757             (stress_funcdeep_ ## type ## _2(a, b) + \
  758              stress_funcdeep_ ## type ## _3(a, b,   \
  759                 c) +                \
  760              stress_funcdeep_ ## type ## _4(a, b,   \
  761                 c, d) +             \
  762              stress_funcdeep_ ## type ## _5(a, b,   \
  763                 c, d, e) +          \
  764              stress_funcdeep_ ## type ## _6(a, b,   \
  765                 c, d, e, f) +           \
  766              stress_funcdeep_ ## type ## _7(a, b,   \
  767                 c, d, e, f, g) +        \
  768              stress_funcdeep_ ## type ## _8(a, b,   \
  769                 c, d, e, f, g, h) +     \
  770              stress_funcdeep_ ## type ## _9(a, b,   \
  771                 c, d, e, f, g, h, i));      \
  772             type ## _put(res);          \
  773             }                   \
  774         inc_counter(args);              \
  775     } while (keep_stressing());             \
  776 }
  777 
  778 stress_funcall_type(uint8_t, mwc8)
  779 stress_funcall_type(uint16_t, mwc16)
  780 stress_funcall_type(uint32_t, mwc32)
  781 stress_funcall_type(uint64_t, mwc64)
  782 #if defined(HAVE_INT128_T)
  783 stress_funcall_type(__uint128_t, mwc64)
  784 #endif
  785 stress_funcall_type(float, (float)mwc64)
  786 stress_funcall_type(double, (double)mwc64)
  787 stress_funcall_type(long_double_t, (long double)mwc64)
  788 #if defined(HAVE_FLOAT_DECIMAL32) && !defined(__clang__)
  789 stress_funcall_type(_Decimal32, (_Decimal32)mwc64)
  790 #endif
  791 #if defined(HAVE_FLOAT_DECIMAL64) && !defined(__clang__)
  792 stress_funcall_type(_Decimal64, (_Decimal64)mwc64)
  793 #endif
  794 #if defined(HAVE_FLOAT_DECIMAL128) && !defined(__clang__)
  795 stress_funcall_type(_Decimal128, (_Decimal128)mwc64)
  796 #endif
  797 #if defined(HAVE_FLOAT80) && !defined(__clang__)
  798 stress_funcall_type(__float80, (__float80)mwc64)
  799 #endif
  800 #if defined(HAVE_FLOAT128) && !defined(__clang__)
  801 stress_funcall_type(__float128, (__float128)mwc64)
  802 #endif
  803 
  804 /*
  805  * Table of func call stress methods
  806  */
  807 static const stress_funccall_method_info_t funccall_methods[] = {
  808     { "uint8",  stress_funccall_uint8_t },
  809     { "uint16", stress_funccall_uint16_t },
  810     { "uint32", stress_funccall_uint32_t },
  811     { "uint64", stress_funccall_uint64_t },
  812 #if defined(HAVE_INT128_T)
  813     { "uint128",    stress_funccall___uint128_t },
  814 #endif
  815     { "float",  stress_funccall_float },
  816     { "double", stress_funccall_double },
  817     { "longdouble", stress_funccall_long_double_t },
  818 #if defined(HAVE_FLOAT80) && !defined(__clang__)
  819     { "float80",    stress_funccall___float80 },
  820 #endif
  821 #if defined(HAVE_FLOAT128) && !defined(__clang__)
  822     { "float128",   stress_funccall___float128 },
  823 #endif
  824 #if defined(HAVE_FLOAT_DECIMAL32) && !defined(__clang__)
  825     { "decimal32",  stress_funccall__Decimal32 },
  826 #endif
  827 #if defined(HAVE_FLOAT_DECIMAL64) && !defined(__clang__)
  828     { "decimal64",  stress_funccall__Decimal64 },
  829 #endif
  830 #if defined(HAVE_FLOAT_DECIMAL128) && !defined(__clang__)
  831     { "decimal128", stress_funccall__Decimal128 },
  832 #endif
  833     { NULL,     NULL },
  834 };
  835 
  836 /*
  837  *  stress_set_funccall_method()
  838  *  set the default funccal stress method
  839  */
  840 int stress_set_funccall_method(const char *name)
  841 {
  842     stress_funccall_method_info_t const *info;
  843 
  844     for (info = funccall_methods; info->func; info++) {
  845         if (!strcmp(info->name, name)) {
  846             set_setting("funccall-method", TYPE_ID_UINTPTR_T, &info);
  847             return 0;
  848         }
  849     }
  850 
  851     (void)fprintf(stderr, "funccall-method must be one of:");
  852     for (info = funccall_methods; info->func; info++) {
  853         (void)fprintf(stderr, " %s", info->name);
  854     }
  855     (void)fprintf(stderr, "\n");
  856 
  857     return -1;
  858 }
  859 
  860 /*
  861  *  stress_funccall()
  862  *  stress various argument sized function calls
  863  */
  864 static int stress_funccall(const args_t *args)
  865 {
  866         const stress_funccall_method_info_t *funccall_method = &funccall_methods[3];
  867 
  868         (void)get_setting("funccall-method", &funccall_method);
  869 
  870         funccall_method->func(args);
  871 
  872     return EXIT_SUCCESS;
  873 }
  874 
  875 static void stress_funcall_set_default(void)
  876 {
  877     stress_set_funccall_method("uint64");
  878 }
  879 
  880 stressor_info_t stress_funccall_info = {
  881     .stressor = stress_funccall,
  882     .set_default = stress_funcall_set_default,
  883     .class = CLASS_CPU
  884 };