49 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; LSR's OptimizeMax function shouldn't try to eliminate this max, because5; it has three operands.6 7target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"8 9define void @foo(ptr nocapture %p, i64 %x, i64 %y) nounwind {10; CHECK-LABEL: foo:11; CHECK: # %bb.0: # %entry12; CHECK-NEXT: testq %rdx, %rdx13; CHECK-NEXT: movl $1, %eax14; CHECK-NEXT: cmovneq %rdx, %rax15; CHECK-NEXT: cmpq %rsi, %rax16; CHECK-NEXT: cmovbeq %rsi, %rax17; CHECK-NEXT: .p2align 418; CHECK-NEXT: .LBB0_1: # %bb419; CHECK-NEXT: # =>This Inner Loop Header: Depth=120; CHECK-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero21; CHECK-NEXT: addsd %xmm0, %xmm022; CHECK-NEXT: movsd %xmm0, (%rdi)23; CHECK-NEXT: addq $8, %rdi24; CHECK-NEXT: decq %rax25; CHECK-NEXT: jne .LBB0_126; CHECK-NEXT: # %bb.2: # %return27; CHECK-NEXT: retq28entry:29 %tmp = icmp eq i64 %y, 0 ; <i1> [#uses=1]30 %umax = select i1 %tmp, i64 1, i64 %y ; <i64> [#uses=2]31 %tmp8 = icmp ugt i64 %umax, %x ; <i1> [#uses=1]32 %umax9 = select i1 %tmp8, i64 %umax, i64 %x ; <i64> [#uses=1]33 br label %bb434 35bb4: ; preds = %bb4, %entry36 %i.07 = phi i64 [ 0, %entry ], [ %2, %bb4 ] ; <i64> [#uses=2]37 %scevgep = getelementptr double, ptr %p, i64 %i.07 ; <ptr> [#uses=2]38 %0 = load double, ptr %scevgep, align 8 ; <double> [#uses=1]39 %1 = fmul double %0, 2.000000e+00 ; <double> [#uses=1]40 store double %1, ptr %scevgep, align 841 %2 = add i64 %i.07, 1 ; <i64> [#uses=2]42 %exitcond = icmp eq i64 %2, %umax9 ; <i1> [#uses=1]43 br i1 %exitcond, label %return, label %bb444 45return: ; preds = %bb446 ret void47}48 49