[PATCH] D117193: [PowerPC] Emit gnu_attribute according to float-abi metadata

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 21 12:04:57 PST 2022


jsji accepted this revision as: jsji.
jsji added a comment.
This revision is now accepted and ready to land.

LGTM with some nits.



================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:181
 
+  void emitAttributes(Module &M);
+
----------------
Should we name it `emitGNUAttributes`? or even `emitGNUAttributes_ABI_FP`


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1400
+  if (flt == "doubledouble")
+    OutStreamer->emitGNUAttribute(4, 5);
+  else if (flt == "ieeequad")
----------------
Can we avoid the magic number here? 4 should be `Tag_GNU_Power_ABI_FP`.

and define:

Val_GNU_Power_ABI_No_Float          0b00 
Val_GNU_Power_ABI_HardFloat_DP  0b01
Val_GNU_Power_ABI_SoftFloat_DP    0b02
Val_GNU_Power_ABI_HardFloat_SP   0b03

Val_GNU_Power_ABI_LDBL_IBM128   0b0100 
Val_GNU_Power_ABI_LDBL_64             0b1000
Val_GNU_Power_ABI_LDBL_IEEE128   0b1100
 
then 5 should be
 Val_GNU_Power_ABI_HardFloat_DP | Val_GNU_Power_ABI_LDBL_IBM128 

9 should be:
 Val_GNU_Power_ABI_HardFloat_DP | Val_GNU_Power_ABI_LDBL_64 

13 should be:
Val_GNU_Power_ABI_HardFloat_DP | Val_GNU_Power_ABI_LDBL_IEEE128 



================
Comment at: llvm/test/CodeGen/PowerPC/gnu-attribute.ll:4
+; RUN: sed -e 's/FLTABI/ieeedouble/' %s | llc -mtriple=powerpc64le | FileCheck %s --check-prefix=DBL
+; RUN: sed -e 's/FLTABI//' %s | llc -mtriple=powerpc64le | FileCheck %s --check-prefix=NONE
+
----------------
How about `softfp`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117193/new/

https://reviews.llvm.org/D117193



More information about the llvm-commits mailing list