AArch64: Add half float view to V registers
authorAlan Hayward <alan.hayward@arm.com>
Tue, 14 May 2019 09:09:05 +0000 (10:09 +0100)
committerAlan Hayward <alan.hayward@arm.com>
Tue, 14 May 2019 09:10:56 +0000 (10:10 +0100)
AArch64 can fill the vector registers with half precision floats.
Add a view for this.

Add builtin type ieee half and connect this to the existing
floatformats_ieee_half.

gdb/ChangeLog:

2019-05-14  Alan Hayward  <alan.hayward@arm.com>

* aarch64-tdep.c (aarch64_vnh_type): Add half view.
(aarch64_vnv_type): Likewise.
* target-descriptions.c (make_gdb_type): Add TDESC_TYPE_IEEE_HALF.
* common/tdesc.c: Likewise.
* common/tdesc.h (enum tdesc_type_kind): Likewise.
* features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerate.
* features/aarch64-fpu.xml: Add ieee half view.
* features/aarch64-sve.c (create_feature_aarch64_fpu): Likewise.
* gdbtypes.c (gdbtypes_post_init): Add builtin_half
* gdbtypes.h (struct builtin_type): Likewise.
(struct objfile_type): Likewise.

gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/common/tdesc.c
gdb/common/tdesc.h
gdb/features/aarch64-fpu.c
gdb/features/aarch64-fpu.xml
gdb/features/aarch64-sve.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/target-descriptions.c

index 19458ccc72636a92c13e99bd870ed00a87bb615c..44646f50d5b007fee2c65fcc64b420760ec3892e 100644 (file)
@@ -1,3 +1,17 @@
+2019-05-14  Alan Hayward  <alan.hayward@arm.com>
+
+       * aarch64-tdep.c (aarch64_vnh_type): Add half view.
+       (aarch64_vnv_type): Likewise.
+       * target-descriptions.c (make_gdb_type): Add TDESC_TYPE_IEEE_HALF.
+       * common/tdesc.c: Likewise.
+       * common/tdesc.h (enum tdesc_type_kind): Likewise.
+       * features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerate.
+       * features/aarch64-fpu.xml: Add ieee half view.
+       * features/aarch64-sve.c (create_feature_aarch64_fpu): Likewise.
+       * gdbtypes.c (gdbtypes_post_init): Add builtin_half
+       * gdbtypes.h (struct builtin_type): Likewise.
+       (struct objfile_type): Likewise.
+
 2019-05-12  Paul Naert  <paul.naert@polymtl.ca>
 
        * language.c (language_sniff_from_mangled_name): Fix "langauge"
index 2c8c6a1bdc32bb01894cc66efc0d8374d1245726..bbb2a25f956c3b09ba199143d5439e2a135fe719 100644 (file)
@@ -1885,6 +1885,9 @@ aarch64_vnh_type (struct gdbarch *gdbarch)
       t = arch_composite_type (gdbarch, "__gdb_builtin_type_vnh",
                               TYPE_CODE_UNION);
 
+      elem = builtin_type (gdbarch)->builtin_half;
+      append_composite_type_field (t, "f", elem);
+
       elem = builtin_type (gdbarch)->builtin_uint16;
       append_composite_type_field (t, "u", elem);
 
@@ -1963,6 +1966,8 @@ aarch64_vnv_type (struct gdbarch *gdbarch)
 
       sub = arch_composite_type (gdbarch, "__gdb_builtin_type_vnh",
                                 TYPE_CODE_UNION);
+      append_composite_type_field (sub, "f",
+                                  init_vector_type (bt->builtin_half, 8));
       append_composite_type_field (sub, "u",
                                   init_vector_type (bt->builtin_uint16, 8));
       append_composite_type_field (sub, "s",
index fe63a36c339e08699c806ba28d64e525f99cc225..f946a53c7f36fd915f2e5409c50aaeaa0b604716 100644 (file)
@@ -50,6 +50,7 @@ static tdesc_type_builtin tdesc_predefined_types[] =
   { "uint128", TDESC_TYPE_UINT128 },
   { "code_ptr", TDESC_TYPE_CODE_PTR },
   { "data_ptr", TDESC_TYPE_DATA_PTR },
+  { "ieee_half", TDESC_TYPE_IEEE_HALF },
   { "ieee_single", TDESC_TYPE_IEEE_SINGLE },
   { "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
   { "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
index a0bc6339e264cda8aaa4c82bd1dac26d1b8e966d..9eb3d5ea3121681ef0b4fe6cb4ba7a4553fe49fc 100644 (file)
@@ -147,6 +147,7 @@ enum tdesc_type_kind
   TDESC_TYPE_UINT128,
   TDESC_TYPE_CODE_PTR,
   TDESC_TYPE_DATA_PTR,
+  TDESC_TYPE_IEEE_HALF,
   TDESC_TYPE_IEEE_SINGLE,
   TDESC_TYPE_IEEE_DOUBLE,
   TDESC_TYPE_ARM_FPA_EXT,
index 47962d1f242751f68d1a9a41aedba4ad662a2ecd..b73d12ebe4880e0c03cc8cd01e24dd3efe2c040a 100644 (file)
@@ -28,6 +28,9 @@ create_feature_aarch64_fpu (struct target_desc *result, long regnum)
   element_type = tdesc_named_type (feature, "int32");
   tdesc_create_vector (feature, "v4i", element_type, 4);
 
+  element_type = tdesc_named_type (feature, "ieee_half");
+  tdesc_create_vector (feature, "v8f", element_type, 8);
+
   element_type = tdesc_named_type (feature, "uint16");
   tdesc_create_vector (feature, "v8u", element_type, 8);
 
@@ -65,6 +68,8 @@ create_feature_aarch64_fpu (struct target_desc *result, long regnum)
   tdesc_add_field (type_with_fields, "s", field_type);
 
   type_with_fields = tdesc_create_union (feature, "vnh");
+  field_type = tdesc_named_type (feature, "v8f");
+  tdesc_add_field (type_with_fields, "f", field_type);
   field_type = tdesc_named_type (feature, "v8u");
   tdesc_add_field (type_with_fields, "u", field_type);
   field_type = tdesc_named_type (feature, "v8i");
index 141c996eadd8fb16c67aed11613323af4c7a7f06..1eba8faea7c92bda8eba922dbf0e8f71701f010f 100644 (file)
@@ -14,6 +14,7 @@
   <vector id="v4f" type="ieee_single" count="4"/>
   <vector id="v4u" type="uint32" count="4"/>
   <vector id="v4i" type="int32" count="4"/>
+  <vector id="v8f" type="ieee_half" count="8"/>
   <vector id="v8u" type="uint16" count="8"/>
   <vector id="v8i" type="int16" count="8"/>
   <vector id="v16u" type="uint8" count="16"/>
@@ -31,6 +32,7 @@
     <field name="s" type="v4i"/>
   </union>
   <union id="vnh">
+    <field name="f" type="v8f"/>
     <field name="u" type="v8u"/>
     <field name="s" type="v8i"/>
   </union>
index 2166b4bb0718d4652ae2a926d543f5b12f18bf3c..ae292d2f3da50291587a6cdfbca6bc789430ce19 100644 (file)
@@ -55,6 +55,9 @@ create_feature_aarch64_sve (struct target_desc *result, long regnum,
   element_type = tdesc_named_type (feature, "int32");
   tdesc_create_vector (feature, "svevss", element_type, 4 * scale);
 
+  element_type = tdesc_named_type (feature, "ieee_half");
+  tdesc_create_vector (feature, "svevhf", element_type, 8 * scale);
+
   element_type = tdesc_named_type (feature, "uint16");
   tdesc_create_vector (feature, "svevhu", element_type, 8 * scale);
 
@@ -90,6 +93,8 @@ create_feature_aarch64_sve (struct target_desc *result, long regnum,
   tdesc_add_field (type_with_fields, "s", field_type);
 
   type_with_fields = tdesc_create_union (feature, "svevnh");
+  field_type = tdesc_named_type (feature, "svevhf");
+  tdesc_add_field (type_with_fields, "f", field_type);
   field_type = tdesc_named_type (feature, "svevhu");
   tdesc_add_field (type_with_fields, "u", field_type);
   field_type = tdesc_named_type (feature, "svevhs");
index 59456f9f3a42fe632084289045c2c17be1db1eb7..e329adc368e049608fb953a349d463247c744af2 100644 (file)
@@ -5359,6 +5359,9 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
   builtin_type->builtin_unsigned_long_long
     = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
                         1, "unsigned long long");
+  builtin_type->builtin_half
+    = arch_float_type (gdbarch, gdbarch_half_bit (gdbarch),
+                      "half", gdbarch_half_format (gdbarch));
   builtin_type->builtin_float
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
                       "float", gdbarch_float_format (gdbarch));
index edea6f05474a3d48ce99afe8d0b43a989bc0f2a8..2f3834e9f560ec35b5aa786b8f9d40e2b4149c91 100644 (file)
@@ -1595,6 +1595,7 @@ struct builtin_type
   struct type *builtin_unsigned_short;
   struct type *builtin_unsigned_int;
   struct type *builtin_unsigned_long;
+  struct type *builtin_half;
   struct type *builtin_float;
   struct type *builtin_double;
   struct type *builtin_long_double;
@@ -1690,6 +1691,7 @@ struct objfile_type
   struct type *builtin_unsigned_int;
   struct type *builtin_unsigned_long;
   struct type *builtin_unsigned_long_long;
+  struct type *builtin_half;
   struct type *builtin_float;
   struct type *builtin_double;
   struct type *builtin_long_double;
index 96d453527cdfb7de7d25719caf41283cae740ff4..bd33091ba9e4bcbad5efafe4fb6e211ca379bfe9 100644 (file)
@@ -119,6 +119,11 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
 
       switch (e->kind)
        {
+       case TDESC_TYPE_IEEE_HALF:
+         m_type = arch_float_type (m_gdbarch, -1, "builtin_type_ieee_half",
+                                   floatformats_ieee_half);
+         return;
+
        case TDESC_TYPE_IEEE_SINGLE:
          m_type = arch_float_type (m_gdbarch, -1, "builtin_type_ieee_single",
                                    floatformats_ieee_single);