r370709 - [RISCV] Correct Logic around ilp32e macros

Sam Elliott via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 01:47:58 PDT 2019


Author: lenary
Date: Tue Sep  3 01:47:58 2019
New Revision: 370709

URL: http://llvm.org/viewvc/llvm-project?rev=370709&view=rev
Log:
[RISCV] Correct Logic around ilp32e macros

Summary:
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.

Reviewers: luismarques, asb

Reviewed By: luismarques

Subscribers: rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66591

Modified:
    cfe/trunk/lib/Basic/Targets/RISCV.cpp

Modified: cfe/trunk/lib/Basic/Targets/RISCV.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/RISCV.cpp?rev=370709&r1=370708&r2=370709&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/RISCV.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/RISCV.cpp Tue Sep  3 01:47:58 2019
@@ -96,11 +96,12 @@ void RISCVTargetInfo::getTargetDefines(c
     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");




More information about the cfe-commits mailing list