title: How to detect crc32 on aarch64
body: <p>Is it possible for a <em>user</em> program on aarch64 detect whether crc32 instructions are available? I have found <a href="https://github.com/torvalds/linux/blob/master/Documentation/arm64/cpu-feature-registers.txt" rel="nofollow noreferrer">references to kernel support</a> for such detection, implying that the registers with the information about what instructions will work in user mode are not available in user mode (!).</p>
  
  <p>Is that the case? Or is there a portable way to determine if the crc32 instructions are available?</p>
  
  <p>Note: What I mean by "user program" and "portable" is an approach that does not require privileged instructions nor operating-system-specific calls or files (e.g. /proc/cpuinfo). The code itself needs to be able to detect if the instructions are available and use them if they are, or fall back to an alternative if they are not. As an example, Intel processors have the <code>cpuid</code> instruction for this purpose.</p>
  
  <p><em>Update:</em></p>
  
  <p>Poking around in ARM architecture descriptions, I found a user-level register, <code>PMCR_EL0</code>, which provides an 8-bit implementer code and an 8-bit ID code for the processor. Perhaps if I could find a list of those codes, I might be closer to what I'm looking for.</p>
  
  <p><em>Update 2</em>:</p>
  
  <p>However, when I try to read that register, I get an illegal instruction exception. So even EL0 registers require privileged access?</p>