• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86-64 | not grep cmov
2
3; LSR should be able to eliminate both smax and umax expressions
4; in loop trip counts.
5
6target 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"
7
8define void @fs(double* nocapture %p, i64 %n) nounwind {
9entry:
10	%tmp = icmp slt i64 %n, 1		; <i1> [#uses=1]
11	%smax = select i1 %tmp, i64 1, i64 %n		; <i64> [#uses=1]
12	br label %bb
13
14bb:		; 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
21
22return:		; preds = %bb
23	ret void
24}
25
26define void @bs(double* nocapture %p, i64 %n) nounwind {
27entry:
28	%tmp = icmp sge i64 %n, 1		; <i1> [#uses=1]
29	%smax = select i1 %tmp, i64 %n, i64 1		; <i64> [#uses=1]
30	br label %bb
31
32bb:		; 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
39
40return:		; preds = %bb
41	ret void
42}
43
44define void @fu(double* nocapture %p, i64 %n) nounwind {
45entry:
46	%tmp = icmp eq i64 %n, 0		; <i1> [#uses=1]
47	%umax = select i1 %tmp, i64 1, i64 %n		; <i64> [#uses=1]
48	br label %bb
49
50bb:		; 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
57
58return:		; preds = %bb
59	ret void
60}
61
62define void @bu(double* nocapture %p, i64 %n) nounwind {
63entry:
64	%tmp = icmp ne i64 %n, 0		; <i1> [#uses=1]
65	%umax = select i1 %tmp, i64 %n, i64 1		; <i64> [#uses=1]
66	br label %bb
67
68bb:		; 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
75
76return:		; preds = %bb
77	ret void
78}
79