brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · dd32f23 Raw
149 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s3 4; <rdar://problem/7859988>5 6; Make sure we don't generate more jumps than we need to. We used to generate7; something like this:8;9;       jne  LBB0_110;       jnp  LBB0_211;   LBB0_1:12;       jmp  LBB0_313;   LBB0_2:14;       addsd ...15;   LBB0_3:16;17; Now we generate this:18;19;       jne  LBB0_220;       jp   LBB0_221;       addsd ...22;   LBB0_2:23 24define double @rdar_7859988(double %x, double %y) nounwind readnone optsize ssp {25; CHECK-LABEL: rdar_7859988:26; CHECK:       # %bb.0: # %entry27; CHECK-NEXT:    mulsd %xmm1, %xmm028; CHECK-NEXT:    xorpd %xmm1, %xmm129; CHECK-NEXT:    ucomisd %xmm1, %xmm030; CHECK-NEXT:    jne .LBB0_231; CHECK-NEXT:    jp .LBB0_232; CHECK-NEXT:  # %bb.1: # %bb133; CHECK-NEXT:    addsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm034; CHECK-NEXT:  .LBB0_2: # %bb235; CHECK-NEXT:    retq36 37entry:38  %mul = fmul double %x, %y39  %cmp = fcmp oeq double %mul, 0.000000e+0040  br i1 %cmp, label %bb1, label %bb241 42bb1:43  %add = fadd double %mul, -1.000000e+0044  br label %bb245 46bb2:47  %phi = phi double [ %add, %bb1 ], [ %mul, %entry ]48  ret double %phi49}50 51define double @profile_metadata(double %x, double %y) {52; CHECK-LABEL: profile_metadata:53; CHECK:       # %bb.0: # %entry54; CHECK-NEXT:    mulsd %xmm1, %xmm055; CHECK-NEXT:    xorpd %xmm1, %xmm156; CHECK-NEXT:    ucomisd %xmm1, %xmm057; CHECK-NEXT:    jne .LBB1_158; CHECK-NEXT:    jp .LBB1_159; CHECK-NEXT:  # %bb.2: # %bb260; CHECK-NEXT:    retq61; CHECK-NEXT:  .LBB1_1: # %bb162; CHECK-NEXT:    addsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm063; CHECK-NEXT:    retq64 65entry:66  %mul = fmul double %x, %y67  %cmp = fcmp une double %mul, 0.000000e+0068  br i1 %cmp, label %bb1, label %bb2, !prof !169 70bb1:71  %add = fadd double %mul, -1.000000e+0072  br label %bb273 74bb2:75  %phi = phi double [ %add, %bb1 ], [ %mul, %entry ]76  ret double %phi77}78 79; Test if the negation of the non-equality check between floating points are80; translated to jnp followed by jne.81 82define void @foo(float %f) {83; CHECK-LABEL: foo:84; CHECK:       # %bb.0: # %entry85; CHECK-NEXT:    xorps %xmm1, %xmm186; CHECK-NEXT:    ucomiss %xmm1, %xmm087; CHECK-NEXT:    jne .LBB2_288; CHECK-NEXT:    jnp .LBB2_189; CHECK-NEXT:  .LBB2_2: # %if.then90; CHECK-NEXT:    jmp a # TAILCALL91; CHECK-NEXT:  .LBB2_1: # %if.end92; CHECK-NEXT:    retq93entry:94  %cmp = fcmp une float %f, 0.000000e+0095  br i1 %cmp, label %if.then, label %if.end96 97if.then:98  tail call void @a()99  br label %if.end100 101if.end:102  ret void103}104 105; Test that an FP oeq/une conditional branch can be inverted successfully even106; when the true and false targets are the same (PR27750).107define void @pr27750(ptr %b, float %x, i1 %y) {108; CHECK-LABEL: pr27750:109; CHECK:       # %bb.0: # %entry110; CHECK-NEXT:    xorps %xmm1, %xmm1111; CHECK-NEXT:    jmp .LBB3_1112; CHECK-NEXT:    .p2align 4113; CHECK-NEXT:  .LBB3_3: # %for.end114; CHECK-NEXT:    # in Loop: Header=BB3_1 Depth=1115; CHECK-NEXT:    ucomiss %xmm1, %xmm0116; CHECK-NEXT:    jne .LBB3_1117; CHECK-NEXT:    jp .LBB3_1118; CHECK-NEXT:  .LBB3_1: # %for.cond1119; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1120; CHECK-NEXT:    testb $1, %sil121; CHECK-NEXT:    je .LBB3_3122; CHECK-NEXT:  # %bb.2: # %for.body3.lr.ph123; CHECK-NEXT:    # in Loop: Header=BB3_1 Depth=1124; CHECK-NEXT:    movl $0, (%rdi)125; CHECK-NEXT:    jmp .LBB3_3126entry:127  br label %for.cond128 129for.cond:130  br label %for.cond1131 132for.cond1:133  br i1 %y, label %for.body3.lr.ph, label %for.end134 135for.body3.lr.ph:136  store i32 0, ptr %b, align 4137  br label %for.end138 139for.end:140; After block %for.cond gets eliminated, the two target blocks of this141; conditional block are the same.142  %tobool = fcmp une float %x, 0.000000e+00143  br i1 %tobool, label %for.cond, label %for.cond1144}145 146declare dso_local void @a()147 148!1 = !{!"branch_weights", i32 1, i32 1000}149