Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ HexagonTargetLowering::initializeHVXLowering() {
// Include cases which are not hander earlier
setOperationAction(ISD::UINT_TO_FP, MVT::v32i1, Custom);
setOperationAction(ISD::UINT_TO_FP, MVT::v64i1, Custom);
setOperationAction(ISD::SINT_TO_FP, MVT::v32i1, Custom);

setTargetDAGCombine({ISD::CONCAT_VECTORS, ISD::TRUNCATE, ISD::VSELECT});
}
Expand Down Expand Up @@ -2337,7 +2338,7 @@ HexagonTargetLowering::LowerHvxFpToInt(SDValue Op, SelectionDAG &DAG) const {
return ExpandHvxFpToInt(Op, DAG);
}

// For vector type v32i1 uint_to_fp to v32f32:
// For vector type v32i1 uint_to_fp/sint_to_fp to v32f32:
// R1 = #1, R2 holds the v32i1 param
// V1 = vsplat(R1)
// V2 = vsplat(R2)
Expand Down Expand Up @@ -2464,7 +2465,7 @@ HexagonTargetLowering::LowerHvxIntToFp(SDValue Op, SelectionDAG &DAG) const {
MVT IntTy = ty(Op.getOperand(0)).getVectorElementType();
MVT FpTy = ResTy.getVectorElementType();

if (Op.getOpcode() == ISD::UINT_TO_FP) {
if (Op.getOpcode() == ISD::UINT_TO_FP || Op.getOpcode() == ISD::SINT_TO_FP) {
if (ResTy == MVT::v32f32 && ty(Op.getOperand(0)) == MVT::v32i1)
return LowerHvxPred32ToFp(Op, DAG);
if (ResTy == MVT::v64f16 && ty(Op.getOperand(0)) == MVT::v64i1)
Expand Down
42 changes: 42 additions & 0 deletions llvm/test/CodeGen/Hexagon/isel-inttofp-v32i1tov32f32.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
; Tests lowering of v32i1 to v32f32

; RUN: llc -march=hexagon -mattr=+hvxv79,+hvx-length128b,+hvx-ieee-fp \
; RUN: -stop-after=hexagon-isel %s -o - | FileCheck %s

define <32 x float> @uitofp_i1(<32 x i16> %in0, <32 x i16> %in1) #0 {
; CHECK: name: uitofp_i1
; CHECK: [[R0:%[0-9]+]]:hvxvr = V6_lvsplatw killed %{{[0-9]+}}
; CHECK-NEXT: [[R1:%[0-9]+]]:intregs = A2_tfrsi 1
; CHECK-NEXT: [[R2:%[0-9]+]]:hvxvr = V6_lvsplatw [[R1]]
; CHECK-NEXT: [[R3:%[0-9]+]]:hvxqr = V6_vandvrt [[R2]], [[R1]]
; CHECK-NEXT: [[R4:%[0-9]+]]:hvxvr = V6_vprefixqw killed [[R3]]
; CHECK-NEXT: [[R5:%[0-9]+]]:hvxvr = V6_vsubw killed [[R4]], [[R2]]
; CHECK-NEXT: [[R6:%[0-9]+]]:hvxvr = V6_vlsrwv killed [[R0]], killed [[R5]]
; CHECK-NEXT: [[R7:%[0-9]+]]:hvxvr = V6_vand killed [[R6]], [[R2]]
; CHECK-NEXT: [[R8:%[0-9]+]]:hvxvr = V6_vconv_sf_w killed [[R7]]
; CHECK-NEXT: hvxvr = V6_vadd_sf_sf [[R8]], [[R8]]
%q1 = icmp eq <32 x i16> %in0, %in1
%fp0 = uitofp <32 x i1> %q1 to <32 x float>
%out = fadd <32 x float> %fp0, %fp0
ret <32 x float> %out
}

define <32 x float> @sitofp_i1(<32 x i16> %in0, <32 x i16> %in1) #0 {
; CHECK: name: sitofp_i1
; CHECK: [[R0:%[0-9]+]]:hvxvr = V6_lvsplatw killed %{{[0-9]+}}
; CHECK-NEXT: [[R1:%[0-9]+]]:intregs = A2_tfrsi 1
; CHECK-NEXT: [[R2:%[0-9]+]]:hvxvr = V6_lvsplatw [[R1]]
; CHECK-NEXT: [[R3:%[0-9]+]]:hvxqr = V6_vandvrt [[R2]], [[R1]]
; CHECK-NEXT: [[R4:%[0-9]+]]:hvxvr = V6_vprefixqw killed [[R3]]
; CHECK-NEXT: [[R5:%[0-9]+]]:hvxvr = V6_vsubw killed [[R4]], [[R2]]
; CHECK-NEXT: [[R6:%[0-9]+]]:hvxvr = V6_vlsrwv killed [[R0]], killed [[R5]]
; CHECK-NEXT: [[R7:%[0-9]+]]:hvxvr = V6_vand killed [[R6]], [[R2]]
; CHECK-NEXT: [[R8:%[0-9]+]]:hvxvr = V6_vconv_sf_w killed [[R7]]
; CHECK-NEXT: hvxvr = V6_vadd_sf_sf [[R8]], [[R8]]
%q1 = icmp eq <32 x i16> %in0, %in1
%fp0 = sitofp <32 x i1> %q1 to <32 x float>
%out = fadd <32 x float> %fp0, %fp0
ret <32 x float> %out
}

attributes #0 = { nounwind readnone "target-cpu"="hexagonv79" "target-features"="+hvxv79,+hvx-length128b" }
25 changes: 0 additions & 25 deletions llvm/test/CodeGen/Hexagon/isel-uinttofp-v32i1tov32f32.ll

This file was deleted.