• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=i386-apple-darwin10 -mcpu=core2 | FileCheck %s
2; rdar://7475489
3
4define i32 @test1(i32 %a, i32 %b) nounwind ssp {
5entry:
6; CHECK: test1:
7; CHECK: xorb
8; CHECK-NOT: andb
9; CHECK-NOT: shrb
10; CHECK: testb $64
11  %0 = and i32 %a, 16384
12  %1 = icmp ne i32 %0, 0
13  %2 = and i32 %b, 16384
14  %3 = icmp ne i32 %2, 0
15  %4 = xor i1 %1, %3
16  br i1 %4, label %bb1, label %bb
17
18bb:                                               ; preds = %entry
19  %5 = tail call i32 (...)* @foo() nounwind       ; <i32> [#uses=1]
20  ret i32 %5
21
22bb1:                                              ; preds = %entry
23  %6 = tail call i32 (...)* @bar() nounwind       ; <i32> [#uses=1]
24  ret i32 %6
25}
26
27declare i32 @foo(...)
28
29declare i32 @bar(...)
30
31
32
33; PR3351 - (P == 0) & (Q == 0) -> (P|Q) == 0
34define i32 @test2(i32* %P, i32* %Q) nounwind ssp {
35entry:
36  %a = icmp eq i32* %P, null                    ; <i1> [#uses=1]
37  %b = icmp eq i32* %Q, null                    ; <i1> [#uses=1]
38  %c = and i1 %a, %b
39  br i1 %c, label %bb1, label %return
40
41bb1:                                              ; preds = %entry
42  ret i32 4
43
44return:                                           ; preds = %entry
45  ret i32 192
46; CHECK: test2:
47; CHECK:	movl	4(%esp), %eax
48; CHECK-NEXT:	orl	8(%esp), %eax
49; CHECK-NEXT:	jne	LBB1_2
50}
51
52; PR3351 - (P != 0) | (Q != 0) -> (P|Q) != 0
53define i32 @test3(i32* %P, i32* %Q) nounwind ssp {
54entry:
55  %a = icmp ne i32* %P, null                    ; <i1> [#uses=1]
56  %b = icmp ne i32* %Q, null                    ; <i1> [#uses=1]
57  %c = or i1 %a, %b
58  br i1 %c, label %bb1, label %return
59
60bb1:                                              ; preds = %entry
61  ret i32 4
62
63return:                                           ; preds = %entry
64  ret i32 192
65; CHECK: test3:
66; CHECK:	movl	4(%esp), %eax
67; CHECK-NEXT:	orl	8(%esp), %eax
68; CHECK-NEXT:	je	LBB2_2
69}
70
71; <rdar://problem/7598384>:
72;
73;    jCC  L1
74;    jmp  L2
75; L1:
76;   ...
77; L2:
78;   ...
79;
80; to:
81;
82;    jnCC L2
83; L1:
84;   ...
85; L2:
86;   ...
87define float @test4(float %x, float %y) nounwind readnone optsize ssp {
88entry:
89  %0 = fpext float %x to double                   ; <double> [#uses=1]
90  %1 = fpext float %y to double                   ; <double> [#uses=1]
91  %2 = fmul double %0, %1                         ; <double> [#uses=3]
92  %3 = fcmp oeq double %2, 0.000000e+00           ; <i1> [#uses=1]
93  br i1 %3, label %bb2, label %bb1
94
95; CHECK:      jne
96; CHECK-NEXT: jnp
97; CHECK-NOT:  jmp
98; CHECK:      LBB
99
100bb1:                                              ; preds = %entry
101  %4 = fadd double %2, -1.000000e+00              ; <double> [#uses=1]
102  br label %bb2
103
104bb2:                                              ; preds = %entry, %bb1
105  %.0.in = phi double [ %4, %bb1 ], [ %2, %entry ] ; <double> [#uses=1]
106  %.0 = fptrunc double %.0.in to float            ; <float> [#uses=1]
107  ret float %.0
108}
109