Arm assembler crc issue

Iain Sandoe iain@sandoe.co.uk
Thu Oct 19 16:41:24 GMT 2023


Hi Richard,


I am being bitten by a problem that falls out from the code that emits

	.arch Armv8.n-a+crc

when the arch is less than Armv8-r.
The code that does this,  in gcc/common/config/aarch64 is quite recent (2022-09).

------

(I admit the permutations are complex and I might have miss-analyzed) - but it appears that llvm assembler (for mach-o, at least) sees an explict mention of an attribute for a feature which is mandatory at a specified arch level as demoting that arch to the minimum that made the explicit feature mandatory.  Of course, it could just be a bug in the handling of transitive feature enables...

the problem is that, for example:

	.arch Armv8.4-a+crc

no longer recognises fp16 insns. (and appending +fp16 does not fix this).

====

Even if upstream LLVM is deemed to be buggy (it does not do what I would expect, at least), and fixed - I will still have a bunch of assembler versions that are broken (before the fix percolates through to downstream xcode) - and the LLVM assembler is the only current option for Darwin.

So, it seems that this ought to be a reasonable configure test:

	.arch armv8.2-a
	.text
m:
	crc32b w0, w1, w2 

and then emit HAS_GAS_AARCH64_CRC_BUG (for example) if that fails to assemble which can be used to make the +crc emit conditional on a broken assembler.

- I am asking here before constructing the patch, in case there’s some reason that doing this at configure time is not acceptable.

thanks
Iain



More information about the Gcc mailing list