diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -4152,7 +4152,12 @@ bool ARMTargetLowering::splitValueIntoRegisterParts( SelectionDAG &DAG, const SDLoc &DL, SDValue Val, SDValue *Parts, unsigned NumParts, MVT PartVT, Optional CC) const { - bool IsABIRegCopy = CC.hasValue(); + bool IsABIRegCopy = false; + if (CC.hasValue()) { + auto CCVal = CC.getValue(); + IsABIRegCopy = + (CCVal == CallingConv::ARM_APCS || CCVal == CallingConv::ARM_AAPCS); + } EVT ValueVT = Val.getValueType(); if (IsABIRegCopy && (ValueVT == MVT::f16 || ValueVT == MVT::bf16) && PartVT == MVT::f32) { @@ -4170,7 +4175,12 @@ SDValue ARMTargetLowering::joinRegisterPartsIntoValue( SelectionDAG &DAG, const SDLoc &DL, const SDValue *Parts, unsigned NumParts, MVT PartVT, EVT ValueVT, Optional CC) const { - bool IsABIRegCopy = CC.hasValue(); + bool IsABIRegCopy = false; + if (CC.hasValue()) { + auto CCVal = CC.getValue(); + IsABIRegCopy = + (CCVal == CallingConv::ARM_APCS || CCVal == CallingConv::ARM_AAPCS); + } if (IsABIRegCopy && (ValueVT == MVT::f16 || ValueVT == MVT::bf16) && PartVT == MVT::f32) { unsigned ValueBits = ValueVT.getSizeInBits(); diff --git a/llvm/test/CodeGen/ARM/arm-half-promote.ll b/llvm/test/CodeGen/ARM/arm-half-promote.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/ARM/arm-half-promote.ll @@ -0,0 +1,20 @@ +; RUN: llc -mtriple=thumbv7s-apple-ios7.0.0 %s -o - + +target datalayout = "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" +target triple = "thumbv7s-apple-ios7.0.0" + +define fastcc { <8 x half>, <8 x half> } @f1() { + ret { <8 x half>, <8 x half> } zeroinitializer +} + +define arm_aapcscc { <8 x half>, <8 x half> } @f2() { + ret { <8 x half>, <8 x half> } zeroinitializer +} + +define arm_apcscc { <8 x half>, <8 x half> } @f3() { + ret { <8 x half>, <8 x half> } zeroinitializer +} + +define swiftcc { <8 x half>, <8 x half> } @f4() { + ret { <8 x half>, <8 x half> } zeroinitializer +}