[libcxx-commits] [clang] [libcxx] [lld] [llvm] Triple::normalize: Set OS for 3-component triple with none as middle (PR #89638)

YunQiang Su via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 23 00:18:51 PDT 2024


https://github.com/wzssyqa updated https://github.com/llvm/llvm-project/pull/89638

>From 11ae27aeb512b661a3423a8b92642a9ec08ca6a1 Mon Sep 17 00:00:00 2001
From: YunQiang Su <syq at gcc.gnu.org>
Date: Tue, 23 Apr 2024 01:36:17 +0800
Subject: [PATCH] Triple::normalize: Set OS for 3-component triple with none as
 middle

If the middle component of a 3-component triple fails to parse as known
Arch/Vendor/OS/Env, it will fallback as Vendor. While for some cases,
we may wish to recognize it as OS, such as `arm64-none-elf`.

In this patch, we will set OS as `none`, if:
	1) Arch is found;
	2) Env is found;
	3) OS is not found and thus is set as empty;
	4) Vendor is not found while is set as "none",
we will swap Component[2] and Component[3].

Use this new triple for these tests:
  - clang/docs/Multilib.rst
  - clang/test/CodeGen/Inputs/linker-diagnostic1.ll
  - clang/test/CodeGen/linker-diagnostic.ll
  - clang/test/Driver/arm-ias-Wa.s
  - clang/test/Driver/arm-triple.c
  - clang/test/Driver/baremetal-multilib-exclusive-group.yaml
  - clang/test/Driver/baremetal-multilib-group-error.yaml
  - clang/test/Driver/baremetal-multilib-layered.yaml
  - clang/test/Driver/baremetal-multilib.yaml
  - clang/test/Driver/baremetal-sysroot.cpp
  - clang/test/Driver/baremetal.cpp
  - clang/test/Driver/print-multi-selection-flags.c
  - clang/test/Driver/program-path-priority.c
  - clang/test/Preprocessor/init-arm.c
  - clang/unittests/Driver/MultilibTest.cpp
  - clang/unittests/Interpreter/IncrementalCompilerBuilderTest.cpp
  - libcxx/utils/ci/run-buildbot
  - lld/test/ELF/lto/arm.ll
  - llvm/test/CodeGen/ARM/machine-sink-multidef.mir
  - llvm/test/CodeGen/ARM/store-prepostinc.mir
  - llvm/test/CodeGen/ARM/unschedule-reg-sequence.ll
  - llvm/test/CodeGen/Thumb/consthoist-few-dependents.ll
  - llvm/test/CodeGen/Thumb/consthoist-imm8-costs-1.ll
  - llvm/test/CodeGen/Thumb/pr42760.ll
  - llvm/test/CodeGen/Thumb/smul_fix.ll
  - llvm/test/CodeGen/Thumb/smul_fix_sat.ll
  - llvm/test/CodeGen/Thumb/umul_fix.ll
  - llvm/test/CodeGen/Thumb/umul_fix_sat.ll
  - llvm/test/CodeGen/Thumb2/LowOverheadLoops/spillingmove.mir
  - llvm/test/CodeGen/Thumb2/LowOverheadLoops/wls-search-pred.mir
  - llvm/test/CodeGen/Thumb2/high-reg-spill.mir
  - llvm/test/CodeGen/Thumb2/mve-pred-constfold.mir
  - llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir
  - llvm/test/CodeGen/Thumb2/pipeliner-preserve-ties.mir
  - llvm/test/CodeGen/Thumb2/store-prepostinc.mir
  - llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
  - llvm/test/Transforms/LoopVectorize/ARM/mve-hoist-runtime-checks.ll
  - llvm/unittests/TargetParser/TripleTest.cpp

Fixes: #89582.
---
 clang/docs/Multilib.rst                       |  4 +-
 .../test/CodeGen/Inputs/linker-diagnostic1.ll |  2 +-
 clang/test/CodeGen/linker-diagnostic.ll       |  4 +-
 clang/test/Driver/arm-ias-Wa.s                |  2 +-
 clang/test/Driver/arm-triple.c                | 10 +--
 .../baremetal-multilib-exclusive-group.yaml   | 22 +++----
 .../baremetal-multilib-group-error.yaml       |  4 +-
 .../Driver/baremetal-multilib-layered.yaml    |  2 +-
 clang/test/Driver/baremetal-multilib.yaml     | 64 +++++++++----------
 clang/test/Driver/baremetal-sysroot.cpp       |  2 +-
 clang/test/Driver/baremetal.cpp               |  2 +-
 .../test/Driver/print-multi-selection-flags.c | 14 ++--
 clang/test/Driver/program-path-priority.c     |  4 +-
 clang/test/Preprocessor/init-arm.c            |  4 +-
 clang/unittests/Driver/MultilibTest.cpp       | 52 +++++++--------
 .../IncrementalCompilerBuilderTest.cpp        |  2 +-
 libcxx/utils/ci/run-buildbot                  |  2 +-
 lld/test/ELF/lto/arm.ll                       |  4 +-
 llvm/lib/TargetParser/Triple.cpp              |  7 ++
 .../CodeGen/ARM/machine-sink-multidef.mir     |  2 +-
 llvm/test/CodeGen/ARM/store-prepostinc.mir    |  2 +-
 .../CodeGen/ARM/unschedule-reg-sequence.ll    |  2 +-
 .../Thumb/consthoist-few-dependents.ll        |  2 +-
 .../CodeGen/Thumb/consthoist-imm8-costs-1.ll  |  2 +-
 llvm/test/CodeGen/Thumb/pr42760.ll            |  2 +-
 llvm/test/CodeGen/Thumb/smul_fix.ll           |  2 +-
 llvm/test/CodeGen/Thumb/smul_fix_sat.ll       |  2 +-
 llvm/test/CodeGen/Thumb/umul_fix.ll           |  2 +-
 llvm/test/CodeGen/Thumb/umul_fix_sat.ll       |  2 +-
 .../Thumb2/LowOverheadLoops/spillingmove.mir  |  2 +-
 .../LowOverheadLoops/wls-search-pred.mir      |  2 +-
 llvm/test/CodeGen/Thumb2/high-reg-spill.mir   |  2 +-
 .../CodeGen/Thumb2/mve-pred-constfold.mir     |  2 +-
 .../CodeGen/Thumb2/mve-vpt-block-debug.mir    |  2 +-
 .../Thumb2/pipeliner-preserve-ties.mir        |  2 +-
 llvm/test/CodeGen/Thumb2/store-prepostinc.mir |  2 +-
 .../InferFunctionAttrs/norecurse_debug.ll     |  2 +-
 .../ARM/mve-hoist-runtime-checks.ll           |  2 +-
 llvm/unittests/TargetParser/TripleTest.cpp    |  2 +-
 39 files changed, 127 insertions(+), 120 deletions(-)

diff --git a/clang/docs/Multilib.rst b/clang/docs/Multilib.rst
index ab737e43b97d23..063fe9a336f2fe 100644
--- a/clang/docs/Multilib.rst
+++ b/clang/docs/Multilib.rst
@@ -188,9 +188,9 @@ For a more comprehensive example see
   - Dir: thumb/v6-m
     # List of one or more normalized command line options, as generated by Clang
     # from the command line options or from Mappings below.
-    # Here, if the flags are a superset of {target=thumbv6m-none-unknown-eabi}
+    # Here, if the flags are a superset of {target=thumbv6m-unknown-none-eabi}
     # then this multilib variant will be considered a match.
-    Flags: [--target=thumbv6m-none-unknown-eabi]
+    Flags: [--target=thumbv6m-unknown-none-eabi]
 
   # Similarly, a multilib variant targeting Arm v7-M with an FPU (floating
   # point unit).
diff --git a/clang/test/CodeGen/Inputs/linker-diagnostic1.ll b/clang/test/CodeGen/Inputs/linker-diagnostic1.ll
index 913dbefe5ccec9..96883aa26cffed 100644
--- a/clang/test/CodeGen/Inputs/linker-diagnostic1.ll
+++ b/clang/test/CodeGen/Inputs/linker-diagnostic1.ll
@@ -1,4 +1,4 @@
-target triple = "armv4-none-unknown-eabi"
+target triple = "armv4-unknown-none-eabi"
 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
 
 declare i32 @foo(i32)
diff --git a/clang/test/CodeGen/linker-diagnostic.ll b/clang/test/CodeGen/linker-diagnostic.ll
index c8406314f8d6fd..009819b464fe50 100644
--- a/clang/test/CodeGen/linker-diagnostic.ll
+++ b/clang/test/CodeGen/linker-diagnostic.ll
@@ -4,10 +4,10 @@
 ; RUN: opt -module-summary -o %t/bar.o %S/Inputs/linker-diagnostic1.ll
 ; RUN: llvm-lto2 run --thinlto-distributed-indexes -r %t/foo.o,foo,plx -r %t/bar.o,bar,plx \
 ; RUN:   -r %t/bar.o,foo, -o %t/foobar.so %t/foo.o %t/bar.o
-; RUN: %clang -c -o %t/lto.bar.o --target=armv4-none-unknown-eabi -O2 \
+; RUN: %clang -c -o %t/lto.bar.o --target=armv4-unknown-none-eabi -O2 \
 ; RUN:   -fthinlto-index=%t/bar.o.thinlto.bc %t/bar.o -Wno-override-module 2>&1 | FileCheck %s
 
-; CHECK: linking module '{{.*}}/bar.o': Linking two modules of different target triples: '{{.*}}/foo.o' is 'thumbv6-unknown-linux-gnueabihf' whereas '{{.*}}/bar.o' is 'armv4-none-unknown-eabi'
+; CHECK: linking module '{{.*}}/bar.o': Linking two modules of different target triples: '{{.*}}/foo.o' is 'thumbv6-unknown-linux-gnueabihf' whereas '{{.*}}/bar.o' is 'armv4-unknown-none-eabi'
 
 target triple = "thumbv6-unknown-linux-gnueabihf"
 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
diff --git a/clang/test/Driver/arm-ias-Wa.s b/clang/test/Driver/arm-ias-Wa.s
index b82ce8dfb31ab3..5e9518ed2dc423 100644
--- a/clang/test/Driver/arm-ias-Wa.s
+++ b/clang/test/Driver/arm-ias-Wa.s
@@ -71,7 +71,7 @@
 
 // RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
-// CHECK-R-PROFILE: "-triple" "armv7r-none-unknown-eabi"
+// CHECK-R-PROFILE: "-triple" "armv7r-unknown-none-eabi"
 
 // RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \
 // RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
diff --git a/clang/test/Driver/arm-triple.c b/clang/test/Driver/arm-triple.c
index fa9f7b189c8278..1fb2b5afe22a51 100644
--- a/clang/test/Driver/arm-triple.c
+++ b/clang/test/Driver/arm-triple.c
@@ -7,7 +7,7 @@
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=arm-none-eabihf -march=armv4t -mfloat-abi=softfp \
 // RUN:   | FileCheck %s --check-prefix=CHECK-DEFAULT
-// CHECK-DEFAULT: armv4t-none-unknown-eabi
+// CHECK-DEFAULT: armv4t-unknown-none-eabi
 
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=armeb-none-eabi \
@@ -15,7 +15,7 @@
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=arm-none-eabi -mbig-endian \
 // RUN:   | FileCheck %s --check-prefix=CHECK-EB
-// CHECK-EB: armebv4t-none-unknown-eabi
+// CHECK-EB: armebv4t-unknown-none-eabi
 
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=arm-none-eabihf -march=armv4t \
@@ -23,7 +23,7 @@
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=arm-none-eabi -mfloat-abi=hard \
 // RUN:   | FileCheck %s --check-prefix=CHECK-HF
-// CHECK-HF: armv4t-none-unknown-eabihf
+// CHECK-HF: armv4t-unknown-none-eabihf
 
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=armeb-none-eabihf -march=armv4t \
@@ -37,7 +37,7 @@
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=arm-none-eabi -mbig-endian -mfloat-abi=hard \
 // RUN:   | FileCheck %s --check-prefix=CHECK-EB-HF
-// CHECK-EB-HF: armebv4t-none-unknown-eabihf
+// CHECK-EB-HF: armebv4t-unknown-none-eabihf
 
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=arm-none-eabi -march=armv8m.main -mbig-endian -mfloat-abi=hard \
@@ -45,4 +45,4 @@
 // RUN: %clang -print-effective-triple \
 // RUN:   --target=arm-none-eabi -mcpu=cortex-m33 -mbig-endian -mfloat-abi=hard \
 // RUN:   | FileCheck %s --check-prefix=CHECK-V8M-EB-HF
-// CHECK-V8M-EB-HF: thumbebv8m.main-none-unknown-eabihf
+// CHECK-V8M-EB-HF: thumbebv8m.main-unknown-none-eabihf
diff --git a/clang/test/Driver/baremetal-multilib-exclusive-group.yaml b/clang/test/Driver/baremetal-multilib-exclusive-group.yaml
index a98549efea4f0a..228c53bbb0f83a 100644
--- a/clang/test/Driver/baremetal-multilib-exclusive-group.yaml
+++ b/clang/test/Driver/baremetal-multilib-exclusive-group.yaml
@@ -8,7 +8,7 @@
 # RUN: mkdir -p %t/baremetal_multilib/lib/clang-runtimes
 # RUN: ln -s %s %t/baremetal_multilib/lib/clang-runtimes/multilib.yaml
 
-# RUN: %t/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out --target=thumbv7em-none-unknown-eabi --sysroot= 2>%t.err
+# RUN: %t/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out --target=thumbv7em-unknown-none-eabi --sysroot= 2>%t.err
 
 # RUN: FileCheck -DSYSROOT=%t/baremetal_multilib %s < %t.err --check-prefix=POS
 # RUN: FileCheck -DSYSROOT=%t/baremetal_multilib %s < %t.err --check-prefix=NEG
@@ -16,7 +16,7 @@
 # Expected results:
 #
 # Due to the Mappings section, all six of these library directories should
-# match the command-line flag --target=thumbv7em-none-unknown-eabi.
+# match the command-line flag --target=thumbv7em-unknown-none-eabi.
 #
 # The two "non_exclusive" directories, which don't have an ExclusiveGroup at
 # all, should both be selected. So should the two "own_group", each of which
@@ -49,31 +49,31 @@ Groups:
 
 Variants:
 - Dir: testdir1_non_exclusive
-  Flags: [--target=thumbv7m-none-unknown-eabi]
+  Flags: [--target=thumbv7m-unknown-none-eabi]
 
 - Dir: testdir2_non_exclusive
-  Flags: [--target=thumbv7em-none-unknown-eabi]
+  Flags: [--target=thumbv7em-unknown-none-eabi]
 
 - Dir: testdir1_exclusive
-  Flags: [--target=thumbv7m-none-unknown-eabi]
+  Flags: [--target=thumbv7m-unknown-none-eabi]
   Group: actually_exclude_something
 
 - Dir: testdir2_exclusive
-  Flags: [--target=thumbv7em-none-unknown-eabi]
+  Flags: [--target=thumbv7em-unknown-none-eabi]
   Group: actually_exclude_something
 
 - Dir: testdir3_exclusive
-  Flags: [--target=thumbv7em-none-unknown-eabi]
+  Flags: [--target=thumbv7em-unknown-none-eabi]
   Group: actually_exclude_something
 
 - Dir: testdir1_own_group
-  Flags: [--target=thumbv7m-none-unknown-eabi]
+  Flags: [--target=thumbv7m-unknown-none-eabi]
   Group: foo
 
 - Dir: testdir2_own_group
-  Flags: [--target=thumbv7em-none-unknown-eabi]
+  Flags: [--target=thumbv7em-unknown-none-eabi]
   Group: bar
 
 Mappings:
-- Match: --target=thumbv7em-none-unknown-eabi
-  Flags: [--target=thumbv7m-none-unknown-eabi]
+- Match: --target=thumbv7em-unknown-none-eabi
+  Flags: [--target=thumbv7m-unknown-none-eabi]
diff --git a/clang/test/Driver/baremetal-multilib-group-error.yaml b/clang/test/Driver/baremetal-multilib-group-error.yaml
index 1e8f83fa50d244..9d8a80bf4a9c60 100644
--- a/clang/test/Driver/baremetal-multilib-group-error.yaml
+++ b/clang/test/Driver/baremetal-multilib-group-error.yaml
@@ -8,7 +8,7 @@
 # RUN: mkdir -p %t/baremetal_multilib/lib/clang-runtimes
 # RUN: ln -s %s %t/baremetal_multilib/lib/clang-runtimes/multilib.yaml
 
-# RUN: %t/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out --target=thumbv7em-none-unknown-eabi --sysroot= 2>%t.err
+# RUN: %t/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out --target=thumbv7em-unknown-none-eabi --sysroot= 2>%t.err
 # RUN: FileCheck %s < %t.err
 
 ---
@@ -20,7 +20,7 @@ Groups:
 
 Variants:
 - Dir: testdir1
-  Flags: [--target=thumbv7m-none-unknown-eabi]
+  Flags: [--target=thumbv7m-unknown-none-eabi]
   Group: nonexistent_group_name
 
 # CHECK: error: unknown enumerated scalar
diff --git a/clang/test/Driver/baremetal-multilib-layered.yaml b/clang/test/Driver/baremetal-multilib-layered.yaml
index 2f86f8e3ea4f5f..a525436d8122f5 100644
--- a/clang/test/Driver/baremetal-multilib-layered.yaml
+++ b/clang/test/Driver/baremetal-multilib-layered.yaml
@@ -18,7 +18,7 @@
 # RUN: %T/baremetal_multilib_layered/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
 # RUN:     --target=thumbv7m-none-eabi -mfloat-abi=softfp --sysroot= \
 # RUN:   | FileCheck -DSYSROOT=%T/baremetal_multilib_layered %s
-# CHECK:      "-cc1" "-triple" "thumbv7m-none-unknown-eabi"
+# CHECK:      "-cc1" "-triple" "thumbv7m-unknown-none-eabi"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/softfp/include/c++/v1"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/soft/include/c++/v1"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/softfp/include"
diff --git a/clang/test/Driver/baremetal-multilib.yaml b/clang/test/Driver/baremetal-multilib.yaml
index 3f026cbeb437b2..9ed83e4aec839c 100644
--- a/clang/test/Driver/baremetal-multilib.yaml
+++ b/clang/test/Driver/baremetal-multilib.yaml
@@ -11,7 +11,7 @@
 # RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
 # RUN:     --target=thumbv8m.main-none-eabihf --sysroot= \
 # RUN:   | FileCheck -DSYSROOT=%T/baremetal_multilib %s
-# CHECK:      "-cc1" "-triple" "thumbv8m.main-none-unknown-eabihf"
+# CHECK:      "-cc1" "-triple" "thumbv8m.main-unknown-none-eabihf"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/include/c++/v1"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/include"
 # CHECK-SAME: "-x" "c++" "{{.*}}baremetal-multilib.yaml"
@@ -24,11 +24,11 @@
 # RUN:     --target=thumbv7em-none-eabi -mfpu=fpv4-sp-d16 --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-NO-MATCH %s
 # CHECK-NO-MATCH: warning: no multilib found matching flags:
-# CHECK-NO-MATCH-SAME: --target=thumbv7em-none-unknown-eabi
+# CHECK-NO-MATCH-SAME: --target=thumbv7em-unknown-none-eabi
 # CHECK-NO-MATCH: note: available multilibs are:
-# CHECK-NO-MATCH: --target=thumbv6m-none-unknown-eabi -mfpu=none
-# CHECK-NO-MATCH: --target=thumbv7m-none-unknown-eabi -mfpu=none
-# CHECK-NO-MATCH: --target=thumbv7em-none-unknown-eabi -mfpu=none
+# CHECK-NO-MATCH: --target=thumbv6m-unknown-none-eabi -mfpu=none
+# CHECK-NO-MATCH: --target=thumbv7m-unknown-none-eabi -mfpu=none
+# CHECK-NO-MATCH: --target=thumbv7em-unknown-none-eabi -mfpu=none
 
 # RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -print-multi-directory 2>&1 \
 # RUN:     --target=thumbv8m.main-none-eabihf --sysroot= \
@@ -38,16 +38,16 @@
 # RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -print-multi-lib 2>&1 \
 # RUN:     --target=arm-none-eabi --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-PRINT-MULTI-LIB %s
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v6-m/nofp;@-target=thumbv6m-none-unknown-eabi at mfpu=none
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7-m/nofp;@-target=thumbv7m-none-unknown-eabi at mfpu=none
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/nofp;@-target=thumbv7em-none-unknown-eabi at mfpu=none
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8-m.main/nofp;@-target=thumbv8m.main-none-unknown-eabi at mfpu=none
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/nofp/nomve;@-target=thumbv8.1m.main-none-unknown-eabi at mfpu=none
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/fpv4_sp_d16;@-target=thumbv7em-none-unknown-eabihf at mfpu=fpv4-sp-d16
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/fpv5_d16;@-target=thumbv7em-none-unknown-eabihf at mfpu=fpv5-d16
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8-m.main/fp;@-target=thumbv8m.main-none-unknown-eabihf at mfpu=fpv5-d16
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/fp;@-target=thumbv8.1m.main-none-unknown-eabihf at mfpu=fp-armv8-fullfp16-sp-d16
-# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/nofp/mve;@-target=thumbv8.1m.main-none-unknown-eabihf at march=thumbv8.1m.main+mve at mfpu=none
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v6-m/nofp;@-target=thumbv6m-unknown-none-eabi at mfpu=none
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7-m/nofp;@-target=thumbv7m-unknown-none-eabi at mfpu=none
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/nofp;@-target=thumbv7em-unknown-none-eabi at mfpu=none
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8-m.main/nofp;@-target=thumbv8m.main-unknown-none-eabi at mfpu=none
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/nofp/nomve;@-target=thumbv8.1m.main-unknown-none-eabi at mfpu=none
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/fpv4_sp_d16;@-target=thumbv7em-unknown-none-eabihf at mfpu=fpv4-sp-d16
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/fpv5_d16;@-target=thumbv7em-unknown-none-eabihf at mfpu=fpv5-d16
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8-m.main/fp;@-target=thumbv8m.main-unknown-none-eabihf at mfpu=fpv5-d16
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/fp;@-target=thumbv8.1m.main-unknown-none-eabihf at mfpu=fp-armv8-fullfp16-sp-d16
+# CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/nofp/mve;@-target=thumbv8.1m.main-unknown-none-eabihf at march=thumbv8.1m.main+mve at mfpu=none
 
 # RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -x assembler -mexecute-only \
 # RUN:     --target=arm-none-eabi --sysroot= %s -c -### 2>&1 \
@@ -86,37 +86,37 @@ MultilibVersion: 1.0
 
 Variants:
 - Dir: arm-none-eabi/arm/v4t
-  Flags: [--target=armv4t-none-unknown-eabi]
+  Flags: [--target=armv4t-unknown-none-eabi]
 
 - Dir: arm-none-eabi/thumb/v6-m/nofp
-  Flags: [--target=thumbv6m-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv6m-unknown-none-eabi, -mfpu=none]
 
 - Dir: arm-none-eabi/thumb/v7-m/nofp
-  Flags: [--target=thumbv7m-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv7m-unknown-none-eabi, -mfpu=none]
 
 - Dir: arm-none-eabi/thumb/v7e-m/nofp
-  Flags: [--target=thumbv7em-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv7em-unknown-none-eabi, -mfpu=none]
 
 - Dir: arm-none-eabi/thumb/v8-m.main/nofp
-  Flags: [--target=thumbv8m.main-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv8m.main-unknown-none-eabi, -mfpu=none]
 
 - Dir: arm-none-eabi/thumb/v8.1-m.main/nofp/nomve
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabi, -mfpu=none]
 
 - Dir: arm-none-eabi/thumb/v7e-m/fpv4_sp_d16
-  Flags: [--target=thumbv7em-none-unknown-eabihf, -mfpu=fpv4-sp-d16]
+  Flags: [--target=thumbv7em-unknown-none-eabihf, -mfpu=fpv4-sp-d16]
 
 - Dir: arm-none-eabi/thumb/v7e-m/fpv5_d16
-  Flags: [--target=thumbv7em-none-unknown-eabihf, -mfpu=fpv5-d16]
+  Flags: [--target=thumbv7em-unknown-none-eabihf, -mfpu=fpv5-d16]
 
 - Dir: arm-none-eabi/thumb/v8-m.main/fp
-  Flags: [--target=thumbv8m.main-none-unknown-eabihf, -mfpu=fpv5-d16]
+  Flags: [--target=thumbv8m.main-unknown-none-eabihf, -mfpu=fpv5-d16]
 
 - Dir: arm-none-eabi/thumb/v8.1-m.main/fp
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabihf, -mfpu=fp-armv8-fullfp16-sp-d16]
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabihf, -mfpu=fp-armv8-fullfp16-sp-d16]
 
 - Dir: arm-none-eabi/thumb/v8.1-m.main/nofp/mve
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabihf, -march=thumbv8.1m.main+mve, -mfpu=none]
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabihf, -march=thumbv8.1m.main+mve, -mfpu=none]
 
 
 # The second section of the file is a map from auto-detected flags
@@ -126,17 +126,17 @@ Variants:
 # All flags in the "Flags" list will be added if an argument matches.
 Mappings:
 # For v8m.base (and potential later v8m baseline versions) use v6m
-- Match: --target=thumbv8(\.[0-9]+)?m\.base-none-unknown-eabi
-  Flags: [--target=thumbv6m-none-unknown-eabi]
+- Match: --target=thumbv8(\.[0-9]+)?m\.base-unknown-none-eabi
+  Flags: [--target=thumbv6m-unknown-none-eabi]
 # Match versions after v8.1m.main. We assume that v8.2m (if/when it exists) will
 # be backwards compatible with v8.1m.
 # The alternative is to not recognise later versions, and require that
 # this multilib spec is updated before it can be used with newer
 # architecture versions.
-- Match: --target=thumbv8\.[1-9]m\.main-none-unknown-eabi
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabi]
-- Match: --target=thumbv8\.[1-9]m\.main-none-unknown-eabihf
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabihf]
+- Match: --target=thumbv8\.[1-9]m\.main-unknown-none-eabi
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabi]
+- Match: --target=thumbv8\.[1-9]m\.main-unknown-none-eabihf
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabihf]
 
 - Match: -march=thumbv8\.[1-9]m\.main.*\+mve($|\+).*
   Flags: [-march=thumbv8.1m.main+mve]
diff --git a/clang/test/Driver/baremetal-sysroot.cpp b/clang/test/Driver/baremetal-sysroot.cpp
index bbc608809d0e48..18654be33b87c9 100644
--- a/clang/test/Driver/baremetal-sysroot.cpp
+++ b/clang/test/Driver/baremetal-sysroot.cpp
@@ -12,7 +12,7 @@
 // RUN: %T/baremetal_default_sysroot/bin/clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:     -target armv6m-none-eabi --sysroot= \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-C %s
-// CHECK-V6M-C: "{{.*}}clang{{.*}}" "-cc1" "-triple" "thumbv6m-none-unknown-eabi"
+// CHECK-V6M-C: "{{.*}}clang{{.*}}" "-cc1" "-triple" "thumbv6m-unknown-none-eabi"
 // CHECK-V6M-C-SAME: "-internal-isystem" "{{.*}}/baremetal_default_sysroot{{[/\\]+}}bin{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}armv6m-none-eabi{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
 // CHECk-V6M-C-SAME: "-internal-isystem" "{{.*}}/baremetal_default_sysroot{{[/\\]+}}bin{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}armv6m-none-eabi{{[/\\]+}}include"
 // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal-sysroot.cpp"
diff --git a/clang/test/Driver/baremetal.cpp b/clang/test/Driver/baremetal.cpp
index 657611bb3f38de..cc14f045df3f9a 100644
--- a/clang/test/Driver/baremetal.cpp
+++ b/clang/test/Driver/baremetal.cpp
@@ -9,7 +9,7 @@
 // RUN:     -L some/directory/user/asked/for \
 // RUN:     --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-C %s
-// CHECK-V6M-C:      "-cc1" "-triple" "thumbv6m-none-unknown-eabi"
+// CHECK-V6M-C:      "-cc1" "-triple" "thumbv6m-unknown-none-eabi"
 // CHECK-V6M-C-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
 // CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
diff --git a/clang/test/Driver/print-multi-selection-flags.c b/clang/test/Driver/print-multi-selection-flags.c
index 06a12db9d97792..9f58d1b557fd74 100644
--- a/clang/test/Driver/print-multi-selection-flags.c
+++ b/clang/test/Driver/print-multi-selection-flags.c
@@ -5,27 +5,27 @@
 // CHECK-FUCHSIA: --target=aarch64-unknown-fuchsia
 
 // RUN: %clang -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=soft -fno-exceptions -fno-rtti | FileCheck --check-prefix=CHECK-ARMV4T %s
-// CHECK-ARMV4T: --target=armv4t-none-unknown-eabi
+// CHECK-ARMV4T: --target=armv4t-unknown-none-eabi
 // CHECK-ARMV4T: -mfloat-abi=soft
 // CHECK-ARMV4T: -mfpu=none
 
 // RUN: %clang -print-multi-flags-experimental --target=armv7em-none-eabi -mfloat-abi=softfp | FileCheck --check-prefix=CHECK-SOFTFP %s
-// CHECK-SOFTFP: --target=thumbv7em-none-unknown-eabi
+// CHECK-SOFTFP: --target=thumbv7em-unknown-none-eabi
 // CHECK-SOFTFP: -mfloat-abi=softfp
 // CHECK-SOFTFP: -mfpu=fpv4-sp-d16
 
 // RUN: %clang -print-multi-flags-experimental --target=arm-none-eabihf -march=armv7em -mfpu=fpv5-d16 | FileCheck --check-prefix=CHECK-HARD %s
-// CHECK-HARD: --target=thumbv7em-none-unknown-eabihf
+// CHECK-HARD: --target=thumbv7em-unknown-none-eabihf
 // CHECK-HARD: -mfloat-abi=hard
 // CHECK-HARD: -mfpu=fpv5-d16
 
 // RUN: %clang -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=soft -march=armv8-m.main+nofp | FileCheck --check-prefix=CHECK-V8MMAIN-NOFP %s
-// CHECK-V8MMAIN-NOFP: --target=thumbv8m.main-none-unknown-eabi
+// CHECK-V8MMAIN-NOFP: --target=thumbv8m.main-unknown-none-eabi
 // CHECK-V8MMAIN-NOFP: -mfloat-abi=soft
 // CHECK-V8MMAIN-NOFP: -mfpu=none
 
 // RUN: %clang -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=hard -march=armv8.1m.main+mve.fp | FileCheck --check-prefix=CHECK-MVE %s
-// CHECK-MVE: --target=thumbv8.1m.main-none-unknown-eabihf
+// CHECK-MVE: --target=thumbv8.1m.main-unknown-none-eabihf
 // CHECK-MVE: -march=thumbv8.1m.main{{.*}}+mve{{.*}}+mve.fp{{.*}}
 // CHECK-MVE: -mfloat-abi=hard
 // CHECK-MVE: -mfpu=fp-armv8-fullfp16-sp-d16
@@ -51,10 +51,10 @@
 // CHECK-M85_NO_FP_DP: -mfpu=fp-armv8-fullfp16-sp-d16
 
 // RUN: %clang -print-multi-flags-experimental --target=aarch64-none-elf -march=armv8-a+lse | FileCheck --check-prefix=CHECK-LSE %s
-// CHECK-LSE: --target=aarch64-none-unknown-elf
+// CHECK-LSE: --target=aarch64-unknown-none-elf
 // CHECK-LSE: -march=armv8-a{{.*}}+lse{{.*}}
 
 // RUN: %clang -print-multi-flags-experimental --target=aarch64-none-elf -march=armv8.5-a+sve+sve2 | FileCheck --check-prefix=CHECK-SVE2 %s
 // RUN: %clang -print-multi-flags-experimental --target=aarch64-none-elf -march=armv9-a            | FileCheck --check-prefix=CHECK-SVE2 %s
-// CHECK-SVE2: --target=aarch64-none-unknown-elf
+// CHECK-SVE2: --target=aarch64-unknown-none-elf
 // CHECK-SVE2: -march=armv{{.*}}-a{{.*}}+simd{{.*}}+sve{{.*}}+sve2{{.*}}
diff --git a/clang/test/Driver/program-path-priority.c b/clang/test/Driver/program-path-priority.c
index c940c4ced94420..d1dd8bb8522fba 100644
--- a/clang/test/Driver/program-path-priority.c
+++ b/clang/test/Driver/program-path-priority.c
@@ -36,7 +36,7 @@
 // RUN: touch %t/notreal-none-elf-gcc && chmod +x %t/notreal-none-elf-gcc
 // RUN: env "PATH=" %t/clang -### -target notreal-none-elf %s 2>&1 | \
 // RUN:   FileCheck --check-prefix=PROG_PATH_NOTREAL_GCC %s
-// PROG_PATH_NOTREAL_GCC: notreal-none-unknown-elf
+// PROG_PATH_NOTREAL_GCC: notreal-unknown-none-elf
 
 /// <triple>-gcc on the PATH is found
 // RUN: mkdir -p %t/env
@@ -57,7 +57,7 @@
 // RUN: touch %t/gcc && chmod +x %t/gcc
 // RUN: env "PATH=" %t/clang -### -target notreal-none-elf %s 2>&1 | \
 // RUN:   FileCheck --check-prefix=NOTREAL_GCC_PREFERRED %s
-// NOTREAL_GCC_PREFERRED: notreal-none-unknown-elf"
+// NOTREAL_GCC_PREFERRED: notreal-unknown-none-elf"
 // NOTREAL_GCC_PREFERRED-NOT: /gcc"
 
 /// <triple>-gcc on the PATH is preferred to gcc in program path
diff --git a/clang/test/Preprocessor/init-arm.c b/clang/test/Preprocessor/init-arm.c
index 6e3acacc5c3a52..dd1c21e3c04b1e 100644
--- a/clang/test/Preprocessor/init-arm.c
+++ b/clang/test/Preprocessor/init-arm.c
@@ -1443,8 +1443,8 @@
 
 // THUMB-MINGW:#define __ARM_DWARF_EH__ 1
 
-// RUN: %clang_cc1 -E -dM -ffreestanding -triple=thumbv6m-none-unknown-eabi < /dev/null | FileCheck -match-full-lines -check-prefix Thumbv6m-elf %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=thumbv6m-unknown-none-eabi < /dev/null | FileCheck -match-full-lines -check-prefix Thumbv6m-elf %s
 // Thumbv6m-elf: #define __ELF__ 1
 
-// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=thumbv6m-none-unknown-eabi < /dev/null | FileCheck -match-full-lines -check-prefix Thumbv6m-cxx %s
+// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=thumbv6m-unknown-none-eabi < /dev/null | FileCheck -match-full-lines -check-prefix Thumbv6m-cxx %s
 // Thumbv6m-cxx: #define _GNU_SOURCE 1
diff --git a/clang/unittests/Driver/MultilibTest.cpp b/clang/unittests/Driver/MultilibTest.cpp
index ed9ac58cecd7b2..a90df3f8893d51 100644
--- a/clang/unittests/Driver/MultilibTest.cpp
+++ b/clang/unittests/Driver/MultilibTest.cpp
@@ -449,42 +449,42 @@ TEST(MultilibTest, SelectMClass) {
   const char *MultilibSpec = YAML_PREAMBLE R"(
 Variants:
 - Dir: thumb/v6-m/nofp
-  Flags: [--target=thumbv6m-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv6m-unknown-none-eabi, -mfpu=none]
 
 - Dir: thumb/v7-m/nofp
-  Flags: [--target=thumbv7m-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv7m-unknown-none-eabi, -mfpu=none]
 
 - Dir: thumb/v7e-m/nofp
-  Flags: [--target=thumbv7em-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv7em-unknown-none-eabi, -mfpu=none]
 
 - Dir: thumb/v8-m.main/nofp
-  Flags: [--target=thumbv8m.main-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv8m.main-unknown-none-eabi, -mfpu=none]
 
 - Dir: thumb/v8.1-m.main/nofp/nomve
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabi, -mfpu=none]
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabi, -mfpu=none]
 
 - Dir: thumb/v7e-m/fpv4_sp_d16
-  Flags: [--target=thumbv7em-none-unknown-eabihf, -mfpu=fpv4-sp-d16]
+  Flags: [--target=thumbv7em-unknown-none-eabihf, -mfpu=fpv4-sp-d16]
 
 - Dir: thumb/v7e-m/fpv5_d16
-  Flags: [--target=thumbv7em-none-unknown-eabihf, -mfpu=fpv5-d16]
+  Flags: [--target=thumbv7em-unknown-none-eabihf, -mfpu=fpv5-d16]
 
 - Dir: thumb/v8-m.main/fp
-  Flags: [--target=thumbv8m.main-none-unknown-eabihf]
+  Flags: [--target=thumbv8m.main-unknown-none-eabihf]
 
 - Dir: thumb/v8.1-m.main/fp
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabihf]
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabihf]
 
 - Dir: thumb/v8.1-m.main/nofp/mve
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabihf, -march=thumbv8.1m.main+mve]
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabihf, -march=thumbv8.1m.main+mve]
 
 Mappings:
-- Match: --target=thumbv8(\.[0-9]+)?m\.base-none-unknown-eabi
-  Flags: [--target=thumbv6m-none-unknown-eabi]
-- Match: -target=thumbv8\.[1-9]m\.main-none-unknown-eabi
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabi]
-- Match: -target=thumbv8\.[1-9]m\.main-none-unknown-eabihf
-  Flags: [--target=thumbv8.1m.main-none-unknown-eabihf]
+- Match: --target=thumbv8(\.[0-9]+)?m\.base-unknown-none-eabi
+  Flags: [--target=thumbv6m-unknown-none-eabi]
+- Match: -target=thumbv8\.[1-9]m\.main-unknown-none-eabi
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabi]
+- Match: -target=thumbv8\.[1-9]m\.main-unknown-none-eabihf
+  Flags: [--target=thumbv8.1m.main-unknown-none-eabihf]
 - Match: -march=thumbv8\.[1-9]m\.main.*\+mve($|\+).*
   Flags: [-march=thumbv8.1m.main+mve]
 )";
@@ -493,44 +493,44 @@ TEST(MultilibTest, SelectMClass) {
   llvm::SmallVector<Multilib> Selected;
   ASSERT_TRUE(parseYaml(MS, MultilibSpec));
 
-  ASSERT_TRUE(MS.select({"--target=thumbv6m-none-unknown-eabi", "-mfpu=none"},
+  ASSERT_TRUE(MS.select({"--target=thumbv6m-unknown-none-eabi", "-mfpu=none"},
                         Selected));
   EXPECT_EQ("/thumb/v6-m/nofp", Selected.back().gccSuffix());
 
-  ASSERT_TRUE(MS.select({"--target=thumbv7m-none-unknown-eabi", "-mfpu=none"},
+  ASSERT_TRUE(MS.select({"--target=thumbv7m-unknown-none-eabi", "-mfpu=none"},
                         Selected));
   EXPECT_EQ("/thumb/v7-m/nofp", Selected.back().gccSuffix());
 
-  ASSERT_TRUE(MS.select({"--target=thumbv7em-none-unknown-eabi", "-mfpu=none"},
+  ASSERT_TRUE(MS.select({"--target=thumbv7em-unknown-none-eabi", "-mfpu=none"},
                         Selected));
   EXPECT_EQ("/thumb/v7e-m/nofp", Selected.back().gccSuffix());
 
   ASSERT_TRUE(MS.select(
-      {"--target=thumbv8m.main-none-unknown-eabi", "-mfpu=none"}, Selected));
+      {"--target=thumbv8m.main-unknown-none-eabi", "-mfpu=none"}, Selected));
   EXPECT_EQ("/thumb/v8-m.main/nofp", Selected.back().gccSuffix());
 
   ASSERT_TRUE(MS.select(
-      {"--target=thumbv8.1m.main-none-unknown-eabi", "-mfpu=none"}, Selected));
+      {"--target=thumbv8.1m.main-unknown-none-eabi", "-mfpu=none"}, Selected));
   EXPECT_EQ("/thumb/v8.1-m.main/nofp/nomve", Selected.back().gccSuffix());
 
   ASSERT_TRUE(
-      MS.select({"--target=thumbv7em-none-unknown-eabihf", "-mfpu=fpv4-sp-d16"},
+      MS.select({"--target=thumbv7em-unknown-none-eabihf", "-mfpu=fpv4-sp-d16"},
                 Selected));
   EXPECT_EQ("/thumb/v7e-m/fpv4_sp_d16", Selected.back().gccSuffix());
 
   ASSERT_TRUE(MS.select(
-      {"--target=thumbv7em-none-unknown-eabihf", "-mfpu=fpv5-d16"}, Selected));
+      {"--target=thumbv7em-unknown-none-eabihf", "-mfpu=fpv5-d16"}, Selected));
   EXPECT_EQ("/thumb/v7e-m/fpv5_d16", Selected.back().gccSuffix());
 
   ASSERT_TRUE(
-      MS.select({"--target=thumbv8m.main-none-unknown-eabihf"}, Selected));
+      MS.select({"--target=thumbv8m.main-unknown-none-eabihf"}, Selected));
   EXPECT_EQ("/thumb/v8-m.main/fp", Selected.back().gccSuffix());
 
   ASSERT_TRUE(
-      MS.select({"--target=thumbv8.1m.main-none-unknown-eabihf"}, Selected));
+      MS.select({"--target=thumbv8.1m.main-unknown-none-eabihf"}, Selected));
   EXPECT_EQ("/thumb/v8.1-m.main/fp", Selected.back().gccSuffix());
 
-  ASSERT_TRUE(MS.select({"--target=thumbv8.1m.main-none-unknown-eabihf",
+  ASSERT_TRUE(MS.select({"--target=thumbv8.1m.main-unknown-none-eabihf",
                          "-mfpu=none", "-march=thumbv8.1m.main+dsp+mve"},
                         Selected));
   EXPECT_EQ("/thumb/v8.1-m.main/nofp/mve", Selected.back().gccSuffix());
diff --git a/clang/unittests/Interpreter/IncrementalCompilerBuilderTest.cpp b/clang/unittests/Interpreter/IncrementalCompilerBuilderTest.cpp
index f729566f7efde6..c4a40071f55cf8 100644
--- a/clang/unittests/Interpreter/IncrementalCompilerBuilderTest.cpp
+++ b/clang/unittests/Interpreter/IncrementalCompilerBuilderTest.cpp
@@ -40,7 +40,7 @@ TEST(IncrementalCompilerBuilder, SetTargetTriple) {
   auto CB = clang::IncrementalCompilerBuilder();
   CB.SetTargetTriple("armv6-none-eabi");
   auto CI = cantFail(CB.CreateCpp());
-  EXPECT_EQ(CI->getTargetOpts().Triple, "armv6-none-unknown-eabi");
+  EXPECT_EQ(CI->getTargetOpts().Triple, "armv6-unknown-none-eabi");
   cleanupRemappedFileBuffers(*CI);
 }
 
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 60307a7d4f350a..3523a29e4f4613 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -217,7 +217,7 @@ function test-armv7m-picolibc() {
         "${@}"
 
     ${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
-    mv "${BUILD_DIR}/install/lib/armv7m-none-unknown-eabi"/* "${BUILD_DIR}/install/lib"
+    mv "${BUILD_DIR}/install/lib/armv7m-unknown-none-eabi"/* "${BUILD_DIR}/install/lib"
 
     check-runtimes
 }
diff --git a/lld/test/ELF/lto/arm.ll b/lld/test/ELF/lto/arm.ll
index 5860262ac8bf90..2908b0ea2f063d 100644
--- a/lld/test/ELF/lto/arm.ll
+++ b/lld/test/ELF/lto/arm.ll
@@ -41,7 +41,7 @@ define void @_start() {
 
 ;--- thumb.ll
 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "thumbv8m.base-none-unknown-gnueabi"
+target triple = "thumbv8m.base-unknown-none-gnueabi"
 
 define void @_start() {
   ret void
@@ -57,7 +57,7 @@ define void @_start() {
 
 ;--- thumbeb.ll
 target datalayout = "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "thumbebv8m.base-none-unknown-gnueabi"
+target triple = "thumbebv8m.base-unknown-none-gnueabi"
 
 define void @_start() {
   ret void
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index 77fdf31d4865c0..07f3df4145dad4 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -1149,6 +1149,13 @@ std::string Triple::normalize(StringRef Str) {
     }
   }
 
+  // For 3-component triples, the middle component is used to set Vendor;
+  // while if it is "none", we'd prefer to set OS.
+  // This is for some baremetal cases, such as "arm-none-elf".
+  if (Found[0] && !Found[1] && !Found[2] && Found[3] &&
+      Components[1].equals("none") && Components[2].empty())
+    std::swap(Components[1], Components[2]);
+
   // Replace empty components with "unknown" value.
   for (StringRef &C : Components)
     if (C.empty())
diff --git a/llvm/test/CodeGen/ARM/machine-sink-multidef.mir b/llvm/test/CodeGen/ARM/machine-sink-multidef.mir
index 737ca824265d6b..b71de8440d6139 100644
--- a/llvm/test/CodeGen/ARM/machine-sink-multidef.mir
+++ b/llvm/test/CodeGen/ARM/machine-sink-multidef.mir
@@ -3,7 +3,7 @@
 
 --- |
   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-  target triple = "arm-none-unknown-eabi"
+  target triple = "arm-unknown-none-eabi"
 
   %struct.anon = type { i32, i32 }
 
diff --git a/llvm/test/CodeGen/ARM/store-prepostinc.mir b/llvm/test/CodeGen/ARM/store-prepostinc.mir
index 5d76f9b24168ad..7f273b5526f764 100644
--- a/llvm/test/CodeGen/ARM/store-prepostinc.mir
+++ b/llvm/test/CodeGen/ARM/store-prepostinc.mir
@@ -3,7 +3,7 @@
 
 --- |
   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-  target triple = "thumbv7a-none-unknown-eabi"
+  target triple = "thumbv7a-unknown-none-eabi"
 
   define ptr @STR_pre4(ptr %p, i32 %v) { unreachable }
   define ptr @STR_pre8(ptr %p, i32 %v) { unreachable }
diff --git a/llvm/test/CodeGen/ARM/unschedule-reg-sequence.ll b/llvm/test/CodeGen/ARM/unschedule-reg-sequence.ll
index 37ba34e1699dce..c8729dbff486b7 100644
--- a/llvm/test/CodeGen/ARM/unschedule-reg-sequence.ll
+++ b/llvm/test/CodeGen/ARM/unschedule-reg-sequence.ll
@@ -2,7 +2,7 @@
 ; Regression test for https://github.com/llvm/llvm-project/issues/58911
 
 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "armv7-none-unknown-eabi"
+target triple = "armv7-unknown-none-eabi"
 
 @a = dso_local global i64 0, align 8
 @d = dso_local local_unnamed_addr global i32 0, align 4
diff --git a/llvm/test/CodeGen/Thumb/consthoist-few-dependents.ll b/llvm/test/CodeGen/Thumb/consthoist-few-dependents.ll
index 30f990f9bc5690..30e96170442115 100644
--- a/llvm/test/CodeGen/Thumb/consthoist-few-dependents.ll
+++ b/llvm/test/CodeGen/Thumb/consthoist-few-dependents.ll
@@ -6,7 +6,7 @@
 ; RUN: llc -consthoist-min-num-to-rebase=2 %s -o - | FileCheck %s --check-prefix=LLC
 
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "thumbv6m-none-unknown-musleabi"
+target triple = "thumbv6m-unknown-none-musleabi"
 
 ; Test that constant 0 and 1 of i1 type is NOT hoisted due low
 ; materializing cost.
diff --git a/llvm/test/CodeGen/Thumb/consthoist-imm8-costs-1.ll b/llvm/test/CodeGen/Thumb/consthoist-imm8-costs-1.ll
index caf7b3bcdd9f38..19efc4a9a5015b 100644
--- a/llvm/test/CodeGen/Thumb/consthoist-imm8-costs-1.ll
+++ b/llvm/test/CodeGen/Thumb/consthoist-imm8-costs-1.ll
@@ -1,7 +1,7 @@
 ; RUN: llc %s -o - | FileCheck %s
 
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "thumbv6m-none-unknown-musleabi"
+target triple = "thumbv6m-unknown-none-musleabi"
 
 @a = global i8 undef, align 4
 
diff --git a/llvm/test/CodeGen/Thumb/pr42760.ll b/llvm/test/CodeGen/Thumb/pr42760.ll
index fc9a18bb33420f..8d2191405663a0 100644
--- a/llvm/test/CodeGen/Thumb/pr42760.ll
+++ b/llvm/test/CodeGen/Thumb/pr42760.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -mtriple=thumbv6m-none-unknown-eabi -tail-dup-placement-threshold=3 < %s | FileCheck %s
+; RUN: llc -mtriple=thumbv6m-unknown-none-eabi -tail-dup-placement-threshold=3 < %s | FileCheck %s
 
 define hidden void @test() {
 ; CHECK-LABEL: test:
diff --git a/llvm/test/CodeGen/Thumb/smul_fix.ll b/llvm/test/CodeGen/Thumb/smul_fix.ll
index 52f241802b87e3..fca4c3b1529d3e 100644
--- a/llvm/test/CodeGen/Thumb/smul_fix.ll
+++ b/llvm/test/CodeGen/Thumb/smul_fix.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=thumbv6m-none-unknown-eabi -mcpu=cortex-m0 | FileCheck %s --check-prefix=ARM
+; RUN: llc < %s -mtriple=thumbv6m-unknown-none-eabi -mcpu=cortex-m0 | FileCheck %s --check-prefix=ARM
 
 declare  i4  @llvm.smul.fix.i4   (i4,  i4, i32)
 declare  i32 @llvm.smul.fix.i32  (i32, i32, i32)
diff --git a/llvm/test/CodeGen/Thumb/smul_fix_sat.ll b/llvm/test/CodeGen/Thumb/smul_fix_sat.ll
index f8557419c41990..8a53fa542b16f4 100644
--- a/llvm/test/CodeGen/Thumb/smul_fix_sat.ll
+++ b/llvm/test/CodeGen/Thumb/smul_fix_sat.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=thumbv6m-none-unknown-eabi -mcpu=cortex-m0 | FileCheck %s --check-prefix=ARM
+; RUN: llc < %s -mtriple=thumbv6m-unknown-none-eabi -mcpu=cortex-m0 | FileCheck %s --check-prefix=ARM
 
 declare  i4  @llvm.smul.fix.sat.i4   (i4,  i4, i32)
 declare  i32 @llvm.smul.fix.sat.i32  (i32, i32, i32)
diff --git a/llvm/test/CodeGen/Thumb/umul_fix.ll b/llvm/test/CodeGen/Thumb/umul_fix.ll
index 7af5775c61d7bf..9d8d62f2bb1a3a 100644
--- a/llvm/test/CodeGen/Thumb/umul_fix.ll
+++ b/llvm/test/CodeGen/Thumb/umul_fix.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=thumbv6m-none-unknown-eabi -mcpu=cortex-m0 | FileCheck %s --check-prefix=ARM
+; RUN: llc < %s -mtriple=thumbv6m-unknown-none-eabi -mcpu=cortex-m0 | FileCheck %s --check-prefix=ARM
 
 declare  i4  @llvm.umul.fix.i4   (i4,  i4, i32)
 declare  i32 @llvm.umul.fix.i32  (i32, i32, i32)
diff --git a/llvm/test/CodeGen/Thumb/umul_fix_sat.ll b/llvm/test/CodeGen/Thumb/umul_fix_sat.ll
index fa88024315211b..5e4c506114822f 100644
--- a/llvm/test/CodeGen/Thumb/umul_fix_sat.ll
+++ b/llvm/test/CodeGen/Thumb/umul_fix_sat.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=thumbv6m-none-unknown-eabi -mcpu=cortex-m0 | FileCheck %s --check-prefix=ARM
+; RUN: llc < %s -mtriple=thumbv6m-unknown-none-eabi -mcpu=cortex-m0 | FileCheck %s --check-prefix=ARM
 
 declare  i4  @llvm.umul.fix.sat.i4   (i4,  i4, i32)
 declare  i32 @llvm.umul.fix.sat.i32  (i32, i32, i32)
diff --git a/llvm/test/CodeGen/Thumb2/LowOverheadLoops/spillingmove.mir b/llvm/test/CodeGen/Thumb2/LowOverheadLoops/spillingmove.mir
index 15aa62d5cff6b5..de377b1f0a1a10 100644
--- a/llvm/test/CodeGen/Thumb2/LowOverheadLoops/spillingmove.mir
+++ b/llvm/test/CodeGen/Thumb2/LowOverheadLoops/spillingmove.mir
@@ -1,5 +1,5 @@
 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
-# RUN: llc -mtriple=thumbv8.1m.main-none-unknown-eabi -mattr=+mve -run-pass=arm-low-overhead-loops -arm-enable-subreg-liveness %s -o - --verify-machineinstrs | FileCheck %s
+# RUN: llc -mtriple=thumbv8.1m.main-unknown-none-eabi -mattr=+mve -run-pass=arm-low-overhead-loops -arm-enable-subreg-liveness %s -o - --verify-machineinstrs | FileCheck %s
 
 --- |
   %struct.arm_2d_size_t = type { i16, i16 }
diff --git a/llvm/test/CodeGen/Thumb2/LowOverheadLoops/wls-search-pred.mir b/llvm/test/CodeGen/Thumb2/LowOverheadLoops/wls-search-pred.mir
index d87f014dc8a84d..deb35eff83eb90 100644
--- a/llvm/test/CodeGen/Thumb2/LowOverheadLoops/wls-search-pred.mir
+++ b/llvm/test/CodeGen/Thumb2/LowOverheadLoops/wls-search-pred.mir
@@ -3,7 +3,7 @@
 
 --- |
   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-  target triple = "thumbv8.1m.main-none-unknown-eabihf"
+  target triple = "thumbv8.1m.main-unknown-none-eabihf"
 
   define void @test_memset_preheader(ptr %x, ptr %y, i32 %n) {
   entry:
diff --git a/llvm/test/CodeGen/Thumb2/high-reg-spill.mir b/llvm/test/CodeGen/Thumb2/high-reg-spill.mir
index 1cf58da63fe831..9057ab93e2a9f5 100644
--- a/llvm/test/CodeGen/Thumb2/high-reg-spill.mir
+++ b/llvm/test/CodeGen/Thumb2/high-reg-spill.mir
@@ -15,7 +15,7 @@
   ; ModuleID = 'test.ll'
   source_filename = "test.c"
   target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-  target triple = "thumbv7m-none-unknown-eabi"
+  target triple = "thumbv7m-unknown-none-eabi"
 
   define dso_local void @constraint_h() {
   entry:
diff --git a/llvm/test/CodeGen/Thumb2/mve-pred-constfold.mir b/llvm/test/CodeGen/Thumb2/mve-pred-constfold.mir
index 31eef0fe8d34fe..df7152931d7c28 100644
--- a/llvm/test/CodeGen/Thumb2/mve-pred-constfold.mir
+++ b/llvm/test/CodeGen/Thumb2/mve-pred-constfold.mir
@@ -3,7 +3,7 @@
 
 --- |
   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-  target triple = "thumbv8.1m.main-none-unknown-eabi"
+  target triple = "thumbv8.1m.main-unknown-none-eabi"
 
   define arm_aapcs_vfpcc void @reg(<8 x i16> %acc0, <8 x i16> %acc1, ptr nocapture %px, i16 signext %p0) #0 {
   entry:
diff --git a/llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir b/llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir
index ce42722215b884..8dea62fe8ec3e8 100644
--- a/llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir
+++ b/llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir
@@ -3,7 +3,7 @@
 
 --- |
   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-  target triple = "thumbv8.1m.main-none-unknown-eabihf"
+  target triple = "thumbv8.1m.main-unknown-none-eabihf"
 
   define <4 x i32> @test(<4 x i32> %x, <4 x i32> %y, <4 x i32> %z) #0 !dbg !5 {
   entry:
diff --git a/llvm/test/CodeGen/Thumb2/pipeliner-preserve-ties.mir b/llvm/test/CodeGen/Thumb2/pipeliner-preserve-ties.mir
index 08f08c41917b1a..eff21a76afe8b8 100644
--- a/llvm/test/CodeGen/Thumb2/pipeliner-preserve-ties.mir
+++ b/llvm/test/CodeGen/Thumb2/pipeliner-preserve-ties.mir
@@ -5,7 +5,7 @@
   ; ModuleID = 'test.ll'
   source_filename = "test.ll"
   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-  target triple = "thumbv7m-none-unknown-eabi"
+  target triple = "thumbv7m-unknown-none-eabi"
 
   %struct.bar = type { i16, i16, i16, i16, i16, i16, i16, i16 }
 
diff --git a/llvm/test/CodeGen/Thumb2/store-prepostinc.mir b/llvm/test/CodeGen/Thumb2/store-prepostinc.mir
index 18a47f7aee026d..204cea23610ec0 100644
--- a/llvm/test/CodeGen/Thumb2/store-prepostinc.mir
+++ b/llvm/test/CodeGen/Thumb2/store-prepostinc.mir
@@ -3,7 +3,7 @@
 
 --- |
   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-  target triple = "thumbv7m-none-unknown-eabi"
+  target triple = "thumbv7m-unknown-none-eabi"
 
   define ptr @STR_pre4(ptr %p, i32 %v) { unreachable }
   define ptr @STR_pre8(ptr %p, i32 %v) { unreachable }
diff --git a/llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll b/llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
index c8568272d320fb..585487eb595f36 100644
--- a/llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
+++ b/llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -O2 -S | FileCheck %s
 
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "armv4t-none-unknown-eabi"
+target triple = "armv4t-unknown-none-eabi"
 
 @foo.coefficient1 = internal unnamed_addr global ptr null, align 4, !dbg !0
 @iirLow1 = external dso_local local_unnamed_addr global ptr, align 4
diff --git a/llvm/test/Transforms/LoopVectorize/ARM/mve-hoist-runtime-checks.ll b/llvm/test/Transforms/LoopVectorize/ARM/mve-hoist-runtime-checks.ll
index 438321e0fb0ccb..a00ff76c10106d 100644
--- a/llvm/test/Transforms/LoopVectorize/ARM/mve-hoist-runtime-checks.ll
+++ b/llvm/test/Transforms/LoopVectorize/ARM/mve-hoist-runtime-checks.ll
@@ -5,7 +5,7 @@
 ; RUN: cat %t | FileCheck %s --check-prefix=DEBUG
 
 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
-target triple = "thumbv8.1m.main-none-unknown-eabi"
+target triple = "thumbv8.1m.main-unknown-none-eabi"
 
 ; Equivalent example in C:
 ; void diff_checks(int32_t *dst, int32_t *src, int m, int n) {
diff --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp
index 0fa7e769038905..b8f5fbd87407d3 100644
--- a/llvm/unittests/TargetParser/TripleTest.cpp
+++ b/llvm/unittests/TargetParser/TripleTest.cpp
@@ -1237,7 +1237,7 @@ TEST(TripleTest, Normalization) {
             Triple::normalize("i386-redhat-linux")); // i386-redhat-linux-gnu
   EXPECT_EQ("i686-unknown-linux",
             Triple::normalize("i686-linux")); // i686-pc-linux-gnu
-  EXPECT_EQ("arm-none-unknown-eabi",
+  EXPECT_EQ("arm-unknown-none-eabi",
             Triple::normalize("arm-none-eabi")); // arm-none-eabi
   EXPECT_EQ("ve-unknown-linux",
             Triple::normalize("ve-linux")); // ve-linux



More information about the libcxx-commits mailing list