1; RUN: llc < %s -march=x86    | FileCheck %s -check-prefix=X32
2; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X64
3; rdar://7367229
4
5define i32 @t(i32 %a, i32 %b) nounwind ssp {
6entry:
7; X32-LABEL:     t:
8; X32:     xorb
9; X32-NOT: andb
10; X32-NOT: shrb
11; X32:     testb $64
12; X32:     je
13
14; X64-LABEL:     t:
15; X64-NOT: setne
16; X64:     xorl
17; X64:     testb $64
18; X64:     je
19  %0 = and i32 %a, 16384
20  %1 = icmp ne i32 %0, 0
21  %2 = and i32 %b, 16384
22  %3 = icmp ne i32 %2, 0
23  %4 = xor i1 %1, %3
24  br i1 %4, label %bb1, label %bb
25
26bb:                                               ; preds = %entry
27  %5 = tail call i32 (...) @foo() nounwind       ; <i32> [#uses=1]
28  ret i32 %5
29
30bb1:                                              ; preds = %entry
31  %6 = tail call i32 (...) @bar() nounwind       ; <i32> [#uses=1]
32  ret i32 %6
33}
34
35declare i32 @foo(...)
36
37declare i32 @bar(...)
38
39define i32 @t2(i32 %x, i32 %y) nounwind ssp {
40; X32-LABEL: t2:
41; X32: cmpl
42; X32: sete
43; X32: cmpl
44; X32: sete
45; X32-NOT: xor
46; X32: je
47
48; X64-LABEL: t2:
49; X64: testl
50; X64: sete
51; X64: testl
52; X64: sete
53; X64-NOT: xor
54; X64: je
55entry:
56  %0 = icmp eq i32 %x, 0                          ; <i1> [#uses=1]
57  %1 = icmp eq i32 %y, 0                          ; <i1> [#uses=1]
58  %2 = xor i1 %1, %0                              ; <i1> [#uses=1]
59  br i1 %2, label %bb, label %return
60
61bb:                                               ; preds = %entry
62  %3 = tail call i32 (...) @foo() nounwind       ; <i32> [#uses=0]
63  ret i32 undef
64
65return:                                           ; preds = %entry
66  ret i32 undef
67}
68