[clang] [llvm] [RISCV] Add Hazard3 CPU (PR #102452)

Sam Elliott via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 16 08:36:16 PDT 2024


https://github.com/lenary updated https://github.com/llvm/llvm-project/pull/102452

>From 0e9579c91242fc63eb2cb686adc105fd248fef91 Mon Sep 17 00:00:00 2001
From: Sam Elliott <quic_aelliott at quicinc.com>
Date: Fri, 16 Aug 2024 07:52:53 -0700
Subject: [PATCH 1/2] [clang][test] Split invalid-cpu-note tests

This change does two kinds of splits:
- Splits each target into a different file. Some targets are left in the
  same files, such as riscv32/64 and x86/_64 as these tests and lists
  are very similar.
- Splits up the very long 'note:' lines which contain a list of CPUs,
  using `CHECK-SAME`. There was a note about this not being possible
  before, but with `--implicit-check-not`, this is now possible -- I
  have verified that this does the right thing if a single CPU anywhere
  in the list is left out.

These tests had become quite annoying to change when adding a CPU, and I
believe this change makes these easier to maintain, and should cut down
on conflicts in these files (or at least makes conflicts easier to
resolve).

I apologise in advance for downstream conflicts, but hopefully that's a
small amount of short term pain, in return for fewer conflicts in
future.
---
 clang/test/Misc/target-invalid-cpu-note.c     |  96 -----
 .../Misc/target-invalid-cpu-note/aarch64.c    |  90 +++++
 .../Misc/target-invalid-cpu-note/amdgcn.c     |  74 ++++
 clang/test/Misc/target-invalid-cpu-note/arm.c |  98 +++++
 clang/test/Misc/target-invalid-cpu-note/avr.c | 320 +++++++++++++++
 clang/test/Misc/target-invalid-cpu-note/bpf.c |  13 +
 .../Misc/target-invalid-cpu-note/hexagon.c    |  19 +
 .../test/Misc/target-invalid-cpu-note/lanai.c |   7 +
 .../test/Misc/target-invalid-cpu-note/mips.c  |  24 ++
 .../test/Misc/target-invalid-cpu-note/nvptx.c |  78 ++++
 .../Misc/target-invalid-cpu-note/powerpc.c    |  71 ++++
 .../test/Misc/target-invalid-cpu-note/r600.c  |  32 ++
 .../test/Misc/target-invalid-cpu-note/riscv.c |  89 ++++
 .../test/Misc/target-invalid-cpu-note/sparc.c |  52 +++
 .../Misc/target-invalid-cpu-note/systemz.c    |  20 +
 .../test/Misc/target-invalid-cpu-note/wasm.c  |   9 +
 clang/test/Misc/target-invalid-cpu-note/x86.c | 382 ++++++++++++++++++
 17 files changed, 1378 insertions(+), 96 deletions(-)
 delete mode 100644 clang/test/Misc/target-invalid-cpu-note.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/aarch64.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/amdgcn.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/arm.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/avr.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/bpf.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/hexagon.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/lanai.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/mips.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/nvptx.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/powerpc.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/r600.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/riscv.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/sparc.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/systemz.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/wasm.c
 create mode 100644 clang/test/Misc/target-invalid-cpu-note/x86.c

diff --git a/clang/test/Misc/target-invalid-cpu-note.c b/clang/test/Misc/target-invalid-cpu-note.c
deleted file mode 100644
index b1783f3917a350..00000000000000
--- a/clang/test/Misc/target-invalid-cpu-note.c
+++ /dev/null
@@ -1,96 +0,0 @@
-// Use CHECK-NEXT instead of multiple CHECK-SAME to ensure we will fail if there is anything extra in the output.
-// RUN: not %clang_cc1 -triple armv5--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix ARM
-// ARM: error: unknown target CPU 'not-a-cpu'
-// ARM-NEXT: note: valid target CPU values are: arm8, arm810, strongarm, strongarm110, strongarm1100, strongarm1110, arm7tdmi, arm7tdmi-s, arm710t, arm720t, arm9, arm9tdmi, arm920, arm920t, arm922t, arm940t, ep9312, arm10tdmi, arm1020t, arm9e, arm946e-s, arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1176jz-s, arm1176jzf-s, arm1156t2-s, arm1156t2f-s, cortex-m0, cortex-m0plus, cortex-m1, sc000, cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15, cortex-a17, krait, cortex-r4, cortex-r4f, cortex-r5, cortex-r7, cortex-r8, cortex-r52, cortex-r52plus, sc300, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33, cortex-m35p, cortex-m55, cortex-m85, cortex-m52, cortex-a32, cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c, cortex-a710, cortex-x1, cortex-x1c, neoverse-n1, neoverse-n2, neoverse-v1, cyclone, exynos-m3, exynos-m4, exynos-m5, kryo, iwmmxt, xscale, swift{{$}}
-
-// RUN: not %clang_cc1 -triple arm64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix AARCH64
-// AARCH64: error: unknown target CPU 'not-a-cpu'
-// AARCH64-NEXT: note: valid target CPU values are: a64fx, ampere1, ampere1a, ampere1b, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-a15, apple-a16, apple-a17, apple-a7, apple-a8, apple-a9, apple-m1, apple-m2, apple-m3, apple-m4, apple-s4, apple-s5, carmel, cobalt-100, cortex-a34, cortex-a35, cortex-a510, cortex-a520, cortex-a520ae, cortex-a53, cortex-a55, cortex-a57, cortex-a65, cortex-a65ae, cortex-a710, cortex-a715, cortex-a72, cortex-a720, cortex-a720ae, cortex-a725, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c, cortex-r82, cortex-r82ae, cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-x4, cortex-x925, cyclone, exynos-m3, exynos-m4, exynos-m5, falkor, generic, grace, kryo, neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-n3, neoverse-v1, neoverse-v2, neoverse-v3, neoverse-v3ae, oryon-1, saphira, thunderx, thunderx2t99, thunderx3t110, thunderxt81, thunderxt83, thunderxt88, tsv110{{$}}
-
-// RUN: not %clang_cc1 -triple arm64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_AARCH64
-// TUNE_AARCH64: error: unknown target CPU 'not-a-cpu'
-// TUNE_AARCH64-NEXT: note: valid target CPU values are: a64fx, ampere1, ampere1a, ampere1b, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-a15, apple-a16, apple-a17, apple-a7, apple-a8, apple-a9, apple-m1, apple-m2, apple-m3, apple-m4, apple-s4, apple-s5, carmel, cobalt-100, cortex-a34, cortex-a35, cortex-a510, cortex-a520, cortex-a520ae, cortex-a53, cortex-a55, cortex-a57, cortex-a65, cortex-a65ae, cortex-a710, cortex-a715, cortex-a72, cortex-a720, cortex-a720ae, cortex-a725, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c, cortex-r82, cortex-r82ae, cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-x4, cortex-x925, cyclone, exynos-m3, exynos-m4, exynos-m5, falkor, generic, grace, kryo, neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-n3, neoverse-v1, neoverse-v2, neoverse-v3, neoverse-v3ae, oryon-1, saphira, thunderx, thunderx2t99, thunderx3t110, thunderxt81, thunderxt83, thunderxt88, tsv110{{$}}
-
-// RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86
-// X86: error: unknown target CPU 'not-a-cpu'
-// X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}}
-
-// RUN: not %clang_cc1 -triple x86_64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86_64
-// X86_64: error: unknown target CPU 'not-a-cpu'
-// X86_64-NEXT: note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4{{$}}
-
-// RUN: not %clang_cc1 -triple i386--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86
-// TUNE_X86: error: unknown target CPU 'not-a-cpu'
-// TUNE_X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, geode{{$}}
-
-// RUN: not %clang_cc1 -triple x86_64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86_64
-// TUNE_X86_64: error: unknown target CPU 'not-a-cpu'
-// TUNE_X86_64-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, geode{{$}}
-
-// RUN: not %clang_cc1 -triple nvptx--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix NVPTX
-// NVPTX: error: unknown target CPU 'not-a-cpu'
-// NVPTX-NEXT: note: valid target CPU values are: sm_20, sm_21, sm_30, sm_32, sm_35, sm_37, sm_50, sm_52, sm_53, sm_60, sm_61, sm_62, sm_70, sm_72, sm_75, sm_80, sm_86, sm_87, sm_89, sm_90, sm_90a, gfx600, gfx601, gfx602, gfx700, gfx701, gfx702, gfx703, gfx704, gfx705, gfx801, gfx802, gfx803, gfx805, gfx810, gfx9-generic, gfx900, gfx902, gfx904, gfx906, gfx908, gfx909, gfx90a, gfx90c, gfx940, gfx941, gfx942, gfx10-1-generic, gfx1010, gfx1011, gfx1012, gfx1013, gfx10-3-generic, gfx1030, gfx1031, gfx1032, gfx1033, gfx1034, gfx1035, gfx1036, gfx11-generic, gfx1100, gfx1101, gfx1102, gfx1103, gfx1150, gfx1151, gfx1152, gfx12-generic, gfx1200, gfx1201, amdgcnspirv{{$}}
-
-// RUN: not %clang_cc1 -triple r600--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix R600
-// R600: error: unknown target CPU 'not-a-cpu'
-// R600-NEXT: note: valid target CPU values are: r600, rv630, rv635, r630, rs780, rs880, rv610, rv620, rv670, rv710, rv730, rv740, rv770, cedar, palm, cypress, hemlock, juniper, redwood, sumo, sumo2, barts, caicos, aruba, cayman, turks{{$}}
-
-// RUN: not %clang_cc1 -triple amdgcn--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix AMDGCN
-// AMDGCN: error: unknown target CPU 'not-a-cpu'
-// AMDGCN-NEXT: note: valid target CPU values are: gfx600, tahiti, gfx601, pitcairn, verde, gfx602, hainan, oland, gfx700, kaveri, gfx701, hawaii, gfx702, gfx703, kabini, mullins, gfx704, bonaire, gfx705, gfx801, carrizo, gfx802, iceland, tonga, gfx803, fiji, polaris10, polaris11, gfx805, tongapro, gfx810, stoney, gfx900, gfx902, gfx904, gfx906, gfx908, gfx909, gfx90a, gfx90c, gfx940, gfx941, gfx942, gfx1010, gfx1011, gfx1012, gfx1013, gfx1030, gfx1031, gfx1032, gfx1033, gfx1034, gfx1035, gfx1036, gfx1100, gfx1101, gfx1102, gfx1103, gfx1150, gfx1151, gfx1152, gfx1200, gfx1201, gfx9-generic, gfx10-1-generic, gfx10-3-generic, gfx11-generic, gfx12-generic{{$}}
-
-// RUN: not %clang_cc1 -triple wasm64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix WEBASM
-// WEBASM: error: unknown target CPU 'not-a-cpu'
-// WEBASM-NEXT: note: valid target CPU values are: mvp, bleeding-edge, generic{{$}}
-
-// RUN: not %clang_cc1 -triple systemz--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix SYSTEMZ
-// SYSTEMZ: error: unknown target CPU 'not-a-cpu'
-// SYSTEMZ-NEXT: note: valid target CPU values are: arch8, z10, arch9, z196, arch10, zEC12, arch11, z13, arch12, z14, arch13, z15, arch14, z16{{$}}
-
-// RUN: not %clang_cc1 -triple sparc--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix SPARC
-// SPARC: error: unknown target CPU 'not-a-cpu'
-// SPARC-NEXT: note: valid target CPU values are: v8, supersparc, sparclite, f934, hypersparc, sparclite86x, sparclet, tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, ma2100, ma2150, ma2155, ma2450, ma2455, ma2x5x, ma2080, ma2085, ma2480, ma2485, ma2x8x, leon2, at697e, at697f, leon3, ut699, gr712rc, leon4, gr740{{$}}
-
-// RUN: not %clang_cc1 -triple sparcv9--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix SPARCV9
-// SPARCV9: error: unknown target CPU 'not-a-cpu'
-// SPARCV9-NEXT: note: valid target CPU values are: v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4{{$}}
-
-// RUN: not %clang_cc1 -triple powerpc--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix PPC
-// PPC: error: unknown target CPU 'not-a-cpu'
-// PPC-NEXT: note: valid target CPU values are: generic, 440, 440fp, ppc440, 450, 601, 602, 603, 603e, 603ev, 604, 604e, 620, 630, g3, 7400, g4, 7450, g4+, 750, 8548, ppc405, ppc464, ppc476, 970, ppc970, g5, a2, ppca2, ppc-cell-be, e500, e500mc, e5500, power3, pwr3, pwr4, power4, pwr5, power5, pwr5+, power5+, pwr5x, power5x, pwr6, power6, pwr6x, power6x, pwr7, power7, pwr8, power8, pwr9, power9, pwr10, power10, pwr11, power11, powerpc, ppc, ppc32, powerpc64, ppc64, powerpc64le, ppc64le, future{{$}}
-
-// RUN: not %clang_cc1 -triple mips--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix MIPS
-// MIPS: error: unknown target CPU 'not-a-cpu'
-// MIPS-NEXT: note: valid target CPU values are: mips1, mips2, mips3, mips4, mips5, mips32, mips32r2, mips32r3, mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5, mips64r6, octeon, octeon+, p5600{{$}}
-
-// RUN: not %clang_cc1 -triple lanai--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix LANAI
-// LANAI: error: unknown target CPU 'not-a-cpu'
-// LANAI-NEXT: note: valid target CPU values are: v11{{$}}
-
-// RUN: not %clang_cc1 -triple hexagon--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix HEXAGON
-// HEXAGON: error: unknown target CPU 'not-a-cpu'
-// HEXAGON-NEXT: note: valid target CPU values are: hexagonv5, hexagonv55, hexagonv60, hexagonv62, hexagonv65, hexagonv66, hexagonv67, hexagonv67t, hexagonv68, hexagonv69, hexagonv71, hexagonv71t, hexagonv73{{$}}
-
-// RUN: not %clang_cc1 -triple bpf--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix BPF
-// BPF: error: unknown target CPU 'not-a-cpu'
-// BPF-NEXT: note: valid target CPU values are: generic, v1, v2, v3, v4, probe{{$}}
-
-// RUN: not %clang_cc1 -triple avr--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix AVR
-// AVR: error: unknown target CPU 'not-a-cpu'
-// AVR-NEXT: note: valid target CPU values are: avr1, at90s1200, attiny11, attiny12, attiny15, attiny28, avr2, at90s2313, at90s2323, at90s2333, at90s2343, attiny22, attiny26, at86rf401, at90s4414, at90s4433, at90s4434, at90s8515, at90c8534, at90s8535, avr25, ata5272, ata6616c, attiny13, attiny13a, attiny2313, attiny2313a, attiny24, attiny24a, attiny4313, attiny44, attiny44a, attiny84, attiny84a, attiny25, attiny45, attiny85, attiny261, attiny261a, attiny441, attiny461, attiny461a, attiny841, attiny861, attiny861a, attiny87, attiny43u, attiny48, attiny88, attiny828, avr3, at43usb355, at76c711, avr31, atmega103, at43usb320, avr35, attiny167, at90usb82, at90usb162, ata5505, ata6617c, ata664251, atmega8u2, atmega16u2, atmega32u2, attiny1634, avr4, atmega8, ata6289, atmega8a, ata6285, ata6286, ata6612c, atmega48, atmega48a, atmega48pa, atmega48pb, atmega48p, atmega88, atmega88a, atmega88p, atmega88pa, atmega88pb, atmega8515, atmega8535, atmega8hva, at90pwm1, at90pwm2, at90pwm2b, at90pwm3, at90pwm3b, at90pwm81, avr5, ata5702m322, ata5782, ata5790, ata5790n, ata5791, ata5795, ata5831, ata6613c, ata6614q, ata8210, ata8510, atmega16, atmega16a, atmega161, atmega162, atmega163, atmega164a, atmega164p, atmega164pa, atmega165, atmega165a, atmega165p, atmega165pa, atmega168, atmega168a, atmega168p, atmega168pa, atmega168pb, atmega169, atmega169a, atmega169p, atmega169pa, atmega32, atmega32a, atmega323, atmega324a, atmega324p, atmega324pa, atmega324pb, atmega325, atmega325a, atmega325p, atmega325pa, atmega3250, atmega3250a, atmega3250p, atmega3250pa, atmega328, atmega328p, atmega328pb, atmega329, atmega329a, atmega329p, atmega329pa, atmega3290, atmega3290a, atmega3290p, atmega3290pa, atmega406, atmega64, atmega64a, atmega640, atmega644, atmega644a, atmega644p, atmega644pa, atmega645, atmega645a, atmega645p, atmega649, atmega649a, atmega649p, atmega6450, atmega6450a, atmega6450p, atmega6490, atmega6490a, atmega6490p, atmega64rfr2, atmega644rfr2, atmega16hva, atmega16hva2, atmega16hvb, atmega16hvbrevb, atmega32hvb, atmega32hvbrevb, atmega64hve, atmega64hve2, at90can32, at90can64, at90pwm161, at90pwm216, at90pwm316, atmega32c1, atmega64c1, atmega16m1, atmega32m1, atmega64m1, atmega16u4, atmega32u4, atmega32u6, at90usb646, at90usb647, at90scr100, at94k, m3000, avr51, atmega128, atmega128a, atmega1280, atmega1281, atmega1284, atmega1284p, atmega128rfa1, atmega128rfr2, atmega1284rfr2, at90can128, at90usb1286, at90usb1287, avr6, atmega2560, atmega2561, atmega256rfr2, atmega2564rfr2, avrxmega2, atxmega16a4, atxmega16a4u, atxmega16c4, atxmega16d4, atxmega32a4, atxmega32a4u, atxmega32c3, atxmega32c4, atxmega32d3, atxmega32d4, atxmega32e5, atxmega16e5, atxmega8e5, avrxmega4, atxmega64a3, atxmega64a3u, atxmega64a4u, atxmega64b1, atxmega64b3, atxmega64c3, atxmega64d3, atxmega64d4, avrxmega5, atxmega64a1, atxmega64a1u, avrxmega6, atxmega128a3, atxmega128a3u, atxmega128b1, atxmega128b3, atxmega128c3, atxmega128d3, atxmega128d4, atxmega192a3, atxmega192a3u, atxmega192c3, atxmega192d3, atxmega256a3, atxmega256a3u, atxmega256a3b, atxmega256a3bu, atxmega256c3, atxmega256d3, atxmega384c3, atxmega384d3, avrxmega7, atxmega128a1, atxmega128a1u, atxmega128a4u, avrtiny, attiny4, attiny5, attiny9, attiny10, attiny20, attiny40, attiny102, attiny104, avrxmega3, attiny202, attiny402, attiny204, attiny404, attiny804, attiny1604, attiny406, attiny806, attiny1606, attiny807, attiny1607, attiny212, attiny412, attiny214, attiny414, attiny814, attiny1614, attiny416, attiny816, attiny1616, attiny3216, attiny417, attiny817, attiny1617, attiny3217, attiny1624, attiny1626, attiny1627, atmega808, atmega809, atmega1608, atmega1609, atmega3208, atmega3209, atmega4808, atmega4809
-
-// RUN: not %clang_cc1 -triple riscv32 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV32
-// RISCV32: error: unknown target CPU 'not-a-cpu'
-// RISCV32-NEXT: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-e20, sifive-e21, sifive-e24, sifive-e31, sifive-e34, sifive-e76, syntacore-scr1-base, syntacore-scr1-max, syntacore-scr3-rv32, syntacore-scr4-rv32, syntacore-scr5-rv32{{$}}
-
-// RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV64
-// RISCV64: error: unknown target CPU 'not-a-cpu'
-// RISCV64-NEXT: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-p450, sifive-p470, sifive-p670, sifive-s21, sifive-s51, sifive-s54, sifive-s76, sifive-u54, sifive-u74, sifive-x280, spacemit-x60, syntacore-scr3-rv64, syntacore-scr4-rv64, syntacore-scr5-rv64, veyron-v1, xiangshan-nanhu{{$}}
-
-// RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
-// TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
-// TUNE-RISCV32-NEXT: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-e20, sifive-e21, sifive-e24, sifive-e31, sifive-e34, sifive-e76, syntacore-scr1-base, syntacore-scr1-max, syntacore-scr3-rv32, syntacore-scr4-rv32, syntacore-scr5-rv32, generic, rocket, sifive-7-series{{$}}
-
-// RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
-// TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
-// TUNE-RISCV64-NEXT: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-p450, sifive-p470, sifive-p670, sifive-s21, sifive-s51, sifive-s54, sifive-s76, sifive-u54, sifive-u74, sifive-x280, spacemit-x60, syntacore-scr3-rv64, syntacore-scr4-rv64, syntacore-scr5-rv64, veyron-v1, xiangshan-nanhu, generic, rocket, sifive-7-series{{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/aarch64.c b/clang/test/Misc/target-invalid-cpu-note/aarch64.c
new file mode 100644
index 00000000000000..ab2d2408756061
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/aarch64.c
@@ -0,0 +1,90 @@
+// Use --implicit-check-not to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple arm64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// RUN: not %clang_cc1 -triple arm64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: a64fx,
+// CHECK-SAME: ampere1,
+// CHECK-SAME: ampere1a,
+// CHECK-SAME: ampere1b,
+// CHECK-SAME: apple-a10,
+// CHECK-SAME: apple-a11,
+// CHECK-SAME: apple-a12,
+// CHECK-SAME: apple-a13,
+// CHECK-SAME: apple-a14,
+// CHECK-SAME: apple-a15,
+// CHECK-SAME: apple-a16,
+// CHECK-SAME: apple-a17,
+// CHECK-SAME: apple-a7,
+// CHECK-SAME: apple-a8,
+// CHECK-SAME: apple-a9,
+// CHECK-SAME: apple-m1,
+// CHECK-SAME: apple-m2,
+// CHECK-SAME: apple-m3,
+// CHECK-SAME: apple-m4,
+// CHECK-SAME: apple-s4,
+// CHECK-SAME: apple-s5,
+// CHECK-SAME: carmel,
+// CHECK-SAME: cobalt-100,
+// CHECK-SAME: cortex-a34,
+// CHECK-SAME: cortex-a35,
+// CHECK-SAME: cortex-a510,
+// CHECK-SAME: cortex-a520,
+// CHECK-SAME: cortex-a520ae,
+// CHECK-SAME: cortex-a53,
+// CHECK-SAME: cortex-a55,
+// CHECK-SAME: cortex-a57,
+// CHECK-SAME: cortex-a65,
+// CHECK-SAME: cortex-a65ae,
+// CHECK-SAME: cortex-a710,
+// CHECK-SAME: cortex-a715,
+// CHECK-SAME: cortex-a72,
+// CHECK-SAME: cortex-a720,
+// CHECK-SAME: cortex-a720ae,
+// CHECK-SAME: cortex-a725,
+// CHECK-SAME: cortex-a73,
+// CHECK-SAME: cortex-a75,
+// CHECK-SAME: cortex-a76,
+// CHECK-SAME: cortex-a76ae,
+// CHECK-SAME: cortex-a77,
+// CHECK-SAME: cortex-a78,
+// CHECK-SAME: cortex-a78ae,
+// CHECK-SAME: cortex-a78c,
+// CHECK-SAME: cortex-r82,
+// CHECK-SAME: cortex-r82ae,
+// CHECK-SAME: cortex-x1,
+// CHECK-SAME: cortex-x1c,
+// CHECK-SAME: cortex-x2,
+// CHECK-SAME: cortex-x3,
+// CHECK-SAME: cortex-x4,
+// CHECK-SAME: cortex-x925,
+// CHECK-SAME: cyclone,
+// CHECK-SAME: exynos-m3,
+// CHECK-SAME: exynos-m4,
+// CHECK-SAME: exynos-m5,
+// CHECK-SAME: falkor,
+// CHECK-SAME: generic,
+// CHECK-SAME: grace,
+// CHECK-SAME: kryo,
+// CHECK-SAME: neoverse-512tvb,
+// CHECK-SAME: neoverse-e1,
+// CHECK-SAME: neoverse-n1,
+// CHECK-SAME: neoverse-n2,
+// CHECK-SAME: neoverse-n3,
+// CHECK-SAME: neoverse-v1,
+// CHECK-SAME: neoverse-v2,
+// CHECK-SAME: neoverse-v3,
+// CHECK-SAME: neoverse-v3ae,
+// CHECK-SAME: oryon-1,
+// CHECK-SAME: saphira,
+// CHECK-SAME: thunderx,
+// CHECK-SAME: thunderx2t99,
+// CHECK-SAME: thunderx3t110,
+// CHECK-SAME: thunderxt81,
+// CHECK-SAME: thunderxt83,
+// CHECK-SAME: thunderxt88,
+// CHECK-SAME: tsv110
+// CHECK-SAME: {{$}}
+
diff --git a/clang/test/Misc/target-invalid-cpu-note/amdgcn.c b/clang/test/Misc/target-invalid-cpu-note/amdgcn.c
new file mode 100644
index 00000000000000..0c4648ecab87a2
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/amdgcn.c
@@ -0,0 +1,74 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple amdgcn--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: gfx600,
+// CHECK-SAME: tahiti,
+// CHECK-SAME: gfx601,
+// CHECK-SAME: pitcairn,
+// CHECK-SAME: verde,
+// CHECK-SAME: gfx602,
+// CHECK-SAME: hainan,
+// CHECK-SAME: oland,
+// CHECK-SAME: gfx700,
+// CHECK-SAME: kaveri,
+// CHECK-SAME: gfx701,
+// CHECK-SAME: hawaii,
+// CHECK-SAME: gfx702,
+// CHECK-SAME: gfx703,
+// CHECK-SAME: kabini,
+// CHECK-SAME: mullins,
+// CHECK-SAME: gfx704,
+// CHECK-SAME: bonaire,
+// CHECK-SAME: gfx705,
+// CHECK-SAME: gfx801,
+// CHECK-SAME: carrizo,
+// CHECK-SAME: gfx802,
+// CHECK-SAME: iceland,
+// CHECK-SAME: tonga,
+// CHECK-SAME: gfx803,
+// CHECK-SAME: fiji,
+// CHECK-SAME: polaris10,
+// CHECK-SAME: polaris11,
+// CHECK-SAME: gfx805,
+// CHECK-SAME: tongapro,
+// CHECK-SAME: gfx810,
+// CHECK-SAME: stoney,
+// CHECK-SAME: gfx900,
+// CHECK-SAME: gfx902,
+// CHECK-SAME: gfx904,
+// CHECK-SAME: gfx906,
+// CHECK-SAME: gfx908,
+// CHECK-SAME: gfx909,
+// CHECK-SAME: gfx90a,
+// CHECK-SAME: gfx90c,
+// CHECK-SAME: gfx940,
+// CHECK-SAME: gfx941,
+// CHECK-SAME: gfx942,
+// CHECK-SAME: gfx1010,
+// CHECK-SAME: gfx1011,
+// CHECK-SAME: gfx1012,
+// CHECK-SAME: gfx1013,
+// CHECK-SAME: gfx1030,
+// CHECK-SAME: gfx1031,
+// CHECK-SAME: gfx1032,
+// CHECK-SAME: gfx1033,
+// CHECK-SAME: gfx1034,
+// CHECK-SAME: gfx1035,
+// CHECK-SAME: gfx1036,
+// CHECK-SAME: gfx1100,
+// CHECK-SAME: gfx1101,
+// CHECK-SAME: gfx1102,
+// CHECK-SAME: gfx1103,
+// CHECK-SAME: gfx1150,
+// CHECK-SAME: gfx1151,
+// CHECK-SAME: gfx1152,
+// CHECK-SAME: gfx1200,
+// CHECK-SAME: gfx1201,
+// CHECK-SAME: gfx9-generic,
+// CHECK-SAME: gfx10-1-generic,
+// CHECK-SAME: gfx10-3-generic,
+// CHECK-SAME: gfx11-generic,
+// CHECK-SAME: gfx12-generic
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/arm.c b/clang/test/Misc/target-invalid-cpu-note/arm.c
new file mode 100644
index 00000000000000..24d8202eeaab67
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/arm.c
@@ -0,0 +1,98 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple armv5--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: arm8,
+// CHECK-SAME: arm810,
+// CHECK-SAME: strongarm,
+// CHECK-SAME: strongarm110,
+// CHECK-SAME: strongarm1100,
+// CHECK-SAME: strongarm1110,
+// CHECK-SAME: arm7tdmi,
+// CHECK-SAME: arm7tdmi-s,
+// CHECK-SAME: arm710t,
+// CHECK-SAME: arm720t,
+// CHECK-SAME: arm9,
+// CHECK-SAME: arm9tdmi,
+// CHECK-SAME: arm920,
+// CHECK-SAME: arm920t,
+// CHECK-SAME: arm922t,
+// CHECK-SAME: arm940t,
+// CHECK-SAME: ep9312,
+// CHECK-SAME: arm10tdmi,
+// CHECK-SAME: arm1020t,
+// CHECK-SAME: arm9e,
+// CHECK-SAME: arm946e-s,
+// CHECK-SAME: arm966e-s,
+// CHECK-SAME: arm968e-s,
+// CHECK-SAME: arm10e,
+// CHECK-SAME: arm1020e,
+// CHECK-SAME: arm1022e,
+// CHECK-SAME: arm926ej-s,
+// CHECK-SAME: arm1136j-s,
+// CHECK-SAME: arm1136jf-s,
+// CHECK-SAME: mpcore,
+// CHECK-SAME: mpcorenovfp,
+// CHECK-SAME: arm1176jz-s,
+// CHECK-SAME: arm1176jzf-s,
+// CHECK-SAME: arm1156t2-s,
+// CHECK-SAME: arm1156t2f-s,
+// CHECK-SAME: cortex-m0,
+// CHECK-SAME: cortex-m0plus,
+// CHECK-SAME: cortex-m1,
+// CHECK-SAME: sc000,
+// CHECK-SAME: cortex-a5,
+// CHECK-SAME: cortex-a7,
+// CHECK-SAME: cortex-a8,
+// CHECK-SAME: cortex-a9,
+// CHECK-SAME: cortex-a12,
+// CHECK-SAME: cortex-a15,
+// CHECK-SAME: cortex-a17,
+// CHECK-SAME: krait,
+// CHECK-SAME: cortex-r4,
+// CHECK-SAME: cortex-r4f,
+// CHECK-SAME: cortex-r5,
+// CHECK-SAME: cortex-r7,
+// CHECK-SAME: cortex-r8,
+// CHECK-SAME: cortex-r52,
+// CHECK-SAME: cortex-r52plus,
+// CHECK-SAME: sc300,
+// CHECK-SAME: cortex-m3,
+// CHECK-SAME: cortex-m4,
+// CHECK-SAME: cortex-m7,
+// CHECK-SAME: cortex-m23,
+// CHECK-SAME: cortex-m33,
+// CHECK-SAME: cortex-m35p,
+// CHECK-SAME: cortex-m55,
+// CHECK-SAME: cortex-m85,
+// CHECK-SAME: cortex-m52,
+// CHECK-SAME: cortex-a32,
+// CHECK-SAME: cortex-a35,
+// CHECK-SAME: cortex-a53,
+// CHECK-SAME: cortex-a55,
+// CHECK-SAME: cortex-a57,
+// CHECK-SAME: cortex-a72,
+// CHECK-SAME: cortex-a73,
+// CHECK-SAME: cortex-a75,
+// CHECK-SAME: cortex-a76,
+// CHECK-SAME: cortex-a76ae,
+// CHECK-SAME: cortex-a77,
+// CHECK-SAME: cortex-a78,
+// CHECK-SAME: cortex-a78ae,
+// CHECK-SAME: cortex-a78c,
+// CHECK-SAME: cortex-a710,
+// CHECK-SAME: cortex-x1,
+// CHECK-SAME: cortex-x1c,
+// CHECK-SAME: neoverse-n1,
+// CHECK-SAME: neoverse-n2,
+// CHECK-SAME: neoverse-v1,
+// CHECK-SAME: cyclone,
+// CHECK-SAME: exynos-m3,
+// CHECK-SAME: exynos-m4,
+// CHECK-SAME: exynos-m5,
+// CHECK-SAME: kryo,
+// CHECK-SAME: iwmmxt,
+// CHECK-SAME: xscale,
+// CHECK-SAME: swift
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/avr.c b/clang/test/Misc/target-invalid-cpu-note/avr.c
new file mode 100644
index 00000000000000..deb304498df9a0
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/avr.c
@@ -0,0 +1,320 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple avr--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: avr1,
+// CHECK-SAME: at90s1200,
+// CHECK-SAME: attiny11,
+// CHECK-SAME: attiny12,
+// CHECK-SAME: attiny15,
+// CHECK-SAME: attiny28,
+// CHECK-SAME: avr2,
+// CHECK-SAME: at90s2313,
+// CHECK-SAME: at90s2323,
+// CHECK-SAME: at90s2333,
+// CHECK-SAME: at90s2343,
+// CHECK-SAME: attiny22,
+// CHECK-SAME: attiny26,
+// CHECK-SAME: at86rf401,
+// CHECK-SAME: at90s4414,
+// CHECK-SAME: at90s4433,
+// CHECK-SAME: at90s4434,
+// CHECK-SAME: at90s8515,
+// CHECK-SAME: at90c8534,
+// CHECK-SAME: at90s8535,
+// CHECK-SAME: avr25,
+// CHECK-SAME: ata5272,
+// CHECK-SAME: ata6616c,
+// CHECK-SAME: attiny13,
+// CHECK-SAME: attiny13a,
+// CHECK-SAME: attiny2313,
+// CHECK-SAME: attiny2313a,
+// CHECK-SAME: attiny24,
+// CHECK-SAME: attiny24a,
+// CHECK-SAME: attiny4313,
+// CHECK-SAME: attiny44,
+// CHECK-SAME: attiny44a,
+// CHECK-SAME: attiny84,
+// CHECK-SAME: attiny84a,
+// CHECK-SAME: attiny25,
+// CHECK-SAME: attiny45,
+// CHECK-SAME: attiny85,
+// CHECK-SAME: attiny261,
+// CHECK-SAME: attiny261a,
+// CHECK-SAME: attiny441,
+// CHECK-SAME: attiny461,
+// CHECK-SAME: attiny461a,
+// CHECK-SAME: attiny841,
+// CHECK-SAME: attiny861,
+// CHECK-SAME: attiny861a,
+// CHECK-SAME: attiny87,
+// CHECK-SAME: attiny43u,
+// CHECK-SAME: attiny48,
+// CHECK-SAME: attiny88,
+// CHECK-SAME: attiny828,
+// CHECK-SAME: avr3,
+// CHECK-SAME: at43usb355,
+// CHECK-SAME: at76c711,
+// CHECK-SAME: avr31,
+// CHECK-SAME: atmega103,
+// CHECK-SAME: at43usb320,
+// CHECK-SAME: avr35,
+// CHECK-SAME: attiny167,
+// CHECK-SAME: at90usb82,
+// CHECK-SAME: at90usb162,
+// CHECK-SAME: ata5505,
+// CHECK-SAME: ata6617c,
+// CHECK-SAME: ata664251,
+// CHECK-SAME: atmega8u2,
+// CHECK-SAME: atmega16u2,
+// CHECK-SAME: atmega32u2,
+// CHECK-SAME: attiny1634,
+// CHECK-SAME: avr4,
+// CHECK-SAME: atmega8,
+// CHECK-SAME: ata6289,
+// CHECK-SAME: atmega8a,
+// CHECK-SAME: ata6285,
+// CHECK-SAME: ata6286,
+// CHECK-SAME: ata6612c,
+// CHECK-SAME: atmega48,
+// CHECK-SAME: atmega48a,
+// CHECK-SAME: atmega48pa,
+// CHECK-SAME: atmega48pb,
+// CHECK-SAME: atmega48p,
+// CHECK-SAME: atmega88,
+// CHECK-SAME: atmega88a,
+// CHECK-SAME: atmega88p,
+// CHECK-SAME: atmega88pa,
+// CHECK-SAME: atmega88pb,
+// CHECK-SAME: atmega8515,
+// CHECK-SAME: atmega8535,
+// CHECK-SAME: atmega8hva,
+// CHECK-SAME: at90pwm1,
+// CHECK-SAME: at90pwm2,
+// CHECK-SAME: at90pwm2b,
+// CHECK-SAME: at90pwm3,
+// CHECK-SAME: at90pwm3b,
+// CHECK-SAME: at90pwm81,
+// CHECK-SAME: avr5,
+// CHECK-SAME: ata5702m322,
+// CHECK-SAME: ata5782,
+// CHECK-SAME: ata5790,
+// CHECK-SAME: ata5790n,
+// CHECK-SAME: ata5791,
+// CHECK-SAME: ata5795,
+// CHECK-SAME: ata5831,
+// CHECK-SAME: ata6613c,
+// CHECK-SAME: ata6614q,
+// CHECK-SAME: ata8210,
+// CHECK-SAME: ata8510,
+// CHECK-SAME: atmega16,
+// CHECK-SAME: atmega16a,
+// CHECK-SAME: atmega161,
+// CHECK-SAME: atmega162,
+// CHECK-SAME: atmega163,
+// CHECK-SAME: atmega164a,
+// CHECK-SAME: atmega164p,
+// CHECK-SAME: atmega164pa,
+// CHECK-SAME: atmega165,
+// CHECK-SAME: atmega165a,
+// CHECK-SAME: atmega165p,
+// CHECK-SAME: atmega165pa,
+// CHECK-SAME: atmega168,
+// CHECK-SAME: atmega168a,
+// CHECK-SAME: atmega168p,
+// CHECK-SAME: atmega168pa,
+// CHECK-SAME: atmega168pb,
+// CHECK-SAME: atmega169,
+// CHECK-SAME: atmega169a,
+// CHECK-SAME: atmega169p,
+// CHECK-SAME: atmega169pa,
+// CHECK-SAME: atmega32,
+// CHECK-SAME: atmega32a,
+// CHECK-SAME: atmega323,
+// CHECK-SAME: atmega324a,
+// CHECK-SAME: atmega324p,
+// CHECK-SAME: atmega324pa,
+// CHECK-SAME: atmega324pb,
+// CHECK-SAME: atmega325,
+// CHECK-SAME: atmega325a,
+// CHECK-SAME: atmega325p,
+// CHECK-SAME: atmega325pa,
+// CHECK-SAME: atmega3250,
+// CHECK-SAME: atmega3250a,
+// CHECK-SAME: atmega3250p,
+// CHECK-SAME: atmega3250pa,
+// CHECK-SAME: atmega328,
+// CHECK-SAME: atmega328p,
+// CHECK-SAME: atmega328pb,
+// CHECK-SAME: atmega329,
+// CHECK-SAME: atmega329a,
+// CHECK-SAME: atmega329p,
+// CHECK-SAME: atmega329pa,
+// CHECK-SAME: atmega3290,
+// CHECK-SAME: atmega3290a,
+// CHECK-SAME: atmega3290p,
+// CHECK-SAME: atmega3290pa,
+// CHECK-SAME: atmega406,
+// CHECK-SAME: atmega64,
+// CHECK-SAME: atmega64a,
+// CHECK-SAME: atmega640,
+// CHECK-SAME: atmega644,
+// CHECK-SAME: atmega644a,
+// CHECK-SAME: atmega644p,
+// CHECK-SAME: atmega644pa,
+// CHECK-SAME: atmega645,
+// CHECK-SAME: atmega645a,
+// CHECK-SAME: atmega645p,
+// CHECK-SAME: atmega649,
+// CHECK-SAME: atmega649a,
+// CHECK-SAME: atmega649p,
+// CHECK-SAME: atmega6450,
+// CHECK-SAME: atmega6450a,
+// CHECK-SAME: atmega6450p,
+// CHECK-SAME: atmega6490,
+// CHECK-SAME: atmega6490a,
+// CHECK-SAME: atmega6490p,
+// CHECK-SAME: atmega64rfr2,
+// CHECK-SAME: atmega644rfr2,
+// CHECK-SAME: atmega16hva,
+// CHECK-SAME: atmega16hva2,
+// CHECK-SAME: atmega16hvb,
+// CHECK-SAME: atmega16hvbrevb,
+// CHECK-SAME: atmega32hvb,
+// CHECK-SAME: atmega32hvbrevb,
+// CHECK-SAME: atmega64hve,
+// CHECK-SAME: atmega64hve2,
+// CHECK-SAME: at90can32,
+// CHECK-SAME: at90can64,
+// CHECK-SAME: at90pwm161,
+// CHECK-SAME: at90pwm216,
+// CHECK-SAME: at90pwm316,
+// CHECK-SAME: atmega32c1,
+// CHECK-SAME: atmega64c1,
+// CHECK-SAME: atmega16m1,
+// CHECK-SAME: atmega32m1,
+// CHECK-SAME: atmega64m1,
+// CHECK-SAME: atmega16u4,
+// CHECK-SAME: atmega32u4,
+// CHECK-SAME: atmega32u6,
+// CHECK-SAME: at90usb646,
+// CHECK-SAME: at90usb647,
+// CHECK-SAME: at90scr100,
+// CHECK-SAME: at94k,
+// CHECK-SAME: m3000,
+// CHECK-SAME: avr51,
+// CHECK-SAME: atmega128,
+// CHECK-SAME: atmega128a,
+// CHECK-SAME: atmega1280,
+// CHECK-SAME: atmega1281,
+// CHECK-SAME: atmega1284,
+// CHECK-SAME: atmega1284p,
+// CHECK-SAME: atmega128rfa1,
+// CHECK-SAME: atmega128rfr2,
+// CHECK-SAME: atmega1284rfr2,
+// CHECK-SAME: at90can128,
+// CHECK-SAME: at90usb1286,
+// CHECK-SAME: at90usb1287,
+// CHECK-SAME: avr6,
+// CHECK-SAME: atmega2560,
+// CHECK-SAME: atmega2561,
+// CHECK-SAME: atmega256rfr2,
+// CHECK-SAME: atmega2564rfr2,
+// CHECK-SAME: avrxmega2,
+// CHECK-SAME: atxmega16a4,
+// CHECK-SAME: atxmega16a4u,
+// CHECK-SAME: atxmega16c4,
+// CHECK-SAME: atxmega16d4,
+// CHECK-SAME: atxmega32a4,
+// CHECK-SAME: atxmega32a4u,
+// CHECK-SAME: atxmega32c3,
+// CHECK-SAME: atxmega32c4,
+// CHECK-SAME: atxmega32d3,
+// CHECK-SAME: atxmega32d4,
+// CHECK-SAME: atxmega32e5,
+// CHECK-SAME: atxmega16e5,
+// CHECK-SAME: atxmega8e5,
+// CHECK-SAME: avrxmega4,
+// CHECK-SAME: atxmega64a3,
+// CHECK-SAME: atxmega64a3u,
+// CHECK-SAME: atxmega64a4u,
+// CHECK-SAME: atxmega64b1,
+// CHECK-SAME: atxmega64b3,
+// CHECK-SAME: atxmega64c3,
+// CHECK-SAME: atxmega64d3,
+// CHECK-SAME: atxmega64d4,
+// CHECK-SAME: avrxmega5,
+// CHECK-SAME: atxmega64a1,
+// CHECK-SAME: atxmega64a1u,
+// CHECK-SAME: avrxmega6,
+// CHECK-SAME: atxmega128a3,
+// CHECK-SAME: atxmega128a3u,
+// CHECK-SAME: atxmega128b1,
+// CHECK-SAME: atxmega128b3,
+// CHECK-SAME: atxmega128c3,
+// CHECK-SAME: atxmega128d3,
+// CHECK-SAME: atxmega128d4,
+// CHECK-SAME: atxmega192a3,
+// CHECK-SAME: atxmega192a3u,
+// CHECK-SAME: atxmega192c3,
+// CHECK-SAME: atxmega192d3,
+// CHECK-SAME: atxmega256a3,
+// CHECK-SAME: atxmega256a3u,
+// CHECK-SAME: atxmega256a3b,
+// CHECK-SAME: atxmega256a3bu,
+// CHECK-SAME: atxmega256c3,
+// CHECK-SAME: atxmega256d3,
+// CHECK-SAME: atxmega384c3,
+// CHECK-SAME: atxmega384d3,
+// CHECK-SAME: avrxmega7,
+// CHECK-SAME: atxmega128a1,
+// CHECK-SAME: atxmega128a1u,
+// CHECK-SAME: atxmega128a4u,
+// CHECK-SAME: avrtiny,
+// CHECK-SAME: attiny4,
+// CHECK-SAME: attiny5,
+// CHECK-SAME: attiny9,
+// CHECK-SAME: attiny10,
+// CHECK-SAME: attiny20,
+// CHECK-SAME: attiny40,
+// CHECK-SAME: attiny102,
+// CHECK-SAME: attiny104,
+// CHECK-SAME: avrxmega3,
+// CHECK-SAME: attiny202,
+// CHECK-SAME: attiny402,
+// CHECK-SAME: attiny204,
+// CHECK-SAME: attiny404,
+// CHECK-SAME: attiny804,
+// CHECK-SAME: attiny1604,
+// CHECK-SAME: attiny406,
+// CHECK-SAME: attiny806,
+// CHECK-SAME: attiny1606,
+// CHECK-SAME: attiny807,
+// CHECK-SAME: attiny1607,
+// CHECK-SAME: attiny212,
+// CHECK-SAME: attiny412,
+// CHECK-SAME: attiny214,
+// CHECK-SAME: attiny414,
+// CHECK-SAME: attiny814,
+// CHECK-SAME: attiny1614,
+// CHECK-SAME: attiny416,
+// CHECK-SAME: attiny816,
+// CHECK-SAME: attiny1616,
+// CHECK-SAME: attiny3216,
+// CHECK-SAME: attiny417,
+// CHECK-SAME: attiny817,
+// CHECK-SAME: attiny1617,
+// CHECK-SAME: attiny3217,
+// CHECK-SAME: attiny1624,
+// CHECK-SAME: attiny1626,
+// CHECK-SAME: attiny1627,
+// CHECK-SAME: atmega808,
+// CHECK-SAME: atmega809,
+// CHECK-SAME: atmega1608,
+// CHECK-SAME: atmega1609,
+// CHECK-SAME: atmega3208,
+// CHECK-SAME: atmega3209,
+// CHECK-SAME: atmega4808,
+// CHECK-SAME: atmega4809
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/bpf.c b/clang/test/Misc/target-invalid-cpu-note/bpf.c
new file mode 100644
index 00000000000000..9b6e80f85359ab
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/bpf.c
@@ -0,0 +1,13 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple bpf--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: generic,
+// CHECK-SAME: v1,
+// CHECK-SAME: v2,
+// CHECK-SAME: v3,
+// CHECK-SAME: v4,
+// CHECK-SAME: probe
+// CHECK-SAME: {{$}}
+
diff --git a/clang/test/Misc/target-invalid-cpu-note/hexagon.c b/clang/test/Misc/target-invalid-cpu-note/hexagon.c
new file mode 100644
index 00000000000000..4ef94a580d5276
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/hexagon.c
@@ -0,0 +1,19 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple hexagon--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: hexagonv5,
+// CHECK-SAME: hexagonv55,
+// CHECK-SAME: hexagonv60,
+// CHECK-SAME: hexagonv62,
+// CHECK-SAME: hexagonv65,
+// CHECK-SAME: hexagonv66,
+// CHECK-SAME: hexagonv67,
+// CHECK-SAME: hexagonv67t,
+// CHECK-SAME: hexagonv68,
+// CHECK-SAME: hexagonv69,
+// CHECK-SAME: hexagonv71,
+// CHECK-SAME: hexagonv71t,
+// CHECK-SAME: hexagonv73
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/lanai.c b/clang/test/Misc/target-invalid-cpu-note/lanai.c
new file mode 100644
index 00000000000000..9579ac36d9f998
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/lanai.c
@@ -0,0 +1,7 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple lanai--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: v11
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/mips.c b/clang/test/Misc/target-invalid-cpu-note/mips.c
new file mode 100644
index 00000000000000..a2d9ca407b0697
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/mips.c
@@ -0,0 +1,24 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple mips--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: mips1,
+// CHECK-SAME: mips2,
+// CHECK-SAME: mips3,
+// CHECK-SAME: mips4,
+// CHECK-SAME: mips5,
+// CHECK-SAME: mips32,
+// CHECK-SAME: mips32r2,
+// CHECK-SAME: mips32r3,
+// CHECK-SAME: mips32r5,
+// CHECK-SAME: mips32r6,
+// CHECK-SAME: mips64,
+// CHECK-SAME: mips64r2,
+// CHECK-SAME: mips64r3,
+// CHECK-SAME: mips64r5,
+// CHECK-SAME: mips64r6,
+// CHECK-SAME: octeon,
+// CHECK-SAME: octeon+,
+// CHECK-SAME: p5600
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/nvptx.c b/clang/test/Misc/target-invalid-cpu-note/nvptx.c
new file mode 100644
index 00000000000000..e8a58d4008f180
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/nvptx.c
@@ -0,0 +1,78 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple nvptx--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: sm_20,
+// CHECK-SAME: sm_21,
+// CHECK-SAME: sm_30,
+// CHECK-SAME: sm_32,
+// CHECK-SAME: sm_35,
+// CHECK-SAME: sm_37,
+// CHECK-SAME: sm_50,
+// CHECK-SAME: sm_52,
+// CHECK-SAME: sm_53,
+// CHECK-SAME: sm_60,
+// CHECK-SAME: sm_61,
+// CHECK-SAME: sm_62,
+// CHECK-SAME: sm_70,
+// CHECK-SAME: sm_72,
+// CHECK-SAME: sm_75,
+// CHECK-SAME: sm_80,
+// CHECK-SAME: sm_86,
+// CHECK-SAME: sm_87,
+// CHECK-SAME: sm_89,
+// CHECK-SAME: sm_90,
+// CHECK-SAME: sm_90a,
+// CHECK-SAME: gfx600,
+// CHECK-SAME: gfx601,
+// CHECK-SAME: gfx602,
+// CHECK-SAME: gfx700,
+// CHECK-SAME: gfx701,
+// CHECK-SAME: gfx702,
+// CHECK-SAME: gfx703,
+// CHECK-SAME: gfx704,
+// CHECK-SAME: gfx705,
+// CHECK-SAME: gfx801,
+// CHECK-SAME: gfx802,
+// CHECK-SAME: gfx803,
+// CHECK-SAME: gfx805,
+// CHECK-SAME: gfx810,
+// CHECK-SAME: gfx9-generic,
+// CHECK-SAME: gfx900,
+// CHECK-SAME: gfx902,
+// CHECK-SAME: gfx904,
+// CHECK-SAME: gfx906,
+// CHECK-SAME: gfx908,
+// CHECK-SAME: gfx909,
+// CHECK-SAME: gfx90a,
+// CHECK-SAME: gfx90c,
+// CHECK-SAME: gfx940,
+// CHECK-SAME: gfx941,
+// CHECK-SAME: gfx942,
+// CHECK-SAME: gfx10-1-generic,
+// CHECK-SAME: gfx1010,
+// CHECK-SAME: gfx1011,
+// CHECK-SAME: gfx1012,
+// CHECK-SAME: gfx1013,
+// CHECK-SAME: gfx10-3-generic,
+// CHECK-SAME: gfx1030,
+// CHECK-SAME: gfx1031,
+// CHECK-SAME: gfx1032,
+// CHECK-SAME: gfx1033,
+// CHECK-SAME: gfx1034,
+// CHECK-SAME: gfx1035,
+// CHECK-SAME: gfx1036,
+// CHECK-SAME: gfx11-generic,
+// CHECK-SAME: gfx1100,
+// CHECK-SAME: gfx1101,
+// CHECK-SAME: gfx1102,
+// CHECK-SAME: gfx1103,
+// CHECK-SAME: gfx1150,
+// CHECK-SAME: gfx1151,
+// CHECK-SAME: gfx1152,
+// CHECK-SAME: gfx12-generic,
+// CHECK-SAME: gfx1200,
+// CHECK-SAME: gfx1201,
+// CHECK-SAME: amdgcnspirv
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/powerpc.c b/clang/test/Misc/target-invalid-cpu-note/powerpc.c
new file mode 100644
index 00000000000000..ba3e007cbedca8
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/powerpc.c
@@ -0,0 +1,71 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple powerpc--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: generic,
+// CHECK-SAME: 440,
+// CHECK-SAME: 440fp,
+// CHECK-SAME: ppc440,
+// CHECK-SAME: 450,
+// CHECK-SAME: 601,
+// CHECK-SAME: 602,
+// CHECK-SAME: 603,
+// CHECK-SAME: 603e,
+// CHECK-SAME: 603ev,
+// CHECK-SAME: 604,
+// CHECK-SAME: 604e,
+// CHECK-SAME: 620,
+// CHECK-SAME: 630,
+// CHECK-SAME: g3,
+// CHECK-SAME: 7400,
+// CHECK-SAME: g4,
+// CHECK-SAME: 7450,
+// CHECK-SAME: g4+,
+// CHECK-SAME: 750,
+// CHECK-SAME: 8548,
+// CHECK-SAME: ppc405,
+// CHECK-SAME: ppc464,
+// CHECK-SAME: ppc476,
+// CHECK-SAME: 970,
+// CHECK-SAME: ppc970,
+// CHECK-SAME: g5,
+// CHECK-SAME: a2,
+// CHECK-SAME: ppca2,
+// CHECK-SAME: ppc-cell-be,
+// CHECK-SAME: e500,
+// CHECK-SAME: e500mc,
+// CHECK-SAME: e5500,
+// CHECK-SAME: power3,
+// CHECK-SAME: pwr3,
+// CHECK-SAME: pwr4,
+// CHECK-SAME: power4,
+// CHECK-SAME: pwr5,
+// CHECK-SAME: power5,
+// CHECK-SAME: pwr5+,
+// CHECK-SAME: power5+,
+// CHECK-SAME: pwr5x,
+// CHECK-SAME: power5x,
+// CHECK-SAME: pwr6,
+// CHECK-SAME: power6,
+// CHECK-SAME: pwr6x,
+// CHECK-SAME: power6x,
+// CHECK-SAME: pwr7,
+// CHECK-SAME: power7,
+// CHECK-SAME: pwr8,
+// CHECK-SAME: power8,
+// CHECK-SAME: pwr9,
+// CHECK-SAME: power9,
+// CHECK-SAME: pwr10,
+// CHECK-SAME: power10,
+// CHECK-SAME: pwr11,
+// CHECK-SAME: power11,
+// CHECK-SAME: powerpc,
+// CHECK-SAME: ppc,
+// CHECK-SAME: ppc32,
+// CHECK-SAME: powerpc64,
+// CHECK-SAME: ppc64,
+// CHECK-SAME: powerpc64le,
+// CHECK-SAME: ppc64le,
+// CHECK-SAME: future
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/r600.c b/clang/test/Misc/target-invalid-cpu-note/r600.c
new file mode 100644
index 00000000000000..253e87904ee0fc
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/r600.c
@@ -0,0 +1,32 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple r600--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: r600,
+// CHECK-SAME: rv630,
+// CHECK-SAME: rv635,
+// CHECK-SAME: r630,
+// CHECK-SAME: rs780,
+// CHECK-SAME: rs880,
+// CHECK-SAME: rv610,
+// CHECK-SAME: rv620,
+// CHECK-SAME: rv670,
+// CHECK-SAME: rv710,
+// CHECK-SAME: rv730,
+// CHECK-SAME: rv740,
+// CHECK-SAME: rv770,
+// CHECK-SAME: cedar,
+// CHECK-SAME: palm,
+// CHECK-SAME: cypress,
+// CHECK-SAME: hemlock,
+// CHECK-SAME: juniper,
+// CHECK-SAME: redwood,
+// CHECK-SAME: sumo,
+// CHECK-SAME: sumo2,
+// CHECK-SAME: barts,
+// CHECK-SAME: caicos,
+// CHECK-SAME: aruba,
+// CHECK-SAME: cayman,
+// CHECK-SAME: turks
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/riscv.c b/clang/test/Misc/target-invalid-cpu-note/riscv.c
new file mode 100644
index 00000000000000..acf0dc4cf0d5e8
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/riscv.c
@@ -0,0 +1,89 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple riscv32 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV32 --implicit-check-not={{[a-zA-Z0-9]}}
+// RISCV32: error: unknown target CPU 'not-a-cpu'
+// RISCV32-NEXT: note: valid target CPU values are:
+// RISCV32-SAME: generic-rv32,
+// RISCV32-SAME: rocket-rv32,
+// RISCV32-SAME: sifive-e20,
+// RISCV32-SAME: sifive-e21,
+// RISCV32-SAME: sifive-e24,
+// RISCV32-SAME: sifive-e31,
+// RISCV32-SAME: sifive-e34,
+// RISCV32-SAME: sifive-e76,
+// RISCV32-SAME: syntacore-scr1-base,
+// RISCV32-SAME: syntacore-scr1-max,
+// RISCV32-SAME: syntacore-scr3-rv32,
+// RISCV32-SAME: syntacore-scr4-rv32,
+// RISCV32-SAME: syntacore-scr5-rv32
+// RISCV32-SAME: {{$}}
+
+// RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV64 --implicit-check-not={{[a-zA-Z0-9]}}
+// RISCV64: error: unknown target CPU 'not-a-cpu'
+// RISCV64-NEXT: note: valid target CPU values are:
+// RISCV64-SAME: generic-rv64,
+// RISCV64-SAME: rocket-rv64,
+// RISCV64-SAME: sifive-p450,
+// RISCV64-SAME: sifive-p470,
+// RISCV64-SAME: sifive-p670,
+// RISCV64-SAME: sifive-s21,
+// RISCV64-SAME: sifive-s51,
+// RISCV64-SAME: sifive-s54,
+// RISCV64-SAME: sifive-s76,
+// RISCV64-SAME: sifive-u54,
+// RISCV64-SAME: sifive-u74,
+// RISCV64-SAME: sifive-x280,
+// RISCV64-SAME: spacemit-x60,
+// RISCV64-SAME: syntacore-scr3-rv64,
+// RISCV64-SAME: syntacore-scr4-rv64,
+// RISCV64-SAME: syntacore-scr5-rv64,
+// RISCV64-SAME: veyron-v1,
+// RISCV64-SAME: xiangshan-nanhu
+// RISCV64-SAME: {{$}}
+
+// RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV32 --implicit-check-not={{[a-zA-Z0-9]}}
+// TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
+// TUNE-RISCV32-NEXT: note: valid target CPU values are:
+// TUNE-RISCV32-SAME: generic-rv32,
+// TUNE-RISCV32-SAME: rocket-rv32,
+// TUNE-RISCV32-SAME: sifive-e20,
+// TUNE-RISCV32-SAME: sifive-e21,
+// TUNE-RISCV32-SAME: sifive-e24,
+// TUNE-RISCV32-SAME: sifive-e31,
+// TUNE-RISCV32-SAME: sifive-e34,
+// TUNE-RISCV32-SAME: sifive-e76,
+// TUNE-RISCV32-SAME: syntacore-scr1-base,
+// TUNE-RISCV32-SAME: syntacore-scr1-max,
+// TUNE-RISCV32-SAME: syntacore-scr3-rv32,
+// TUNE-RISCV32-SAME: syntacore-scr4-rv32,
+// TUNE-RISCV32-SAME: syntacore-scr5-rv32,
+// TUNE-RISCV32-SAME: generic,
+// TUNE-RISCV32-SAME: rocket,
+// TUNE-RISCV32-SAME: sifive-7-series
+// TUNE-RISCV32-SAME: {{$}}
+
+// RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64 --implicit-check-not={{[a-zA-Z0-9]}}
+// TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
+// TUNE-RISCV64-NEXT: note: valid target CPU values are:
+// TUNE-RISCV64-SAME: generic-rv64,
+// TUNE-RISCV64-SAME: rocket-rv64,
+// TUNE-RISCV64-SAME: sifive-p450,
+// TUNE-RISCV64-SAME: sifive-p470,
+// TUNE-RISCV64-SAME: sifive-p670,
+// TUNE-RISCV64-SAME: sifive-s21,
+// TUNE-RISCV64-SAME: sifive-s51,
+// TUNE-RISCV64-SAME: sifive-s54,
+// TUNE-RISCV64-SAME: sifive-s76,
+// TUNE-RISCV64-SAME: sifive-u54,
+// TUNE-RISCV64-SAME: sifive-u74,
+// TUNE-RISCV64-SAME: sifive-x280,
+// TUNE-RISCV64-SAME: spacemit-x60,
+// TUNE-RISCV64-SAME: syntacore-scr3-rv64,
+// TUNE-RISCV64-SAME: syntacore-scr4-rv64,
+// TUNE-RISCV64-SAME: syntacore-scr5-rv64,
+// TUNE-RISCV64-SAME: veyron-v1,
+// TUNE-RISCV64-SAME: xiangshan-nanhu,
+// TUNE-RISCV64-SAME: generic,
+// TUNE-RISCV64-SAME: rocket,
+// TUNE-RISCV64-SAME: sifive-7-series
+// TUNE-RISCV64-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/sparc.c b/clang/test/Misc/target-invalid-cpu-note/sparc.c
new file mode 100644
index 00000000000000..a8430bef18a391
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/sparc.c
@@ -0,0 +1,52 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple sparc--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix SPARC --implicit-check-not={{[a-zA-Z0-9]}}
+// SPARC: error: unknown target CPU 'not-a-cpu'
+// SPARC-NEXT: note: valid target CPU values are:
+// SPARC-SAME: v8,
+// SPARC-SAME: supersparc,
+// SPARC-SAME: sparclite,
+// SPARC-SAME: f934,
+// SPARC-SAME: hypersparc,
+// SPARC-SAME: sparclite86x,
+// SPARC-SAME: sparclet,
+// SPARC-SAME: tsc701,
+// SPARC-SAME: v9,
+// SPARC-SAME: ultrasparc,
+// SPARC-SAME: ultrasparc3,
+// SPARC-SAME: niagara,
+// SPARC-SAME: niagara2,
+// SPARC-SAME: niagara3,
+// SPARC-SAME: niagara4,
+// SPARC-SAME: ma2100,
+// SPARC-SAME: ma2150,
+// SPARC-SAME: ma2155,
+// SPARC-SAME: ma2450,
+// SPARC-SAME: ma2455,
+// SPARC-SAME: ma2x5x,
+// SPARC-SAME: ma2080,
+// SPARC-SAME: ma2085,
+// SPARC-SAME: ma2480,
+// SPARC-SAME: ma2485,
+// SPARC-SAME: ma2x8x,
+// SPARC-SAME: leon2,
+// SPARC-SAME: at697e,
+// SPARC-SAME: at697f,
+// SPARC-SAME: leon3,
+// SPARC-SAME: ut699,
+// SPARC-SAME: gr712rc,
+// SPARC-SAME: leon4,
+// SPARC-SAME: gr740
+// SPARC-SAME: {{$}}
+
+// RUN: not %clang_cc1 -triple sparcv9--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix SPARCV9 --implicit-check-not={{[a-zA-Z0-9]}}
+// SPARCV9: error: unknown target CPU 'not-a-cpu'
+// SPARCV9-NEXT: note: valid target CPU values are:
+// SPARCV9-SAME: v9,
+// SPARCV9-SAME: ultrasparc,
+// SPARCV9-SAME: ultrasparc3,
+// SPARCV9-SAME: niagara,
+// SPARCV9-SAME: niagara2,
+// SPARCV9-SAME: niagara3,
+// SPARCV9-SAME: niagara4
+// SPARCV9-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/systemz.c b/clang/test/Misc/target-invalid-cpu-note/systemz.c
new file mode 100644
index 00000000000000..de0d9dc46724b4
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/systemz.c
@@ -0,0 +1,20 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple systemz--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: arch8,
+// CHECK-SAME: z10,
+// CHECK-SAME: arch9,
+// CHECK-SAME: z196,
+// CHECK-SAME: arch10,
+// CHECK-SAME: zEC12,
+// CHECK-SAME: arch11,
+// CHECK-SAME: z13,
+// CHECK-SAME: arch12,
+// CHECK-SAME: z14,
+// CHECK-SAME: arch13,
+// CHECK-SAME: z15,
+// CHECK-SAME: arch14,
+// CHECK-SAME: z16
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/wasm.c b/clang/test/Misc/target-invalid-cpu-note/wasm.c
new file mode 100644
index 00000000000000..952c5d0959a1db
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/wasm.c
@@ -0,0 +1,9 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in this list
+
+// RUN: not %clang_cc1 -triple wasm64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --implicit-check-not={{[a-zA-Z0-9]}}
+// CHECK: error: unknown target CPU 'not-a-cpu'
+// CHECK-NEXT: note: valid target CPU values are:
+// CHECK-SAME: mvp,
+// CHECK-SAME: bleeding-edge,
+// CHECK-SAME: generic
+// CHECK-SAME: {{$}}
diff --git a/clang/test/Misc/target-invalid-cpu-note/x86.c b/clang/test/Misc/target-invalid-cpu-note/x86.c
new file mode 100644
index 00000000000000..a6433f866e86d1
--- /dev/null
+++ b/clang/test/Misc/target-invalid-cpu-note/x86.c
@@ -0,0 +1,382 @@
+// Use --implicit-check-not={{[a-zA-Z0-9]}} to ensure no additional CPUs are in these lists
+
+// RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86 --implicit-check-not={{[a-zA-Z0-9]}}
+// X86: error: unknown target CPU 'not-a-cpu'
+// X86-NEXT: note: valid target CPU values are:
+// X86-SAME: i386,
+// X86-SAME: i486,
+// X86-SAME: winchip-c6,
+// X86-SAME: winchip2,
+// X86-SAME: c3,
+// X86-SAME: i586,
+// X86-SAME: pentium,
+// X86-SAME: pentium-mmx,
+// X86-SAME: pentiumpro,
+// X86-SAME: i686,
+// X86-SAME: pentium2,
+// X86-SAME: pentium3,
+// X86-SAME: pentium3m,
+// X86-SAME: pentium-m,
+// X86-SAME: c3-2,
+// X86-SAME: yonah,
+// X86-SAME: pentium4,
+// X86-SAME: pentium4m,
+// X86-SAME: prescott,
+// X86-SAME: nocona,
+// X86-SAME: core2,
+// X86-SAME: penryn,
+// X86-SAME: bonnell,
+// X86-SAME: atom,
+// X86-SAME: silvermont,
+// X86-SAME: slm,
+// X86-SAME: goldmont,
+// X86-SAME: goldmont-plus,
+// X86-SAME: tremont,
+// X86-SAME: nehalem,
+// X86-SAME: corei7,
+// X86-SAME: westmere,
+// X86-SAME: sandybridge,
+// X86-SAME: corei7-avx,
+// X86-SAME: ivybridge,
+// X86-SAME: core-avx-i,
+// X86-SAME: haswell,
+// X86-SAME: core-avx2,
+// X86-SAME: broadwell,
+// X86-SAME: skylake,
+// X86-SAME: skylake-avx512,
+// X86-SAME: skx,
+// X86-SAME: cascadelake,
+// X86-SAME: cooperlake,
+// X86-SAME: cannonlake,
+// X86-SAME: icelake-client,
+// X86-SAME: rocketlake,
+// X86-SAME: icelake-server,
+// X86-SAME: tigerlake,
+// X86-SAME: sapphirerapids,
+// X86-SAME: alderlake,
+// X86-SAME: raptorlake,
+// X86-SAME: meteorlake,
+// X86-SAME: arrowlake,
+// X86-SAME: arrowlake-s,
+// X86-SAME: lunarlake,
+// X86-SAME: gracemont,
+// X86-SAME: pantherlake,
+// X86-SAME: sierraforest,
+// X86-SAME: grandridge,
+// X86-SAME: graniterapids,
+// X86-SAME: graniterapids-d,
+// X86-SAME: emeraldrapids,
+// X86-SAME: clearwaterforest,
+// X86-SAME: knl,
+// X86-SAME: knm,
+// X86-SAME: lakemont,
+// X86-SAME: k6,
+// X86-SAME: k6-2,
+// X86-SAME: k6-3,
+// X86-SAME: athlon,
+// X86-SAME: athlon-tbird,
+// X86-SAME: athlon-xp,
+// X86-SAME: athlon-mp,
+// X86-SAME: athlon-4,
+// X86-SAME: k8,
+// X86-SAME: athlon64,
+// X86-SAME: athlon-fx,
+// X86-SAME: opteron,
+// X86-SAME: k8-sse3,
+// X86-SAME: athlon64-sse3,
+// X86-SAME: opteron-sse3,
+// X86-SAME: amdfam10,
+// X86-SAME: barcelona,
+// X86-SAME: btver1,
+// X86-SAME: btver2,
+// X86-SAME: bdver1,
+// X86-SAME: bdver2,
+// X86-SAME: bdver3,
+// X86-SAME: bdver4,
+// X86-SAME: znver1,
+// X86-SAME: znver2,
+// X86-SAME: znver3,
+// X86-SAME: znver4,
+// X86-SAME: x86-64,
+// X86-SAME: x86-64-v2,
+// X86-SAME: x86-64-v3,
+// X86-SAME: x86-64-v4,
+// X86-SAME: geode
+// X86-SAME: {{$}}
+
+// RUN: not %clang_cc1 -triple x86_64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=X86_64  --implicit-check-not={{[a-zA-Z0-9]}}
+// X86_64: error: unknown target CPU 'not-a-cpu'
+// X86_64-NEXT: note: valid target CPU values are:
+// X86_64-SAME: nocona,
+// X86_64-SAME: core2,
+// X86_64-SAME: penryn,
+// X86_64-SAME: bonnell,
+// X86_64-SAME: atom,
+// X86_64-SAME: silvermont,
+// X86_64-SAME: slm,
+// X86_64-SAME: goldmont,
+// X86_64-SAME: goldmont-plus,
+// X86_64-SAME: tremont,
+// X86_64-SAME: nehalem,
+// X86_64-SAME: corei7,
+// X86_64-SAME: westmere,
+// X86_64-SAME: sandybridge,
+// X86_64-SAME: corei7-avx,
+// X86_64-SAME: ivybridge,
+// X86_64-SAME: core-avx-i,
+// X86_64-SAME: haswell,
+// X86_64-SAME: core-avx2,
+// X86_64-SAME: broadwell,
+// X86_64-SAME: skylake,
+// X86_64-SAME: skylake-avx512,
+// X86_64-SAME: skx,
+// X86_64-SAME: cascadelake,
+// X86_64-SAME: cooperlake,
+// X86_64-SAME: cannonlake,
+// X86_64-SAME: icelake-client,
+// X86_64-SAME: rocketlake,
+// X86_64-SAME: icelake-server,
+// X86_64-SAME: tigerlake,
+// X86_64-SAME: sapphirerapids,
+// X86_64-SAME: alderlake,
+// X86_64-SAME: raptorlake,
+// X86_64-SAME: meteorlake,
+// X86_64-SAME: arrowlake,
+// X86_64-SAME: arrowlake-s,
+// X86_64-SAME: lunarlake,
+// X86_64-SAME: gracemont,
+// X86_64-SAME: pantherlake,
+// X86_64-SAME: sierraforest,
+// X86_64-SAME: grandridge,
+// X86_64-SAME: graniterapids,
+// X86_64-SAME: graniterapids-d,
+// X86_64-SAME: emeraldrapids,
+// X86_64-SAME: clearwaterforest,
+// X86_64-SAME: knl,
+// X86_64-SAME: knm,
+// X86_64-SAME: k8,
+// X86_64-SAME: athlon64,
+// X86_64-SAME: athlon-fx,
+// X86_64-SAME: opteron,
+// X86_64-SAME: k8-sse3,
+// X86_64-SAME: athlon64-sse3,
+// X86_64-SAME: opteron-sse3,
+// X86_64-SAME: amdfam10,
+// X86_64-SAME: barcelona,
+// X86_64-SAME: btver1,
+// X86_64-SAME: btver2,
+// X86_64-SAME: bdver1,
+// X86_64-SAME: bdver2,
+// X86_64-SAME: bdver3,
+// X86_64-SAME: bdver4,
+// X86_64-SAME: znver1,
+// X86_64-SAME: znver2,
+// X86_64-SAME: znver3,
+// X86_64-SAME: znver4,
+// X86_64-SAME: x86-64,
+// X86_64-SAME: x86-64-v2,
+// X86_64-SAME: x86-64-v3,
+// X86_64-SAME: x86-64-v4
+// X86_64-SAME: {{$}}
+
+// RUN: not %clang_cc1 -triple i386--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=TUNE_X86 --implicit-check-not={{[a-zA-Z0-9]}}
+// TUNE_X86: error: unknown target CPU 'not-a-cpu'
+// TUNE_X86-NEXT: note: valid target CPU values are:
+// TUNE_X86-SAME: i386,
+// TUNE_X86-SAME: i486,
+// TUNE_X86-SAME: winchip-c6,
+// TUNE_X86-SAME: winchip2,
+// TUNE_X86-SAME: c3,
+// TUNE_X86-SAME: i586,
+// TUNE_X86-SAME: pentium,
+// TUNE_X86-SAME: pentium-mmx,
+// TUNE_X86-SAME: pentiumpro,
+// TUNE_X86-SAME: i686,
+// TUNE_X86-SAME: pentium2,
+// TUNE_X86-SAME: pentium3,
+// TUNE_X86-SAME: pentium3m,
+// TUNE_X86-SAME: pentium-m,
+// TUNE_X86-SAME: c3-2,
+// TUNE_X86-SAME: yonah,
+// TUNE_X86-SAME: pentium4,
+// TUNE_X86-SAME: pentium4m,
+// TUNE_X86-SAME: prescott,
+// TUNE_X86-SAME: nocona,
+// TUNE_X86-SAME: core2,
+// TUNE_X86-SAME: penryn,
+// TUNE_X86-SAME: bonnell,
+// TUNE_X86-SAME: atom,
+// TUNE_X86-SAME: silvermont,
+// TUNE_X86-SAME: slm,
+// TUNE_X86-SAME: goldmont,
+// TUNE_X86-SAME: goldmont-plus,
+// TUNE_X86-SAME: tremont,
+// TUNE_X86-SAME: nehalem,
+// TUNE_X86-SAME: corei7,
+// TUNE_X86-SAME: westmere,
+// TUNE_X86-SAME: sandybridge,
+// TUNE_X86-SAME: corei7-avx,
+// TUNE_X86-SAME: ivybridge,
+// TUNE_X86-SAME: core-avx-i,
+// TUNE_X86-SAME: haswell,
+// TUNE_X86-SAME: core-avx2,
+// TUNE_X86-SAME: broadwell,
+// TUNE_X86-SAME: skylake,
+// TUNE_X86-SAME: skylake-avx512,
+// TUNE_X86-SAME: skx,
+// TUNE_X86-SAME: cascadelake,
+// TUNE_X86-SAME: cooperlake,
+// TUNE_X86-SAME: cannonlake,
+// TUNE_X86-SAME: icelake-client,
+// TUNE_X86-SAME: rocketlake,
+// TUNE_X86-SAME: icelake-server,
+// TUNE_X86-SAME: tigerlake,
+// TUNE_X86-SAME: sapphirerapids,
+// TUNE_X86-SAME: alderlake,
+// TUNE_X86-SAME: raptorlake,
+// TUNE_X86-SAME: meteorlake,
+// TUNE_X86-SAME: arrowlake,
+// TUNE_X86-SAME: arrowlake-s,
+// TUNE_X86-SAME: lunarlake,
+// TUNE_X86-SAME: gracemont,
+// TUNE_X86-SAME: pantherlake,
+// TUNE_X86-SAME: sierraforest,
+// TUNE_X86-SAME: grandridge,
+// TUNE_X86-SAME: graniterapids,
+// TUNE_X86-SAME: graniterapids-d,
+// TUNE_X86-SAME: emeraldrapids,
+// TUNE_X86-SAME: clearwaterforest,
+// TUNE_X86-SAME: knl,
+// TUNE_X86-SAME: knm,
+// TUNE_X86-SAME: lakemont,
+// TUNE_X86-SAME: k6,
+// TUNE_X86-SAME: k6-2,
+// TUNE_X86-SAME: k6-3,
+// TUNE_X86-SAME: athlon,
+// TUNE_X86-SAME: athlon-tbird,
+// TUNE_X86-SAME: athlon-xp,
+// TUNE_X86-SAME: athlon-mp,
+// TUNE_X86-SAME: athlon-4,
+// TUNE_X86-SAME: k8,
+// TUNE_X86-SAME: athlon64,
+// TUNE_X86-SAME: athlon-fx,
+// TUNE_X86-SAME: opteron,
+// TUNE_X86-SAME: k8-sse3,
+// TUNE_X86-SAME: athlon64-sse3,
+// TUNE_X86-SAME: opteron-sse3,
+// TUNE_X86-SAME: amdfam10,
+// TUNE_X86-SAME: barcelona,
+// TUNE_X86-SAME: btver1,
+// TUNE_X86-SAME: btver2,
+// TUNE_X86-SAME: bdver1,
+// TUNE_X86-SAME: bdver2,
+// TUNE_X86-SAME: bdver3,
+// TUNE_X86-SAME: bdver4,
+// TUNE_X86-SAME: znver1,
+// TUNE_X86-SAME: znver2,
+// TUNE_X86-SAME: znver3,
+// TUNE_X86-SAME: znver4,
+// TUNE_X86-SAME: x86-64,
+// TUNE_X86-SAME: geode
+// TUNE_X86-SAME: {{$}}
+
+// RUN: not %clang_cc1 -triple x86_64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=TUNE_X86_64 --implicit-check-not={{[a-zA-Z0-9]}}
+// TUNE_X86_64: error: unknown target CPU 'not-a-cpu'
+// TUNE_X86_64-NEXT: note: valid target CPU values are:
+// TUNE_X86_64-SAME: i386,
+// TUNE_X86_64-SAME: i486,
+// TUNE_X86_64-SAME: winchip-c6,
+// TUNE_X86_64-SAME: winchip2,
+// TUNE_X86_64-SAME: c3,
+// TUNE_X86_64-SAME: i586,
+// TUNE_X86_64-SAME: pentium,
+// TUNE_X86_64-SAME: pentium-mmx,
+// TUNE_X86_64-SAME: pentiumpro,
+// TUNE_X86_64-SAME: i686,
+// TUNE_X86_64-SAME: pentium2,
+// TUNE_X86_64-SAME: pentium3,
+// TUNE_X86_64-SAME: pentium3m,
+// TUNE_X86_64-SAME: pentium-m,
+// TUNE_X86_64-SAME: c3-2,
+// TUNE_X86_64-SAME: yonah,
+// TUNE_X86_64-SAME: pentium4,
+// TUNE_X86_64-SAME: pentium4m,
+// TUNE_X86_64-SAME: prescott,
+// TUNE_X86_64-SAME: nocona,
+// TUNE_X86_64-SAME: core2,
+// TUNE_X86_64-SAME: penryn,
+// TUNE_X86_64-SAME: bonnell,
+// TUNE_X86_64-SAME: atom,
+// TUNE_X86_64-SAME: silvermont,
+// TUNE_X86_64-SAME: slm,
+// TUNE_X86_64-SAME: goldmont,
+// TUNE_X86_64-SAME: goldmont-plus,
+// TUNE_X86_64-SAME: tremont,
+// TUNE_X86_64-SAME: nehalem,
+// TUNE_X86_64-SAME: corei7,
+// TUNE_X86_64-SAME: westmere,
+// TUNE_X86_64-SAME: sandybridge,
+// TUNE_X86_64-SAME: corei7-avx,
+// TUNE_X86_64-SAME: ivybridge,
+// TUNE_X86_64-SAME: core-avx-i,
+// TUNE_X86_64-SAME: haswell,
+// TUNE_X86_64-SAME: core-avx2,
+// TUNE_X86_64-SAME: broadwell,
+// TUNE_X86_64-SAME: skylake,
+// TUNE_X86_64-SAME: skylake-avx512,
+// TUNE_X86_64-SAME: skx,
+// TUNE_X86_64-SAME: cascadelake,
+// TUNE_X86_64-SAME: cooperlake,
+// TUNE_X86_64-SAME: cannonlake,
+// TUNE_X86_64-SAME: icelake-client,
+// TUNE_X86_64-SAME: rocketlake,
+// TUNE_X86_64-SAME: icelake-server,
+// TUNE_X86_64-SAME: tigerlake,
+// TUNE_X86_64-SAME: sapphirerapids,
+// TUNE_X86_64-SAME: alderlake,
+// TUNE_X86_64-SAME: raptorlake,
+// TUNE_X86_64-SAME: meteorlake,
+// TUNE_X86_64-SAME: arrowlake,
+// TUNE_X86_64-SAME: arrowlake-s,
+// TUNE_X86_64-SAME: lunarlake,
+// TUNE_X86_64-SAME: gracemont,
+// TUNE_X86_64-SAME: pantherlake,
+// TUNE_X86_64-SAME: sierraforest,
+// TUNE_X86_64-SAME: grandridge,
+// TUNE_X86_64-SAME: graniterapids,
+// TUNE_X86_64-SAME: graniterapids-d,
+// TUNE_X86_64-SAME: emeraldrapids,
+// TUNE_X86_64-SAME: clearwaterforest,
+// TUNE_X86_64-SAME: knl,
+// TUNE_X86_64-SAME: knm,
+// TUNE_X86_64-SAME: lakemont,
+// TUNE_X86_64-SAME: k6,
+// TUNE_X86_64-SAME: k6-2,
+// TUNE_X86_64-SAME: k6-3,
+// TUNE_X86_64-SAME: athlon,
+// TUNE_X86_64-SAME: athlon-tbird,
+// TUNE_X86_64-SAME: athlon-xp,
+// TUNE_X86_64-SAME: athlon-mp,
+// TUNE_X86_64-SAME: athlon-4,
+// TUNE_X86_64-SAME: k8,
+// TUNE_X86_64-SAME: athlon64,
+// TUNE_X86_64-SAME: athlon-fx,
+// TUNE_X86_64-SAME: opteron,
+// TUNE_X86_64-SAME: k8-sse3,
+// TUNE_X86_64-SAME: athlon64-sse3,
+// TUNE_X86_64-SAME: opteron-sse3,
+// TUNE_X86_64-SAME: amdfam10,
+// TUNE_X86_64-SAME: barcelona,
+// TUNE_X86_64-SAME: btver1,
+// TUNE_X86_64-SAME: btver2,
+// TUNE_X86_64-SAME: bdver1,
+// TUNE_X86_64-SAME: bdver2,
+// TUNE_X86_64-SAME: bdver3,
+// TUNE_X86_64-SAME: bdver4,
+// TUNE_X86_64-SAME: znver1,
+// TUNE_X86_64-SAME: znver2,
+// TUNE_X86_64-SAME: znver3,
+// TUNE_X86_64-SAME: znver4,
+// TUNE_X86_64-SAME: x86-64,
+// TUNE_X86_64-SAME: geode
+// TUNE_X86_64-SAME: {{$}}

>From a874174a884b2fc2881262a95eaa3d1c7f03369c Mon Sep 17 00:00:00 2001
From: Sam Elliott <quic_aelliott at quicinc.com>
Date: Thu, 8 Aug 2024 04:03:36 -0700
Subject: [PATCH 2/2] [RISCV] Add Hazard3 Core as taped out for RP2350

Luke Wren's Hazard3 is a configurable, open-source 32-bit RISC-V core.
The core's source code and docs are available on github:
https://github.com/wren6991/hazard3

This is the RISC-V core used in the RP2350, a recently announced SoC by
Raspberry Pi (which also contains Arm cores):
https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf

We have agreed to name this `-mcpu` option `rp2350-hazard3`, and it
reflects exactly the options configured in the RP2350 chips. Notably,
the Zbc is not configured, and nor is B because the `misa.B` bit is not
either.
---
 clang/test/Driver/riscv-cpus.c                  | 15 +++++++++++++++
 clang/test/Misc/target-invalid-cpu-note/riscv.c |  2 ++
 llvm/docs/ReleaseNotes.rst                      |  1 +
 llvm/lib/Target/RISCV/RISCVProcessors.td        | 16 ++++++++++++++++
 4 files changed, 34 insertions(+)

diff --git a/clang/test/Driver/riscv-cpus.c b/clang/test/Driver/riscv-cpus.c
index 2fa5b1753745f8..481eaae9153e86 100644
--- a/clang/test/Driver/riscv-cpus.c
+++ b/clang/test/Driver/riscv-cpus.c
@@ -402,6 +402,21 @@
 // MCPU-SIFIVE-P670-SAME: "-target-feature" "+zvkt"
 // MCPU-SIFIVE-P670-SAME: "-target-abi" "lp64d"
 
+// RUN: %clang -target riscv32 -### -c %s 2>&1 -mcpu=rp2350-hazard3 | FileCheck -check-prefix=MCPU-HAZARD3 %s
+// MCPU-HAZARD3: "-target-cpu" "rp2350-hazard3"
+// MCPU-HAZARD3-SAME: "-target-feature" "+m"
+// MCPU-HAZARD3-SAME: "-target-feature" "+a"
+// MCPU-HAZARD3-SAME: "-target-feature" "+c"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zicsr"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zifencei"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zcb"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zcmp"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zba"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zbb"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zbkb"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zbs"
+// MCPU-HAZARD3-SAME: "-target-abi" "ilp32"
+
 // Check failed cases
 
 // RUN: not %clang --target=riscv32 -### -c %s 2>&1 -mcpu=generic-rv321 | FileCheck -check-prefix=FAIL-MCPU-NAME %s
diff --git a/clang/test/Misc/target-invalid-cpu-note/riscv.c b/clang/test/Misc/target-invalid-cpu-note/riscv.c
index acf0dc4cf0d5e8..795459b2d70aeb 100644
--- a/clang/test/Misc/target-invalid-cpu-note/riscv.c
+++ b/clang/test/Misc/target-invalid-cpu-note/riscv.c
@@ -5,6 +5,7 @@
 // RISCV32-NEXT: note: valid target CPU values are:
 // RISCV32-SAME: generic-rv32,
 // RISCV32-SAME: rocket-rv32,
+// RISCV32-SAME: rp2350-hazard3,
 // RISCV32-SAME: sifive-e20,
 // RISCV32-SAME: sifive-e21,
 // RISCV32-SAME: sifive-e24,
@@ -46,6 +47,7 @@
 // TUNE-RISCV32-NEXT: note: valid target CPU values are:
 // TUNE-RISCV32-SAME: generic-rv32,
 // TUNE-RISCV32-SAME: rocket-rv32,
+// TUNE-RISCV32-SAME: rp2350-hazard3,
 // TUNE-RISCV32-SAME: sifive-e20,
 // TUNE-RISCV32-SAME: sifive-e21,
 // TUNE-RISCV32-SAME: sifive-e24,
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 42c0ad976089f7..2fb16f3bd48a2e 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -108,6 +108,7 @@ Changes to the RISC-V Backend
   fill value) rather than NOPs.
 * Added Syntacore SCR4 and SCR5 CPUs: ``-mcpu=syntacore-scr4/5-rv32/64``
 * ``-mcpu=sifive-p470`` was added.
+* Added Hazard3 CPU: ``-mcpu=hazard3`` (32-bit only).
 * Fixed length vector support using RVV instructions now requires VLEN>=64. This
   means Zve32x and Zve32f will also require Zvl64b. The prior support was
   largely untested.
diff --git a/llvm/lib/Target/RISCV/RISCVProcessors.td b/llvm/lib/Target/RISCV/RISCVProcessors.td
index 640fe9670d542b..d4ec5ecc6489c1 100644
--- a/llvm/lib/Target/RISCV/RISCVProcessors.td
+++ b/llvm/lib/Target/RISCV/RISCVProcessors.td
@@ -454,3 +454,19 @@ def SPACEMIT_X60 : RISCVProcessorModel<"spacemit-x60",
                                         FeatureStdExtZvkt,
                                         FeatureStdExtZvl256b]),
                                        [TuneDLenFactor2]>;
+
+def RP2350_HAZARD3 : RISCVProcessorModel<"rp2350-hazard3",
+                                         NoSchedModel,
+                                         [Feature32Bit,
+                                          FeatureStdExtI,
+                                          FeatureStdExtM,
+                                          FeatureStdExtA,
+                                          FeatureStdExtC,
+                                          FeatureStdExtZicsr,
+                                          FeatureStdExtZifencei,
+                                          FeatureStdExtZba,
+                                          FeatureStdExtZbb,
+                                          FeatureStdExtZbs,
+                                          FeatureStdExtZbkb,
+                                          FeatureStdExtZcb,
+                                          FeatureStdExtZcmp]>;



More information about the cfe-commits mailing list