2020#include  < stdio.h> 
2121
2222#include  " hwy/detect_compiler_arch.h" 
23+ #include  " hwy/timer.h" //  GetCpuString
24+ 
25+ #undef  HWY_TARGET_INCLUDE
26+ #define  HWY_TARGET_INCLUDE  " hwy/tests/list_targets.cc" 
27+ #include  " hwy/foreach_target.h" //  IWYU pragma: keep
2328#include  " hwy/highway.h" 
2429
25- namespace  {
30+ HWY_BEFORE_NAMESPACE ();
31+ namespace  hwy  {
32+ namespace  HWY_NAMESPACE  {
2633
2734void  PrintCompiler () {
2835  if  (HWY_COMPILER_ICX) {
@@ -80,9 +87,8 @@ void PrintConfig() {
8087  const  char * target_str = " " 
8188#endif 
8289  fprintf (stderr,
83-           " Target attributes: %s\n Config: emu128:%d scalar:%d static:%d " 
84-           " all_attain:%d " 
85-           " is_test:%d\n " 
90+           " Target attributes: %s\n " 
91+           " Config: emu128:%d scalar:%d static:%d all_attain:%d is_test:%d\n " 
8692          target_str, only_emu128, only_scalar, only_static, all_attain,
8793          is_test);
8894}
@@ -99,8 +105,7 @@ void PrintHave() {
99105void  PrintTargets (const  char * msg, int64_t  targets) {
100106  fprintf (stderr, " %s" 
101107  //  For each bit other than the sign bit:
102-   for  (int64_t  x = targets & hwy::LimitsMax<int64_t >(); x != 0 ;
103-        x = x & (x - 1 )) {
108+   for  (int64_t  x = targets & 0x7FFFFFFFFFFFFFFFLL ; x != 0 ; x = x & (x - 1 )) {
104109    //  Extract value of least-significant bit.
105110    fprintf (stderr, "  %s" hwy::TargetName (x & (~x + 1 )));
106111  }
@@ -116,9 +121,7 @@ void TestVisitor() {
116121  }
117122}
118123
119- }  //  namespace
120- 
121- int  main () {
124+ void  PrintAll () {
122125  PrintCompiler ();
123126  PrintConfig ();
124127  PrintHave ();
@@ -129,7 +132,30 @@ int main() {
129132  PrintTargets (" HWY_STATIC_TARGET:     " 
130133  PrintTargets (" HWY_BROKEN_TARGETS:    " 
131134  PrintTargets (" HWY_DISABLED_TARGETS:  " 
132-   PrintTargets (" Current CPU supports:  " hwy::SupportedTargets ());
135+   PrintTargets (" CPU supports:          " hwy::SupportedTargets ());
136+ 
137+   char  cpu100[100 ];
138+   (void )platform::GetCpuString (cpu100);
139+   fprintf (stderr, " CPU: %s\n " 
140+ 
133141  TestVisitor ();
142+ }
143+ 
144+ //  NOLINTNEXTLINE(google-readability-namespace-comments)
145+ }  //  namespace HWY_NAMESPACE
146+ }  //  namespace hwy
147+ HWY_AFTER_NAMESPACE ();
148+ 
149+ #if  HWY_ONCE
150+ namespace  hwy  {
151+ namespace  {
152+ HWY_EXPORT (PrintAll);
153+ void  CallPrintAll () { HWY_DYNAMIC_DISPATCH (PrintAll)(); }
154+ }  //  namespace
155+ }  //  namespace hwy
156+ 
157+ int  main () {
158+   hwy::CallPrintAll ();
134159  return  0 ;
135160}
161+ #endif   //  HWY_ONCE
0 commit comments