]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Fix build against libc++ in c++11 mode [PR113763]
authorJakub Jelinek <jakub@redhat.com>
Tue, 6 Feb 2024 14:56:50 +0000 (15:56 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 6 Feb 2024 14:56:50 +0000 (15:56 +0100)
std::pair ctor used in tiles constexpr variable is only constexpr in C++14
and later, it works with libstdc++ because it is marked constexpr there even
in C++11 mode.

The following patch fixes it by using an unnamed local class instead of
std::pair, and additionally changes the first element from unsigned int to
unsigned char because 0xff has to fit into unsigned char on all hosts.

2024-02-06  Jakub Jelinek  <jakub@redhat.com>

PR target/113763
* config/aarch64/aarch64.cc (aarch64_output_sme_zero_za): Change tiles
element from std::pair<unsigned int, char> to an unnamed struct.
Adjust uses of tile range variable.

gcc/config/aarch64/aarch64.cc

index 872393a823125edac53393fd85a3d9c460eb4760..bdbfe2afb69ac369c89f02739917e2a3a5dd28b7 100644 (file)
@@ -13132,7 +13132,7 @@ aarch64_output_sme_zero_za (rtx mask)
   if (mask_val == 0xff)
     return "zero\t{ za }";
 
-  static constexpr std::pair<unsigned int, char> tiles[] = {
+  static constexpr struct { unsigned char mask; char letter; } tiles[] = {
     { 0xff, 'b' },
     { 0x55, 'h' },
     { 0x11, 's' },
@@ -13146,14 +13146,14 @@ aarch64_output_sme_zero_za (rtx mask)
   const char *prefix = "{ ";
   for (auto &tile : tiles)
     {
-      auto tile_mask = tile.first;
+      unsigned int tile_mask = tile.mask;
       unsigned int tile_index = 0;
       while (tile_mask < 0x100)
        {
          if ((mask_val & tile_mask) == tile_mask)
            {
              i += snprintf (buffer + i, sizeof (buffer) - i, "%sza%d.%c",
-                            prefix, tile_index, tile.second);
+                            prefix, tile_index, tile.letter);
              prefix = ", ";
              mask_val &= ~tile_mask;
            }