1 ; RUN: llc < %s -march=x86-64 | not grep cmov
3 ; LSR should be able to eliminate both smax and umax expressions
6 target 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 define void @fs(double* nocapture %p, i64 %n) nounwind {
10 %tmp = icmp slt i64 %n, 1 ; <i1> [#uses=1]
11 %smax = select i1 %tmp, i64 1, i64 %n ; <i64> [#uses=1]
14 bb: ; preds = %bb, %entry
15 %i.0 = phi i64 [ 0, %entry ], [ %0, %bb ] ; <i64> [#uses=2]
16 %scevgep = getelementptr double* %p, i64 %i.0 ; <double*> [#uses=1]
17 store double 0.000000e+00, double* %scevgep, align 8
18 %0 = add i64 %i.0, 1 ; <i64> [#uses=2]
19 %exitcond = icmp eq i64 %0, %smax ; <i1> [#uses=1]
20 br i1 %exitcond, label %return, label %bb
26 define void @bs(double* nocapture %p, i64 %n) nounwind {
28 %tmp = icmp sge i64 %n, 1 ; <i1> [#uses=1]
29 %smax = select i1 %tmp, i64 %n, i64 1 ; <i64> [#uses=1]
32 bb: ; preds = %bb, %entry
33 %i.0 = phi i64 [ 0, %entry ], [ %0, %bb ] ; <i64> [#uses=2]
34 %scevgep = getelementptr double* %p, i64 %i.0 ; <double*> [#uses=1]
35 store double 0.000000e+00, double* %scevgep, align 8
36 %0 = add i64 %i.0, 1 ; <i64> [#uses=2]
37 %exitcond = icmp eq i64 %0, %smax ; <i1> [#uses=1]
38 br i1 %exitcond, label %return, label %bb
44 define void @fu(double* nocapture %p, i64 %n) nounwind {
46 %tmp = icmp eq i64 %n, 0 ; <i1> [#uses=1]
47 %umax = select i1 %tmp, i64 1, i64 %n ; <i64> [#uses=1]
50 bb: ; preds = %bb, %entry
51 %i.0 = phi i64 [ 0, %entry ], [ %0, %bb ] ; <i64> [#uses=2]
52 %scevgep = getelementptr double* %p, i64 %i.0 ; <double*> [#uses=1]
53 store double 0.000000e+00, double* %scevgep, align 8
54 %0 = add i64 %i.0, 1 ; <i64> [#uses=2]
55 %exitcond = icmp eq i64 %0, %umax ; <i1> [#uses=1]
56 br i1 %exitcond, label %return, label %bb
62 define void @bu(double* nocapture %p, i64 %n) nounwind {
64 %tmp = icmp ne i64 %n, 0 ; <i1> [#uses=1]
65 %umax = select i1 %tmp, i64 %n, i64 1 ; <i64> [#uses=1]
68 bb: ; preds = %bb, %entry
69 %i.0 = phi i64 [ 0, %entry ], [ %0, %bb ] ; <i64> [#uses=2]
70 %scevgep = getelementptr double* %p, i64 %i.0 ; <double*> [#uses=1]
71 store double 0.000000e+00, double* %scevgep, align 8
72 %0 = add i64 %i.0, 1 ; <i64> [#uses=2]
73 %exitcond = icmp eq i64 %0, %umax ; <i1> [#uses=1]
74 br i1 %exitcond, label %return, label %bb