[PATCH] D124171: [NVPTX] Support float <-> 2 x half bitcasts
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 25 14:42:16 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG76d1f5eaa87b: [NVPTX] Support float <-> 2 x half bitcasts (authored by jchlanda, committed by tra).
Changed prior to commit:
https://reviews.llvm.org/D124171?vs=424185&id=425036#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124171/new/
https://reviews.llvm.org/D124171
Files:
llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
llvm/test/CodeGen/NVPTX/f16x2-instructions.ll
Index: llvm/test/CodeGen/NVPTX/f16x2-instructions.ll
===================================================================
--- llvm/test/CodeGen/NVPTX/f16x2-instructions.ll
+++ llvm/test/CodeGen/NVPTX/f16x2-instructions.ll
@@ -1002,6 +1002,25 @@
ret <2 x half> %r
}
+; CHECK-LABEL: test_bitcast_float_to_2xhalf(
+; CHECK: ld.param.f32 [[AF1:%f[0-9]+]], [test_bitcast_float_to_2xhalf_param_0];
+; CHECK: mov.b32 [[R:%hh[0-9]+]], [[AF1]];
+; CHECK: st.param.b32 [func_retval0+0], [[R]];
+; CHECK: ret;
+define <2 x half> @test_bitcast_float_to_2xhalf(float %a) #0 {
+ %r = bitcast float %a to <2 x half>
+ ret <2 x half> %r
+}
+
+; CHECK-LABEL: test_bitcast_2xhalf_to_float(
+; CHECK: ld.param.u32 [[R:%r[0-9]+]], [test_bitcast_2xhalf_to_float_param_0];
+; CHECK: mov.b32 [[AF1:%f[0-9]+]], [[R]];
+; CHECK: st.param.f32 [func_retval0+0], [[AF1]];
+; CHECK: ret;
+define float @test_bitcast_2xhalf_to_float(<2 x half> %a) #0 {
+ %r = bitcast <2 x half> %a to float
+ ret float %r
+}
declare <2 x half> @llvm.sqrt.f16(<2 x half> %a) #0
declare <2 x half> @llvm.powi.f16.i32(<2 x half> %a, <2 x i32> %b) #0
Index: llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
===================================================================
--- llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
+++ llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
@@ -2658,6 +2658,8 @@
def BITCONVERT_64_F2I : F_BITCONVERT<"64", Float64Regs, Int64Regs>;
def BITCONVERT_32_I2F16x2 : F_BITCONVERT<"32", Int32Regs, Float16x2Regs>;
def BITCONVERT_32_F16x22I : F_BITCONVERT<"32", Float16x2Regs, Int32Regs>;
+def BITCONVERT_32_F2F16x2 : F_BITCONVERT<"32", Float32Regs, Float16x2Regs>;
+def BITCONVERT_32_F16x22F : F_BITCONVERT<"32", Float16x2Regs, Float32Regs>;
// NOTE: pred->fp are currently sub-optimal due to an issue in TableGen where
// we cannot specify floating-point literals in isel patterns. Therefore, we
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124171.425036.patch
Type: text/x-patch
Size: 1878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220425/7bc2c9be/attachment.bin>
More information about the llvm-commits
mailing list