Lines Matching refs:op

110    ir_constant *op[Elements(this->operands)] = { NULL, };
116 op[operand] = this->operands[operand]->constant_expression_value(variable_context);
117 if (!op[operand])
121 if (op[1] != NULL)
122 assert(op[0]->type->base_type == op[1]->type->base_type ||
126 bool op0_scalar = op[0]->type->is_scalar();
127 bool op1_scalar = op[1] != NULL && op[1]->type->is_scalar();
135 if (op1_scalar || !op[1]) {
136 components = op[0]->type->components();
138 components = op[1]->type->components();
144 if (op[0]->type->is_array()) {
145 assert(op[1] != NULL && op[1]->type->is_array());
148 return new(ctx) ir_constant(op[0]->has_value(op[1]));
150 return new(ctx) ir_constant(!op[0]->has_value(op[1]));
159 switch (op[0]->type->base_type) {
162 data.i[c] = ~ op[0]->value.i[c];
166 data.u[c] = ~ op[0]->value.u[c];
174 assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
175 for (unsigned c = 0; c < op[0]->type->components(); c++)
176 data.b[c] = !op[0]->value.b[c];
180 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
181 for (unsigned c = 0; c < op[0]->type->components(); c++) {
182 data.i[c] = (int) op[0]->value.f[c];
186 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
187 for (unsigned c = 0; c < op[0]->type->components(); c++) {
188 data.i[c] = (unsigned) op[0]->value.f[c];
192 assert(op[0]->type->base_type == GLSL_TYPE_INT);
193 for (unsigned c = 0; c < op[0]->type->components(); c++) {
194 data.f[c] = (float) op[0]->value.i[c];
198 assert(op[0]->type->base_type == GLSL_TYPE_UINT);
199 for (unsigned c = 0; c < op[0]->type->components(); c++) {
200 data.f[c] = (float) op[0]->value.u[c];
204 assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
205 for (unsigned c = 0; c < op[0]->type->components(); c++) {
206 data.f[c] = op[0]->value.b[c] ? 1.0F : 0.0F;
210 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
211 for (unsigned c = 0; c < op[0]->type->components(); c++) {
212 data.b[c] = op[0]->value.f[c] != 0.0F ? true : false;
216 assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
217 for (unsigned c = 0; c < op[0]->type->components(); c++) {
218 data.u[c] = op[0]->value.b[c] ? 1 : 0;
222 assert(op[0]->type->is_integer());
223 for (unsigned c = 0; c < op[0]->type->components(); c++) {
224 data.b[c] = op[0]->value.u[c] ? true : false;
228 assert(op[0]->type->base_type == GLSL_TYPE_UINT);
229 for (unsigned c = 0; c < op[0]->type->components(); c++) {
230 data.i[c] = op[0]->value.u[c];
234 assert(op[0]->type->base_type == GLSL_TYPE_INT);
235 for (unsigned c = 0; c < op[0]->type->components(); c++) {
236 data.u[c] = op[0]->value.i[c];
240 assert(op[0]->type->base_type == GLSL_TYPE_INT);
241 for (unsigned c = 0; c < op[0]->type->components(); c++) {
242 data.f[c] = bitcast_u2f(op[0]->value.i[c]);
246 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
247 for (unsigned c = 0; c < op[0]->type->components(); c++) {
248 data.i[c] = bitcast_f2u(op[0]->value.f[c]);
252 assert(op[0]->type->base_type == GLSL_TYPE_UINT);
253 for (unsigned c = 0; c < op[0]->type->components(); c++) {
254 data.f[c] = bitcast_u2f(op[0]->value.u[c]);
258 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
259 for (unsigned c = 0; c < op[0]->type->components(); c++) {
260 data.u[c] = bitcast_f2u(op[0]->value.f[c]);
264 assert(op[0]->type->is_boolean());
266 for (unsigned c = 0; c < op[0]->type->components(); c++) {
267 if (op[0]->value.b[c])
273 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
274 for (unsigned c = 0; c < op[0]->type->components(); c++) {
275 data.f[c] = truncf(op[0]->value.f[c]);
280 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
281 for (unsigned c = 0; c < op[0]->type->components(); c++) {
282 data.f[c] = round_to_even(op[0]->value.f[c]);
287 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
288 for (unsigned c = 0; c < op[0]->type->components(); c++) {
289 data.f[c] = ceilf(op[0]->value.f[c]);
294 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
295 for (unsigned c = 0; c < op[0]->type->components(); c++) {
296 data.f[c] = floorf(op[0]->value.f[c]);
301 for (unsigned c = 0; c < op[0]->type->components(); c++) {
310 data.f[c] = op[0]->value.f[c] - floor(op[0]->value.f[c]);
320 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
321 for (unsigned c = 0; c < op[0]->type->components(); c++) {
322 data.f[c] = sinf(op[0]->value.f[c]);
328 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
329 for (unsigned c = 0; c < op[0]->type->components(); c++) {
330 data.f[c] = cosf(op[0]->value.f[c]);
335 for (unsigned c = 0; c < op[0]->type->components(); c++) {
338 data.u[c] = -((int) op[0]->value.u[c]);
341 data.i[c] = -op[0]->value.i[c];
344 data.f[c] = -op[0]->value.f[c];
353 for (unsigned c = 0; c < op[0]->type->components(); c++) {
356 data.u[c] = op[0]->value.u[c];
359 data.i[c] = op[0]->value.i[c];
364 data.f[c] = fabs(op[0]->value.f[c]);
373 for (unsigned c = 0; c < op[0]->type->components(); c++) {
376 data.u[c] = op[0]->value.i[c] > 0;
379 data.i[c] = (op[0]->value.i[c] > 0) - (op[0]->value.i[c] < 0);
382 data.f[c] = float((op[0]->value.f[c] > 0)-(op[0]->value.f[c] < 0));
391 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
392 for (unsigned c = 0; c < op[0]->type->components(); c++) {
395 if (op[0]->value.u[c] != 0.0)
396 data.u[c] = 1 / op[0]->value.u[c];
399 if (op[0]->value.i[c] != 0.0)
400 data.i[c] = 1 / op[0]->value.i[c];
403 if (op[0]->value.f[c] != 0.0)
404 data.f[c] = 1.0F / op[0]->value.f[c];
413 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
414 for (unsigned c = 0; c < op[0]->type->components(); c++) {
415 data.f[c] = 1.0F / sqrtf(op[0]->value.f[c]);
420 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
421 for (unsigned c = 0; c < op[0]->type->components(); c++) {
422 data.f[c] = sqrtf(op[0]->value.f[c]);
427 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
428 for (unsigned c = 0; c < op[0]->type->components(); c++) {
429 data.f[c] = expf(op[0]->value.f[c]);
434 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
435 for (unsigned c = 0; c < op[0]->type->components(); c++) {
436 data.f[c] = exp2f(op[0]->value.f[c]);
441 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
442 for (unsigned c = 0; c < op[0]->type->components(); c++) {
443 data.f[c] = logf(op[0]->value.f[c]);
448 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
449 for (unsigned c = 0; c < op[0]->type->components(); c++) {
450 data.f[c] = log2f(op[0]->value.f[c]);
456 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
457 for (unsigned c = 0; c < op[0]->type->components(); c++) {
463 assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
464 for (unsigned c = 0; c < op[0]->type->components(); c++) {
465 data.f[c] = powf(op[0]->value.f[c], op[1]->value.f[c]);
470 data.f[0] = dot(op[0], op[1]);
474 assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
479 switch (op[0]->type->base_type) {
481 data.u[c] = MIN2(op[0]->value.u[c0], op[1]->value.u[c1]);
484 data.i[c] = MIN2(op[0]->value.i[c0], op[1]->value.i[c1]);
487 data.f[c] = MIN2(op[0]->value.f[c0], op[1]->value.f[c1]);
496 assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
501 switch (op[0]->type->base_type) {
503 data.u[c] = MAX2(op[0]->value.u[c0], op[1]->value.u[c1]);
506 data.i[c] = MAX2(op[0]->value.i[c0], op[1]->value.i[c1]);
509 data.f[c] = MAX2(op[0]->value.f[c0], op[1]->value.f[c1]);
518 assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
523 switch (op[0]->type->base_type) {
525 data.u[c] = op[0]->value.u[c0] + op[1]->value.u[c1];
528 data.i[c] = op[0]->value.i[c0] + op[1]->value.i[c1];
531 data.f[c] = op[0]->value.f[c0] + op[1]->value.f[c1];
540 assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
545 switch (op[0]->type->base_type) {
547 data.u[c] = op[0]->value.u[c0] - op[1]->value.u[c1];
550 data.i[c] = op[0]->value.i[c0] - op[1]->value.i[c1];
553 data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1];
563 if ((op[0]->type == op[1]->type && !op[0]->type->is_matrix())
569 switch (op[0]->type->base_type) {
571 data.u[c] = op[0]->value.u[c0] * op[1]->value.u[c1];
574 data.i[c] = op[0]->value.i[c0] * op[1]->value.i[c1];
577 data.f[c] = op[0]->value.f[c0] * op[1]->value.f[c1];
584 assert(op[0]->type->is_matrix() || op[1]->type->is_matrix());
595 const unsigned n = op[0]->type->is_vector()
596 ? 1 : op[0]->type->vector_elements;
597 const unsigned m = op[1]->type->vector_elements;
598 const unsigned p = op[1]->type->matrix_columns;
602 data.f[i+n*j] += op[0]->value.f[i+n*k]*op[1]->value.f[k+m*j];
611 assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
616 switch (op[0]->type->base_type) {
618 if (op[1]->value.u[c1] == 0) {
621 data.u[c] = op[0]->value.u[c0] / op[1]->value.u[c1];
625 if (op[1]->value.i[c1] == 0) {
628 data.i[c] = op[0]->value.i[c0] / op[1]->value.i[c1];
632 data.f[c] = op[0]->value.f[c0] / op[1]->value.f[c1];
642 assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
647 switch (op[0]->type->base_type) {
649 if (op[1]->value.u[c1] == 0) {
652 data.u[c] = op[0]->value.u[c0] % op[1]->value.u[c1];
656 if (op[1]->value.i[c1] == 0) {
659 data.i[c] = op[0]->value.i[c0] % op[1]->value.i[c1];
666 data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1]
667 * floorf(op[0]->value.f[c0] / op[1]->value.f[c1]);
677 assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
678 for (unsigned c = 0; c < op[0]->type->components(); c++)
679 data.b[c] = op[0]->value.b[c] && op[1]->value.b[c];
682 assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
683 for (unsigned c = 0; c < op[0]->type->components(); c++)
684 data.b[c] = op[0]->value.b[c] ^ op[1]->value.b[c];
687 assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
688 for (unsigned c = 0; c < op[0]->type->components(); c++)
689 data.b[c] = op[0]->value.b[c] || op[1]->value.b[c];
693 assert(op[0]->type == op[1]->type);
694 for (unsigned c = 0; c < op[0]->type->components(); c++) {
695 switch (op[0]->type->base_type) {
697 data.b[c] = op[0]->value.u[c] < op[1]->value.u[c];
700 data.b[c] = op[0]->value.i[c] < op[1]->value.i[c];
703 data.b[c] = op[0]->value.f[c] < op[1]->value.f[c];
711 assert(op[0]->type == op[1]->type);
712 for (unsigned c = 0; c < op[0]->type->components(); c++) {
713 switch (op[0]->type->base_type) {
715 data.b[c] = op[0]->value.u[c] > op[1]->value.u[c];
718 data.b[c] = op[0]->value.i[c] > op[1]->value.i[c];
721 data.b[c] = op[0]->value.f[c] > op[1]->value.f[c];
729 assert(op[0]->type == op[1]->type);
730 for (unsigned c = 0; c < op[0]->type->components(); c++) {
731 switch (op[0]->type->base_type) {
733 data.b[c] = op[0]->value.u[c] <= op[1]->value.u[c];
736 data.b[c] = op[0]->value.i[c] <= op[1]->value.i[c];
739 data.b[c] = op[0]->value.f[c] <= op[1]->value.f[c];
747 assert(op[0]->type == op[1]->type);
748 for (unsigned c = 0; c < op[0]->type->components(); c++) {
749 switch (op[0]->type->base_type) {
751 data.b[c] = op[0]->value.u[c] >= op[1]->value.u[c];
754 data.b[c] = op[0]->value.i[c] >= op[1]->value.i[c];
757 data.b[c] = op[0]->value.f[c] >= op[1]->value.f[c];
765 assert(op[0]->type == op[1]->type);
767 switch (op[0]->type->base_type) {
769 data.b[c] = op[0]->value.u[c] == op[1]->value.u[c];
772 data.b[c] = op[0]->value.i[c] == op[1]->value.i[c];
775 data.b[c] = op[0]->value.f[c] == op[1]->value.f[c];
778 data.b[c] = op[0]->value.b[c] == op[1]->value.b[c];
786 assert(op[0]->type == op[1]->type);
788 switch (op[0]->type->base_type) {
790 data.b[c] = op[0]->value.u[c] != op[1]->value.u[c];
793 data.b[c] = op[0]->value.i[c] != op[1]->value.i[c];
796 data.b[c] = op[0]->value.f[c] != op[1]->value.f[c];
799 data.b[c] = op[0]->value.b[c] != op[1]->value.b[c];
807 data.b[0] = op[0]->has_value(op[1]);
810 data.b[0] = !op[0]->has_value(op[1]);
818 if (op[0]->type->base_type == GLSL_TYPE_INT &&
819 op[1]->type->base_type == GLSL_TYPE_INT) {
820 data.i[c] = op[0]->value.i[c0] << op[1]->value.i[c1];
822 } else if (op[0]->type->base_type == GLSL_TYPE_INT &&
823 op[1]->type->base_type == GLSL_TYPE_UINT) {
824 data.i[c] = op[0]->value.i[c0] << op[1]->value.u[c1];
826 } else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
827 op[1]->type->base_type == GLSL_TYPE_INT) {
828 data.u[c] = op[0]->value.u[c0] << op[1]->value.i[c1];
830 } else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
831 op[1]->type->base_type == GLSL_TYPE_UINT) {
832 data.u[c] = op[0]->value.u[c0] << op[1]->value.u[c1];
842 if (op[0]->type->base_type == GLSL_TYPE_INT &&
843 op[1]->type->base_type == GLSL_TYPE_INT) {
844 data.i[c] = op[0]->value.i[c0] >> op[1]->value.i[c1];
846 } else if (op[0]->type->base_type == GLSL_TYPE_INT &&
847 op[1]->type->base_type == GLSL_TYPE_UINT) {
848 data.i[c] = op[0]->value.i[c0] >> op[1]->value.u[c1];
850 } else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
851 op[1]->type->base_type == GLSL_TYPE_INT) {
852 data.u[c] = op[0]->value.u[c0] >> op[1]->value.i[c1];
854 } else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
855 op[1]->type->base_type == GLSL_TYPE_UINT) {
856 data.u[c] = op[0]->value.u[c0] >> op[1]->value.u[c1];
866 switch (op[0]->type->base_type) {
868 data.i[c] = op[0]->value.i[c0] & op[1]->value.i[c1];
871 data.u[c] = op[0]->value.u[c0] & op[1]->value.u[c1];
884 switch (op[0]->type->base_type) {
886 data.i[c] = op[0]->value.i[c0] | op[1]->value.i[c1];
889 data.u[c] = op[0]->value.u[c0] | op[1]->value.u[c1];
902 switch (op[0]->type->base_type) {
904 data.i[c] = op[0]->value.i[c0] ^ op[1]->value.i[c1];
907 data.u[c] = op[0]->value.u[c0] ^ op[1]->value.u[c1];
919 data.i[c] = op[c]->value.i[0];
922 data.u[c] = op[c]->value.u[0];
925 data.f[c] = op[c]->value.f[0];