[llvm] [SystemZ] Support fp16 vector ABI and basic codegen. (PR #171066)

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 7 16:23:33 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/lib/Target/SystemZ/SystemZISelLowering.cpp llvm/lib/Target/SystemZ/SystemZISelLowering.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index aaa6c22ea..ccd99eeb8 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -845,8 +845,9 @@ bool SystemZTargetLowering::useSoftFloat() const {
   return Subtarget.hasSoftFloat();
 }
 
-unsigned SystemZTargetLowering::getNumRegisters(LLVMContext &Context, EVT VT,
-                                          std::optional<MVT> RegisterVT) const {
+unsigned
+SystemZTargetLowering::getNumRegisters(LLVMContext &Context, EVT VT,
+                                       std::optional<MVT> RegisterVT) const {
   // i128 inline assembly operand.
   if (VT == MVT::i128 && RegisterVT && *RegisterVT == MVT::Untyped)
     return 1;
@@ -6391,13 +6392,12 @@ static SDValue mergeHighParts(SelectionDAG &DAG, const SDLoc &DL,
          "Handling full vectors only.");
   Op0 = DAG.getNode(ISD::BITCAST, DL, IntVecVT, Op0);
   Op1 = DAG.getNode(ISD::BITCAST, DL, IntVecVT, Op1);
-  SDValue Op = DAG.getNode(SystemZISD::MERGE_HIGH,
-                           DL, IntVecVT, Op0, Op1);
+  SDValue Op = DAG.getNode(SystemZISD::MERGE_HIGH, DL, IntVecVT, Op0, Op1);
   return DAG.getNode(ISD::BITCAST, DL, VT, Op);
 }
 
-static SDValue buildFPVecFromScalars4(SelectionDAG &DAG, const SDLoc &DL, EVT VT,
-                                      SmallVectorImpl<SDValue> &Elems,
+static SDValue buildFPVecFromScalars4(SelectionDAG &DAG, const SDLoc &DL,
+                                      EVT VT, SmallVectorImpl<SDValue> &Elems,
                                       unsigned Pos) {
   SDValue Op01 = buildMergeScalars(DAG, DL, VT, Elems[Pos + 0], Elems[Pos + 1]);
   SDValue Op23 = buildMergeScalars(DAG, DL, VT, Elems[Pos + 2], Elems[Pos + 3]);
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.h b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
index ca47b96ef..9ea7f3e55 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.h
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
@@ -68,7 +68,8 @@ public:
     // Expand (narrow) f16 vectors during type legalization to avoid
     // operations for all elements as with expansion after widening.
     if (VT.getScalarType() == MVT::f16)
-      return VT.getVectorElementCount().isScalar() ? TypeScalarizeVector : TypeSplitVector;
+      return VT.getVectorElementCount().isScalar() ? TypeScalarizeVector
+                                                   : TypeSplitVector;
     if (VT.getScalarSizeInBits() % 8 == 0)
       return TypeWidenVector;
     return TargetLoweringBase::getPreferredVectorAction(VT);

``````````

</details>


https://github.com/llvm/llvm-project/pull/171066


More information about the llvm-commits mailing list