[PATCH] D44727: [RISCV] Extend getTargetDefines for RISCVTargetInfo

Alex Bradbury via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 4 08:31:32 PDT 2018


asb accepted this revision.
asb added a comment.
This revision is now accepted and ready to land.

Thanks, this looks good to me.



================
Comment at: lib/Basic/Targets/RISCV.cpp:62-70
+  if (HasD)
+    Builder.defineMacro("__riscv_flen", "64");
+  else if (HasF)
+    Builder.defineMacro("__riscv_flen", "32");
+
+  if (HasF || HasD) {
+    Builder.defineMacro("__riscv_fdiv");
----------------
We really are nitpicking now, but this could be written as below, which would keep the F/D defines in one place.

```
if (HasF || HasD) {
    Builder.defineMacro("__riscv_flen", HasD ? "64" : "32");
    Builder.defineMacro("__riscv_fdiv");
    Builder.defineMacro("__riscv_fsqrt");
}

```


Repository:
  rC Clang

https://reviews.llvm.org/D44727





More information about the cfe-commits mailing list