2011-03-12 05:52:04 +08:00
|
|
|
; RUN: llc < %s -march=x86 -disable-cgp-branch-opts | FileCheck %s -check-prefix=32
|
|
|
|
; RUN: llc < %s -march=x86-64 -disable-cgp-branch-opts | FileCheck %s -check-prefix=64
|
2010-01-26 10:00:44 +08:00
|
|
|
; rdar://7573216
|
2010-01-28 09:57:22 +08:00
|
|
|
; PR6146
|
2010-01-26 10:00:44 +08:00
|
|
|
|
|
|
|
define i32 @t1(i32 %x) nounwind readnone ssp {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; 32-LABEL: t1:
|
2010-01-28 09:57:22 +08:00
|
|
|
; 32: cmpl $1
|
|
|
|
; 32: sbbl
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; 64-LABEL: t1:
|
2010-01-28 09:57:22 +08:00
|
|
|
; 64: cmpl $1
|
|
|
|
; 64: sbbl
|
2010-01-26 10:00:44 +08:00
|
|
|
%0 = icmp eq i32 %x, 0
|
|
|
|
%iftmp.0.0 = select i1 %0, i32 -1, i32 0
|
|
|
|
ret i32 %iftmp.0.0
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @t2(i32 %x) nounwind readnone ssp {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; 32-LABEL: t2:
|
2010-01-28 09:57:22 +08:00
|
|
|
; 32: cmpl $1
|
|
|
|
; 32: sbbl
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; 64-LABEL: t2:
|
2010-01-28 09:57:22 +08:00
|
|
|
; 64: cmpl $1
|
|
|
|
; 64: sbbl
|
2010-01-26 10:00:44 +08:00
|
|
|
%0 = icmp eq i32 %x, 0
|
|
|
|
%iftmp.0.0 = sext i1 %0 to i32
|
|
|
|
ret i32 %iftmp.0.0
|
|
|
|
}
|
2010-01-28 09:57:22 +08:00
|
|
|
|
|
|
|
%struct.zbookmark = type { i64, i64 }
|
|
|
|
%struct.zstream = type { }
|
|
|
|
|
|
|
|
define i32 @t3() nounwind readonly {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; 32-LABEL: t3:
|
2010-01-28 09:57:22 +08:00
|
|
|
; 32: cmpl $1
|
|
|
|
; 32: sbbl
|
2011-03-24 07:11:02 +08:00
|
|
|
; 32: cmpl
|
2010-01-28 09:57:22 +08:00
|
|
|
; 32: xorl
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; 64-LABEL: t3:
|
2010-01-28 09:57:22 +08:00
|
|
|
; 64: cmpl $1
|
|
|
|
; 64: sbbq
|
2010-02-06 17:07:11 +08:00
|
|
|
; 64: cmpq
|
|
|
|
; 64: xorl
|
2010-01-28 09:57:22 +08:00
|
|
|
%not.tobool = icmp eq i32 undef, 0 ; <i1> [#uses=2]
|
|
|
|
%cond = sext i1 %not.tobool to i32 ; <i32> [#uses=1]
|
|
|
|
%conv = sext i1 %not.tobool to i64 ; <i64> [#uses=1]
|
|
|
|
%add13 = add i64 0, %conv ; <i64> [#uses=1]
|
|
|
|
%cmp = icmp ult i64 undef, %add13 ; <i1> [#uses=1]
|
|
|
|
br i1 %cmp, label %if.then, label %if.end
|
|
|
|
|
|
|
|
if.then: ; preds = %entry
|
|
|
|
br label %if.end
|
|
|
|
|
|
|
|
if.end: ; preds = %if.then, %entry
|
|
|
|
%xor27 = xor i32 undef, %cond ; <i32> [#uses=0]
|
|
|
|
ret i32 0
|
|
|
|
}
|
[DAGCombine] Remove SIGN_EXTEND-related inf-loop
The patch's author points out that, despite the function's documentation,
getSetCCResultType is only used to get the SETCC result type (with one
here-removed problematic exception). In one case, getSetCCResultType was being
used to get the predicate type to use for a SELECT node, and then
SIGN_EXTENDing (or truncating) to get the input predicate to match that type.
Unfortunately, this was happening inside visitSIGN_EXTEND, and creating new
SIGN_EXTEND nodes was causing an infinite loop. In addition, this behavior was
wrong if a target was not using ZeroOrNegativeOneBooleanContent. Lastly, the
extension/truncation seems unnecessary here: SELECT is defined as:
Select(COND, TRUEVAL, FALSEVAL). If the type of the boolean COND is not i1
then the high bits must conform to getBooleanContents.
So here we remove this use of getSetCCResultType and update
getSetCCResultType's documentation to reflect its actual uses.
Patch by deadal nix!
llvm-svn: 219141
2014-10-07 04:19:47 +08:00
|
|
|
|
|
|
|
define i32 @t4(i64 %x) nounwind readnone ssp {
|
|
|
|
entry:
|
|
|
|
; 32-LABEL: t4:
|
|
|
|
; 32: movl
|
|
|
|
; 32: orl
|
|
|
|
; 32: movl
|
|
|
|
; 32: je
|
|
|
|
; 32: xorl
|
|
|
|
|
|
|
|
; 64-LABEL: t4:
|
|
|
|
; 64: cmpq $1
|
|
|
|
; 64: sbbl
|
|
|
|
%0 = icmp eq i64 %x, 0
|
|
|
|
%1 = sext i1 %0 to i32
|
|
|
|
ret i32 %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @t5(i32 %x) nounwind readnone ssp {
|
|
|
|
entry:
|
|
|
|
; 32-LABEL: t5:
|
|
|
|
; 32: cmpl $1
|
|
|
|
; 32: sbbl
|
|
|
|
; 32: movl
|
|
|
|
|
|
|
|
; 64-LABEL: t5:
|
|
|
|
; 64: cmpl $1
|
|
|
|
; 64: sbbq
|
|
|
|
%0 = icmp eq i32 %x, 0
|
|
|
|
%1 = sext i1 %0 to i64
|
|
|
|
ret i64 %1
|
|
|
|
}
|
|
|
|
|