LCOV - code coverage report
Current view: top level - raid - tag.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 26 26 100.0 %
Date: 2017-11-06 22:14:04 Functions: 11 11 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2013 Andrea Mazzoleni
       3             :  *
       4             :  * This program is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (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             : 
      15             : #include "internal.h"
      16             : 
      17             : static struct raid_func {
      18             :         const char *name;
      19             :         void (*p)();
      20             : } RAID_FUNC[] = {
      21             :         { "int8", raid_gen3_int8 },
      22             :         { "int8", raid_gen4_int8 },
      23             :         { "int8", raid_gen5_int8 },
      24             :         { "int8", raid_gen6_int8 },
      25             :         { "int32", raid_gen1_int32 },
      26             :         { "int64", raid_gen1_int64 },
      27             :         { "int32", raid_gen2_int32 },
      28             :         { "int64", raid_gen2_int64 },
      29             :         { "int32", raid_genz_int32 },
      30             :         { "int64", raid_genz_int64 },
      31             :         { "int8", raid_rec1_int8 },
      32             :         { "int8", raid_rec2_int8 },
      33             :         { "int8", raid_recX_int8 },
      34             : 
      35             : #ifdef CONFIG_X86
      36             : #ifdef CONFIG_SSE2
      37             :         { "sse2", raid_gen1_sse2 },
      38             :         { "sse2", raid_gen2_sse2 },
      39             :         { "sse2", raid_genz_sse2 },
      40             : #endif
      41             : #ifdef CONFIG_SSSE3
      42             :         { "ssse3", raid_gen3_ssse3 },
      43             :         { "ssse3", raid_gen4_ssse3 },
      44             :         { "ssse3", raid_gen5_ssse3 },
      45             :         { "ssse3", raid_gen6_ssse3 },
      46             :         { "ssse3", raid_rec1_ssse3 },
      47             :         { "ssse3", raid_rec2_ssse3 },
      48             :         { "ssse3", raid_recX_ssse3 },
      49             : #endif
      50             : #ifdef CONFIG_AVX2
      51             :         { "avx2", raid_gen1_avx2 },
      52             :         { "avx2", raid_gen2_avx2 },
      53             :         { "avx2", raid_rec1_avx2 },
      54             :         { "avx2", raid_rec2_avx2 },
      55             :         { "avx2", raid_recX_avx2 },
      56             : #endif
      57             : #endif
      58             : 
      59             : #ifdef CONFIG_X86_64
      60             : #ifdef CONFIG_SSE2
      61             :         { "sse2e", raid_gen2_sse2ext },
      62             :         { "sse2e", raid_genz_sse2ext },
      63             : #endif
      64             : #ifdef CONFIG_SSSE3
      65             :         { "ssse3e", raid_gen3_ssse3ext },
      66             :         { "ssse3e", raid_gen4_ssse3ext },
      67             :         { "ssse3e", raid_gen5_ssse3ext },
      68             :         { "ssse3e", raid_gen6_ssse3ext },
      69             : #endif
      70             : #ifdef CONFIG_AVX2
      71             :         { "avx2e", raid_gen3_avx2ext },
      72             :         { "avx2e", raid_genz_avx2ext },
      73             :         { "avx2e", raid_gen4_avx2ext },
      74             :         { "avx2e", raid_gen5_avx2ext },
      75             :         { "avx2e", raid_gen6_avx2ext },
      76             : #endif
      77             : #endif
      78             :         { 0, 0 }
      79             : };
      80             : 
      81          52 : static const char *raid_tag(void (*func)())
      82             : {
      83          52 :         struct raid_func *i = RAID_FUNC;
      84             : 
      85        1285 :         while (i->name != 0) {
      86        1233 :                 if (i->p == func)
      87          52 :                         return i->name;
      88        1181 :                 ++i;
      89             :         }
      90             : 
      91             :         /* LCOV_EXCL_START */
      92             :         return "unknown";
      93             :         /* LCOV_EXCL_STOP */
      94             : }
      95             : 
      96           4 : const char *raid_gen1_tag(void)
      97             : {
      98           4 :         return raid_tag(raid_gen_ptr[0]);
      99             : }
     100             : 
     101           4 : const char *raid_gen2_tag(void)
     102             : {
     103           4 :         return raid_tag(raid_gen_ptr[1]);
     104             : }
     105             : 
     106           4 : const char *raid_genz_tag(void)
     107             : {
     108           4 :         return raid_tag(raid_genz_ptr);
     109             : }
     110             : 
     111           4 : const char *raid_gen3_tag(void)
     112             : {
     113           4 :         return raid_tag(raid_gen_ptr[2]);
     114             : }
     115             : 
     116           4 : const char *raid_gen4_tag(void)
     117             : {
     118           4 :         return raid_tag(raid_gen_ptr[3]);
     119             : }
     120             : 
     121           4 : const char *raid_gen5_tag(void)
     122             : {
     123           4 :         return raid_tag(raid_gen_ptr[4]);
     124             : }
     125             : 
     126           4 : const char *raid_gen6_tag(void)
     127             : {
     128           4 :         return raid_tag(raid_gen_ptr[5]);
     129             : }
     130             : 
     131           4 : const char *raid_rec1_tag(void)
     132             : {
     133           4 :         return raid_tag(raid_rec_ptr[0]);
     134             : }
     135             : 
     136           4 : const char *raid_rec2_tag(void)
     137             : {
     138           4 :         return raid_tag(raid_rec_ptr[1]);
     139             : }
     140             : 
     141          16 : const char *raid_recX_tag(void)
     142             : {
     143          16 :         return raid_tag(raid_rec_ptr[2]);
     144             : }
     145             : 

Generated by: LCOV version 1.13