1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 00:12:50 +01:00
llvm-mirror/test/CodeGen/X86/neg_cmp.ll
Chad Rosier d627fcbf2a Add x86-specific DAG combine to simplify:
x == -y --> x+y == 0
 x != -y --> x+y != 0

On x86, the generated code goes from
   negl    %esi
   cmpl    %esi, %edi
   je    .LBB0_2
to
   addl    %esi, %edi
   je    .L4

This case is correctly handled for ARM with "cmn".

Patch by Manman Ren.
rdar://11245199
PR12545

llvm-svn: 155739
2012-04-27 22:33:25 +00:00

23 lines
502 B
LLVM

; RUN: llc < %s -march=x86-64 | FileCheck %s
; rdar://11245199
; PR12545
define void @f(i32 %x, i32 %y) nounwind uwtable ssp {
entry:
; CHECK: f:
; CHECK-NOT: neg
; CHECK: add
%sub = sub i32 0, %y
%cmp = icmp eq i32 %x, %sub
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @g() nounwind
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
declare void @g()