[PATCH] D66591: [RISCV] Correct Logic around ilp32e macros

Sam Elliott via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 07:23:27 PDT 2019


lenary created this revision.
lenary added reviewers: luismarques, asb.
Herald added subscribers: cfe-commits, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, MaskRay, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, apazos, simoncook, johnrusso, rbar.
Herald added a project: clang.

GCC seperates the `__riscv_float_abi_*` macros and the
`__riscv_abi_rve` macro. If the chosen abi is ilp32e, `gcc -march=rv32i
-mabi=ilp32i -E -dM` shows that both `__riscv_float_abi_soft` and
`__riscv_abi_rve` are set.

This patch corrects the compiler logic around these defines.

At the moment, this patch will not change clang's behaviour, because we do not
accept the `ilp32e` abi yet.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66591

Files:
  clang/lib/Basic/Targets/RISCV.cpp


Index: clang/lib/Basic/Targets/RISCV.cpp
===================================================================
--- clang/lib/Basic/Targets/RISCV.cpp
+++ clang/lib/Basic/Targets/RISCV.cpp
@@ -96,11 +96,12 @@
     Builder.defineMacro("__riscv_float_abi_single");
   else if (ABIName == "ilp32d" || ABIName == "lp64d")
     Builder.defineMacro("__riscv_float_abi_double");
-  else if (ABIName == "ilp32e")
-    Builder.defineMacro("__riscv_abi_rve");
   else
     Builder.defineMacro("__riscv_float_abi_soft");
 
+  if (ABIName == "ilp32e")
+    Builder.defineMacro("__riscv_abi_rve");
+
   if (HasM) {
     Builder.defineMacro("__riscv_mul");
     Builder.defineMacro("__riscv_div");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66591.216612.patch
Type: text/x-patch
Size: 680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190822/96eba509/attachment-0001.bin>


More information about the cfe-commits mailing list