[PATCH] D103668: [PowerPC] Implement trap and conversion builtins for XL compatibility

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 23:28:11 PDT 2021


qiucf added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:3334
      return SemaBuiltinConstantArgRange(TheCall, 3, 0, 7);
+  case PPC::BI__builtin_ppc_tw: {
+    return SemaBuiltinConstantArgRange(TheCall, 2, 1, 31);
----------------
Unnecessary brace?


================
Comment at: llvm/include/llvm/IR/IntrinsicsPowerPC.td:115
 
+  // xl compatibility
+  def int_ppc_tdw
----------------
This comment is little bit confusing: we don't have `__builtin_ppc_fcfid` in XL. XL has `__fcfid` instead. What we're doing is to follow Clang's convention to name them `__builtin_xxx` and defines macros to maintain XL compatibility.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1735
+// trap, trapd
+def : Pat<(int_ppc_trapd g8rc:$A),
+          (TDI 24, $A, 0)>;
----------------
Where is `trap`?


================
Comment at: llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-conversionfunc.c:1
+// RUN: clang -mcpu=pwr9 -O2 -c -S %s -o - | FileCheck %s
+
----------------
Please separate front-end and back-end tests. IIRC, LLVM doesn't accept end-to-end tests yet. So it's better to put //'C to IR'// test in Clang's codegen, and put //'IR to Assembly'// test in llvm/PowerPC's codegen.

Use `%clang_cc1` in front-end tests. And also test in back-end if `VSX` is not available.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103668



More information about the llvm-commits mailing list