Lines Matching +full:1 +full:- +full:3
3 #define YYDEBUG 1
8 #define IN_EXPR_Y 1
10 #include "expr-bison.h"
16 %parse-param { double *final_val }
17 %parse-param { struct expr_parse_ctx *ctx }
18 %parse-param { bool compute_ids }
19 %parse-param {void *scanner}
20 %lex-param {void* scanner}
48 %left '-' '+'
73 /* During computing ids, does val represent a constant (non-BOTTOM) value? */
124 * If we're not computing ids or $1 and $3 are constants, compute the new
126 * ids for non-constants union the set of IDs that must be computed.
148 ctx->ids = ids__union($1.ids, ctx->ids);
151 *final_val = $1.val;
157 if (fpclassify($3.val) == FP_ZERO) {
164 ids__free($1.ids);
165 ids__free($3.ids);
166 } else if (!compute_ids || is_const($3.val)) {
169 * ids are being computed and the IF expr is a non-zero
172 $$.val = $1.val;
173 $$.ids = $1.ids;
174 ids__free($3.ids);
176 } else if ($1.val == $5.val) {
181 $$.val = $1.val;
183 ids__free($1.ids);
184 ids__free($3.ids);
191 $$ = union_expr($1, union_expr($3, $5));
199 $$.val = $1;
202 | ID { $$ = handle_id(ctx, $1, compute_ids, /*source_count=*/false); }
203 | SOURCE_COUNT '(' ID ')' { $$ = handle_id(ctx, $3, compute_ids, /*source_count=*/true); }
206 $$.val = expr__has_event(ctx, compute_ids, $3);
208 free($3);
212 $$.val = expr__strcmp_cpuid_str(ctx, compute_ids, $3);
214 free($3);
218 if (is_const($1.val) && is_const($3.val)) {
219 assert($1.ids == NULL);
220 assert($3.ids == NULL);
222 $$.val = (fpclassify($1.val) == FP_ZERO && fpclassify($3.val) == FP_ZERO) ? 0 : 1;
223 } else if (is_const($1.val)) {
224 assert($1.ids == NULL);
225 if (fpclassify($1.val) == FP_ZERO) {
226 $$ = $3;
228 $$.val = 1;
230 ids__free($3.ids);
232 } else if (is_const($3.val)) {
233 assert($3.ids == NULL);
234 if (fpclassify($3.val) == FP_ZERO) {
235 $$ = $1;
237 $$.val = 1;
239 ids__free($1.ids);
242 $$ = union_expr($1, $3);
247 if (is_const($1.val) && is_const($3.val)) {
248 assert($1.ids == NULL);
249 assert($3.ids == NULL);
250 $$.val = (fpclassify($1.val) != FP_ZERO && fpclassify($3.val) != FP_ZERO) ? 1 : 0;
252 } else if (is_const($1.val)) {
253 assert($1.ids == NULL);
254 if (fpclassify($1.val) != FP_ZERO) {
255 $$ = $3;
259 ids__free($3.ids);
261 } else if (is_const($3.val)) {
262 assert($3.ids == NULL);
263 if (fpclassify($3.val) != FP_ZERO) {
264 $$ = $1;
268 ids__free($1.ids);
271 $$ = union_expr($1, $3);
276 if (is_const($1.val) && is_const($3.val)) {
277 assert($1.ids == NULL);
278 assert($3.ids == NULL);
279 $$.val = (fpclassify($1.val) == FP_ZERO) != (fpclassify($3.val) == FP_ZERO) ? 1 : 0;
282 $$ = union_expr($1, $3);
285 | expr '<' expr { BINARY_OP($$, <, $1, $3); }
286 | expr '>' expr { BINARY_OP($$, >, $1, $3); }
287 | expr '+' expr { BINARY_OP($$, +, $1, $3); }
288 | expr '-' expr { BINARY_OP($$, -, $1, $3); }
289 | expr '*' expr { BINARY_OP($$, *, $1, $3); }
292 if (fpclassify($3.val) == FP_ZERO) {
294 assert($3.ids == NULL);
296 ids__free($1.ids);
299 } else if (!compute_ids || (is_const($1.val) && is_const($3.val))) {
300 assert($1.ids == NULL);
301 assert($3.ids == NULL);
302 $$.val = $1.val / $3.val;
306 $$ = union_expr($1, $3);
311 if (fpclassify($3.val) == FP_ZERO) {
314 } else if (!compute_ids || (is_const($1.val) && is_const($3.val))) {
315 assert($1.ids == NULL);
316 assert($3.ids == NULL);
317 $$.val = (long)$1.val % (long)$3.val;
321 $$ = union_expr($1, $3);
334 ids__free($3.ids);
335 } else if (!compute_ids || (is_const($3.val) && is_const($5.val))) {
336 assert($3.ids == NULL);
338 $$.val = $3.val / $5.val;
342 $$ = union_expr($3, $5);
345 | '-' expr %prec NEG
347 $$.val = -$2.val;
357 $$.val = $3.val < $5.val ? $3.val : $5.val;
360 $$ = union_expr($3, $5);
366 $$.val = $3.val > $5.val ? $3.val : $5.val;
369 $$ = union_expr($3, $5);
374 $$.val = $1;