diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp index 19b221bb98d46..e8707ba7978e9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp @@ -1114,13 +1114,15 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_VSELECT(SDNode *N) { } /// If the operand is a vector that needs to be scalarized then the -/// result must be v1i1, so just convert to a scalar SETCC and wrap -/// with a scalar_to_vector since the res type is legal if we got here +/// result must be a single-element vector, so just convert to a scalar +/// SETCC and wrap with a scalar_to_vector since the res type is legal +/// if we got here SDValue DAGTypeLegalizer::ScalarizeVecOp_VSETCC(SDNode *N) { assert(N->getValueType(0).isVector() && N->getOperand(0).getValueType().isVector() && "Operand types must be vectors"); - assert(N->getValueType(0) == MVT::v1i1 && "Expected v1i1 type"); + assert(N->getValueType(0).getVectorNumElements() == 1 && + "Expected single-element vector type"); EVT VT = N->getValueType(0); SDValue LHS = GetScalarizedVector(N->getOperand(0)); @@ -1150,7 +1152,8 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_VSTRICT_FSETCC(SDNode *N, assert(N->getValueType(0).isVector() && N->getOperand(1).getValueType().isVector() && "Operand types must be vectors"); - assert(N->getValueType(0) == MVT::v1i1 && "Expected v1i1 type"); + assert(N->getValueType(0).getVectorNumElements() == 1 && + "Expected single-element vector type"); EVT VT = N->getValueType(0); SDValue Ch = N->getOperand(0); diff --git a/llvm/test/CodeGen/PowerPC/fp128-vector-setcc.ll b/llvm/test/CodeGen/PowerPC/fp128-vector-setcc.ll new file mode 100644 index 0000000000000..1d0c83edd8b78 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/fp128-vector-setcc.ll @@ -0,0 +1,22 @@ +; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 %s -o - | FileCheck %s + +define <4 x i1> @fp(<4 x fp128> %0) { +; CHECK-LABEL: fp: +; CHECK-COUNT-4: bl __eqkf2 +; CHECK: blr +Entry: + %1 = fcmp oeq <4 x fp128> %0, zeroinitializer + ret <4 x i1> %1 +} + +define <4 x i1> @foo(<4 x fp128> %0) strictfp { +; CHECK-LABEL: foo: +; CHECK-COUNT-4: bl __eqkf2 +; CHECK: blr +Entry: + %1 = call <4 x i1> @llvm.experimental.constrained.fcmp.v4fp128(<4 x fp128> %0, <4 x fp128> zeroinitializer, metadata !"oeq", metadata !"fpexcept.strict") + ret <4 x i1> %1 +} + +declare <4 x i1> @llvm.experimental.constrained.fcmp.v4fp128(<4 x fp128>, <4 x fp128>, metadata, metadata) +