Index: clang/lib/Basic/Targets/RISCV.cpp =================================================================== --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -187,13 +187,13 @@ } if (HasZba) - Builder.defineMacro("__riscv_zba", "93000"); + Builder.defineMacro("__riscv_zba", "1000000"); if (HasZbb) - Builder.defineMacro("__riscv_zbb", "93000"); + Builder.defineMacro("__riscv_zbb", "1000000"); if (HasZbc) - Builder.defineMacro("__riscv_zbc", "93000"); + Builder.defineMacro("__riscv_zbc", "1000000"); if (HasZbe) Builder.defineMacro("__riscv_zbe", "93000"); @@ -214,7 +214,7 @@ Builder.defineMacro("__riscv_zbr", "93000"); if (HasZbs) - Builder.defineMacro("__riscv_zbs", "93000"); + Builder.defineMacro("__riscv_zbs", "1000000"); if (HasZbt) Builder.defineMacro("__riscv_zbt", "93000"); Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -58,9 +58,11 @@ // extension that the compiler currently supports. static Optional isExperimentalExtension(StringRef Ext) { - if (Ext == "b" || Ext == "zba" || Ext == "zbb" || Ext == "zbc" || + if (Ext == "zba" || Ext == "zbb" || Ext == "zbc" || Ext == "zbs") + return RISCVExtensionVersion{"1", "0"}; + if (Ext == "b" || Ext == "zbe" || Ext == "zbf" || Ext == "zbm" || Ext == "zbp" || - Ext == "zbr" || Ext == "zbs" || Ext == "zbt" || Ext == "zbproposedc") + Ext == "zbr" || Ext == "zbt" || Ext == "zbproposedc") return RISCVExtensionVersion{"0", "93"}; if (Ext == "v" || Ext == "zvamo" || Ext == "zvlsseg") return RISCVExtensionVersion{"0", "10"}; Index: clang/test/Driver/riscv-arch.c =================================================================== --- clang/test/Driver/riscv-arch.c +++ clang/test/Driver/riscv-arch.c @@ -406,20 +406,20 @@ // RV32-EXPERIMENTAL-ZBB-NOFLAG: error: invalid arch name 'rv32izbb' // RV32-EXPERIMENTAL-ZBB-NOFLAG: requires '-menable-experimental-extensions' -// RUN: %clang -target riscv32-unknown-elf -march=rv32izbb0p93 -menable-experimental-extensions -### %s \ +// RUN: %clang -target riscv32-unknown-elf -march=rv32izbb1p0 -menable-experimental-extensions -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB %s // RV32-EXPERIMENTAL-ZBB: "-target-feature" "+experimental-zbb" -// RUN: %clang -target riscv32-unknown-elf -march=rv32izbb0p93_zbp0p93 -menable-experimental-extensions -### %s \ +// RUN: %clang -target riscv32-unknown-elf -march=rv32izbb1p0_zbp0p93 -menable-experimental-extensions -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP %s // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbb" // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbp" -// RUN: %clang -target riscv32-unknown-elf -march=rv32izbb0p93zbp0p93 -menable-experimental-extensions -### %s \ +// RUN: %clang -target riscv32-unknown-elf -march=rv32izbb1p0zbp0p93 -menable-experimental-extensions -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE %s -// RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE: error: invalid arch name 'rv32izbb0p93zbp0p93', multi-character extensions must be separated by underscores +// RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE: error: invalid arch name 'rv32izbb1p0zbp0p93', multi-character extensions must be separated by underscores -// RUN: %clang -target riscv32-unknown-elf -march=rv32izba0p93 -menable-experimental-extensions -### %s \ +// RUN: %clang -target riscv32-unknown-elf -march=rv32izba1p0 -menable-experimental-extensions -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBA %s // RV32-EXPERIMENTAL-ZBA: "-target-feature" "+experimental-zba" Index: clang/test/Preprocessor/riscv-target-features.c =================================================================== --- clang/test/Preprocessor/riscv-target-features.c +++ clang/test/Preprocessor/riscv-target-features.c @@ -108,43 +108,43 @@ // RUN: -o - | FileCheck --check-prefix=CHECK-B-EXT %s // CHECK-B-EXT: __riscv_b 93000 // CHECK-B-EXT: __riscv_bitmanip 1 -// CHECK-B-EXT: __riscv_zba 93000 -// CHECK-B-EXT: __riscv_zbb 93000 -// CHECK-B-EXT: __riscv_zbc 93000 +// CHECK-B-EXT: __riscv_zba 1000000{{$}} +// CHECK-B-EXT: __riscv_zbb 1000000{{$}} +// CHECK-B-EXT: __riscv_zbc 1000000{{$}} // CHECK-B-EXT: __riscv_zbe 93000 // CHECK-B-EXT: __riscv_zbf 93000 // CHECK-B-EXT: __riscv_zbm 93000 // CHECK-B-EXT: __riscv_zbp 93000 // CHECK-B-EXT: __riscv_zbr 93000 -// CHECK-B-EXT: __riscv_zbs 93000 +// CHECK-B-EXT: __riscv_zbs 1000000{{$}} // CHECK-B-EXT: __riscv_zbt 93000 // RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv32izba0p93 -x c -E -dM %s \ +// RUN: -march=rv32izba1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBA-EXT %s // RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv64izba0p93 -x c -E -dM %s \ +// RUN: -march=rv64izba1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBA-EXT %s // CHECK-ZBA-NOT: __riscv_b -// CHECK-ZBA-EXT: __riscv_zba 93000 +// CHECK-ZBA-EXT: __riscv_zba 1000000{{$}} // RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv32izbb0p93 -x c -E -dM %s \ +// RUN: -march=rv32izbb1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBB-EXT %s // RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv64izbb0p93 -x c -E -dM %s \ +// RUN: -march=rv64izbb1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBB-EXT %s // CHECK-ZBB-NOT: __riscv_b -// CHECK-ZBB-EXT: __riscv_zbb 93000 +// CHECK-ZBB-EXT: __riscv_zbb 1000000{{$}} // RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv32izbc0p93 -x c -E -dM %s \ +// RUN: -march=rv32izbc1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBC-EXT %s // RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv64izbc0p93 -x c -E -dM %s \ +// RUN: -march=rv64izbc1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBC-EXT %s // CHECK-ZBC-NOT: __riscv_b -// CHECK-ZBC-EXT: __riscv_zbc 93000 +// CHECK-ZBC-EXT: __riscv_zbc 1000000{{$}} // RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \ // RUN: -march=rv32izbe0p93 -x c -E -dM %s \ @@ -201,13 +201,13 @@ // CHECK-ZBR-EXT: __riscv_zbr 93000 // RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv32izbs0p93 -x c -E -dM %s \ +// RUN: -march=rv32izbs1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBS-EXT %s // RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv64izbs0p93 -x c -E -dM %s \ +// RUN: -march=rv64izbs1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBS-EXT %s // CHECK-ZBS-NOT: __riscv_b -// CHECK-ZBS-EXT: __riscv_zbs 93000 +// CHECK-ZBS-EXT: __riscv_zbs 1000000{{$}} // RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \ // RUN: -march=rv32izbt0p93 -x c -E -dM %s \ Index: llvm/lib/Target/RISCV/RISCVInstrInfoB.td =================================================================== --- llvm/lib/Target/RISCV/RISCVInstrInfoB.td +++ llvm/lib/Target/RISCV/RISCVInstrInfoB.td @@ -1,4 +1,4 @@ -//===-- RISCVInstrInfoB.td - RISC-V 'B' instructions -------*- tablegen -*-===// +//===-- RISCVInstrInfoB.td - RISC-V Bitmanip instructions --*- tablegen -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,9 +6,19 @@ // //===----------------------------------------------------------------------===// // -// This file describes the RISC-V instructions from the standard 'B' Bitmanip -// extension, version 0.93. -// This version is still experimental as the 'B' extension hasn't been +// This file describes the RISC-V instructions from the standard Bitmanip +// extensions, versions: +// Zba - 1.0 +// Zbb - 1.0 +// Zbc - 1.0 +// Zbs - 1.0 +// Zbe - 0.93 +// Zbf - 0.93 +// Zbm - 0.93 +// Zbp - 0.93 +// Zbr - 0.93 +// Zbt - 0.93 +// This version is still experimental as the Bitmanip extensions haven't been // ratified yet. // //===----------------------------------------------------------------------===// @@ -646,8 +656,6 @@ //===----------------------------------------------------------------------===// let Predicates = [HasStdExtZba, IsRV64] in { -// NOTE: The 0.93 spec shows zext.w as an alias of pack/packw. It has been -// changed to add.uw in a draft after 0.94. def : InstAlias<"zext.w $rd, $rs", (ADDUW GPR:$rd, GPR:$rs, X0)>; }