Function-local metadata whose operands had been optimized to no longer refer to funct...
[oota-llvm.git] / test / Assembler / flags.ll
1 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
2
3 @addr = external global i64
4
5 define i64 @add_unsigned(i64 %x, i64 %y) {
6 ; CHECK: %z = add nuw i64 %x, %y
7         %z = add nuw i64 %x, %y
8         ret i64 %z
9 }
10
11 define i64 @sub_unsigned(i64 %x, i64 %y) {
12 ; CHECK: %z = sub nuw i64 %x, %y
13         %z = sub nuw i64 %x, %y
14         ret i64 %z
15 }
16
17 define i64 @mul_unsigned(i64 %x, i64 %y) {
18 ; CHECK: %z = mul nuw i64 %x, %y
19         %z = mul nuw i64 %x, %y
20         ret i64 %z
21 }
22
23 define i64 @add_signed(i64 %x, i64 %y) {
24 ; CHECK: %z = add nsw i64 %x, %y
25         %z = add nsw i64 %x, %y
26         ret i64 %z
27 }
28
29 define i64 @sub_signed(i64 %x, i64 %y) {
30 ; CHECK: %z = sub nsw i64 %x, %y
31         %z = sub nsw i64 %x, %y
32         ret i64 %z
33 }
34
35 define i64 @mul_signed(i64 %x, i64 %y) {
36 ; CHECK: %z = mul nsw i64 %x, %y
37         %z = mul nsw i64 %x, %y
38         ret i64 %z
39 }
40
41 define i64 @add_plain(i64 %x, i64 %y) {
42 ; CHECK: %z = add i64 %x, %y
43         %z = add i64 %x, %y
44         ret i64 %z
45 }
46
47 define i64 @sub_plain(i64 %x, i64 %y) {
48 ; CHECK: %z = sub i64 %x, %y
49         %z = sub i64 %x, %y
50         ret i64 %z
51 }
52
53 define i64 @mul_plain(i64 %x, i64 %y) {
54 ; CHECK: %z = mul i64 %x, %y
55         %z = mul i64 %x, %y
56         ret i64 %z
57 }
58
59 define i64 @add_both(i64 %x, i64 %y) {
60 ; CHECK: %z = add nuw nsw i64 %x, %y
61         %z = add nuw nsw i64 %x, %y
62         ret i64 %z
63 }
64
65 define i64 @sub_both(i64 %x, i64 %y) {
66 ; CHECK: %z = sub nuw nsw i64 %x, %y
67         %z = sub nuw nsw i64 %x, %y
68         ret i64 %z
69 }
70
71 define i64 @mul_both(i64 %x, i64 %y) {
72 ; CHECK: %z = mul nuw nsw i64 %x, %y
73         %z = mul nuw nsw i64 %x, %y
74         ret i64 %z
75 }
76
77 define i64 @add_both_reversed(i64 %x, i64 %y) {
78 ; CHECK: %z = add nuw nsw i64 %x, %y
79         %z = add nsw nuw i64 %x, %y
80         ret i64 %z
81 }
82
83 define i64 @sub_both_reversed(i64 %x, i64 %y) {
84 ; CHECK: %z = sub nuw nsw i64 %x, %y
85         %z = sub nsw nuw i64 %x, %y
86         ret i64 %z
87 }
88
89 define i64 @mul_both_reversed(i64 %x, i64 %y) {
90 ; CHECK: %z = mul nuw nsw i64 %x, %y
91         %z = mul nsw nuw i64 %x, %y
92         ret i64 %z
93 }
94
95 define i64 @sdiv_exact(i64 %x, i64 %y) {
96 ; CHECK: %z = sdiv exact i64 %x, %y
97         %z = sdiv exact i64 %x, %y
98         ret i64 %z
99 }
100
101 define i64 @sdiv_plain(i64 %x, i64 %y) {
102 ; CHECK: %z = sdiv i64 %x, %y
103         %z = sdiv i64 %x, %y
104         ret i64 %z
105 }
106
107 define i64* @gep_nw(i64* %p, i64 %x) {
108 ; CHECK: %z = getelementptr inbounds i64* %p, i64 %x
109         %z = getelementptr inbounds i64* %p, i64 %x
110         ret i64* %z
111 }
112
113 define i64* @gep_plain(i64* %p, i64 %x) {
114 ; CHECK: %z = getelementptr i64* %p, i64 %x
115         %z = getelementptr i64* %p, i64 %x
116         ret i64* %z
117 }
118
119 define i64 @add_both_ce() {
120 ; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
121         ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
122 }
123
124 define i64 @sub_both_ce() {
125 ; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
126         ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
127 }
128
129 define i64 @mul_both_ce() {
130 ; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
131         ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
132 }
133
134 define i64 @sdiv_exact_ce() {
135 ; CHECK: ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
136         ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
137 }
138
139 define i64* @gep_nw_ce() {
140 ; CHECK: ret i64* getelementptr inbounds (i64* @addr, i64 171)
141         ret i64* getelementptr inbounds (i64* @addr, i64 171)
142 }
143
144 define i64 @add_plain_ce() {
145 ; CHECK: ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91)
146         ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91)
147 }
148
149 define i64 @sub_plain_ce() {
150 ; CHECK: ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91)
151         ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91)
152 }
153
154 define i64 @mul_plain_ce() {
155 ; CHECK: ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91)
156         ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91)
157 }
158
159 define i64 @sdiv_plain_ce() {
160 ; CHECK: ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91)
161         ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91)
162 }
163
164 define i64* @gep_plain_ce() {
165 ; CHECK: ret i64* getelementptr (i64* @addr, i64 171)
166         ret i64* getelementptr (i64* @addr, i64 171)
167 }
168
169 define i64 @add_both_reversed_ce() {
170 ; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
171         ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
172 }
173
174 define i64 @sub_both_reversed_ce() {
175 ; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
176         ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
177 }
178
179 define i64 @mul_both_reversed_ce() {
180 ; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
181         ret i64 mul nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
182 }
183
184 define i64 @add_signed_ce() {
185 ; CHECK: ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
186         ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
187 }
188
189 define i64 @sub_signed_ce() {
190 ; CHECK: ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
191         ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
192 }
193
194 define i64 @mul_signed_ce() {
195 ; CHECK: ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
196         ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
197 }
198
199 define i64 @add_unsigned_ce() {
200 ; CHECK: ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
201         ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
202 }
203
204 define i64 @sub_unsigned_ce() {
205 ; CHECK: ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
206         ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
207 }
208
209 define i64 @mul_unsigned_ce() {
210 ; CHECK: ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
211         ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
212 }