[Bug target/82641] New: Unable to enable crc32 for a certain function with target attribute on ARM

yyc1992 at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Oct 20 17:59:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82641

            Bug ID: 82641
           Summary: Unable to enable crc32 for a certain function with
                    target attribute on ARM
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yyc1992 at gmail dot com
  Target Milestone: ---

The assembler complains about the target not supporting CRC32 instructions for
certain (generic) targets on ARM and AArch64. On AArch64, this can be lifted
with the `target("+crc")` attribute (or pragma though I've only tested the
function attribute) when writing inline assembly code that uses non-default
processor features and cpu-feature dispatch. However, none of these approaches
works on ARM.

There are multiple issues when trying to do this,

1. "+crc" is not accepted as a feature on ARM (32bit), not even when `march` is
set to `armv8-a`. OTOH, "armv8-a+crc" works though that makes supporting
different arch profile harder...

2. No `.arch` or `.arch_feature` directives are generated in the assembly which
cause the assembler to complain. This is the case for either function attribute
or pragma.

    I've tried to manually added a `.arch armv8-a` and a `.arch_extension crc`
before the function that uses the `crc32` instruction and then reset it back
with `.arch armv7-a` in the assembly code and it behaves correctly so I believe
this should be fixable on the GCC side.


More information about the Gcc-bugs mailing list