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

Generated by: LCOV version 1.0