kito-cheng updated this revision to Diff 471701. kito-cheng added a comment.
Changes: - Update doc, H is support assembly only. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136817/new/ https://reviews.llvm.org/D136817 Files: clang/test/Preprocessor/riscv-target-features.c llvm/docs/RISCVUsage.rst llvm/lib/Support/RISCVISAInfo.cpp llvm/lib/Target/RISCV/RISCV.td llvm/lib/Target/RISCV/RISCVInstrInfo.td llvm/lib/Target/RISCV/RISCVSubtarget.h llvm/test/CodeGen/RISCV/attributes.ll llvm/test/MC/RISCV/priv-aliases-valid.s llvm/test/MC/RISCV/priv-rv64-valid.s llvm/test/MC/RISCV/priv-valid.s llvm/test/MC/RISCV/rv32ih-aliases-valid.s llvm/test/MC/RISCV/rv32ih-valid.s llvm/test/MC/RISCV/rv64ih-valid.s llvm/test/MC/RISCV/rvi-aliases-valid.s
Index: llvm/test/MC/RISCV/rvi-aliases-valid.s =================================================================== --- llvm/test/MC/RISCV/rvi-aliases-valid.s +++ llvm/test/MC/RISCV/rvi-aliases-valid.s @@ -256,18 +256,6 @@ # CHECK-S-OBJ-NOALIAS: sfence.vma a0, zero # CHECK-S-OBJ: sfence.vma a0 sfence.vma a0 -# CHECK-S-OBJ-NOALIAS: hfence.gvma zero, zero -# CHECK-S-OBJ: hfence.gvma -hfence.gvma -# CHECK-S-OBJ-NOALIAS: hfence.gvma a0, zero -# CHECK-S-OBJ: hfence.gvma a0 -hfence.gvma a0 -# CHECK-S-OBJ-NOALIAS: hfence.vvma zero, zero -# CHECK-S-OBJ: hfence.vvma -hfence.vvma -# CHECK-S-OBJ-NOALIAS: hfence.vvma a0, zero -# CHECK-S-OBJ: hfence.vvma a0 -hfence.vvma a0 # The following aliases are accepted as input but the canonical form # of the instruction will always be printed. Index: llvm/test/MC/RISCV/rv64ih-valid.s =================================================================== --- llvm/test/MC/RISCV/rv64ih-valid.s +++ llvm/test/MC/RISCV/rv64ih-valid.s @@ -1,10 +1,10 @@ -# RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases -show-encoding \ +# RUN: llvm-mc %s -triple=riscv64 -mattr=+h -riscv-no-aliases -show-encoding \ # RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s -# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \ -# RUN: | llvm-objdump -M no-aliases -d - \ +# RUN: llvm-mc -filetype=obj -mattr=+h -triple riscv64 < %s \ +# RUN: | llvm-objdump --mattr=+h -M no-aliases -d - \ # RUN: | FileCheck -check-prefix=CHECK-INST %s -# RUN: not llvm-mc -triple riscv32 < %s 2>&1 \ +# RUN: not llvm-mc -triple riscv32 -mattr=+h < %s 2>&1 \ # RUN: | FileCheck -check-prefix=CHECK-RV32 %s # CHECK-INST: hlv.wu a0, (a1) Index: llvm/test/MC/RISCV/rv32ih-valid.s =================================================================== --- /dev/null +++ llvm/test/MC/RISCV/rv32ih-valid.s @@ -0,0 +1,66 @@ +# RUN: llvm-mc %s -triple=riscv32 -mattr=+h -riscv-no-aliases -show-encoding \ +# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s +# RUN: llvm-mc %s -triple=riscv64 -mattr=+h -riscv-no-aliases -show-encoding \ +# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s +# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+h < %s \ +# RUN: | llvm-objdump --mattr=+h -M no-aliases -d - \ +# RUN: | FileCheck -check-prefix=CHECK-INST %s +# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+h < %s \ +# RUN: | llvm-objdump --mattr=+h -M no-aliases -d - \ +# RUN: | FileCheck -check-prefix=CHECK-INST %s + +# CHECK-INST: hfence.vvma zero, zero +# CHECK: encoding: [0x73,0x00,0x00,0x22] +hfence.vvma zero, zero + +# CHECK-INST: hfence.vvma a0, a1 +# CHECK: encoding: [0x73,0x00,0xb5,0x22] +hfence.vvma a0, a1 + +# CHECK-INST: hfence.gvma zero, zero +# CHECK: encoding: [0x73,0x00,0x00,0x62] +hfence.gvma zero, zero + +# CHECK-INST: hfence.gvma a0, a1 +# CHECK: encoding: [0x73,0x00,0xb5,0x62] +hfence.gvma a0, a1 + +# CHECK-INST: hlv.b a0, (a1) +# CHECK: encoding: [0x73,0xc5,0x05,0x60] +hlv.b a0, (a1) + +# CHECK-INST: hlv.bu a0, (a1) +# CHECK: encoding: [0x73,0xc5,0x15,0x60] +hlv.bu a0, (a1) + +# CHECK-INST: hlv.h a1, (a2) +# CHECK: encoding: [0xf3,0x45,0x06,0x64] +hlv.h a1, (a2) + +# CHECK-INST: hlv.hu a1, (a1) +# CHECK: encoding: [0xf3,0xc5,0x15,0x64] +hlv.hu a1, (a1) + +# CHECK-INST: hlvx.hu a1, (a2) +# CHECK: encoding: [0xf3,0x45,0x36,0x64] +hlvx.hu a1, (a2) + +# CHECK-INST: hlv.w a2, (a2) +# CHECK: encoding: [0x73,0x46,0x06,0x68] +hlv.w a2, (a2) + +# CHECK-INST: hlvx.wu a2, (a3) +# CHECK: encoding: [0x73,0xc6,0x36,0x68] +hlvx.wu a2, (a3) + +# CHECK-INST: hsv.b a0, (a1) +# CHECK: encoding: [0x73,0xc0,0xa5,0x62] +hsv.b a0, (a1) + +# CHECK-INST: hsv.h a0, (a1) +# CHECK: encoding: [0x73,0xc0,0xa5,0x66] +hsv.h a0, (a1) + +# CHECK-INST: hsv.w a0, (a1) +# CHECK: encoding: [0x73,0xc0,0xa5,0x6a] +hsv.w a0, (a1) Index: llvm/test/MC/RISCV/rv32ih-aliases-valid.s =================================================================== --- /dev/null +++ llvm/test/MC/RISCV/rv32ih-aliases-valid.s @@ -0,0 +1,70 @@ +# RUN: llvm-mc %s -triple=riscv32 -mattr=+h -riscv-no-aliases -show-encoding \ +# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST,CHECK-ALIAS-INST %s +# RUN: llvm-mc %s -triple=riscv64 -mattr=+h -riscv-no-aliases -show-encoding \ +# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST,CHECK-ALIAS-INST %s +# RUN: llvm-mc -filetype=obj -mattr=+h -triple riscv32 < %s \ +# RUN: | llvm-objdump --mattr=+h -M no-aliases -d - \ +# RUN: | FileCheck -check-prefixes=CHECK-INST,CHECK-NOALIAS-INST %s +# RUN: llvm-mc -filetype=obj -mattr=+h -triple riscv64 < %s \ +# RUN: | llvm-objdump --mattr=+h -M no-aliases -d - \ +# RUN: | FileCheck -check-prefixes=CHECK-INST,CHECK-NOALIAS-INST %s + +# CHECK-ALIAS-INST: hfence.gvma +# CHECK-NOALIAS-INST: hfence.gvma zero, zero +# CHECK: encoding: [0x73,0x00,0x00,0x62] +hfence.gvma + +# CHECK-ALIAS-INST: hfence.gvma a0 +# CHECK-NOALIAS-INST: hfence.gvma a0, zero +# CHECK: encoding: [0x73,0x00,0x05,0x62] +hfence.gvma a0 + +# CHECK-ALIAS-INST: hfence.vvma +# CHECK-NOALIAS-INST: hfence.vvma zero, zero +# CHECK: encoding: [0x73,0x00,0x00,0x22] +hfence.vvma + +# CHECK-ALIAS-INST: hfence.vvma a0 +# CHECK-NOALIAS-INST: hfence.vvma a0, zero +# CHECK: encoding: [0x73,0x00,0x05,0x22] +hfence.vvma a0 + +# CHECK-INST: hlv.b a0, (a1) +# CHECK: encoding: [0x73,0xc5,0x05,0x60] +hlv.b a0, 0(a1) + +# CHECK-INST: hlv.bu a0, (a1) +# CHECK: encoding: [0x73,0xc5,0x15,0x60] +hlv.bu a0, 0(a1) + +# CHECK-INST: hlv.h a1, (a2) +# CHECK: encoding: [0xf3,0x45,0x06,0x64] +hlv.h a1, 0(a2) + +# CHECK-INST: hlv.hu a1, (a1) +# CHECK: encoding: [0xf3,0xc5,0x15,0x64] +hlv.hu a1, 0(a1) + +# CHECK-INST: hlvx.hu a1, (a2) +# CHECK: encoding: [0xf3,0x45,0x36,0x64] +hlvx.hu a1, 0(a2) + +# CHECK-INST: hlv.w a2, (a2) +# CHECK: encoding: [0x73,0x46,0x06,0x68] +hlv.w a2, 0(a2) + +# CHECK-INST: hlvx.wu a2, (a3) +# CHECK: encoding: [0x73,0xc6,0x36,0x68] +hlvx.wu a2, 0(a3) + +# CHECK-INST: hsv.b a0, (a1) +# CHECK: encoding: [0x73,0xc0,0xa5,0x62] +hsv.b a0, 0(a1) + +# CHECK-INST: hsv.h a0, (a1) +# CHECK: encoding: [0x73,0xc0,0xa5,0x66] +hsv.h a0, 0(a1) + +# CHECK-INST: hsv.w a0, (a1) +# CHECK: encoding: [0x73,0xc0,0xa5,0x6a] +hsv.w a0, 0(a1) Index: llvm/test/MC/RISCV/priv-valid.s =================================================================== --- llvm/test/MC/RISCV/priv-valid.s +++ llvm/test/MC/RISCV/priv-valid.s @@ -48,75 +48,3 @@ # CHECK-INST: sfence.inval.ir # CHECK: encoding: [0x73,0x00,0x10,0x18] sfence.inval.ir - -# CHECK-INST: hfence.vvma zero, zero -# CHECK: encoding: [0x73,0x00,0x00,0x22] -hfence.vvma zero, zero - -# CHECK-INST: hfence.vvma a0, a1 -# CHECK: encoding: [0x73,0x00,0xb5,0x22] -hfence.vvma a0, a1 - -# CHECK-INST: hfence.gvma zero, zero -# CHECK: encoding: [0x73,0x00,0x00,0x62] -hfence.gvma zero, zero - -# CHECK-INST: hfence.gvma a0, a1 -# CHECK: encoding: [0x73,0x00,0xb5,0x62] -hfence.gvma a0, a1 - -# CHECK-INST: hinval.vvma zero, zero -# CHECK: encoding: [0x73,0x00,0x00,0x26] -hinval.vvma zero, zero - -# CHECK-INST: hinval.vvma a0, a1 -# CHECK: encoding: [0x73,0x00,0xb5,0x26] -hinval.vvma a0, a1 - -# CHECK-INST: hinval.gvma zero, zero -# CHECK: encoding: [0x73,0x00,0x00,0x66] -hinval.gvma zero, zero - -# CHECK-INST: hinval.gvma a0, a1 -# CHECK: encoding: [0x73,0x00,0xb5,0x66] -hinval.gvma a0, a1 - -# CHECK-INST: hlv.b a0, (a1) -# CHECK: encoding: [0x73,0xc5,0x05,0x60] -hlv.b a0, (a1) - -# CHECK-INST: hlv.bu a0, (a1) -# CHECK: encoding: [0x73,0xc5,0x15,0x60] -hlv.bu a0, (a1) - -# CHECK-INST: hlv.h a1, (a2) -# CHECK: encoding: [0xf3,0x45,0x06,0x64] -hlv.h a1, (a2) - -# CHECK-INST: hlv.hu a1, (a1) -# CHECK: encoding: [0xf3,0xc5,0x15,0x64] -hlv.hu a1, (a1) - -# CHECK-INST: hlvx.hu a1, (a2) -# CHECK: encoding: [0xf3,0x45,0x36,0x64] -hlvx.hu a1, (a2) - -# CHECK-INST: hlv.w a2, (a2) -# CHECK: encoding: [0x73,0x46,0x06,0x68] -hlv.w a2, (a2) - -# CHECK-INST: hlvx.wu a2, (a3) -# CHECK: encoding: [0x73,0xc6,0x36,0x68] -hlvx.wu a2, (a3) - -# CHECK-INST: hsv.b a0, (a1) -# CHECK: encoding: [0x73,0xc0,0xa5,0x62] -hsv.b a0, (a1) - -# CHECK-INST: hsv.h a0, (a1) -# CHECK: encoding: [0x73,0xc0,0xa5,0x66] -hsv.h a0, (a1) - -# CHECK-INST: hsv.w a0, (a1) -# CHECK: encoding: [0x73,0xc0,0xa5,0x6a] -hsv.w a0, (a1) Index: llvm/test/MC/RISCV/priv-aliases-valid.s =================================================================== --- llvm/test/MC/RISCV/priv-aliases-valid.s +++ /dev/null @@ -1,50 +0,0 @@ -# RUN: llvm-mc %s -triple=riscv32 -riscv-no-aliases -show-encoding \ -# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s -# RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases -show-encoding \ -# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s -# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ -# RUN: | llvm-objdump -M no-aliases -d - \ -# RUN: | FileCheck -check-prefix=CHECK-INST %s -# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \ -# RUN: | llvm-objdump -M no-aliases -d - \ -# RUN: | FileCheck -check-prefix=CHECK-INST %s - -# CHECK-INST: hlv.b a0, (a1) -# CHECK: encoding: [0x73,0xc5,0x05,0x60] -hlv.b a0, 0(a1) - -# CHECK-INST: hlv.bu a0, (a1) -# CHECK: encoding: [0x73,0xc5,0x15,0x60] -hlv.bu a0, 0(a1) - -# CHECK-INST: hlv.h a1, (a2) -# CHECK: encoding: [0xf3,0x45,0x06,0x64] -hlv.h a1, 0(a2) - -# CHECK-INST: hlv.hu a1, (a1) -# CHECK: encoding: [0xf3,0xc5,0x15,0x64] -hlv.hu a1, 0(a1) - -# CHECK-INST: hlvx.hu a1, (a2) -# CHECK: encoding: [0xf3,0x45,0x36,0x64] -hlvx.hu a1, 0(a2) - -# CHECK-INST: hlv.w a2, (a2) -# CHECK: encoding: [0x73,0x46,0x06,0x68] -hlv.w a2, 0(a2) - -# CHECK-INST: hlvx.wu a2, (a3) -# CHECK: encoding: [0x73,0xc6,0x36,0x68] -hlvx.wu a2, 0(a3) - -# CHECK-INST: hsv.b a0, (a1) -# CHECK: encoding: [0x73,0xc0,0xa5,0x62] -hsv.b a0, 0(a1) - -# CHECK-INST: hsv.h a0, (a1) -# CHECK: encoding: [0x73,0xc0,0xa5,0x66] -hsv.h a0, 0(a1) - -# CHECK-INST: hsv.w a0, (a1) -# CHECK: encoding: [0x73,0xc0,0xa5,0x6a] -hsv.w a0, 0(a1) Index: llvm/test/CodeGen/RISCV/attributes.ll =================================================================== --- llvm/test/CodeGen/RISCV/attributes.ll +++ llvm/test/CodeGen/RISCV/attributes.ll @@ -16,6 +16,7 @@ ; RUN: llc -mtriple=riscv32 -mattr=+zbc %s -o - | FileCheck --check-prefix=RV32ZBC %s ; RUN: llc -mtriple=riscv32 -mattr=+zbs %s -o - | FileCheck --check-prefix=RV32ZBS %s ; RUN: llc -mtriple=riscv32 -mattr=+v %s -o - | FileCheck --check-prefix=RV32V %s +; RUN: llc -mtriple=riscv32 -mattr=+h %s -o - | FileCheck --check-prefix=RV32H %s ; RUN: llc -mtriple=riscv32 -mattr=+zbb,+zfh,+v,+f %s -o - | FileCheck --check-prefix=RV32COMBINED %s ; RUN: llc -mtriple=riscv32 -mattr=+zbkb %s -o - | FileCheck --check-prefix=RV32ZBKB %s ; RUN: llc -mtriple=riscv32 -mattr=+zbkc %s -o - | FileCheck --check-prefix=RV32ZBKC %s @@ -54,6 +55,7 @@ ; RUN: llc -mtriple=riscv64 -mattr=+zbc %s -o - | FileCheck --check-prefix=RV64ZBC %s ; RUN: llc -mtriple=riscv64 -mattr=+zbs %s -o - | FileCheck --check-prefix=RV64ZBS %s ; RUN: llc -mtriple=riscv64 -mattr=+v %s -o - | FileCheck --check-prefix=RV64V %s +; RUN: llc -mtriple=riscv64 -mattr=+h %s -o - | FileCheck --check-prefix=RV64H %s ; RUN: llc -mtriple=riscv64 -mattr=+zbb,+zfh,+v,+f %s -o - | FileCheck --check-prefix=RV64COMBINED %s ; RUN: llc -mtriple=riscv64 -mattr=+zbkb %s -o - | FileCheck --check-prefix=RV64ZBKB %s ; RUN: llc -mtriple=riscv64 -mattr=+zbkc %s -o - | FileCheck --check-prefix=RV64ZBKC %s @@ -95,6 +97,7 @@ ; RV32ZBC: .attribute 5, "rv32i2p0_zbc1p0" ; RV32ZBS: .attribute 5, "rv32i2p0_zbs1p0" ; RV32V: .attribute 5, "rv32i2p0_f2p0_d2p0_v1p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0" +; RV32H: .attribute 5, "rv32i2p0_h1p0" ; RV32COMBINED: .attribute 5, "rv32i2p0_f2p0_d2p0_v1p0_zfh1p0_zbb1p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0" ; RV32ZBKB: .attribute 5, "rv32i2p0_zbkb1p0" ; RV32ZBKC: .attribute 5, "rv32i2p0_zbkc1p0" @@ -134,6 +137,7 @@ ; RV64ZBC: .attribute 5, "rv64i2p0_zbc1p0" ; RV64ZBS: .attribute 5, "rv64i2p0_zbs1p0" ; RV64V: .attribute 5, "rv64i2p0_f2p0_d2p0_v1p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0" +; RV64H: .attribute 5, "rv64i2p0_h1p0" ; RV64COMBINED: .attribute 5, "rv64i2p0_f2p0_d2p0_v1p0_zfh1p0_zbb1p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0" ; RV64ZBKB: .attribute 5, "rv64i2p0_zbkb1p0" ; RV64ZBKC: .attribute 5, "rv64i2p0_zbkc1p0" Index: llvm/lib/Target/RISCV/RISCVSubtarget.h =================================================================== --- llvm/lib/Target/RISCV/RISCVSubtarget.h +++ llvm/lib/Target/RISCV/RISCVSubtarget.h @@ -57,6 +57,7 @@ bool HasStdExtZbs = false; bool HasStdExtZca = false; bool HasStdExtV = false; + bool HasStdExtH = false; bool HasStdExtZve32x = false; bool HasStdExtZve32f = false; bool HasStdExtZve64x = false; @@ -157,6 +158,7 @@ bool hasStdExtD() const { return HasStdExtD; } bool hasStdExtC() const { return HasStdExtC; } bool hasStdExtV() const { return HasStdExtV; } + bool hasStdExtH() const { return HasStdExtH; } bool hasStdExtZihintpause() const { return HasStdExtZihintpause; } bool hasStdExtZihintntl() const { return HasStdExtZihintntl; } bool hasStdExtZba() const { return HasStdExtZba; } Index: llvm/lib/Target/RISCV/RISCVInstrInfo.td =================================================================== --- llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -814,6 +814,8 @@ } // Predicates = [HasStdExtSvinval] def SFENCE_VMA : Priv_rr<"sfence.vma", 0b0001001>, Sched<[]>; + +let Predicates = [HasStdExtH] in { def HFENCE_VVMA : Priv_rr<"hfence.vvma", 0b0010001>, Sched<[]>; def HFENCE_GVMA : Priv_rr<"hfence.gvma", 0b0110001>, Sched<[]>; @@ -827,8 +829,8 @@ def HSV_B : HStore_rr<0b0110001, "hsv.b">, Sched<[]>; def HSV_H : HStore_rr<0b0110011, "hsv.h">, Sched<[]>; def HSV_W : HStore_rr<0b0110101, "hsv.w">, Sched<[]>; - -let Predicates = [IsRV64] in { +} +let Predicates = [IsRV64, HasStdExtH] in { def HLV_WU : HLoad_r<0b0110100, 0b00001, "hlv.wu">, Sched<[]>; def HLV_D : HLoad_r<0b0110110, 0b00000, "hlv.d">, Sched<[]>; def HSV_D : HStore_rr<0b0110111, "hsv.d">, Sched<[]>; Index: llvm/lib/Target/RISCV/RISCV.td =================================================================== --- llvm/lib/Target/RISCV/RISCV.td +++ llvm/lib/Target/RISCV/RISCV.td @@ -51,6 +51,14 @@ AssemblerPredicate<(all_of FeatureStdExtD), "'D' (Double-Precision Floating-Point)">; +def FeatureStdExtH + : SubtargetFeature<"h", "HasStdExtH", "true", + "'H' (Hypervisor)">; + +def HasStdExtH : Predicate<"Subtarget->hasStdExtH()">, + AssemblerPredicate<(all_of FeatureStdExtH), + "'H' (Hypervisor)">; + def FeatureStdExtZihintpause : SubtargetFeature<"zihintpause", "HasStdExtZihintpause", "true", "'zihintpause' (Pause Hint)">; Index: llvm/lib/Support/RISCVISAInfo.cpp =================================================================== --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -37,7 +37,7 @@ } // end anonymous namespace -static constexpr StringLiteral AllStdExts = "mafdqlcbkjtpvn"; +static constexpr StringLiteral AllStdExts = "mafdqlcbkjtpvnh"; static const RISCVSupportedExtension SupportedExtensions[] = { {"i", RISCVExtensionVersion{2, 0}}, @@ -48,6 +48,8 @@ {"d", RISCVExtensionVersion{2, 0}}, {"c", RISCVExtensionVersion{2, 0}}, + {"h", RISCVExtensionVersion{1, 0}}, + {"zihintpause", RISCVExtensionVersion{2, 0}}, {"zfhmin", RISCVExtensionVersion{1, 0}}, @@ -275,17 +277,14 @@ case 's': HighOrder = 0; break; - case 'h': - HighOrder = 1; - break; case 'z': - HighOrder = 2; + HighOrder = 1; // `z` extension must be sorted by canonical order of second letter. // e.g. zmx has higher rank than zax. LowOrder = singleLetterExtensionRank(ExtName[1]); break; case 'x': - HighOrder = 3; + HighOrder = 2; break; default: llvm_unreachable("Unknown prefix for multi-char extension"); @@ -602,8 +601,8 @@ // The order is OK, then push it into features. // TODO: Use version number when setting target features - // Currently LLVM supports only "mafdcv". - StringRef SupportedStandardExtension = "mafdcv"; + // Currently LLVM supports only "mafdcvh". + StringRef SupportedStandardExtension = "mafdcvh"; if (!SupportedStandardExtension.contains(C)) return createStringError(errc::invalid_argument, "unsupported standard user-level extension '%c'", Index: llvm/docs/RISCVUsage.rst =================================================================== --- llvm/docs/RISCVUsage.rst +++ llvm/docs/RISCVUsage.rst @@ -51,6 +51,7 @@ ``C`` Supported ``D`` Supported ``F`` Supported + ``H`` Assembly Support ``M`` Supported ``Svinval`` Assembly Support ``V`` Supported Index: clang/test/Preprocessor/riscv-target-features.c =================================================================== --- clang/test/Preprocessor/riscv-target-features.c +++ clang/test/Preprocessor/riscv-target-features.c @@ -41,6 +41,7 @@ // CHECK-NOT: __riscv_zicboz // CHECK-NOT: __riscv_svnapot // CHECK-NOT: __riscv_svinval +// CHECK-NOT: __riscv_h // RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32im -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-M-EXT %s @@ -432,3 +433,9 @@ // RUN: %clang -target riscv64 -march=rv64isvinval -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-SVINVAL-EXT %s // CHECK-SVINVAL-EXT: __riscv_svinval 1000000{{$}} + +// RUN: %clang -target riscv32 -march=rv32ih -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-H-EXT %s +// RUN: %clang -target riscv64 -march=rv64ih -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-H-EXT %s +// CHECK-H-EXT: __riscv_h 1000000{{$}}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits