+#if CHECK_LZCNT
+ int g2;
+ struct sigaction new_action, old_action;
+ new_action.sa_handler = sigill_handler;
+ sigemptyset(&new_action.sa_mask);
+ new_action.sa_flags = 0;
+ sigaction(SIGILL, NULL, &old_action);
+ if (old_action.sa_handler != SIG_IGN) {
+ sigaction(SIGILL, &new_action, NULL);
+ if (!sigsetjmp(jit_env, 1)) {
+ jit_cpu.lzcnt = 1;
+ /* lzcnt %g2, %g2 */
+ __asm__ volatile("mov %%g2, %0; .long 0xa3b0021; mov %0, %%g2"
+ : "=r" (g2));
+ sigaction(SIGILL, &old_action, NULL);
+ }
+ }
+#else
+ jit_cpu.lzcnt = 0;
+#endif