[PATCH] D91315: [RISCV] Handle zfh in the arch string.
Hsiangkai Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 2 17:17:55 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG432d05174ed0: [RISCV] Handle zfh in the arch string. (authored by HsiangKai).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91315/new/
https://reviews.llvm.org/D91315
Files:
clang/lib/Basic/Targets/RISCV.cpp
clang/lib/Basic/Targets/RISCV.h
clang/lib/Driver/ToolChains/Arch/RISCV.cpp
clang/test/Driver/riscv-arch.c
clang/test/Preprocessor/riscv-target-features.c
Index: clang/test/Preprocessor/riscv-target-features.c
===================================================================
--- clang/test/Preprocessor/riscv-target-features.c
+++ clang/test/Preprocessor/riscv-target-features.c
@@ -78,3 +78,9 @@
// CHECK-DOUBLE: __riscv_float_abi_double 1
// CHECK-DOUBLE-NOT: __riscv_float_abi_soft
// CHECK-DOUBLE-NOT: __riscv_float_abi_single
+
+// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions -march=rv32izfh0p1 -x c -E -dM %s \
+// RUN: -o - | FileCheck --check-prefix=CHECK-ZFH-EXT %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions -march=rv64izfh0p1 -x c -E -dM %s \
+// RUN: -o - | FileCheck --check-prefix=CHECK-ZFH-EXT %s
+// CHECK-ZFH-EXT: __riscv_zfh 1
Index: clang/test/Driver/riscv-arch.c
===================================================================
--- clang/test/Driver/riscv-arch.c
+++ clang/test/Driver/riscv-arch.c
@@ -383,3 +383,12 @@
// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p9 -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-V-GOODVERS %s
// RV32-EXPERIMENTAL-V-GOODVERS: "-target-feature" "+experimental-v"
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32izfh -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZFH-NOFLAG %s
+// RV32-EXPERIMENTAL-ZFH-NOFLAG: error: invalid arch name 'rv32izfh'
+// RV32-EXPERIMENTAL-ZFH-NOFLAG: requires '-menable-experimental-extensions'
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32izfh0p1 -menable-experimental-extensions -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZFH %s
+// RV32-EXPERIMENTAL-ZFH: "-target-feature" "+experimental-zfh"
Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -64,6 +64,8 @@
return RISCVExtensionVersion{"0", "92"};
if (Ext == "v")
return RISCVExtensionVersion{"0", "9"};
+ if (Ext == "zfh")
+ return RISCVExtensionVersion{"0", "1"};
return None;
}
Index: clang/lib/Basic/Targets/RISCV.h
===================================================================
--- clang/lib/Basic/Targets/RISCV.h
+++ clang/lib/Basic/Targets/RISCV.h
@@ -31,11 +31,12 @@
bool HasD;
bool HasC;
bool HasB;
+ bool HasZfh;
public:
RISCVTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
- : TargetInfo(Triple), HasM(false), HasA(false), HasF(false),
- HasD(false), HasC(false), HasB(false) {
+ : TargetInfo(Triple), HasM(false), HasA(false), HasF(false), HasD(false),
+ HasC(false), HasB(false), HasZfh(false) {
LongDoubleWidth = 128;
LongDoubleAlign = 128;
LongDoubleFormat = &llvm::APFloat::IEEEquad();
Index: clang/lib/Basic/Targets/RISCV.cpp
===================================================================
--- clang/lib/Basic/Targets/RISCV.cpp
+++ clang/lib/Basic/Targets/RISCV.cpp
@@ -135,6 +135,9 @@
if (HasB)
Builder.defineMacro("__riscv_bitmanip");
+
+ if (HasZfh)
+ Builder.defineMacro("__riscv_zfh");
}
/// Return true if has this feature, need to sync with handleTargetFeatures.
@@ -150,6 +153,7 @@
.Case("d", HasD)
.Case("c", HasC)
.Case("experimental-b", HasB)
+ .Case("experimental-zfh", HasZfh)
.Default(false);
}
@@ -169,6 +173,8 @@
HasC = true;
else if (Feature == "+experimental-b")
HasB = true;
+ else if (Feature == "+experimental-zfh")
+ HasZfh = true;
}
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91315.309111.patch
Type: text/x-patch
Size: 3676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201203/dd6ea705/attachment-0001.bin>
More information about the llvm-commits
mailing list