1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 ; <rdar://problem/7859988>
6 ; Make sure we don't generate more jumps than we need to. We used to generate
17 ; Now we generate this:
24 define double @rdar_7859988(double %x, double %y) nounwind readnone optsize ssp {
25 ; CHECK-LABEL: rdar_7859988:
26 ; CHECK: # %bb.0: # %entry
27 ; CHECK-NEXT: mulsd %xmm1, %xmm0
28 ; CHECK-NEXT: xorpd %xmm1, %xmm1
29 ; CHECK-NEXT: ucomisd %xmm1, %xmm0
30 ; CHECK-NEXT: jne .LBB0_2
31 ; CHECK-NEXT: jp .LBB0_2
32 ; CHECK-NEXT: # %bb.1: # %bb1
33 ; CHECK-NEXT: addsd {{.*}}(%rip), %xmm0
34 ; CHECK-NEXT: .LBB0_2: # %bb2
38 %mul = fmul double %x, %y
39 %cmp = fcmp oeq double %mul, 0.000000e+00
40 br i1 %cmp, label %bb1, label %bb2
43 %add = fadd double %mul, -1.000000e+00
47 %phi = phi double [ %add, %bb1 ], [ %mul, %entry ]
51 define double @profile_metadata(double %x, double %y) {
52 ; CHECK-LABEL: profile_metadata:
53 ; CHECK: # %bb.0: # %entry
54 ; CHECK-NEXT: mulsd %xmm1, %xmm0
55 ; CHECK-NEXT: xorpd %xmm1, %xmm1
56 ; CHECK-NEXT: ucomisd %xmm1, %xmm0
57 ; CHECK-NEXT: jne .LBB1_1
58 ; CHECK-NEXT: jp .LBB1_1
61 ; CHECK-NEXT: .LBB1_1: # %bb1
62 ; CHECK-NEXT: addsd {{.*}}(%rip), %xmm0
66 %mul = fmul double %x, %y
67 %cmp = fcmp une double %mul, 0.000000e+00
68 br i1 %cmp, label %bb1, label %bb2, !prof !1
71 %add = fadd double %mul, -1.000000e+00
75 %phi = phi double [ %add, %bb1 ], [ %mul, %entry ]
79 ; Test if the negation of the non-equality check between floating points are
80 ; translated to jnp followed by jne.
82 define void @foo(float %f) {
84 ; CHECK: # %bb.0: # %entry
85 ; CHECK-NEXT: xorps %xmm1, %xmm1
86 ; CHECK-NEXT: ucomiss %xmm1, %xmm0
87 ; CHECK-NEXT: jne .LBB2_2
88 ; CHECK-NEXT: jnp .LBB2_1
89 ; CHECK-NEXT: .LBB2_2: # %if.then
90 ; CHECK-NEXT: jmp a # TAILCALL
91 ; CHECK-NEXT: .LBB2_1: # %if.end
94 %cmp = fcmp une float %f, 0.000000e+00
95 br i1 %cmp, label %if.then, label %if.end
105 ; Test that an FP oeq/une conditional branch can be inverted successfully even
106 ; when the true and false targets are the same (PR27750).
108 ; CHECK-LABEL: pr27750
110 ; CHECK-NEXT: jne [[TARGET:.*]]
111 ; CHECK-NEXT: jp [[TARGET]]
112 define void @pr27750(i32* %b, float %x, i1 %y) {
120 br i1 %y, label %for.body3.lr.ph, label %for.end
123 store i32 0, i32* %b, align 4
127 ; After block %for.cond gets eliminated, the two target blocks of this
128 ; conditional block are the same.
129 %tobool = fcmp une float %x, 0.000000e+00
130 br i1 %tobool, label %for.cond, label %for.cond1
135 !1 = !{!"branch_weights", i32 1, i32 1000}