[llvm] 21bce90 - [Support] Add CSKY target parser and attributes parser

Zi Xuan Wu via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 27 19:35:40 PST 2022


Author: Zi Xuan Wu
Date: 2022-02-28T11:35:07+08:00
New Revision: 21bce9007ae818f95863dca928c1488d982e5383

URL: https://github.com/llvm/llvm-project/commit/21bce9007ae818f95863dca928c1488d982e5383
DIFF: https://github.com/llvm/llvm-project/commit/21bce9007ae818f95863dca928c1488d982e5383.diff

LOG: [Support] Add CSKY target parser and attributes parser

Construct LLVM Support module about CSKY target parser and attribute parser.
It refers CSKY ABIv2 and implementation of GNU binutils and GCC.

https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf

Now we only support CSKY 800 series cpus and newer cpus in the future undering CSKYv2 ABI specification.
There are 11 archs including ck801, ck802, ck803, ck803s, ck804, ck805, ck807, ck810, ck810v, ck860, ck860v.

Every arch has base extensions, the cpus of that arch family have more extended extensions than base extensions.
We need specify extended extensions for every cpu. Every extension has its enum value, name and related llvm feature string with +/-.
Every enum value represents a bit of uint64_t integer.

Differential Revision: https://reviews.llvm.org/D119917

Added: 
    llvm/include/llvm/Support/CSKYAttributeParser.h
    llvm/include/llvm/Support/CSKYAttributes.h
    llvm/include/llvm/Support/CSKYTargetParser.def
    llvm/include/llvm/Support/CSKYTargetParser.h
    llvm/lib/Support/CSKYAttributeParser.cpp
    llvm/lib/Support/CSKYAttributes.cpp
    llvm/lib/Support/CSKYTargetParser.cpp
    llvm/unittests/Support/CSKYAttributeParserTest.cpp
    llvm/unittests/Support/CSKYTargetParserTest.cpp

Modified: 
    llvm/include/llvm/BinaryFormat/ELF.h
    llvm/lib/Support/CMakeLists.txt
    llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
    llvm/unittests/Support/CMakeLists.txt
    llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
    llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h
index 473fa41e4bd11..bc34f94cf1d1b 100644
--- a/llvm/include/llvm/BinaryFormat/ELF.h
+++ b/llvm/include/llvm/BinaryFormat/ELF.h
@@ -866,6 +866,23 @@ enum {
 #include "ELFRelocs/VE.def"
 };
 
+// CSKY Specific e_flags
+enum : unsigned {
+  EF_CSKY_801 = 0xa,
+  EF_CSKY_802 = 0x10,
+  EF_CSKY_803 = 0x9,
+  EF_CSKY_805 = 0x11,
+  EF_CSKY_807 = 0x6,
+  EF_CSKY_810 = 0x8,
+  EF_CSKY_860 = 0xb,
+  EF_CSKY_800 = 0x1f,
+  EF_CSKY_FLOAT = 0x2000,
+  EF_CSKY_DSP = 0x4000,
+  EF_CSKY_ABIV2 = 0x20000000,
+  EF_CSKY_EFV1 = 0x1000000,
+  EF_CSKY_EFV2 = 0x2000000,
+  EF_CSKY_EFV3 = 0x3000000
+};
 
 // ELF Relocation types for CSKY
 enum {
@@ -991,6 +1008,8 @@ enum : unsigned {
 
   SHT_RISCV_ATTRIBUTES = 0x70000003U,
 
+  SHT_CSKY_ATTRIBUTES = 0x70000001U,
+
   SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type.
   SHT_LOUSER = 0x80000000, // Lowest type reserved for applications.
   SHT_HIUSER = 0xffffffff  // Highest type reserved for applications.

diff  --git a/llvm/include/llvm/Support/CSKYAttributeParser.h b/llvm/include/llvm/Support/CSKYAttributeParser.h
new file mode 100644
index 0000000000000..e926ebe5e306e
--- /dev/null
+++ b/llvm/include/llvm/Support/CSKYAttributeParser.h
@@ -0,0 +1,43 @@
+//===---- CSKYAttributeParser.h - CSKY Attribute Parser ---------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H
+#define LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H
+
+#include "llvm/Support/CSKYAttributes.h"
+#include "llvm/Support/ELFAttributeParser.h"
+
+namespace llvm {
+class CSKYAttributeParser : public ELFAttributeParser {
+  struct DisplayHandler {
+    CSKYAttrs::AttrType attribute;
+    Error (CSKYAttributeParser::*routine)(unsigned);
+  };
+  static const DisplayHandler displayRoutines[];
+
+  Error dspVersion(unsigned tag);
+  Error vdspVersion(unsigned tag);
+  Error fpuVersion(unsigned tag);
+  Error fpuABI(unsigned tag);
+  Error fpuRounding(unsigned tag);
+  Error fpuDenormal(unsigned tag);
+  Error fpuException(unsigned tag);
+  Error fpuHardFP(unsigned tag);
+
+  Error handler(uint64_t tag, bool &handled) override;
+
+public:
+  CSKYAttributeParser(ScopedPrinter *sw)
+      : ELFAttributeParser(sw, CSKYAttrs::getCSKYAttributeTags(), "csky") {}
+  CSKYAttributeParser()
+      : ELFAttributeParser(CSKYAttrs::getCSKYAttributeTags(), "csky") {}
+};
+
+} // namespace llvm
+
+#endif

diff  --git a/llvm/include/llvm/Support/CSKYAttributes.h b/llvm/include/llvm/Support/CSKYAttributes.h
new file mode 100644
index 0000000000000..723f2ceee8fb7
--- /dev/null
+++ b/llvm/include/llvm/Support/CSKYAttributes.h
@@ -0,0 +1,95 @@
+//===---- CSKYAttributes.h - CSKY Attributes --------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains enumerations for CSKY attributes.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_SUPPORT_CSKYATTRIBUTES_H
+#define LLVM_SUPPORT_CSKYATTRIBUTES_H
+
+#include "llvm/Support/ELFAttributes.h"
+
+namespace llvm {
+namespace CSKYAttrs {
+
+const TagNameMap &getCSKYAttributeTags();
+
+enum AttrType {
+  CSKY_ARCH_NAME = 4,
+  CSKY_CPU_NAME = 5,
+  CSKY_ISA_FLAGS = 6,
+  CSKY_ISA_EXT_FLAGS = 7,
+  CSKY_DSP_VERSION = 8,
+  CSKY_VDSP_VERSION = 9,
+  CSKY_FPU_VERSION = 16,
+  CSKY_FPU_ABI = 17,
+  CSKY_FPU_ROUNDING = 18,
+  CSKY_FPU_DENORMAL = 19,
+  CSKY_FPU_EXCEPTION = 20,
+  CSKY_FPU_NUMBER_MODULE = 21,
+  CSKY_FPU_HARDFP = 22
+};
+
+enum ISA_FLAGS {
+  V2_ISA_E1 = 1 << 1,
+  V2_ISA_1E2 = 1 << 2,
+  V2_ISA_2E3 = 1 << 3,
+  V2_ISA_3E7 = 1 << 4,
+  V2_ISA_7E10 = 1 << 5,
+  V2_ISA_3E3R1 = 1 << 6,
+  V2_ISA_3E3R2 = 1 << 7,
+  V2_ISA_10E60 = 1 << 8,
+  V2_ISA_3E3R3 = 1 << 9,
+  ISA_TRUST = 1 << 11,
+  ISA_CACHE = 1 << 12,
+  ISA_NVIC = 1 << 13,
+  ISA_CP = 1 << 14,
+  ISA_MP = 1 << 15,
+  ISA_MP_1E2 = 1 << 16,
+  ISA_JAVA = 1 << 17,
+  ISA_MAC = 1 << 18,
+  ISA_MAC_DSP = 1 << 19,
+  ISA_DSP = 1 << 20,
+  ISA_DSP_1E2 = 1 << 21,
+  ISA_DSP_ENHANCE = 1 << 22,
+  ISA_DSP_SILAN = 1 << 23,
+  ISA_VDSP = 1 << 24,
+  ISA_VDSP_2 = 1 << 25,
+  ISA_VDSP_2E3 = 1 << 26,
+  V2_ISA_DSPE60 = 1 << 27,
+  ISA_VDSP_2E60F = 1 << 28
+};
+
+enum ISA_EXT_FLAGS {
+  ISA_FLOAT_E1 = 1 << 0,
+  ISA_FLOAT_1E2 = 1 << 1,
+  ISA_FLOAT_1E3 = 1 << 2,
+  ISA_FLOAT_3E4 = 1 << 3,
+  ISA_FLOAT_7E60 = 1 << 4
+};
+
+enum { NONE = 0, NEEDED = 1 };
+
+enum DSP_VERSION { DSP_VERSION_EXTENSION = 1, DSP_VERSION_2 = 2 };
+
+enum VDSP_VERSION { VDSP_VERSION_1 = 1, VDSP_VERSION_2 = 2 };
+
+enum FPU_VERSION { FPU_VERSION_1 = 1, FPU_VERSION_2 = 2, FPU_VERSION_3 = 3 };
+
+enum FPU_ABI { FPU_ABI_SOFT = 1, FPU_ABI_SOFTFP = 2, FPU_ABI_HARD = 3 };
+
+enum FPU_HARDFP {
+  FPU_HARDFP_HALF = 1,
+  FPU_HARDFP_SINGLE = 2,
+  FPU_HARDFP_DOUBLE = 4
+};
+
+} // namespace CSKYAttrs
+} // namespace llvm
+
+#endif

diff  --git a/llvm/include/llvm/Support/CSKYTargetParser.def b/llvm/include/llvm/Support/CSKYTargetParser.def
new file mode 100644
index 0000000000000..c93d6fdf8cce1
--- /dev/null
+++ b/llvm/include/llvm/Support/CSKYTargetParser.def
@@ -0,0 +1,524 @@
+//===- CSKYTargetParser.def - CSKY target parsing defines -------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file provides defines to build up the CSKY target parser's logic.
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: NO INCLUDE GUARD DESIRED!
+
+#ifndef CSKY_FPU
+#define CSKY_FPU(NAME, KIND, VERSION)
+#endif
+CSKY_FPU("invalid", FK_INVALID, FPUVersion::NONE)
+CSKY_FPU("auto", FK_AUTO, FPUVersion::FPV2)
+CSKY_FPU("fpv2", FK_FPV2, FPUVersion::FPV2)
+CSKY_FPU("fpv2_divd", FK_FPV2_DIVD, FPUVersion::FPV2)
+CSKY_FPU("fpv2_sf", FK_FPV2_SF, FPUVersion::FPV2)
+CSKY_FPU("fpv3", FK_FPV3, FPUVersion::FPV3)
+CSKY_FPU("fpv3_hf", FK_FPV3_HF, FPUVersion::FPV3)
+CSKY_FPU("fpv3_hsf", FK_FPV3_HSF, FPUVersion::FPV3)
+CSKY_FPU("fpv3_sdf", FK_FPV3_SDF, FPUVersion::FPV3)
+
+#undef CSKY_FPU
+
+#ifndef CSKY_ARCH
+#define CSKY_ARCH(NAME, ID, ARCH_BASE_EXT)
+#endif
+CSKY_ARCH("invalid", INVALID, CSKY::AEK_INVALID)
+CSKY_ARCH("ck801", CK801, CSKY::MAEK_E1 | CSKY::AEK_TRUST)
+CSKY_ARCH("ck802", CK802, CSKY::MAEK_E2 | CSKY::AEK_TRUST | CSKY::AEK_NVIC)
+CSKY_ARCH("ck803", CK803,
+          CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+              CSKY::AEK_HWDIV)
+CSKY_ARCH("ck803s", CK803S,
+          CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+              CSKY::AEK_HWDIV)
+CSKY_ARCH("ck804", CK804,
+          CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
+CSKY_ARCH("ck805", CK805,
+          CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+              CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG | CSKY::MAEK_3E3R2 |
+              CSKY::AEK_3E3R3 | CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3)
+CSKY_ARCH("ck807", CK807,
+          CSKY::MAEK_3E7 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+              CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+              CSKY::AEK_NVIC | CSKY::AEK_CACHE)
+CSKY_ARCH("ck810", CK810,
+          CSKY::MAEK_7E10 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+              CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+              CSKY::AEK_NVIC | CSKY::AEK_CACHE)
+CSKY_ARCH("ck810v", CK810V,
+          CSKY::MAEK_7E10 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+              CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+              CSKY::AEK_NVIC | CSKY::AEK_CACHE | CSKY::AEK_VDSPV1)
+CSKY_ARCH("ck860", CK860,
+          CSKY::MAEK_10E60 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 |
+              CSKY::AEK_TRUST | CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 |
+              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP | CSKY::AEK_NVIC |
+              CSKY::AEK_CACHE | CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
+CSKY_ARCH("ck860v", CK860V,
+          CSKY::MAEK_10E60 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 |
+              CSKY::AEK_TRUST | CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 |
+              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP | CSKY::AEK_NVIC |
+              CSKY::AEK_CACHE | CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E60F)
+#undef CSKY_ARCH
+
+#ifndef CSKY_ARCH_EXT_NAME
+#define CSKY_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE)
+#endif
+CSKY_ARCH_EXT_NAME("invalid", CSKY::AEK_INVALID, nullptr, nullptr)
+CSKY_ARCH_EXT_NAME("none", CSKY::AEK_NONE, nullptr, nullptr)
+CSKY_ARCH_EXT_NAME("fpuv2_sf", CSKY::AEK_FPUV2SF, "+fpuv2_sf", "-fpuv2_sf")
+CSKY_ARCH_EXT_NAME("fpuv2_df", CSKY::AEK_FPUV2DF, "+fpuv2_df", "-fpuv2_df")
+CSKY_ARCH_EXT_NAME("fdivdu", CSKY::AEK_FDIVDU, "+fdivdu", "-fdivdu")
+CSKY_ARCH_EXT_NAME("fpuv3_hi", CSKY::AEK_FPUV3HI, "+fpuv3_hi", "-fpuv3_hi")
+CSKY_ARCH_EXT_NAME("fpuv3_hf", CSKY::AEK_FPUV3HF, "+fpuv3_hf", "-fpuv3_hf")
+CSKY_ARCH_EXT_NAME("fpuv3_sf", CSKY::AEK_FPUV3SF, "+fpuv3_sf", "-fpuv3_sf")
+CSKY_ARCH_EXT_NAME("fpuv3_df", CSKY::AEK_FPUV3DF, "+fpuv3_df", "-fpuv3_df")
+CSKY_ARCH_EXT_NAME("floate1", CSKY::AEK_FLOATE1, "+floate1", "-floate1")
+CSKY_ARCH_EXT_NAME("float1e2", CSKY::AEK_FLOAT1E2, "+float1e2", "-float1e2")
+CSKY_ARCH_EXT_NAME("float1e3", CSKY::AEK_FLOAT1E3, "+float1e3", "-float1e3")
+CSKY_ARCH_EXT_NAME("float3e4", CSKY::AEK_FLOAT3E4, "+float3e4", "-float3e4")
+CSKY_ARCH_EXT_NAME("float7e60", CSKY::AEK_FLOAT7E60, "+float7e60", "-float7e60")
+CSKY_ARCH_EXT_NAME("hwdiv", CSKY::AEK_HWDIV, "+hwdiv", "-hwdiv")
+CSKY_ARCH_EXT_NAME("multiple_stld", CSKY::AEK_STLD, "+multiple_stld",
+                   "-multiple_stld")
+CSKY_ARCH_EXT_NAME("pushpop", CSKY::AEK_PUSHPOP, "+pushpop", "-pushpop")
+CSKY_ARCH_EXT_NAME("edsp", CSKY::AEK_EDSP, "+edsp", "-edsp")
+CSKY_ARCH_EXT_NAME("dsp1e2", CSKY::AEK_DSP1E2, "+dsp1e2", "-dsp1e2")
+CSKY_ARCH_EXT_NAME("dspe60", CSKY::AEK_DSPE60, "+dspe60", "-dspe60")
+CSKY_ARCH_EXT_NAME("dspv2", CSKY::AEK_DSPV2, "+dspv2", "-dspv2")
+CSKY_ARCH_EXT_NAME("dsp_silan", CSKY::AEK_DSPSILAN, "+dsp_silan", "-dsp_silan")
+CSKY_ARCH_EXT_NAME("elrw", CSKY::AEK_ELRW, "+elrw", "-elrw")
+CSKY_ARCH_EXT_NAME("trust", CSKY::AEK_TRUST, "+trust", "-trust")
+CSKY_ARCH_EXT_NAME("java", CSKY::AEK_JAVA, "+java", "-java")
+CSKY_ARCH_EXT_NAME("cache", CSKY::AEK_CACHE, "+cache", "-cache")
+CSKY_ARCH_EXT_NAME("nvic", CSKY::AEK_NVIC, "+nvic", "-nvic")
+CSKY_ARCH_EXT_NAME("doloop", CSKY::AEK_DOLOOP, "+doloop", "-doloop")
+CSKY_ARCH_EXT_NAME("high-registers", CSKY::AEK_HIGHREG, "+high-registers",
+                   "-high-registers")
+CSKY_ARCH_EXT_NAME("smart", CSKY::AEK_SMART, "+smart", "-smart")
+CSKY_ARCH_EXT_NAME("vdsp2e3", CSKY::AEK_VDSP2E3, "+vdsp2e3", "-vdsp2e3")
+CSKY_ARCH_EXT_NAME("vdsp2e60f", CSKY::AEK_VDSP2E60F, "+vdsp2e60f", "-vdsp2e60f")
+CSKY_ARCH_EXT_NAME("vdspv2", CSKY::AEK_VDSPV2, "+vdspv2", "-vdspv2")
+CSKY_ARCH_EXT_NAME("hard-tp", CSKY::AEK_HARDTP, "+hard-tp", "-hard-tp")
+CSKY_ARCH_EXT_NAME("soft-tp", CSKY::AEK_SOFTTP, "+soft-tp", "-soft-tp")
+CSKY_ARCH_EXT_NAME("istack", CSKY::AEK_ISTACK, "+istack", "-istack")
+CSKY_ARCH_EXT_NAME("constpool", CSKY::AEK_CONSTPOOL, "+constpool", "-constpool")
+CSKY_ARCH_EXT_NAME("stack-size", CSKY::AEK_STACKSIZE, "+stack-size",
+                   "-stack-size")
+CSKY_ARCH_EXT_NAME("ccrt", CSKY::AEK_CCRT, "+ccrt", "-ccrt")
+CSKY_ARCH_EXT_NAME("vdspv1", CSKY::AEK_VDSPV1, "+vdspv1", "-vdspv1")
+
+CSKY_ARCH_EXT_NAME("e1", CSKY::AEK_E1, "+e1", "-e1")
+CSKY_ARCH_EXT_NAME("e2", CSKY::AEK_E2, "+e2", "-e2")
+CSKY_ARCH_EXT_NAME("2e3", CSKY::AEK_2E3, "+2e3", "-2e3")
+CSKY_ARCH_EXT_NAME("mp", CSKY::AEK_MP, "+mp", "-mp")
+CSKY_ARCH_EXT_NAME("3e3r1", CSKY::AEK_3E3R1, "+3e3r1", "-3e3r1")
+CSKY_ARCH_EXT_NAME("3e3r2", CSKY::AEK_3E3R2, "+3e3r2", "-3e3r2")
+CSKY_ARCH_EXT_NAME("3e3r3", CSKY::AEK_3E3R3, "+3e3r3", "-3e3r3")
+CSKY_ARCH_EXT_NAME("3e7", CSKY::AEK_3E7, "+3e7", "-3e7")
+CSKY_ARCH_EXT_NAME("mp1e2", CSKY::AEK_MP1E2, "+mp1e2", "-mp1e2")
+CSKY_ARCH_EXT_NAME("7e10", CSKY::AEK_7E10, "+7e10", "-7e10")
+CSKY_ARCH_EXT_NAME("10e60", CSKY::AEK_10E60, "+10e60", "-10e60")
+
+#undef CSKY_ARCH_EXT_NAME
+
+#ifndef CSKY_CPU_NAME
+#define CSKY_CPU_NAME(NAME, ARCH_ID, DEFAULT_EXT)
+#endif
+
+CSKY_CPU_NAME("ck801", CK801, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck801t", CK801, CSKY::AEK_NONE)
+CSKY_CPU_NAME("e801", CK801, CSKY::AEK_NONE)
+
+CSKY_CPU_NAME("ck802", CK802, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck802t", CK802, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck802j", CK802, CSKY::AEK_JAVA)
+CSKY_CPU_NAME("e802", CK802, CSKY::AEK_NONE)
+CSKY_CPU_NAME("e802t", CK802, CSKY::AEK_NONE)
+CSKY_CPU_NAME("s802", CK802, CSKY::AEK_NONE)
+CSKY_CPU_NAME("s802t", CK802, CSKY::AEK_NONE)
+
+CSKY_CPU_NAME("ck803", CK803, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck803h", CK803, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck803t", CK803, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck803ht", CK803, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck803f", CK803,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803fh", CK803,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803e", CK803,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
+CSKY_CPU_NAME("ck803eh", CK803,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
+CSKY_CPU_NAME("ck803et", CK803,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
+CSKY_CPU_NAME("ck803eht", CK803,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
+CSKY_CPU_NAME("ck803ef", CK803,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803efh", CK803,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803ft", CK803,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803eft", CK803,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803efht", CK803,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803r1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803r2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803r3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803hr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803hr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803hr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803tr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803tr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803tr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803htr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803htr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803htr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
+CSKY_CPU_NAME("ck803fr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803fr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803fr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803fhr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803fhr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803fhr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803er1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803er2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803er3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803ehr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803ehr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803ehr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803etr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803etr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803etr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803ehtr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803ehtr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803ehtr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efhr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efhr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efhr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803ftr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803ftr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803ftr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803eftr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803eftr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803eftr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efhtr1", CK803,
+              CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efhtr2", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck803efhtr3", CK803,
+              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("s803", CK803, CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
+CSKY_CPU_NAME("s803t", CK803, CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
+CSKY_CPU_NAME("e803", CK803, CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
+CSKY_CPU_NAME("e803t", CK803, CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
+
+CSKY_CPU_NAME("ck803s", CK803S, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck803st", CK803S, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck803se", CK803S,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
+CSKY_CPU_NAME("ck803sf", CK803S,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803sef", CK803S,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck803seft", CK803S,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+
+CSKY_CPU_NAME("ck804", CK804, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck804h", CK804, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck804t", CK804, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck804ht", CK804, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck804f", CK804,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck804fh", CK804,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck804e", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck804eh", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck804et", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck804eht", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck804ef", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck804efh", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck804ft", CK804,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck804eft", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("ck804efht", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("e804d", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("e804dt", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("e804f", CK804,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("e804ft", CK804,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("e804df", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_HIGHREG)
+CSKY_CPU_NAME("e804dft", CK804,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_HIGHREG)
+
+CSKY_CPU_NAME("ck805", CK805, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck805e", CK805,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3)
+CSKY_CPU_NAME("ck805f", CK805,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck805t", CK805, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck805ef", CK805,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck805et", CK805,
+              CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3)
+CSKY_CPU_NAME("ck805ft", CK805,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+CSKY_CPU_NAME("ck805eft", CK805,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3)
+CSKY_CPU_NAME("i805", CK805, CSKY::AEK_NONE)
+CSKY_CPU_NAME("i805f", CK805,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
+
+CSKY_CPU_NAME("ck807", CK807, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck807e", CK807,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
+CSKY_CPU_NAME("ck807f", CK807,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_FLOAT3E4)
+CSKY_CPU_NAME("ck807ef", CK807,
+              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                  CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_FLOAT3E4)
+CSKY_CPU_NAME("c807", CK807, CSKY::AEK_NONE)
+CSKY_CPU_NAME("c807f", CK807,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_FLOAT3E4)
+CSKY_CPU_NAME("r807", CK807, CSKY::AEK_NONE)
+CSKY_CPU_NAME("r807f", CK807,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
+                  CSKY::AEK_FLOAT3E4)
+
+CSKY_CPU_NAME("ck810e", CK810, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck810et", CK810, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck810ef", CK810,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("ck810eft", CK810,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("ck810", CK810, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck810f", CK810,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("ck810t", CK810, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck810ft", CK810,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("c810", CK810,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("c810t", CK810,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+
+CSKY_CPU_NAME("ck810v", CK810V, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck810ev", CK810V, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck810tv", CK810V, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck810etv", CK810V, CSKY::AEK_NONE)
+CSKY_CPU_NAME("c810v", CK810V,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("ck810fv", CK810V,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("ck810efv", CK810V,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("ck810ftv", CK810V,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("c810tv", CK810V,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+CSKY_CPU_NAME("c810eftv", CK810V,
+              CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                  CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
+
+CSKY_CPU_NAME("ck860", CK860, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck860f", CK860,
+              CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
+                  CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60)
+CSKY_CPU_NAME("c860", CK860,
+              CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
+                  CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60)
+
+CSKY_CPU_NAME("ck860v", CK860V, CSKY::AEK_NONE)
+CSKY_CPU_NAME("ck860fv", CK860V,
+              CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
+                  CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60)
+CSKY_CPU_NAME("c860v", CK860V,
+              CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
+                  CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60)
+// Invalid CPU
+CSKY_CPU_NAME("invalid", INVALID, CSKY::AEK_INVALID)
+#undef CSKY_CPU_NAME

diff  --git a/llvm/include/llvm/Support/CSKYTargetParser.h b/llvm/include/llvm/Support/CSKYTargetParser.h
new file mode 100644
index 0000000000000..ca33a7ee406c3
--- /dev/null
+++ b/llvm/include/llvm/Support/CSKYTargetParser.h
@@ -0,0 +1,203 @@
+//===-- CSKYTargetParser - Parser for CSKY target features --------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements a target parser to recognise CSKY hardware features
+// such as FPU/CPU/ARCH/extensions and specific support such as HWDIV.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_CSKYTARGETPARSER_H
+#define LLVM_SUPPORT_CSKYTARGETPARSER_H
+
+#include "llvm/ADT/Triple.h"
+#include <vector>
+
+namespace llvm {
+class StringRef;
+
+namespace CSKY {
+
+// Arch extension modifiers for CPUs.
+enum ArchExtKind : uint64_t {
+  AEK_INVALID = 0,
+  AEK_NONE = 1,
+  AEK_FPUV2SF = 1 << 1,
+  AEK_FPUV2DF = 1 << 2,
+  AEK_FDIVDU = 1 << 3,
+  AEK_FPUV3HI = 1 << 4,
+  AEK_FPUV3HF = 1 << 5,
+  AEK_FPUV3SF = 1 << 6,
+  AEK_FPUV3DF = 1 << 7,
+  AEK_FLOATE1 = 1 << 8,
+  AEK_FLOAT1E2 = 1 << 9,
+  AEK_FLOAT1E3 = 1 << 10,
+  AEK_FLOAT3E4 = 1 << 11,
+  AEK_FLOAT7E60 = 1 << 12,
+  AEK_HWDIV = 1 << 13,
+  AEK_STLD = 1 << 14,
+  AEK_PUSHPOP = 1 << 15,
+  AEK_EDSP = 1 << 16,
+  AEK_DSP1E2 = 1 << 17,
+  AEK_DSPE60 = 1 << 18,
+  AEK_DSPV2 = 1 << 19,
+  AEK_DSPSILAN = 1 << 20,
+  AEK_ELRW = 1 << 21,
+  AEK_TRUST = 1 << 22,
+  AEK_JAVA = 1 << 23,
+  AEK_CACHE = 1 << 24,
+  AEK_NVIC = 1 << 25,
+  AEK_DOLOOP = 1 << 26,
+  AEK_HIGHREG = 1 << 27,
+  AEK_SMART = 1 << 28,
+  AEK_VDSP2E3 = 1 << 29,
+  AEK_VDSP2E60F = 1 << 30,
+  AEK_VDSPV2 = 1ULL << 31,
+  AEK_HARDTP = 1ULL << 32,
+  AEK_SOFTTP = 1ULL << 33,
+  AEK_ISTACK = 1ULL << 34,
+  AEK_CONSTPOOL = 1ULL << 35,
+  AEK_STACKSIZE = 1ULL << 36,
+  AEK_CCRT = 1ULL << 37,
+  AEK_VDSPV1 = 1ULL << 38,
+  AEK_E1 = 1ULL << 39,
+  AEK_E2 = 1ULL << 40,
+  AEK_2E3 = 1ULL << 41,
+  AEK_MP = 1ULL << 42,
+  AEK_3E3R1 = 1ULL << 43,
+  AEK_3E3R2 = 1ULL << 44,
+  AEK_3E3R3 = 1ULL << 45,
+  AEK_3E7 = 1ULL << 46,
+  AEK_MP1E2 = 1ULL << 47,
+  AEK_7E10 = 1ULL << 48,
+  AEK_10E60 = 1ULL << 49
+
+};
+
+// Arch extension modifiers for CPUs.
+enum MultiArchExtKind : uint64_t {
+  MAEK_E1 = CSKY::AEK_E1 | CSKY::AEK_ELRW,
+  MAEK_E2 = CSKY::AEK_E2 | CSKY::MAEK_E1,
+  MAEK_2E3 = CSKY::AEK_2E3 | CSKY::MAEK_E2,
+  MAEK_MP = CSKY::AEK_MP | CSKY::MAEK_2E3,
+  MAEK_3E3R1 = CSKY::AEK_3E3R1,
+  MAEK_3E3R2 = CSKY::AEK_3E3R1 | CSKY::AEK_3E3R2 | CSKY::AEK_DOLOOP,
+  MAEK_3E7 = CSKY::AEK_3E7 | CSKY::MAEK_2E3,
+  MAEK_MP1E2 = CSKY::AEK_MP1E2 | CSKY::MAEK_3E7,
+  MAEK_7E10 = CSKY::AEK_7E10 | CSKY::MAEK_3E7,
+  MAEK_10E60 = CSKY::AEK_10E60 | CSKY::MAEK_7E10,
+};
+// FPU names.
+enum CSKYFPUKind {
+#define CSKY_FPU(NAME, KIND, VERSION) KIND,
+#include "CSKYTargetParser.def"
+  FK_LAST
+};
+
+// FPU Version
+enum class FPUVersion {
+  NONE,
+  FPV2,
+  FPV3,
+};
+
+// Arch names.
+enum class ArchKind {
+#define CSKY_ARCH(NAME, ID, ARCH_BASE_EXT) ID,
+#include "CSKYTargetParser.def"
+};
+
+// List of Arch Extension names.
+// FIXME: TableGen this.
+struct ExtName {
+  const char *NameCStr;
+  size_t NameLength;
+  uint64_t ID;
+  const char *Feature;
+  const char *NegFeature;
+
+  StringRef getName() const { return StringRef(NameCStr, NameLength); }
+};
+
+const CSKY::ExtName CSKYARCHExtNames[] = {
+#define CSKY_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE)                      \
+  {NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE},
+#include "CSKYTargetParser.def"
+};
+
+// List of CPU names and their arches.
+template <typename T> struct CpuNames {
+  const char *NameCStr;
+  size_t NameLength;
+  T ArchID;
+  uint64_t defaultExt;
+
+  StringRef getName() const { return StringRef(NameCStr, NameLength); }
+};
+const CpuNames<CSKY::ArchKind> CPUNames[] = {
+#define CSKY_CPU_NAME(NAME, ARCH_ID, DEFAULT_EXT)                              \
+  {NAME, sizeof(NAME) - 1, CSKY::ArchKind::ARCH_ID, DEFAULT_EXT},
+#include "llvm/Support/CSKYTargetParser.def"
+};
+
+// FIXME: TableGen this.
+// The entries must appear in the order listed in CSKY::CSKYFPUKind for correct
+// indexing
+struct FPUName {
+  const char *NameCStr;
+  size_t NameLength;
+  CSKYFPUKind ID;
+  FPUVersion FPUVer;
+
+  StringRef getName() const { return StringRef(NameCStr, NameLength); }
+};
+
+static const FPUName FPUNames[] = {
+#define CSKY_FPU(NAME, KIND, VERSION) {NAME, sizeof(NAME) - 1, KIND, VERSION},
+#include "llvm/Support/CSKYTargetParser.def"
+};
+
+// List of canonical arch names.
+template <typename T> struct ArchNames {
+  const char *NameCStr;
+  size_t NameLength;
+  T ID;
+  uint64_t archBaseExt;
+  StringRef getName() const { return StringRef(NameCStr, NameLength); }
+};
+const ArchNames<CSKY::ArchKind> ARCHNames[] = {
+#define CSKY_ARCH(NAME, ID, ARCH_BASE_EXT)                                     \
+  {NAME, sizeof(NAME) - 1, CSKY::ArchKind::ID, ARCH_BASE_EXT},
+#include "llvm/Support/CSKYTargetParser.def"
+};
+
+StringRef getArchName(ArchKind AK);
+StringRef getDefaultCPU(StringRef Arch);
+StringRef getArchExtName(uint64_t ArchExtKind);
+StringRef getArchExtFeature(StringRef ArchExt);
+uint64_t getDefaultExtensions(StringRef CPU);
+bool getExtensionFeatures(uint64_t Extensions,
+                          std::vector<StringRef> &Features);
+
+// Information by ID
+StringRef getFPUName(unsigned FPUKind);
+FPUVersion getFPUVersion(unsigned FPUKind);
+
+bool getFPUFeatures(CSKYFPUKind Kind, std::vector<StringRef> &Features);
+
+// Parser
+ArchKind parseArch(StringRef Arch);
+ArchKind parseCPUArch(StringRef CPU);
+uint64_t parseArchExt(StringRef ArchExt);
+void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values);
+
+} // namespace CSKY
+
+} // namespace llvm
+
+#endif

diff  --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 4d9099554192d..b9afc33d89d2e 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -134,6 +134,9 @@ add_llvm_component_library(LLVMSupport
   ConvertUTF.cpp
   ConvertUTFWrapper.cpp
   CrashRecoveryContext.cpp
+  CSKYAttributes.cpp
+  CSKYAttributeParser.cpp
+  CSKYTargetParser.cpp
   DataExtractor.cpp
   Debug.cpp
   DebugCounter.cpp

diff  --git a/llvm/lib/Support/CSKYAttributeParser.cpp b/llvm/lib/Support/CSKYAttributeParser.cpp
new file mode 100644
index 0000000000000..ea1ac92323158
--- /dev/null
+++ b/llvm/lib/Support/CSKYAttributeParser.cpp
@@ -0,0 +1,155 @@
+//===-- CSKYAttributeParser.cpp - CSKY Attribute Parser -----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/CSKYAttributeParser.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Errc.h"
+
+using namespace llvm;
+
+const CSKYAttributeParser::DisplayHandler
+    CSKYAttributeParser::displayRoutines[] = {
+        {
+            CSKYAttrs::CSKY_ARCH_NAME,
+            &ELFAttributeParser::stringAttribute,
+        },
+        {
+            CSKYAttrs::CSKY_CPU_NAME,
+            &ELFAttributeParser::stringAttribute,
+        },
+        {
+            CSKYAttrs::CSKY_ISA_FLAGS,
+            &ELFAttributeParser::integerAttribute,
+        },
+        {
+            CSKYAttrs::CSKY_ISA_EXT_FLAGS,
+            &ELFAttributeParser::integerAttribute,
+        },
+        {
+            CSKYAttrs::CSKY_DSP_VERSION,
+            &CSKYAttributeParser::dspVersion,
+        },
+        {
+            CSKYAttrs::CSKY_VDSP_VERSION,
+            &CSKYAttributeParser::vdspVersion,
+        },
+        {
+            CSKYAttrs::CSKY_FPU_VERSION,
+            &CSKYAttributeParser::fpuVersion,
+        },
+        {
+            CSKYAttrs::CSKY_FPU_ABI,
+            &CSKYAttributeParser::fpuABI,
+        },
+        {
+            CSKYAttrs::CSKY_FPU_ROUNDING,
+            &CSKYAttributeParser::fpuRounding,
+        },
+        {
+            CSKYAttrs::CSKY_FPU_DENORMAL,
+            &CSKYAttributeParser::fpuDenormal,
+        },
+        {
+            CSKYAttrs::CSKY_FPU_EXCEPTION,
+            &CSKYAttributeParser::fpuException,
+        },
+        {
+            CSKYAttrs::CSKY_FPU_NUMBER_MODULE,
+            &ELFAttributeParser::stringAttribute,
+        },
+        {
+            CSKYAttrs::CSKY_FPU_HARDFP,
+            &CSKYAttributeParser::fpuHardFP,
+        }};
+
+Error CSKYAttributeParser::handler(uint64_t tag, bool &handled) {
+  handled = false;
+  for (unsigned AHI = 0, AHE = array_lengthof(displayRoutines); AHI != AHE;
+       ++AHI) {
+    if (uint64_t(displayRoutines[AHI].attribute) == tag) {
+      if (Error e = (this->*displayRoutines[AHI].routine)(tag))
+        return e;
+      handled = true;
+      break;
+    }
+  }
+
+  return Error::success();
+}
+
+Error CSKYAttributeParser::dspVersion(unsigned tag) {
+  static const char *strings[] = {"Error", "DSP Extension", "DSP 2.0"};
+  return parseStringAttribute("Tag_CSKY_DSP_VERSION", tag,
+                              makeArrayRef(strings));
+}
+
+Error CSKYAttributeParser::vdspVersion(unsigned tag) {
+  static const char *strings[] = {"Error", "VDSP Version 1", "VDSP Version 2"};
+  return parseStringAttribute("Tag_CSKY_VDSP_VERSION", tag,
+                              makeArrayRef(strings));
+}
+
+Error CSKYAttributeParser::fpuVersion(unsigned tag) {
+  static const char *strings[] = {"Error", "FPU Version 1", "FPU Version 2",
+                                  "FPU Version 3"};
+  return parseStringAttribute("Tag_CSKY_FPU_VERSION", tag,
+                              makeArrayRef(strings));
+}
+
+Error CSKYAttributeParser::fpuABI(unsigned tag) {
+  static const char *strings[] = {"Error", "Soft", "SoftFP", "Hard"};
+  return parseStringAttribute("Tag_CSKY_FPU_ABI", tag, makeArrayRef(strings));
+}
+
+Error CSKYAttributeParser::fpuRounding(unsigned tag) {
+  static const char *strings[] = {"None", "Needed"};
+  return parseStringAttribute("Tag_CSKY_FPU_ROUNDING", tag,
+                              makeArrayRef(strings));
+}
+
+Error CSKYAttributeParser::fpuDenormal(unsigned tag) {
+  static const char *strings[] = {"None", "Needed"};
+  return parseStringAttribute("Tag_CSKY_FPU_DENORMAL", tag,
+                              makeArrayRef(strings));
+}
+
+Error CSKYAttributeParser::fpuException(unsigned tag) {
+  static const char *strings[] = {"None", "Needed"};
+  return parseStringAttribute("Tag_CSKY_FPU_EXCEPTION", tag,
+                              makeArrayRef(strings));
+}
+
+Error CSKYAttributeParser::fpuHardFP(unsigned tag) {
+  uint64_t value = de.getULEB128(cursor);
+  ListSeparator LS(" ");
+
+  std::string description;
+
+  if (value & 0x1) {
+    description += LS;
+    description += "Half";
+  }
+  if ((value >> 1) & 0x1) {
+    description += LS;
+    description += "Single";
+  }
+  if ((value >> 2) & 0x1) {
+    description += LS;
+    description += "Double";
+  }
+
+  if (description.empty()) {
+    printAttribute(tag, value, "");
+    return createStringError(errc::invalid_argument,
+                             "unknown Tag_CSKY_FPU_HARDFP value: " +
+                                 Twine(value));
+  }
+
+  printAttribute(tag, value, description);
+  return Error::success();
+}

diff  --git a/llvm/lib/Support/CSKYAttributes.cpp b/llvm/lib/Support/CSKYAttributes.cpp
new file mode 100644
index 0000000000000..6130517e44e3f
--- /dev/null
+++ b/llvm/lib/Support/CSKYAttributes.cpp
@@ -0,0 +1,33 @@
+//===-- CSKYAttributes.cpp - CSKY Attributes ------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/CSKYAttributes.h"
+
+using namespace llvm;
+using namespace llvm::CSKYAttrs;
+
+static const TagNameItem tagData[] = {
+    {CSKY_ARCH_NAME, "Tag_CSKY_ARCH_NAME"},
+    {CSKY_CPU_NAME, "Tag_CSKY_CPU_NAME"},
+    {CSKY_CPU_NAME, "Tag_CSKY_CPU_NAME"},
+    {CSKY_ISA_FLAGS, "Tag_CSKY_ISA_FLAGS"},
+    {CSKY_ISA_EXT_FLAGS, "Tag_CSKY_ISA_EXT_FLAGS"},
+    {CSKY_DSP_VERSION, "Tag_CSKY_DSP_VERSION"},
+    {CSKY_VDSP_VERSION, "Tag_CSKY_VDSP_VERSION"},
+    {CSKY_FPU_VERSION, "Tag_CSKY_FPU_VERSION"},
+    {CSKY_FPU_ABI, "Tag_CSKY_FPU_ABI"},
+    {CSKY_FPU_ROUNDING, "Tag_CSKY_FPU_ROUNDING"},
+    {CSKY_FPU_DENORMAL, "Tag_CSKY_FPU_DENORMAL"},
+    {CSKY_FPU_EXCEPTION, "Tag_CSKY_FPU_EXCEPTION"},
+    {CSKY_FPU_NUMBER_MODULE, "Tag_CSKY_FPU_NUMBER_MODULE"},
+    {CSKY_FPU_HARDFP, "Tag_CSKY_FPU_HARDFP"}};
+
+constexpr TagNameMap CSKYAttributeTags{tagData};
+const TagNameMap &llvm::CSKYAttrs::getCSKYAttributeTags() {
+  return CSKYAttributeTags;
+}

diff  --git a/llvm/lib/Support/CSKYTargetParser.cpp b/llvm/lib/Support/CSKYTargetParser.cpp
new file mode 100644
index 0000000000000..1c72a6318e3fb
--- /dev/null
+++ b/llvm/lib/Support/CSKYTargetParser.cpp
@@ -0,0 +1,181 @@
+//===-- TargetParser - Parser for target features ---------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements a target parser to recognise CSKY hardware features
+// such as CPU/ARCH names.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/CSKYTargetParser.h"
+#include "llvm/ADT/StringSwitch.h"
+#include <cctype>
+
+using namespace llvm;
+
+bool CSKY::getFPUFeatures(CSKYFPUKind CSKYFPUKind,
+                          std::vector<StringRef> &Features) {
+
+  if (CSKYFPUKind >= FK_LAST || CSKYFPUKind == FK_INVALID)
+    return false;
+
+  switch (CSKYFPUKind) {
+  case FK_AUTO:
+    Features.push_back("+fpuv2_sf");
+    Features.push_back("+fpuv2_df");
+    Features.push_back("+fdivdu");
+    break;
+  case FK_FPV2:
+    Features.push_back("+fpuv2_sf");
+    Features.push_back("+fpuv2_df");
+    break;
+  case FK_FPV2_DIVD:
+    Features.push_back("+fpuv2_sf");
+    Features.push_back("+fpuv2_df");
+    Features.push_back("+fdivdu");
+    break;
+  case FK_FPV2_SF:
+    Features.push_back("+fpuv2_sf");
+    break;
+  case FK_FPV3:
+    Features.push_back("+fpuv3_hf");
+    Features.push_back("+fpuv3_sf");
+    Features.push_back("+fpuv3_df");
+    break;
+  case FK_FPV3_HF:
+    Features.push_back("+fpuv3_hf");
+    break;
+  case FK_FPV3_HSF:
+    Features.push_back("+fpuv3_hf");
+    Features.push_back("+fpuv3_sf");
+    break;
+  case FK_FPV3_SDF:
+    Features.push_back("+fpuv3_sf");
+    Features.push_back("+fpuv3_df");
+    break;
+  default:
+    llvm_unreachable("Unknown FPU Kind");
+    return false;
+  }
+
+  return true;
+}
+
+// ======================================================= //
+// Information by ID
+// ======================================================= //
+
+StringRef CSKY::getArchName(ArchKind AK) {
+  return ARCHNames[static_cast<unsigned>(AK)].getName();
+}
+
+// The default cpu's name is same as arch name.
+StringRef CSKY::getDefaultCPU(StringRef Arch) {
+  ArchKind AK = parseArch(Arch);
+  if (AK == CSKY::ArchKind::INVALID)
+    return StringRef();
+
+  return Arch;
+}
+
+// ======================================================= //
+// Parsers
+// ======================================================= //
+CSKY::ArchKind CSKY::parseArch(StringRef Arch) {
+  for (const auto A : ARCHNames) {
+    if (A.getName() == Arch)
+      return A.ID;
+  }
+
+  return CSKY::ArchKind::INVALID;
+}
+
+CSKY::ArchKind CSKY::parseCPUArch(StringRef CPU) {
+  for (const auto C : CPUNames) {
+    if (CPU == C.getName())
+      return C.ArchID;
+  }
+
+  return CSKY::ArchKind::INVALID;
+}
+
+uint64_t CSKY::parseArchExt(StringRef ArchExt) {
+  for (const auto &A : CSKYARCHExtNames) {
+    if (ArchExt == A.getName())
+      return A.ID;
+  }
+  return AEK_INVALID;
+}
+
+void CSKY::fillValidCPUArchList(SmallVectorImpl<StringRef> &Values) {
+  for (const CpuNames<CSKY::ArchKind> &Arch : CPUNames) {
+    if (Arch.ArchID != CSKY::ArchKind::INVALID)
+      Values.push_back(Arch.getName());
+  }
+}
+
+StringRef CSKY::getFPUName(unsigned FPUKind) {
+  if (FPUKind >= FK_LAST)
+    return StringRef();
+  return FPUNames[FPUKind].getName();
+}
+
+CSKY::FPUVersion CSKY::getFPUVersion(unsigned FPUKind) {
+  if (FPUKind >= FK_LAST)
+    return FPUVersion::NONE;
+  return FPUNames[FPUKind].FPUVer;
+}
+
+uint64_t CSKY::getDefaultExtensions(StringRef CPU) {
+  return StringSwitch<uint64_t>(CPU)
+#define CSKY_CPU_NAME(NAME, ID, DEFAULT_EXT)                                   \
+  .Case(NAME, ARCHNames[static_cast<unsigned>(ArchKind::ID)].archBaseExt |     \
+                  DEFAULT_EXT)
+#include "llvm/Support/CSKYTargetParser.def"
+      .Default(CSKY::AEK_INVALID);
+}
+
+StringRef CSKY::getArchExtName(uint64_t ArchExtKind) {
+  for (const auto &AE : CSKYARCHExtNames)
+    if (ArchExtKind == AE.ID)
+      return AE.getName();
+  return StringRef();
+}
+
+static bool stripNegationPrefix(StringRef &Name) {
+  if (Name.startswith("no")) {
+    Name = Name.substr(2);
+    return true;
+  }
+  return false;
+}
+
+StringRef CSKY::getArchExtFeature(StringRef ArchExt) {
+  bool Negated = stripNegationPrefix(ArchExt);
+  for (const auto &AE : CSKYARCHExtNames) {
+    if (AE.Feature && ArchExt == AE.getName())
+      return StringRef(Negated ? AE.NegFeature : AE.Feature);
+  }
+
+  return StringRef();
+}
+
+bool CSKY::getExtensionFeatures(uint64_t Extensions,
+                                std::vector<StringRef> &Features) {
+  if (Extensions == CSKY::AEK_INVALID)
+    return false;
+
+  for (const auto &AE : CSKYARCHExtNames) {
+    if ((Extensions & AE.ID) == AE.ID && AE.Feature)
+      Features.push_back(AE.Feature);
+    else if (AE.NegFeature)
+      Features.push_back(AE.NegFeature);
+  }
+
+  return true;
+}

diff  --git a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
index abd4915555b76..2e54d8240c81c 100644
--- a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
+++ b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
@@ -18,6 +18,7 @@
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCParser/MCAsmLexer.h"
 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
 #include "llvm/MC/MCParser/MCTargetAsmParser.h"

diff  --git a/llvm/unittests/Support/CMakeLists.txt b/llvm/unittests/Support/CMakeLists.txt
index 66eecb5377c9b..a20e1ccc2ed00 100644
--- a/llvm/unittests/Support/CMakeLists.txt
+++ b/llvm/unittests/Support/CMakeLists.txt
@@ -22,6 +22,8 @@ add_llvm_unittest(SupportTests
   CompressionTest.cpp
   ConvertUTFTest.cpp
   CRCTest.cpp
+  CSKYAttributeParserTest.cpp
+  CSKYTargetParserTest.cpp
   DataExtractorTest.cpp
   DebugTest.cpp
   DebugCounterTest.cpp

diff  --git a/llvm/unittests/Support/CSKYAttributeParserTest.cpp b/llvm/unittests/Support/CSKYAttributeParserTest.cpp
new file mode 100644
index 0000000000000..db64ef72d1a99
--- /dev/null
+++ b/llvm/unittests/Support/CSKYAttributeParserTest.cpp
@@ -0,0 +1,236 @@
+//===----- unittests/CSKYAttributeParserTest.cpp --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#include "llvm/Support/CSKYAttributeParser.h"
+#include "llvm/Support/ARMBuildAttributes.h"
+#include "llvm/Support/ELFAttributes.h"
+#include "gtest/gtest.h"
+#include <string>
+
+using namespace llvm;
+
+struct CSKYAttributeSection {
+  unsigned Tag;
+  struct {
+    unsigned IntValue;
+    const char *StringValue;
+  } Value;
+
+  CSKYAttributeSection(unsigned tag, unsigned value) : Tag(tag) {
+    Value.IntValue = value;
+  }
+
+  CSKYAttributeSection(unsigned tag, const char *value) : Tag(tag) {
+    Value.StringValue = value;
+  }
+
+  void writeInt(raw_ostream &OS) {
+    OS.flush();
+    // Format version.
+    OS << 'A'
+       // uint32_t = VendorHeaderSize + TagHeaderSize + ContentsSize.
+       << (uint8_t)16 << (uint8_t)0 << (uint8_t)0
+       << (uint8_t)0
+       // CurrentVendor.
+       << "csky"
+       << '\0'
+       // ELFAttrs::File.
+       << (uint8_t)1
+       // uint32_t = TagHeaderSize + ContentsSize.
+       << (uint8_t)6 << (uint8_t)0 << (uint8_t)0
+       << (uint8_t)0
+       // Tag
+       << (uint8_t)Tag
+       // IntValue
+       << (uint8_t)Value.IntValue;
+  }
+
+  void writeString(raw_ostream &OS) {
+    OS.flush();
+    // Format version.
+    OS << 'A'
+       // uint32_t = VendorHeaderSize + TagHeaderSize + ContentsSize.
+       << (uint8_t)(16 + strlen(Value.StringValue)) << (uint8_t)0 << (uint8_t)0
+       << (uint8_t)0
+       // CurrentVendor.
+       << "csky"
+       << '\0'
+       // ELFAttrs::File.
+       << (uint8_t)1
+       // uint32_t = TagHeaderSize + ContentsSize.
+       << (uint8_t)(6 + strlen(Value.StringValue)) << (uint8_t)0 << (uint8_t)0
+       << (uint8_t)0
+       // Tag
+       << (uint8_t)Tag
+       // StringValue
+       << Value.StringValue << '\0';
+  }
+};
+
+static bool testAttributeInt(unsigned Tag, unsigned Value, unsigned ExpectedTag,
+                             unsigned ExpectedValue) {
+  std::string buffer;
+  raw_string_ostream OS(buffer);
+  CSKYAttributeSection Section(Tag, Value);
+  Section.writeInt(OS);
+  ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(OS.str().c_str()),
+                          OS.str().size());
+
+  CSKYAttributeParser Parser;
+  cantFail(Parser.parse(Bytes, support::little));
+
+  Optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
+  return Attr.hasValue() && Attr.getValue() == ExpectedValue;
+}
+
+static bool testAttributeString(unsigned Tag, const char *Value,
+                                unsigned ExpectedTag,
+                                const char *ExpectedValue) {
+  std::string buffer;
+  raw_string_ostream OS(buffer);
+  CSKYAttributeSection Section(Tag, Value);
+  Section.writeString(OS);
+  ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(OS.str().c_str()),
+                          OS.str().size());
+
+  CSKYAttributeParser Parser;
+  cantFail(Parser.parse(Bytes, support::little));
+
+  Optional<StringRef> Attr = Parser.getAttributeString(ExpectedTag);
+  return Attr.hasValue() && Attr.getValue() == ExpectedValue;
+}
+
+static void testParseError(unsigned Tag, unsigned Value, const char *msg) {
+  std::string buffer;
+  raw_string_ostream OS(buffer);
+  CSKYAttributeSection Section(Tag, Value);
+  Section.writeInt(OS);
+  ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(OS.str().c_str()),
+                          OS.str().size());
+
+  CSKYAttributeParser Parser;
+  Error e = Parser.parse(Bytes, support::little);
+  EXPECT_STREQ(toString(std::move(e)).c_str(), msg);
+}
+
+static bool testTagString(unsigned Tag, const char *name) {
+  return ELFAttrs::attrTypeAsString(Tag, CSKYAttrs::getCSKYAttributeTags())
+             .str() == name;
+}
+
+TEST(ArchName, testAttribute) {
+  EXPECT_TRUE(testTagString(4, "Tag_CSKY_ARCH_NAME"));
+  EXPECT_TRUE(
+      testAttributeString(4, "ck860", CSKYAttrs::CSKY_ARCH_NAME, "ck860"));
+  EXPECT_FALSE(
+      testAttributeString(4, "ck86", CSKYAttrs::CSKY_ARCH_NAME, "ck60"));
+}
+
+TEST(CPUName, testAttribute) {
+  EXPECT_TRUE(testTagString(5, "Tag_CSKY_CPU_NAME"));
+  EXPECT_TRUE(
+      testAttributeString(5, "ck860fv", CSKYAttrs::CSKY_CPU_NAME, "ck860fv"));
+  EXPECT_FALSE(
+      testAttributeString(5, "ck860", CSKYAttrs::CSKY_CPU_NAME, "ck860fv"));
+}
+
+TEST(DSPVersion, testAttribute) {
+  EXPECT_TRUE(testTagString(8, "Tag_CSKY_DSP_VERSION"));
+  EXPECT_TRUE(testAttributeInt(8, 1, CSKYAttrs::CSKY_DSP_VERSION,
+                               CSKYAttrs::DSP_VERSION_EXTENSION));
+  EXPECT_TRUE(testAttributeInt(8, 2, CSKYAttrs::CSKY_DSP_VERSION,
+                               CSKYAttrs::DSP_VERSION_2));
+  EXPECT_FALSE(testAttributeInt(8, 0, CSKYAttrs::CSKY_DSP_VERSION,
+                                CSKYAttrs::DSP_VERSION_EXTENSION));
+  testParseError(8, 3, "unknown Tag_CSKY_DSP_VERSION value: 3");
+}
+
+TEST(VDSPVersion, testAttribute) {
+  EXPECT_TRUE(testTagString(9, "Tag_CSKY_VDSP_VERSION"));
+  EXPECT_TRUE(testAttributeInt(9, 1, CSKYAttrs::CSKY_VDSP_VERSION,
+                               CSKYAttrs::VDSP_VERSION_1));
+  EXPECT_TRUE(testAttributeInt(9, 2, CSKYAttrs::CSKY_VDSP_VERSION,
+                               CSKYAttrs::VDSP_VERSION_2));
+  EXPECT_FALSE(testAttributeInt(9, 0, CSKYAttrs::CSKY_VDSP_VERSION,
+                                CSKYAttrs::VDSP_VERSION_2));
+  testParseError(9, 3, "unknown Tag_CSKY_VDSP_VERSION value: 3");
+}
+
+TEST(FPUVersion, testAttribute) {
+  EXPECT_TRUE(testTagString(16, "Tag_CSKY_FPU_VERSION"));
+  EXPECT_TRUE(testAttributeInt(16, 1, CSKYAttrs::CSKY_FPU_VERSION,
+                               CSKYAttrs::FPU_VERSION_1));
+  EXPECT_TRUE(testAttributeInt(16, 2, CSKYAttrs::CSKY_FPU_VERSION,
+                               CSKYAttrs::FPU_VERSION_2));
+  EXPECT_TRUE(testAttributeInt(16, 3, CSKYAttrs::CSKY_FPU_VERSION,
+                               CSKYAttrs::FPU_VERSION_3));
+  EXPECT_FALSE(testAttributeInt(16, 0, CSKYAttrs::CSKY_FPU_VERSION,
+                                CSKYAttrs::FPU_VERSION_3));
+  testParseError(16, 4, "unknown Tag_CSKY_FPU_VERSION value: 4");
+}
+
+TEST(FPUABI, testAttribute) {
+  EXPECT_TRUE(testTagString(17, "Tag_CSKY_FPU_ABI"));
+  EXPECT_TRUE(testAttributeInt(17, 1, CSKYAttrs::CSKY_FPU_ABI,
+                               CSKYAttrs::FPU_ABI_SOFT));
+  EXPECT_TRUE(testAttributeInt(17, 2, CSKYAttrs::CSKY_FPU_ABI,
+                               CSKYAttrs::FPU_ABI_SOFTFP));
+  EXPECT_TRUE(testAttributeInt(17, 3, CSKYAttrs::CSKY_FPU_ABI,
+                               CSKYAttrs::FPU_ABI_HARD));
+  EXPECT_FALSE(testAttributeInt(17, 0, CSKYAttrs::CSKY_FPU_ABI,
+                                CSKYAttrs::FPU_ABI_HARD));
+  testParseError(17, 4, "unknown Tag_CSKY_FPU_ABI value: 4");
+}
+
+TEST(FPURounding, testAttribute) {
+  EXPECT_TRUE(testTagString(18, "Tag_CSKY_FPU_ROUNDING"));
+  EXPECT_TRUE(
+      testAttributeInt(18, 0, CSKYAttrs::CSKY_FPU_ROUNDING, CSKYAttrs::NONE));
+  EXPECT_TRUE(
+      testAttributeInt(18, 1, CSKYAttrs::CSKY_FPU_ROUNDING, CSKYAttrs::NEEDED));
+  testParseError(18, 2, "unknown Tag_CSKY_FPU_ROUNDING value: 2");
+}
+
+TEST(FPUDenormal, testAttribute) {
+  EXPECT_TRUE(testTagString(19, "Tag_CSKY_FPU_DENORMAL"));
+  EXPECT_TRUE(
+      testAttributeInt(19, 0, CSKYAttrs::CSKY_FPU_DENORMAL, CSKYAttrs::NONE));
+  EXPECT_TRUE(
+      testAttributeInt(19, 1, CSKYAttrs::CSKY_FPU_DENORMAL, CSKYAttrs::NEEDED));
+  testParseError(19, 2, "unknown Tag_CSKY_FPU_DENORMAL value: 2");
+}
+
+TEST(FPUException, testAttribute) {
+  EXPECT_TRUE(testTagString(20, "Tag_CSKY_FPU_EXCEPTION"));
+  EXPECT_TRUE(
+      testAttributeInt(20, 0, CSKYAttrs::CSKY_FPU_EXCEPTION, CSKYAttrs::NONE));
+  EXPECT_TRUE(testAttributeInt(20, 1, CSKYAttrs::CSKY_FPU_EXCEPTION,
+                               CSKYAttrs::NEEDED));
+  testParseError(20, 2, "unknown Tag_CSKY_FPU_EXCEPTION value: 2");
+}
+
+TEST(FPUNumberModule, testAttribute) {
+  EXPECT_TRUE(testTagString(21, "Tag_CSKY_FPU_NUMBER_MODULE"));
+  EXPECT_TRUE(testAttributeString(
+      21, "IEEE 754", CSKYAttrs::CSKY_FPU_NUMBER_MODULE, "IEEE 754"));
+  EXPECT_FALSE(testAttributeString(
+      21, "IEEE 755", CSKYAttrs::CSKY_FPU_NUMBER_MODULE, "IEEE 754"));
+}
+
+TEST(FPUHardFP, testAttribute) {
+  EXPECT_TRUE(testTagString(22, "Tag_CSKY_FPU_HARDFP"));
+  EXPECT_TRUE(testAttributeInt(22, 1, CSKYAttrs::CSKY_FPU_HARDFP,
+                               CSKYAttrs::FPU_HARDFP_HALF));
+  EXPECT_TRUE(testAttributeInt(22, 2, CSKYAttrs::CSKY_FPU_HARDFP,
+                               CSKYAttrs::FPU_HARDFP_SINGLE));
+  EXPECT_TRUE(testAttributeInt(22, 4, CSKYAttrs::CSKY_FPU_HARDFP,
+                               CSKYAttrs::FPU_HARDFP_DOUBLE));
+  EXPECT_FALSE(testAttributeInt(22, 3, CSKYAttrs::CSKY_FPU_HARDFP,
+                                CSKYAttrs::FPU_HARDFP_DOUBLE));
+  testParseError(22, 0, "unknown Tag_CSKY_FPU_HARDFP value: 0");
+  testParseError(22, 8, "unknown Tag_CSKY_FPU_HARDFP value: 8");
+}

diff  --git a/llvm/unittests/Support/CSKYTargetParserTest.cpp b/llvm/unittests/Support/CSKYTargetParserTest.cpp
new file mode 100644
index 0000000000000..a9aa5767f9ea5
--- /dev/null
+++ b/llvm/unittests/Support/CSKYTargetParserTest.cpp
@@ -0,0 +1,1151 @@
+//===-------- CSKYTargetParser.cpp - CSKY Target Parser -------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/CSKYTargetParser.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/CSKYAttributes.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/TargetParser.h"
+#include "gtest/gtest.h"
+#include <string>
+
+using namespace llvm;
+
+namespace {
+
+std::string FormatExtensionFlags(uint64_t Flags) {
+  std::vector<StringRef> Features;
+
+  if (Flags & CSKY::AEK_NONE)
+    Features.push_back("none");
+  CSKY::getExtensionFeatures(Flags, Features);
+
+  Features.erase(std::remove_if(Features.begin(), Features.end(),
+                                [](StringRef extension) {
+                                  return extension.startswith("-");
+                                }),
+                 Features.end());
+
+  return llvm::join(Features, ", ");
+}
+
+testing::AssertionResult AssertSameExtensionFlags(const char *m_expr,
+                                                  const char *n_expr,
+                                                  uint64_t ExpectedFlags,
+                                                  uint64_t GotFlags) {
+  if (ExpectedFlags == GotFlags)
+    return testing::AssertionSuccess();
+
+  return testing::AssertionFailure()
+         << llvm::formatv("Expected extension flags: {0} ({1:x})\n"
+                          "     Got extension flags: {2} ({3:x})\n",
+                          FormatExtensionFlags(ExpectedFlags), ExpectedFlags,
+                          FormatExtensionFlags(GotFlags), GotFlags);
+}
+
+struct CSKYCPUTestParams {
+  CSKYCPUTestParams(StringRef CPUName, StringRef ExpectedArch,
+                    uint64_t ExpectedFlags)
+      : CPUName(CPUName), ExpectedArch(ExpectedArch),
+        ExpectedFlags(ExpectedFlags) {}
+
+  friend std::ostream &operator<<(std::ostream &os,
+                                  const CSKYCPUTestParams &params) {
+    return os << "\"" << params.CPUName.str() << "\", \""
+              << params.ExpectedArch.str() << "\", \"" << params.ExpectedFlags
+              << "\"";
+  }
+
+  StringRef CPUName;
+  StringRef ExpectedArch;
+  uint64_t ExpectedFlags;
+};
+
+class CSKYCPUTestFixture : public ::testing::TestWithParam<CSKYCPUTestParams> {
+};
+
+TEST_P(CSKYCPUTestFixture, CSKYCPUTests) {
+  auto params = GetParam();
+
+  CSKY::ArchKind AK = CSKY::parseCPUArch(params.CPUName);
+  EXPECT_EQ(params.ExpectedArch, CSKY::getArchName(AK));
+
+  uint64_t default_extensions = CSKY::getDefaultExtensions(params.CPUName);
+  EXPECT_PRED_FORMAT2(AssertSameExtensionFlags, params.ExpectedFlags,
+                      default_extensions);
+}
+
+// Note that we include CSKY::AEK_NONE even when there are other extensions
+// we expect. This is because the default extensions for a CPU are the sum
+// of the default extensions for its architecture and for the CPU.
+// So if a CPU has no extra extensions, it adds AEK_NONE.
+INSTANTIATE_TEST_SUITE_P(
+    CSKYCPUTests, CSKYCPUTestFixture,
+    ::testing::Values(
+
+        CSKYCPUTestParams("ck801", "ck801",
+                          CSKY::AEK_NONE | CSKY::MAEK_E1 | CSKY::AEK_TRUST),
+        CSKYCPUTestParams("ck801t", "ck801",
+                          CSKY::AEK_NONE | CSKY::MAEK_E1 | CSKY::AEK_TRUST),
+        CSKYCPUTestParams("e801", "ck801",
+                          CSKY::AEK_NONE | CSKY::MAEK_E1 | CSKY::AEK_TRUST),
+
+        CSKYCPUTestParams("ck802", "ck802",
+                          CSKY::AEK_NONE | CSKY::MAEK_E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC),
+        CSKYCPUTestParams("ck802t", "ck802",
+                          CSKY::AEK_NONE | CSKY::MAEK_E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC),
+        CSKYCPUTestParams("ck802j", "ck802",
+                          CSKY::AEK_JAVA | CSKY::MAEK_E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC),
+        CSKYCPUTestParams("e802", "ck802",
+                          CSKY::AEK_NONE | CSKY::MAEK_E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC),
+        CSKYCPUTestParams("e802t", "ck802",
+                          CSKY::AEK_NONE | CSKY::MAEK_E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC),
+        CSKYCPUTestParams("s802", "ck802",
+                          CSKY::AEK_NONE | CSKY::MAEK_E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC),
+        CSKYCPUTestParams("s802t", "ck802",
+                          CSKY::AEK_NONE | CSKY::MAEK_E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC),
+
+        CSKYCPUTestParams("ck803", "ck803",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803h", "ck803",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803t", "ck803",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ht", "ck803",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803f", "ck803",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803fh", "ck803",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803e", "ck803",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803eh", "ck803",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803et", "ck803",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803eht", "ck803",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ef", "ck803",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efh", "ck803",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ft", "ck803",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803eft", "ck803",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efht", "ck803",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803r1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803r2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803r3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803hr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803hr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803hr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803tr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803tr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803tr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803htr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803htr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803htr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803fr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803fr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803fr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803fhr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803fhr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803fhr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803er1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803er2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803er3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ehr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ehr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ehr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803etr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803etr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803etr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ehtr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ehtr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ehtr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                              CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efhr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efhr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efhr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ftr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ftr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803ftr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803eftr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803eftr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803eftr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efhtr1", "ck803",
+                          CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efhtr2", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803efhtr3", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("s803", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("s803t", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("e803", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("e803t", "ck803",
+                          CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+
+        CSKYCPUTestParams("ck803s", "ck803s",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803st", "ck803s",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803se", "ck803s",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803sf", "ck803s",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803sef", "ck803s",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+        CSKYCPUTestParams("ck803seft", "ck803s",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV),
+
+        CSKYCPUTestParams("ck804", "ck804",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804h", "ck804",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804t", "ck804",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804ht", "ck804",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804f", "ck804",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804fh", "ck804",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804e", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804eh", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804et", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804eht", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804ef", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804efh", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804ft", "ck804",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804eft", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("ck804efht", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("e804d", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("e804dt", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("e804f", "ck804",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("e804ft", "ck804",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("e804df", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+        CSKYCPUTestParams("e804dft", "ck804",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+
+        CSKYCPUTestParams("ck805", "ck805",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("ck805e", "ck805",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3 | CSKY::AEK_VDSPV2 |
+                              CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("ck805f", "ck805",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("ck805t", "ck805",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("ck805ef", "ck805",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("ck805et", "ck805",
+                          CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3 | CSKY::AEK_VDSPV2 |
+                              CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("ck805ft", "ck805",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("ck805eft", "ck805",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::AEK_DSPV2 |
+                              CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
+                              CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST |
+                              CSKY::AEK_NVIC | CSKY::AEK_HWDIV |
+                              CSKY::AEK_HIGHREG | CSKY::MAEK_3E3R2 |
+                              CSKY::AEK_3E3R3 | CSKY::AEK_VDSPV2 |
+                              CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("i805", "ck805",
+                          CSKY::AEK_NONE | CSKY::MAEK_2E3 | CSKY::AEK_MP |
+                              CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3),
+        CSKYCPUTestParams("i805f", "ck805",
+                          CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 |
+                              CSKY::AEK_FLOAT1E3 | CSKY::MAEK_2E3 |
+                              CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
+                              CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3),
+
+        CSKYCPUTestParams("ck807", "ck807",
+                          CSKY::AEK_NONE | CSKY::MAEK_3E7 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams("ck807e", "ck807",
+                          CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::MAEK_3E7 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "ck807f", "ck807",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
+                CSKY::AEK_FLOAT3E4 | CSKY::MAEK_3E7 | CSKY::MAEK_MP |
+                CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST | CSKY::AEK_HWDIV |
+                CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP | CSKY::AEK_NVIC |
+                CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "ck807ef", "ck807",
+            CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
+                CSKY::AEK_FLOAT3E4 | CSKY::MAEK_3E7 | CSKY::MAEK_MP |
+                CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST | CSKY::AEK_HWDIV |
+                CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP | CSKY::AEK_NVIC |
+                CSKY::AEK_CACHE),
+        CSKYCPUTestParams("c807", "ck807",
+                          CSKY::AEK_NONE | CSKY::MAEK_3E7 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "c807f", "ck807",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
+                CSKY::AEK_FLOAT3E4 | CSKY::MAEK_3E7 | CSKY::MAEK_MP |
+                CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST | CSKY::AEK_HWDIV |
+                CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP | CSKY::AEK_NVIC |
+                CSKY::AEK_CACHE),
+
+        CSKYCPUTestParams("r807", "ck807",
+                          CSKY::AEK_NONE | CSKY::MAEK_3E7 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "r807f", "ck807",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
+                CSKY::AEK_FLOAT3E4 | CSKY::MAEK_3E7 | CSKY::MAEK_MP |
+                CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST | CSKY::AEK_HWDIV |
+                CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP | CSKY::AEK_NVIC |
+                CSKY::AEK_CACHE),
+
+        CSKYCPUTestParams("ck810e", "ck810",
+                          CSKY::AEK_NONE | CSKY::MAEK_7E10 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+
+        CSKYCPUTestParams("ck810et", "ck810",
+                          CSKY::AEK_NONE | CSKY::MAEK_7E10 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "ck810ef", "ck810",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "ck810eft", "ck810",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams("ck810", "ck810",
+                          CSKY::AEK_NONE | CSKY::MAEK_7E10 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "ck810f", "ck810",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams("ck810t", "ck810",
+                          CSKY::AEK_NONE | CSKY::MAEK_7E10 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "ck810ft", "ck810",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "c810", "ck810",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+        CSKYCPUTestParams(
+            "c810t", "ck810",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE),
+
+        CSKYCPUTestParams("ck810v", "ck810v",
+                          CSKY::AEK_NONE | CSKY::MAEK_7E10 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                              CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams("ck810ev", "ck810v",
+                          CSKY::AEK_NONE | CSKY::MAEK_7E10 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                              CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams("ck810tv", "ck810v",
+                          CSKY::AEK_NONE | CSKY::MAEK_7E10 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                              CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams("ck810etv", "ck810v",
+                          CSKY::AEK_NONE | CSKY::MAEK_7E10 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_EDSP |
+                              CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                              CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams(
+            "c810v", "ck810v",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE | CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams(
+            "ck810fv", "ck810v",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE | CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams(
+            "ck810efv", "ck810v",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE | CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams(
+            "ck810ftv", "ck810v",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE | CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams(
+            "c810tv", "ck810v",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE | CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams(
+            "c810eftv", "ck810v",
+            CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
+                CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::MAEK_7E10 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
+                CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                CSKY::AEK_NVIC | CSKY::AEK_CACHE | CSKY::AEK_VDSPV1),
+
+        CSKYCPUTestParams("ck860", "ck860",
+                          CSKY::AEK_NONE | CSKY::MAEK_10E60 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+
+        CSKYCPUTestParams(
+            "ck860f", "ck860",
+            CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
+                CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60 | CSKY::MAEK_10E60 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                CSKY::AEK_HARDTP | CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+
+        CSKYCPUTestParams(
+            "c860", "ck860",
+            CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
+                CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60 | CSKY::MAEK_10E60 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                CSKY::AEK_HARDTP | CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3),
+
+        CSKYCPUTestParams("ck860v", "ck860v",
+                          CSKY::AEK_NONE | CSKY::MAEK_10E60 | CSKY::MAEK_MP |
+                              CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                              CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 |
+                              CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
+                              CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                              CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
+                              CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E60F),
+
+        CSKYCPUTestParams(
+            "ck860fv", "ck860v",
+            CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
+                CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60 | CSKY::MAEK_10E60 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                CSKY::AEK_HARDTP | CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_VDSPV2 |
+                CSKY::AEK_VDSP2E60F),
+
+        CSKYCPUTestParams(
+            "c860v", "ck860v",
+            CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
+                CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60 | CSKY::MAEK_10E60 |
+                CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
+                CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG |
+                CSKY::AEK_HARDTP | CSKY::AEK_NVIC | CSKY::AEK_CACHE |
+                CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_VDSPV2 |
+                CSKY::AEK_VDSP2E60F)));
+
+static constexpr unsigned NumCSKYCPUArchs = 145;
+
+TEST(TargetParserTest, testCSKYCPUArchList) {
+  SmallVector<StringRef, NumCSKYCPUArchs> List;
+  CSKY::fillValidCPUArchList(List);
+
+  // No list exists for these in this test suite, so ensure all are
+  // valid, and match the expected 'magic' count.
+  EXPECT_EQ(List.size(), NumCSKYCPUArchs);
+  for (StringRef CPU : List) {
+    EXPECT_NE(CSKY::parseCPUArch(CPU), CSKY::ArchKind::INVALID);
+  }
+}
+
+TEST(TargetParserTest, testInvalidCSKYArch) {
+  auto InvalidArchStrings = {"ckv", "ckv99", "nock"};
+  for (const char *InvalidArch : InvalidArchStrings)
+    EXPECT_EQ(CSKY::parseArch(InvalidArch), CSKY::ArchKind::INVALID);
+}
+
+bool testCSKYArch(StringRef Arch, StringRef DefaultCPU) {
+  CSKY::ArchKind AK = CSKY::parseArch(Arch);
+  bool Result = (AK != CSKY::ArchKind::INVALID);
+  Result &= CSKY::getDefaultCPU(Arch).equals(DefaultCPU);
+  return Result;
+}
+
+TEST(TargetParserTest, testCSKYArch) {
+  EXPECT_TRUE(testCSKYArch("ck801", "ck801"));
+  EXPECT_TRUE(testCSKYArch("ck802", "ck802"));
+  EXPECT_TRUE(testCSKYArch("ck803", "ck803"));
+  EXPECT_TRUE(testCSKYArch("ck803s", "ck803s"));
+  EXPECT_TRUE(testCSKYArch("ck804", "ck804"));
+  EXPECT_TRUE(testCSKYArch("ck805", "ck805"));
+  EXPECT_TRUE(testCSKYArch("ck807", "ck807"));
+  EXPECT_TRUE(testCSKYArch("ck810", "ck810"));
+  EXPECT_TRUE(testCSKYArch("ck810v", "ck810v"));
+  EXPECT_TRUE(testCSKYArch("ck860", "ck860"));
+  EXPECT_TRUE(testCSKYArch("ck860v", "ck860v"));
+}
+
+TEST(TargetParserTest, CSKYFPUVersion) {
+  for (CSKY::CSKYFPUKind FK = static_cast<CSKY::CSKYFPUKind>(0);
+       FK <= CSKY::CSKYFPUKind::FK_LAST;
+       FK = static_cast<CSKY::CSKYFPUKind>(static_cast<unsigned>(FK) + 1))
+    if (FK == CSKY::FK_LAST || CSKY::getFPUName(FK) == "invalid")
+      EXPECT_EQ(CSKY::FPUVersion::NONE, CSKY::getFPUVersion(FK));
+    else
+      EXPECT_NE(CSKY::FPUVersion::NONE, CSKY::getFPUVersion(FK));
+}
+
+TEST(TargetParserTest, CSKYExtensionFeatures) {
+  std::map<uint64_t, std::vector<StringRef>> Extensions;
+
+  for (auto &Ext : CSKY::CSKYARCHExtNames) {
+    if (Ext.Feature && Ext.NegFeature)
+      Extensions[Ext.ID] = {StringRef(Ext.Feature), StringRef(Ext.NegFeature)};
+  }
+
+  std::vector<StringRef> Features;
+
+  EXPECT_FALSE(CSKY::getExtensionFeatures(CSKY::AEK_INVALID, Features));
+
+  for (auto &E : Extensions) {
+    // test +extension
+    Features.clear();
+    CSKY::getExtensionFeatures(E.first, Features);
+    EXPECT_TRUE(llvm::is_contained(Features, E.second.at(0)));
+    EXPECT_EQ(Extensions.size(), Features.size());
+
+    // test -extension
+    Features.clear();
+    CSKY::getExtensionFeatures(~E.first, Features);
+    EXPECT_TRUE(llvm::is_contained(Features, E.second.at(1)));
+    EXPECT_EQ(Extensions.size(), Features.size());
+  }
+}
+
+TEST(TargetParserTest, CSKYFPUFeatures) {
+  std::vector<StringRef> Features;
+  for (CSKY::CSKYFPUKind FK = static_cast<CSKY::CSKYFPUKind>(0);
+       FK <= CSKY::CSKYFPUKind::FK_LAST;
+       FK = static_cast<CSKY::CSKYFPUKind>(static_cast<unsigned>(FK) + 1)) {
+    if (FK == CSKY::FK_INVALID || FK >= CSKY::FK_LAST)
+      EXPECT_FALSE(CSKY::getFPUFeatures(FK, Features));
+    else
+      EXPECT_TRUE(CSKY::getFPUFeatures(FK, Features));
+  }
+}
+
+TEST(TargetParserTest, CSKYArchExtFeature) {
+  const char *ArchExt[][4] = {
+      {"fpuv2_sf", "nofpuv2_sf", "+fpuv2_sf", "-fpuv2_sf"},
+      {"fpuv2_df", "nofpuv2_df", "+fpuv2_df", "-fpuv2_df"},
+      {"fdivdu", "nofdivdu", "+fdivdu", "-fdivdu"},
+      {"fpuv3_hi", "nofpuv3_hi", "+fpuv3_hi", "-fpuv3_hi"},
+      {"fpuv3_hf", "nofpuv3_hf", "+fpuv3_hf", "-fpuv3_hf"},
+      {"fpuv2_df", "nofpuv2_df", "+fpuv2_df", "-fpuv2_df"},
+      {"fpuv3_sf", "nofpuv3_sf", "+fpuv3_sf", "-fpuv3_sf"},
+      {"fpuv3_df", "nofpuv3_df", "+fpuv3_df", "-fpuv3_df"},
+      {"floate1", "nofloate1", "+floate1", "-floate1"},
+      {"float1e2", "nofloat1e2", "+float1e2", "-float1e2"},
+      {"float1e3", "nofloat1e3", "+float1e3", "-float1e3"},
+      {"float3e4", "nofloat3e4", "+float3e4", "-float3e4"},
+      {"float7e60", "nofloat7e60", "+float7e60", "-float7e60"},
+      {"hwdiv", "nohwdiv", "+hwdiv", "-hwdiv"},
+      {"multiple_stld", "nomultiple_stld", "+multiple_stld", "-multiple_stld"},
+      {"pushpop", "nopushpop", "+pushpop", "-pushpop"},
+      {"edsp", "noedsp", "+edsp", "-edsp"},
+      {"dsp1e2", "nodsp1e2", "+dsp1e2", "-dsp1e2"},
+      {"dspe60", "nodspe60", "+dspe60", "-dspe60"},
+      {"dspv2", "nodspv2", "+dspv2", "-dspv2"},
+      {"dsp_silan", "nodsp_silan", "+dsp_silan", "-dsp_silan"},
+      {"elrw", "noelrw", "+elrw", "-elrw"},
+      {"trust", "notrust", "+trust", "-trust"},
+      {"java", "nojava", "+java", "-java"},
+      {"cache", "nocache", "+cache", "-cache"},
+      {"nvic", "nonvic", "+nvic", "-nvic"},
+      {"doloop", "nodoloop", "+doloop", "-doloop"},
+      {"high-registers", "nohigh-registers", "+high-registers",
+       "-high-registers"},
+      {"smart", "nosmart", "+smart", "-smart"},
+      {"vdsp2e3", "novdsp2e3", "+vdsp2e3", "-vdsp2e3"},
+      {"vdsp2e60f", "novdsp2e60f", "+vdsp2e60f", "-vdsp2e60f"},
+      {"vdspv2", "novdspv2", "+vdspv2", "-vdspv2"},
+      {"hard-tp", "nohard-tp", "+hard-tp", "-hard-tp"},
+      {"soft-tp", "nosoft-tp", "+soft-tp", "-soft-tp"},
+      {"istack", "noistack", "+istack", "-istack"},
+      {"constpool", "noconstpool", "+constpool", "-constpool"},
+      {"stack-size", "nostack-size", "+stack-size", "-stack-size"},
+      {"ccrt", "noccrt", "+ccrt", "-ccrt"},
+      {"vdspv1", "novdspv1", "+vdspv1", "-vdspv1"},
+      {"e1", "noe1", "+e1", "-e1"},
+      {"e2", "noe2", "+e2", "-e2"},
+      {"2e3", "no2e3", "+2e3", "-2e3"},
+      {"mp", "nomp", "+mp", "-mp"},
+      {"3e3r1", "no3e3r1", "+3e3r1", "-3e3r1"},
+      {"3e3r2", "no3e3r2", "+3e3r2", "-3e3r2"},
+      {"3e3r3", "no3e3r3", "+3e3r3", "-3e3r3"},
+      {"3e7", "no3e7", "+3e7", "-3e7"},
+      {"mp1e2", "nomp1e2", "+mp1e2", "-mp1e2"},
+      {"7e10", "no7e10", "+7e10", "-7e10"},
+      {"10e60", "no10e60", "+10e60", "-10e60"},
+  };
+
+  for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
+    EXPECT_EQ(StringRef(ArchExt[i][2]), CSKY::getArchExtFeature(ArchExt[i][0]));
+    EXPECT_EQ(StringRef(ArchExt[i][3]), CSKY::getArchExtFeature(ArchExt[i][1]));
+  }
+}
+
+} // namespace

diff  --git a/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
index 461b7498978f4..a1ae977868f30 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
@@ -62,6 +62,9 @@ static_library("Support") {
     "ConvertUTF.cpp",
     "ConvertUTFWrapper.cpp",
     "CrashRecoveryContext.cpp",
+    "CSKYAttributeParser.cpp",
+    "CSKYAttributes.cpp",
+    "CSKYTargetParser.cpp",
     "DAGDeltaAlgorithm.cpp",
     "DJB.cpp",
     "DataExtractor.cpp",

diff  --git a/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn
index 6accbee81590b..81564ee40c069 100644
--- a/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn
@@ -25,6 +25,8 @@ unittest("SupportTests") {
     "CompressionTest.cpp",
     "ConvertUTFTest.cpp",
     "CrashRecoveryTest.cpp",
+    "CSKYAttributeParserTest.cpp",
+    "CSKYTargetParserTest.cpp",
     "DJBTest.cpp",
     "DataExtractorTest.cpp",
     "DebugCounterTest.cpp",


        


More information about the llvm-commits mailing list