summaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC/ctrloops-softfloat.ll
blob: 7fe7a911b0741f555f7ce4e0da63d5b8b63424b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-linux-gnu -O1 < %s | FileCheck %s

; double x, y;
; 
; void foo1()
; {
;   x = y = 1.1;
;   for (int i = 0; i < 175; i++)
;     y = x + y;    
; }
; void foo2()
; {
;   x = y = 1.1;
;   for (int i = 0; i < 175; i++)
;     y = x - y;    
; }
; void foo3()
; {
;   x = y = 1.1;
;   for (int i = 0; i < 175; i++)
;     y = x * y;    
; }
; void foo4()
; {
;   x = y = 1.1;
;   for (int i = 0; i < 175; i++)
;     y = x / y;    
; }

target datalayout = "E-m:e-p:32:32-i64:64-n32"
target triple = "powerpc-buildroot-linux-gnu"

@y = common global double 0.000000e+00, align 8
@x = common global double 0.000000e+00, align 8

define void @foo1() #0 {
  store double 1.100000e+00, double* @y, align 8
  store double 1.100000e+00, double* @x, align 8
  br label %2

; <label>:1                                       ; preds = %2
  %.lcssa = phi double [ %4, %2 ]
  store double %.lcssa, double* @y, align 8
  ret void

; <label>:2                                       ; preds = %2, %0
  %3 = phi double [ 1.100000e+00, %0 ], [ %4, %2 ]
  %i.01 = phi i32 [ 0, %0 ], [ %5, %2 ]
  %4 = fadd double %3, 1.100000e+00
  %5 = add nuw nsw i32 %i.01, 1
  %exitcond = icmp eq i32 %5, 75
  br i1 %exitcond, label %1, label %2
  ; CHECK: bl __adddf3
  ; CHECK: cmplwi
  ; CHECK-NOT: li [[REG1:[0-9]+]], 175
  ; CHECK-NOT: mtctr [[REG1]]
}

define void @foo2() #0 {
  store double 1.100000e+00, double* @y, align 8
  store double 1.100000e+00, double* @x, align 8
  br label %2

; <label>:1                                       ; preds = %2
  %.lcssa = phi double [ %4, %2 ]
  store double %.lcssa, double* @y, align 8
  ret void

; <label>:2                                       ; preds = %2, %0
  %3 = phi double [ 1.100000e+00, %0 ], [ %4, %2 ]
  %i.01 = phi i32 [ 0, %0 ], [ %5, %2 ]
  %4 = fsub double 1.100000e+00, %3
  %5 = add nuw nsw i32 %i.01, 1
  %exitcond = icmp eq i32 %5, 75
  br i1 %exitcond, label %1, label %2
  ; CHECK: bl __subdf3
  ; CHECK: cmplwi
  ; CHECK-NOT: li [[REG1:[0-9]+]], 175
  ; CHECK-NOT: mtctr [[REG1]]
}

define void @foo3() #0 {
  store double 1.100000e+00, double* @y, align 8
  store double 1.100000e+00, double* @x, align 8
  br label %2

; <label>:1                                       ; preds = %2
  %.lcssa = phi double [ %4, %2 ]
  store double %.lcssa, double* @y, align 8
  ret void

; <label>:2                                       ; preds = %2, %0
  %3 = phi double [ 1.100000e+00, %0 ], [ %4, %2 ]
  %i.01 = phi i32 [ 0, %0 ], [ %5, %2 ]
  %4 = fmul double %3, 1.100000e+00
  %5 = add nuw nsw i32 %i.01, 1
  %exitcond = icmp eq i32 %5, 75
  br i1 %exitcond, label %1, label %2
  ; CHECK: bl __muldf3
  ; CHECK: cmplwi
  ; CHECK-NOT: li [[REG1:[0-9]+]], 175
  ; CHECK-NOT: mtctr [[REG1]]
}

define void @foo4() #0 {
  store double 1.100000e+00, double* @y, align 8
  store double 1.100000e+00, double* @x, align 8
  br label %2

; <label>:1                                       ; preds = %2
  %.lcssa = phi double [ %4, %2 ]
  store double %.lcssa, double* @y, align 8
  ret void

; <label>:2                                       ; preds = %2, %0
  %3 = phi double [ 1.100000e+00, %0 ], [ %4, %2 ]
  %i.01 = phi i32 [ 0, %0 ], [ %5, %2 ]
  %4 = fdiv double 1.100000e+00, %3
  %5 = add nuw nsw i32 %i.01, 1
  %exitcond = icmp eq i32 %5, 75
  br i1 %exitcond, label %1, label %2
  ; CHECK: bl __divdf3
  ; CHECK: cmplwi
  ; CHECK-NOT: li [[REG1:[0-9]+]], 175
  ; CHECK-NOT: mtctr [[REG1]]
}

attributes #0 = { "use-soft-float"="true" }