<div dir="ltr"><span style="line-height:normal">On Thu, Aug 20, 2015 at 4:33 PM, Matthias Braun via llvm-commits </span><span dir="ltr" style="line-height:normal"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span><span style="line-height:normal"> wrote:</span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: matze<br>
Date: Thu Aug 20 18:33:31 2015<br>
New Revision: 245640<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=245640&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=245640&view=rev</a><br>
Log:<br>
AArch64: Do not create CCMP on multiple users.<br>
<br>
Create CMP;CCMP sequences from and/or trees does not gain us anything if<br>
the and/or tree is materialized to a GP register anyway. While most of<br>
the code already checked for hasOneUse() there was one important case<br>
missing.<br>
<br>
Modified:<br>
llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp<br>
llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll<br>
<br>
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=245640&r1=245639&r2=245640&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=245640&r1=245639&r2=245640&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Thu Aug 20 18:33:31 2015<br>
@@ -1349,7 +1349,7 @@ static SDValue emitConjunctionDisjunctio<br>
unsigned NZCV = AArch64CC::getNZCVToSatisfyCondCode(InvOutCC);<br>
return emitConditionalComparison(LHS, RHS, CC, CCOp, ConditionOp, NZCV, DL,<br>
DAG);<br>
- } else if (Opcode != ISD::AND && Opcode != ISD::OR)<br>
+ } else if ((Opcode != ISD::AND && Opcode != ISD::OR) || !Val->hasOneUse())<br>
return SDValue();<br>
<br>
assert((Opcode == ISD::OR || !PushNegate)<br>
<br>
Modified: llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll?rev=245640&r1=245639&r2=245640&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll?rev=245640&r1=245639&r2=245640&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll (original)<br>
+++ llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll Thu Aug 20 18:33:31 2015<br>
@@ -373,8 +373,8 @@ define i32 @select_ororand(i32 %w0, i32<br>
ret i32 %sel<br>
}<br>
<br>
-; CHECK-LABEL: select_noccmp<br>
-define i64 @select_noccmp(i64 %v1, i64 %v2, i64 %v3, i64 %r) {<br>
+; CHECK-LABEL: select_noccmp1<br>
+define i64 @select_noccmp1(i64 %v1, i64 %v2, i64 %v3, i64 %r) {<br>
; CHECK-NOT: CCMP<br></blockquote><div><br></div><div><span style="line-height:normal">Should this be lowercase "ccmp" ?</span></div><div><span style="line-height:normal"><br></span></div><div><span style="line-height:normal">-Ahmed</span></div><div><span style="line-height:normal"> </span><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
%c0 = icmp slt i64 %v1, 0<br>
%c1 = icmp sgt i64 %v1, 13<br>
@@ -386,3 +386,19 @@ define i64 @select_noccmp(i64 %v1, i64 %<br>
%sel = select i1 %or, i64 0, i64 %r<br>
ret i64 %sel<br>
}<br>
+<br>
+@g = global i32 0<br>
+<br>
+; Should not use ccmp if we have to compute the or expression in an integer<br>
+; register anyway because of other users.<br>
+; CHECK-LABEL: select_noccmp2<br>
+define i64 @select_noccmp2(i64 %v1, i64 %v2, i64 %v3, i64 %r) {<br>
+; CHECK-NOT: CCMP<br>
+ %c0 = icmp slt i64 %v1, 0<br>
+ %c1 = icmp sgt i64 %v1, 13<br>
+ %or = or i1 %c0, %c1<br>
+ %sel = select i1 %or, i64 0, i64 %r<br>
+ %ext = sext i1 %or to i32<br>
+ store volatile i32 %ext, i32* @g<br>
+ ret i64 %sel<br>
+}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>