[PATCH] D84166: AMDGPU: Simplify f16 to i64 custom lowering
Petar Avramovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 20 06:28:01 PDT 2020
Petar.Avramovic updated this revision to Diff 279221.
Petar.Avramovic marked an inline comment as done.
Petar.Avramovic added a comment.
Context was missing.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84166/new/
https://reviews.llvm.org/D84166
Files:
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/test/CodeGen/AMDGPU/fptosi.f16.ll
llvm/test/CodeGen/AMDGPU/fptoui.f16.ll
Index: llvm/test/CodeGen/AMDGPU/fptoui.f16.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/fptoui.f16.ll
+++ llvm/test/CodeGen/AMDGPU/fptoui.f16.ll
@@ -105,7 +105,6 @@
; GCN-LABEL: {{^}}fptoui_v2f16_to_v2i64
; GCN: buffer_load_dword
-; GCN: v_cvt_f32_f16_e32
; SI: v_cvt_f32_f16_e32
; VI: v_cvt_f32_f16_sdwa
; GCN: s_endpgm
Index: llvm/test/CodeGen/AMDGPU/fptosi.f16.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/fptosi.f16.ll
+++ llvm/test/CodeGen/AMDGPU/fptosi.f16.ll
@@ -105,7 +105,6 @@
; GCN-LABEL: {{^}}fptosi_v2f16_to_v2i64
; GCN: buffer_load_dword
-; GCN: v_cvt_f32_f16_e32
; SI: v_cvt_f32_f16_e32
; VI: v_cvt_f32_f16_sdwa
; GCN: s_endpgm
Index: llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -2701,11 +2701,8 @@
if (Subtarget->has16BitInsts() && SrcVT == MVT::f16) {
SDLoc DL(Op);
- SDValue FPExtend = DAG.getNode(ISD::FP_EXTEND, DL, MVT::f32, Src);
- SDValue FpToInt32 =
- DAG.getNode(Op.getOpcode(), DL, MVT::i64, FPExtend);
-
- return FpToInt32;
+ SDValue FpToInt32 = DAG.getNode(Op.getOpcode(), DL, MVT::i32, Src);
+ return DAG.getNode(ISD::SIGN_EXTEND, DL, MVT::i64, FpToInt32);
}
if (Op.getValueType() == MVT::i64 && Src.getValueType() == MVT::f64)
@@ -2724,11 +2721,8 @@
if (Subtarget->has16BitInsts() && SrcVT == MVT::f16) {
SDLoc DL(Op);
- SDValue FPExtend = DAG.getNode(ISD::FP_EXTEND, DL, MVT::f32, Src);
- SDValue FpToInt32 =
- DAG.getNode(Op.getOpcode(), DL, MVT::i64, FPExtend);
-
- return FpToInt32;
+ SDValue FpToUInt32 = DAG.getNode(Op.getOpcode(), DL, MVT::i32, Src);
+ return DAG.getNode(ISD::ZERO_EXTEND, DL, MVT::i64, FpToUInt32);
}
if (Op.getValueType() == MVT::i64 && Src.getValueType() == MVT::f64)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84166.279221.patch
Type: text/x-patch
Size: 2001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200720/ffd81468/attachment.bin>
More information about the llvm-commits
mailing list