[PATCH] D105930: [PowerPC] Implement XL compact math builtins

Nemanja Ivanovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 14 11:28:41 PDT 2021


nemanjai requested changes to this revision.
nemanjai added a comment.
This revision now requires changes to proceed.

Please change `compact` in the title to `compat`.



================
Comment at: clang/include/clang/Basic/BuiltinsPPC.def:76-79
+BUILTIN(__builtin_ppc_mtfsb0, "vUi", "")
+BUILTIN(__builtin_ppc_mtfsb1, "vUi", "")
+BUILTIN(__builtin_ppc_mtfsf, "vUiUi", "")
+BUILTIN(__builtin_ppc_mtfsfi, "vUiUi", "")
----------------
I think at least some of these should be `I` because the parameter must be foldable to an integer constant expression (see `Builtins.def`).


================
Comment at: llvm/include/llvm/IR/IntrinsicsPowerPC.td:1588
+      : GCCBuiltin<"__builtin_ppc_mtfsf">,
+        Intrinsic <[], [llvm_i32_ty, llvm_i32_ty],
+                   [IntrNoMem, IntrHasSideEffects]>;
----------------
For parameters that need to be immediates, please mark them as such with the respective intrinsic property.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.td:3650
+// XL Compat intrinsics.
+def : Pat<(int_ppc_fmsub f64:$A, f64:$B, f64:$C), (FMSUB $A, $B, $C)>;
+def : Pat<(int_ppc_fmsubs f32:$A, f32:$B, f32:$C), (FMSUBS $A, $B, $C)>;
----------------
Please review the order of operands carefully here. I believe the order is wrong either for this one or for the VSX version. Double-check all of the others as well please.


================
Comment at: llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-math.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s |\
+; RUN:   FileCheck %s --check-prefix=CHECK-PWR8
----------------
Please add `-mattr=-vsx` to one of the run lines since you have added patterns for non-VSX but do not appear to be testing that code path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105930



More information about the cfe-commits mailing list