diff 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
line wrap: on
line diff
--- a/test/CodeGen/X86/fp-une-cmp.ll	Tue Jan 26 22:56:36 2016 +0900
+++ b/test/CodeGen/X86/fp-une-cmp.ll	Fri Nov 25 19:14:25 2016 +0900
@@ -1,4 +1,6 @@
-; RUN: llc < %s -march=x86 -mattr=sse4.1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+
 ; <rdar://problem/7859988>
 
 ; Make sure we don't generate more jumps than we need to. We used to generate
@@ -19,25 +21,115 @@
 ;       addsd ...
 ;   LBB0_2:
 
-; CHECK:       func
-; CHECK:       jne [[LABEL:.*]]
-; CHECK-NEXT:  jp  [[LABEL]]
-; CHECK-NOT:   jmp
+define double @rdar_7859988(double %x, double %y) nounwind readnone optsize ssp {
+; CHECK-LABEL: rdar_7859988:
+; CHECK:       # BB#0: # %entry
+; CHECK-NEXT:    mulsd %xmm1, %xmm0
+; CHECK-NEXT:    xorpd %xmm1, %xmm1
+; CHECK-NEXT:    ucomisd %xmm1, %xmm0
+; CHECK-NEXT:    jne .LBB0_2
+; CHECK-NEXT:    jp .LBB0_2
+; CHECK-NEXT:  # BB#1: # %bb1
+; CHECK-NEXT:    addsd {{.*}}(%rip), %xmm0
+; CHECK-NEXT:  .LBB0_2: # %bb2
+; CHECK-NEXT:    retq
 
-define float @func(float %x, float %y) nounwind readnone optsize ssp {
 entry:
-  %0 = fpext float %x to double
-  %1 = fpext float %y to double
-  %2 = fmul double %0, %1
-  %3 = fcmp une double %2, 0.000000e+00
-  br i1 %3, label %bb2, label %bb1
+  %mul = fmul double %x, %y
+  %cmp = fcmp une double %mul, 0.000000e+00
+  br i1 %cmp, label %bb2, label %bb1
 
 bb1:
-  %4 = fadd double %2, -1.000000e+00
+  %add = fadd double %mul, -1.000000e+00
+  br label %bb2
+
+bb2:
+  %phi = phi double [ %add, %bb1 ], [ %mul, %entry ]
+  ret double %phi
+}
+
+define double @profile_metadata(double %x, double %y) {
+; CHECK-LABEL: profile_metadata:
+; CHECK:       # BB#0: # %entry
+; CHECK-NEXT:    mulsd %xmm1, %xmm0
+; CHECK-NEXT:    xorpd %xmm1, %xmm1
+; CHECK-NEXT:    ucomisd %xmm1, %xmm0
+; CHECK-NEXT:    jne .LBB1_1
+; CHECK-NEXT:    jp .LBB1_1
+; CHECK-NEXT:  # %bb2
+; CHECK-NEXT:    retq
+; CHECK-NEXT:  .LBB1_1: # %bb1
+; CHECK-NEXT:    addsd {{.*}}(%rip), %xmm0
+; CHECK-NEXT:    retq
+
+entry:
+  %mul = fmul double %x, %y
+  %cmp = fcmp une double %mul, 0.000000e+00
+  br i1 %cmp, label %bb1, label %bb2, !prof !1
+
+bb1:
+  %add = fadd double %mul, -1.000000e+00
   br label %bb2
 
 bb2:
-  %.0.in = phi double [ %4, %bb1 ], [ %2, %entry ]
-  %.0 = fptrunc double %.0.in to float
-  ret float %.0
+  %phi = phi double [ %add, %bb1 ], [ %mul, %entry ]
+  ret double %phi
+}
+
+; Test if the negation of the non-equality check between floating points are
+; translated to jnp followed by jne.
+
+define void @foo(float %f) {
+; CHECK-LABEL: foo:
+; CHECK:       # BB#0: # %entry
+; CHECK-NEXT:    xorps %xmm1, %xmm1
+; CHECK-NEXT:    ucomiss %xmm1, %xmm0
+; CHECK-NEXT:    jne .LBB2_2
+; CHECK-NEXT:    jnp .LBB2_1
+; CHECK-NEXT:  .LBB2_2: # %if.then
+; CHECK-NEXT:    jmp a # TAILCALL
+; CHECK-NEXT:  .LBB2_1: # %if.end
+; CHECK-NEXT:    retq
+entry:
+  %cmp = fcmp une float %f, 0.000000e+00
+  br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+  tail call void @a()
+  br label %if.end
+
+if.end:
+  ret void
 }
+
+; Test that an FP oeq/une conditional branch can be inverted successfully even
+; when the true and false targets are the same (PR27750).
+; 
+; CHECK-LABEL: pr27750
+; CHECK: ucomiss
+; CHECK-NEXT: jne [[TARGET:.*]]
+; CHECK-NEXT: jp [[TARGET]]
+define void @pr27750(i32* %b, float %x, i1 %y) {
+entry:
+  br label %for.cond
+
+for.cond:
+  br label %for.cond1
+
+for.cond1:
+  br i1 %y, label %for.body3.lr.ph, label %for.end
+
+for.body3.lr.ph:
+  store i32 0, i32* %b, align 4
+  br label %for.end
+
+for.end:
+; After block %for.cond gets eliminated, the two target blocks of this
+; conditional block are the same.
+  %tobool = fcmp une float %x, 0.000000e+00
+  br i1 %tobool, label %for.cond, label %for.cond1
+}
+
+declare void @a()
+
+!1 = !{!"branch_weights", i32 1, i32 1000}