phi.ll
5.19 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL
define i8 @test_i8(i32 %a, i8 %f, i8 %t) {
; ALL-LABEL: test_i8:
; ALL: # %bb.0: # %entry
; ALL-NEXT: xorl %ecx, %ecx
; ALL-NEXT: cmpl %ecx, %edi
; ALL-NEXT: setg %cl
; ALL-NEXT: testb $1, %cl
; ALL-NEXT: je .LBB0_2
; ALL-NEXT: # %bb.1:
; ALL-NEXT: movl %esi, %eax
; ALL-NEXT: # kill: def $al killed $al killed $eax
; ALL-NEXT: retq
; ALL-NEXT: .LBB0_2: # %cond.false
; ALL-NEXT: movl %edx, %eax
; ALL-NEXT: # kill: def $al killed $al killed $eax
; ALL-NEXT: retq
entry:
%cmp = icmp sgt i32 %a, 0
br i1 %cmp, label %cond.true, label %cond.false
cond.true: ; preds = %entry
br label %cond.end
cond.false: ; preds = %entry
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi i8 [ %f, %cond.true ], [ %t, %cond.false ]
ret i8 %cond
}
define i16 @test_i16(i32 %a, i16 %f, i16 %t) {
; ALL-LABEL: test_i16:
; ALL: # %bb.0: # %entry
; ALL-NEXT: xorl %ecx, %ecx
; ALL-NEXT: cmpl %ecx, %edi
; ALL-NEXT: setg %cl
; ALL-NEXT: testb $1, %cl
; ALL-NEXT: je .LBB1_2
; ALL-NEXT: # %bb.1:
; ALL-NEXT: movl %esi, %eax
; ALL-NEXT: # kill: def $ax killed $ax killed $eax
; ALL-NEXT: retq
; ALL-NEXT: .LBB1_2: # %cond.false
; ALL-NEXT: movl %edx, %eax
; ALL-NEXT: # kill: def $ax killed $ax killed $eax
; ALL-NEXT: retq
entry:
%cmp = icmp sgt i32 %a, 0
br i1 %cmp, label %cond.true, label %cond.false
cond.true: ; preds = %entry
br label %cond.end
cond.false: ; preds = %entry
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi i16 [ %f, %cond.true ], [ %t, %cond.false ]
ret i16 %cond
}
define i32 @test_i32(i32 %a, i32 %f, i32 %t) {
; ALL-LABEL: test_i32:
; ALL: # %bb.0: # %entry
; ALL-NEXT: movl %esi, %eax
; ALL-NEXT: xorl %ecx, %ecx
; ALL-NEXT: cmpl %ecx, %edi
; ALL-NEXT: setg %cl
; ALL-NEXT: testb $1, %cl
; ALL-NEXT: jne .LBB2_2
; ALL-NEXT: # %bb.1: # %cond.false
; ALL-NEXT: movl %edx, %eax
; ALL-NEXT: .LBB2_2: # %cond.end
; ALL-NEXT: retq
entry:
%cmp = icmp sgt i32 %a, 0
br i1 %cmp, label %cond.true, label %cond.false
cond.true: ; preds = %entry
br label %cond.end
cond.false: ; preds = %entry
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi i32 [ %f, %cond.true ], [ %t, %cond.false ]
ret i32 %cond
}
define i64 @test_i64(i32 %a, i64 %f, i64 %t) {
; ALL-LABEL: test_i64:
; ALL: # %bb.0: # %entry
; ALL-NEXT: movq %rsi, %rax
; ALL-NEXT: xorl %ecx, %ecx
; ALL-NEXT: cmpl %ecx, %edi
; ALL-NEXT: setg %cl
; ALL-NEXT: testb $1, %cl
; ALL-NEXT: jne .LBB3_2
; ALL-NEXT: # %bb.1: # %cond.false
; ALL-NEXT: movq %rdx, %rax
; ALL-NEXT: .LBB3_2: # %cond.end
; ALL-NEXT: retq
entry:
%cmp = icmp sgt i32 %a, 0
br i1 %cmp, label %cond.true, label %cond.false
cond.true: ; preds = %entry
br label %cond.end
cond.false: ; preds = %entry
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi i64 [ %f, %cond.true ], [ %t, %cond.false ]
ret i64 %cond
}
define float @test_float(i32 %a, float %f, float %t) {
; ALL-LABEL: test_float:
; ALL: # %bb.0: # %entry
; ALL-NEXT: xorl %eax, %eax
; ALL-NEXT: cmpl %eax, %edi
; ALL-NEXT: setg %al
; ALL-NEXT: testb $1, %al
; ALL-NEXT: jne .LBB4_2
; ALL-NEXT: # %bb.1: # %cond.false
; ALL-NEXT: movaps %xmm1, %xmm0
; ALL-NEXT: .LBB4_2: # %cond.end
; ALL-NEXT: retq
entry:
%cmp = icmp sgt i32 %a, 0
br i1 %cmp, label %cond.true, label %cond.false
cond.true: ; preds = %entry
br label %cond.end
cond.false: ; preds = %entry
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi float [ %f, %cond.true ], [ %t, %cond.false ]
ret float %cond
}
define double @test_double(i32 %a, double %f, double %t) {
; ALL-LABEL: test_double:
; ALL: # %bb.0: # %entry
; ALL-NEXT: xorl %eax, %eax
; ALL-NEXT: cmpl %eax, %edi
; ALL-NEXT: setg %al
; ALL-NEXT: testb $1, %al
; ALL-NEXT: jne .LBB5_2
; ALL-NEXT: # %bb.1: # %cond.false
; ALL-NEXT: movaps %xmm1, %xmm0
; ALL-NEXT: .LBB5_2: # %cond.end
; ALL-NEXT: retq
entry:
%cmp = icmp sgt i32 %a, 0
br i1 %cmp, label %cond.true, label %cond.false
cond.true: ; preds = %entry
br label %cond.end
cond.false: ; preds = %entry
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi double [ %f, %cond.true ], [ %t, %cond.false ]
ret double %cond
}