comparison test/CodeGen/X86/fp-une-cmp.ll @ 120:1172e4bd9c6f

update 4.0.0
author mir3636
date Fri, 25 Nov 2016 19:14:25 +0900
parents 95c75e76d11b
children 803732b1fca8
comparison
equal deleted inserted replaced
101:34baf5011add 120:1172e4bd9c6f
1 ; RUN: llc < %s -march=x86 -mattr=sse4.1 | FileCheck %s 1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3
2 ; <rdar://problem/7859988> 4 ; <rdar://problem/7859988>
3 5
4 ; Make sure we don't generate more jumps than we need to. We used to generate 6 ; Make sure we don't generate more jumps than we need to. We used to generate
5 ; something like this: 7 ; something like this:
6 ; 8 ;
17 ; jne LBB0_2 19 ; jne LBB0_2
18 ; jp LBB0_2 20 ; jp LBB0_2
19 ; addsd ... 21 ; addsd ...
20 ; LBB0_2: 22 ; LBB0_2:
21 23
22 ; CHECK: func 24 define double @rdar_7859988(double %x, double %y) nounwind readnone optsize ssp {
23 ; CHECK: jne [[LABEL:.*]] 25 ; CHECK-LABEL: rdar_7859988:
24 ; CHECK-NEXT: jp [[LABEL]] 26 ; CHECK: # BB#0: # %entry
25 ; CHECK-NOT: jmp 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
35 ; CHECK-NEXT: retq
26 36
27 define float @func(float %x, float %y) nounwind readnone optsize ssp {
28 entry: 37 entry:
29 %0 = fpext float %x to double 38 %mul = fmul double %x, %y
30 %1 = fpext float %y to double 39 %cmp = fcmp une double %mul, 0.000000e+00
31 %2 = fmul double %0, %1 40 br i1 %cmp, label %bb2, label %bb1
32 %3 = fcmp une double %2, 0.000000e+00
33 br i1 %3, label %bb2, label %bb1
34 41
35 bb1: 42 bb1:
36 %4 = fadd double %2, -1.000000e+00 43 %add = fadd double %mul, -1.000000e+00
37 br label %bb2 44 br label %bb2
38 45
39 bb2: 46 bb2:
40 %.0.in = phi double [ %4, %bb1 ], [ %2, %entry ] 47 %phi = phi double [ %add, %bb1 ], [ %mul, %entry ]
41 %.0 = fptrunc double %.0.in to float 48 ret double %phi
42 ret float %.0
43 } 49 }
50
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
59 ; CHECK-NEXT: # %bb2
60 ; CHECK-NEXT: retq
61 ; CHECK-NEXT: .LBB1_1: # %bb1
62 ; CHECK-NEXT: addsd {{.*}}(%rip), %xmm0
63 ; CHECK-NEXT: retq
64
65 entry:
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
69
70 bb1:
71 %add = fadd double %mul, -1.000000e+00
72 br label %bb2
73
74 bb2:
75 %phi = phi double [ %add, %bb1 ], [ %mul, %entry ]
76 ret double %phi
77 }
78
79 ; Test if the negation of the non-equality check between floating points are
80 ; translated to jnp followed by jne.
81
82 define void @foo(float %f) {
83 ; CHECK-LABEL: foo:
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
92 ; CHECK-NEXT: retq
93 entry:
94 %cmp = fcmp une float %f, 0.000000e+00
95 br i1 %cmp, label %if.then, label %if.end
96
97 if.then:
98 tail call void @a()
99 br label %if.end
100
101 if.end:
102 ret void
103 }
104
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).
107 ;
108 ; CHECK-LABEL: pr27750
109 ; CHECK: ucomiss
110 ; CHECK-NEXT: jne [[TARGET:.*]]
111 ; CHECK-NEXT: jp [[TARGET]]
112 define void @pr27750(i32* %b, float %x, i1 %y) {
113 entry:
114 br label %for.cond
115
116 for.cond:
117 br label %for.cond1
118
119 for.cond1:
120 br i1 %y, label %for.body3.lr.ph, label %for.end
121
122 for.body3.lr.ph:
123 store i32 0, i32* %b, align 4
124 br label %for.end
125
126 for.end:
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
131 }
132
133 declare void @a()
134
135 !1 = !{!"branch_weights", i32 1, i32 1000}