[GAS, Arm] CLI with architecture sensitive extensions

Andre Vieira (lists) andre.simoesdiasvieira@arm.com
Fri Mar 22 10:35:00 GMT 2019
Hi,

This patch adds a new framework to add architecture sensitive 
extensions, like GCC does.
This patch also implements all architecture extensions currently 
available in GCC.

This framework works as follows.  To enable architecture sensitive 
extensions for a particular architecture, that architecture must contain 
an ARM_ARCH_OPT2 entry in the 'arm_archs' table.
All fields here are the same as previous, with the addition of a new 
extra field at the end to <name> it's extension table.  This <name>, 
corresponds to a <name>_ext_table of type 'struct arm_ext_table'.  This 
struct can be filled with three types of entries:
ARM_ADD (string <ext>, arm_feature_set <enable_bits>), which means 
+<ext> will enable <enable_bits>
ARM_REMOVE (string <ext>, arm_feature_set <disable_bits>), which means 
+no<ext> will disable <disable_bits>
ARM_EXT (string <ext>, arm_feature_set <enable_bits>, arm_feature_set 
<disable_bits>), which means +<ext> will enable <enable_bits> and 
+no<ext> will disable <disable_bits> (this is to be used instead of 
adding an ARM_ADD and ARM_REMOVE for the same <ext>)

This patch does not disable the use of the old extensions, even if some 
of them are duplicated in the new tables.  This is a "in-between-step" 
as we may want to deprecate the old table of extensions in later 
patches.  For now, GAS will first look for the +<ext> or +no<ext> in the 
new table and if no entry is found it will continue searching in the old 
table, following old behaviour.  If only an ARM_ADD or an ARM_REMOVE is 
defined for <ext> and +no<ext> or +<ext> resp. is used then it also 
continues to search the old table for it.

A couple of caveats:
- This patch does not enable the use of these architecture extensions 
with the
'.arch_extension' directive.  This is future work that I will tend to later.
- This patch does not enable the use of these architecture extensions 
with the
-mcpu option.  This is future work that I will tend to later.
- This patch does not change the current behaviour when combining an
architecture extension and using -mfpu on the command-line.  The current
behaviour of GAS is to stage the union of feature bits enabled by both 
-march
and -mfpu.  GCC behaves differently here, so this is something we may 
want to
revisit on a later date.

For testing I duplicated an attributes test prior to Armv8-A for every 
set of enabled bits by one of the new extensions, I didn't test all 
possible new -march +ext combinations as that would be too much I 
believe.  For armv8-a I reused a couple of instruction tests using the 
new extensions. For Armv8-m I added two new tests.

Cheers,
Andre

gas/ChangeLog:
2019-03-**  Andre Vieira  <andre.simoesdiasvieira@arm.com>

         * config/tc-arm.c (arm_ext_table): New struct type.
         (arm_arch_option_table): Add new 'arm_ext_table' field.
         (ARM_EXT,ARM_ADD,ARM_REMOVE, ALL_FP): New macros.
         (armv5te_ext_table, armv7ve_ext_table, armv7a_ext_table,
          armv7r_ext_table, armv7em_ext_table, armv8a_ext_table,
          armv81a_ext_table, armv82a_ext_table, armv84a_ext_table,
          armv85a_ext_table, armv8m_main_ext_table,
          armv8r_ext_table): New architecture extension tables.
         (ARM_ARCH_OPT): Add new default field.
         (ARM_ARCH_OPT2): New macro.
         (arm_archs): Extend some architectures with the new architecture
         extension tables mentioned above.
         (arm_extensions): Add DEPRECATED comment with instructions to 
use new
         table.
         (arm_parse_extension): Change to use new extension tables.
         (arm_parse_cpu): Don't change existing behavior.
         (arm_parse_arch): Change to use new extension tables.
         * doc/c-arm.texi: Document new architecture extensions.
         * testsuite/gas/arm/attr-mfpu-neon-fp16.d: Change test to use new
         extension option rather than -mfpu and change expected behaviour to
         sane outputs.
         * testsuite/gas/arm/armv8-2-fp16-scalar-bad-ext.d: New.
         * testsuite/gas/arm/armv8-2-fp16-scalar-ext.d: New.
         * testsuite/gas/arm/armv8-2-fp16-scalar-thumb-ext.d: New.
         * testsuite/gas/arm/armv8-2-fp16-simd-ext.d: New.
         * testsuite/gas/arm/armv8-2-fp16-simd-thumb-ext.d: New.
         * testsuite/gas/arm/armv8-2-fp16-simd-warning-ext.d: New.
         * testsuite/gas/arm/armv8-2-fp16-simd-warning-thumb-ext.d: New.
         * testsuite/gas/arm/armv8_2+rdma-ext.d: New.
         * testsuite/gas/arm/armv8_2-a-fp16-thumb2-ext.d: New.
         * testsuite/gas/arm/armv8_2-a-fp16_ext.d: New.
         * testsuite/gas/arm/armv8_3-a-fp-bad-ext.d: New.
         * testsuite/gas/arm/armv8_3-a-fp-ext.d: New.
         * testsuite/gas/arm/armv8_3-a-fp16-ext.d: New.
         * testsuite/gas/arm/armv8_3-a-simd-bad-ext.d: New.
         * testsuite/gas/arm/armv8_4-a-fp16-ext.d: New.
         * testsuite/gas/arm/armv8m.main+fp.d: New.
         * testsuite/gas/arm/armv8m.main+fp.dp.d: New.
         * testsuite/gas/arm/attr-ext-fpv5-d16.d: New.
         * testsuite/gas/arm/attr-ext-fpv5.d: New.
         * testsuite/gas/arm/attr-ext-idiv.d: New.
         * testsuite/gas/arm/attr-ext-mp.d: New.
         * testsuite/gas/arm/attr-ext-neon-fp16.d: New.
         * testsuite/gas/arm/attr-ext-neon-vfpv3.d: New.
         * testsuite/gas/arm/attr-ext-neon-vfpv4.d: New.
         * testsuite/gas/arm/attr-ext-sec.d: New.
         * testsuite/gas/arm/attr-ext-vfpv3-d16-fp16.d: New.
         * testsuite/gas/arm/attr-ext-vfpv3-d16.d: New.
         * testsuite/gas/arm/attr-ext-vfpv3-fp16.d: New.
         * testsuite/gas/arm/attr-ext-vfpv3.d: New.
         * testsuite/gas/arm/attr-ext-vfpv3xd-fp.d: New.
         * testsuite/gas/arm/attr-ext-vfpv3xd.d: New.
         * testsuite/gas/arm/attr-ext-vfpv4-d16.d: New.
         * testsuite/gas/arm/attr-ext-vfpv4-sp-d16.d: New.
         * testsuite/gas/arm/attr-ext-vfpv4.d: New.
         * testsuite/gas/arm/dotprod-mandatory-ext.d: New.
         * testsuite/gas/arm/fpv5-d16.s: New.
         * testsuite/gas/arm/fpv5-sp-d16.s: New.

include/ChangeLog:
2019-03-**  Andre Vieira  <andre.simoesdiasvieira@arm.com>

         * opcode/arm.h (FPU_NEON_ARMV8_1): New.
         (FPU_ARCH_NEON_VFP_ARMV8_1): Use FPU_NEON_ARMV8_1.
         (FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_1): Likewise.
         (FPU_ARCH_DOTPROD_NEON_VFP_ARMV8): Likewise.
         (FPU_ARCH_NEON_VFP_ARMV8_2_FP16): New.
         (FPU_ARCH_NEON_VFP_ARMV8_2_FP16FML): New.
         (FPU_ARCH_NEON_VFP_ARMV8_4_FP16FML): New.
         (FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_4): New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CLI.patch
Type: text/x-patch
Size: 124366 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20190322/f863c6fb/attachment.bin>


More information about the Binutils mailing list