[llvm] r335000 - [ARM] Testcase for missed optimization with i16 compare.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 17:07:30 PDT 2018


Author: efriedma
Date: Mon Jun 18 17:07:30 2018
New Revision: 335000

URL: http://llvm.org/viewvc/llvm-project?rev=335000&view=rev
Log:
[ARM] Testcase for missed optimization with i16 compare.

The result looks weird because the DAG actually has an explicit
shift; I haven't figured out why, exactly.


Modified:
    llvm/trunk/test/CodeGen/ARM/and-cmpz.ll

Modified: llvm/trunk/test/CodeGen/ARM/and-cmpz.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/and-cmpz.ll?rev=335000&r1=334999&r2=335000&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/and-cmpz.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/and-cmpz.ll Mon Jun 18 17:07:30 2018
@@ -87,3 +87,24 @@ true:
 false:
   ret i32 2
 }
+
+; CHECK-LABEL: i16_cmpz:
+; T1:      movs    r2, #127
+; T1-NEXT: lsls    r2, r2, #9
+; T1-NEXT: ands    r2, r0
+; T1-NEXT: lsrs    r0, r2, #9
+; T2:      and     r0, r0, #65024
+; T2-NEXT: movs    r2, #0
+; T2-NEXT: cmp.w   r2, r0, lsr #9
+define void @i16_cmpz(i16 %x, void (i32)* %foo) {
+entry:
+  %cmp = icmp ult i16 %x, 512
+  br i1 %cmp, label %if.then, label %if.end
+
+if.then:                                          ; preds = %entry
+  tail call void %foo(i32 0) #1
+  br label %if.end
+
+if.end:                                           ; preds = %if.then, %entry
+  ret void
+}




More information about the llvm-commits mailing list