[llvm] r338715 - DAG: Fix vector widening fcanonicalize
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 2 06:43:53 PDT 2018
Author: arsenm
Date: Thu Aug 2 06:43:53 2018
New Revision: 338715
URL: http://llvm.org/viewvc/llvm-project?rev=338715&view=rev
Log:
DAG: Fix vector widening fcanonicalize
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/trunk/test/CodeGen/AMDGPU/fcanonicalize.f16.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=338715&r1=338714&r2=338715&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Thu Aug 2 06:43:53 2018
@@ -2394,6 +2394,7 @@ void DAGTypeLegalizer::WidenVectorResult
case ISD::FSIN:
case ISD::FSQRT:
case ISD::FTRUNC:
+ case ISD::FCANONICALIZE:
Res = WidenVecRes_Unary(N);
break;
case ISD::FMA:
Modified: llvm/trunk/test/CodeGen/AMDGPU/fcanonicalize.f16.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/fcanonicalize.f16.ll?rev=338715&r1=338714&r2=338715&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/fcanonicalize.f16.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/fcanonicalize.f16.ll Thu Aug 2 06:43:53 2018
@@ -6,6 +6,7 @@ declare half @llvm.fabs.f16(half) #0
declare half @llvm.canonicalize.f16(half) #0
declare <2 x half> @llvm.fabs.v2f16(<2 x half>) #0
declare <2 x half> @llvm.canonicalize.v2f16(<2 x half>) #0
+declare <3 x half> @llvm.canonicalize.v3f16(<3 x half>) #0
declare <4 x half> @llvm.canonicalize.v4f16(<4 x half>) #0
declare i32 @llvm.amdgcn.workitem.id.x() #0
@@ -477,6 +478,25 @@ define amdgpu_kernel void @test_fold_can
ret void
}
+; FIXME: Extra 4th component handled
+; GCN-LABEL: {{^}}v_test_canonicalize_var_v3f16:
+; GFX9: s_waitcnt
+; GFX9-NEXT: v_pk_max_f16 v1, v1, v1
+; GFX9-NEXT: v_pk_max_f16 v0, v0, v0
+; GFX9-NEXT: s_setpc_b64
+
+; VI-DAG: v_max_f16_sdwa [[CANON_ELT3:v[0-9]+]], v1, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
+; VI-DAG: v_max_f16_e32 [[CANON_ELT2:v[0-9]+]], v1, v1
+; VI-DAG: v_max_f16_sdwa [[CANON_ELT1:v[0-9]+]], v0, v0 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
+; VI-DAG: v_max_f16_e32 [[CANON_ELT0:v[0-9]+]], v0, v0
+; VI-DAG: v_or_b32_e32 v0, [[CANON_ELT0]], [[CANON_ELT1]]
+; VI-DAG: v_or_b32_e32 v1, [[CANON_ELT2]], [[CANON_ELT3]]
+; VI: s_setpc_b64
+define <3 x half> @v_test_canonicalize_var_v3f16(<3 x half> %val) #1 {
+ %canonicalized = call <3 x half> @llvm.canonicalize.v3f16(<3 x half> %val)
+ ret <3 x half> %canonicalized
+}
+
; GCN-LABEL: {{^}}v_test_canonicalize_var_v4f16:
; GFX9: s_waitcnt
; GFX9-NEXT: v_pk_max_f16 v0, v0, v0
More information about the llvm-commits
mailing list