[llvm] r269151 - [AArch64] Fix DAG selection for cmps for fp16 type
Weiming Zhao via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 18:26:32 PDT 2016
Author: weimingz
Date: Tue May 10 20:26:32 2016
New Revision: 269151
URL: http://llvm.org/viewvc/llvm-project?rev=269151&view=rev
Log:
[AArch64] Fix DAG selection for cmps for fp16 type
Summary: When emitting comparison for fp16, in addition to promote the LHS and RHS to fp32, we need to change the VT as well.
Reviewers: t.p.northover
Subscribers: t.p.northover, aemerson, rengolin, llvm-commits
Differential Revision: http://reviews.llvm.org/D19922
Modified:
llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/trunk/test/CodeGen/AArch64/half.ll
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=269151&r1=269150&r2=269151&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Tue May 10 20:26:32 2016
@@ -1229,6 +1229,7 @@ static SDValue emitComparison(SDValue LH
if (VT == MVT::f16) {
LHS = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f32, LHS);
RHS = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f32, RHS);
+ VT = MVT::f32;
}
return DAG.getNode(AArch64ISD::FCMP, dl, VT, LHS, RHS);
}
Modified: llvm/trunk/test/CodeGen/AArch64/half.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/half.ll?rev=269151&r1=269150&r2=269151&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/half.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/half.ll Tue May 10 20:26:32 2016
@@ -81,3 +81,15 @@ define void @test_trunc64(double %in, ha
store half %val16, half* %addr
ret void
}
+
+define i16 @test_fccmp(i1 %a) {
+;CHECK-LABEL: test_fccmp:
+;CHECK: fcmp
+ %cmp0 = fcmp ogt half 0xH3333, undef
+ %cmp1 = fcmp ogt half 0xH2222, undef
+ %x = select i1 %cmp0, i16 0, i16 undef
+ %or = or i1 %cmp1, %cmp0
+ %y = select i1 %or, i16 4, i16 undef
+ %r = add i16 %x, %y
+ ret i16 %r
+}
More information about the llvm-commits
mailing list