Lines Matching refs:locp

33 void yyerror(YYLTYPE *locp,  in yyerror()  argument
43 for (int i = locp->first_column; i < locp->last_column; i++) { in yyerror()
52 code_ptr[locp->first_column - 10 + i] != '\0' && in yyerror()
53 code_ptr[locp->first_column - 10 + i] != '\n'; in yyerror()
55 fprintf(stderr, "%c", code_ptr[locp->first_column - 10 + i]); in yyerror()
62 for (int i = 0; i < (locp->last_column - locp->first_column) - 1; i++) { in yyerror()
80 void str_print(Context *c, YYLTYPE *locp, const char *string) in str_print() argument
82 (void) locp; in str_print()
86 void uint8_print(Context *c, YYLTYPE *locp, uint8_t *num) in uint8_print() argument
88 (void) locp; in uint8_print()
92 void uint64_print(Context *c, YYLTYPE *locp, uint64_t *num) in uint64_print() argument
94 (void) locp; in uint64_print()
98 void int_print(Context *c, YYLTYPE *locp, int *num) in int_print() argument
100 (void) locp; in int_print()
104 void uint_print(Context *c, YYLTYPE *locp, unsigned *num) in uint_print() argument
106 (void) locp; in uint_print()
110 void tmp_print(Context *c, YYLTYPE *locp, HexTmp *tmp) in tmp_print() argument
112 (void) locp; in tmp_print()
116 void pred_print(Context *c, YYLTYPE *locp, HexPred *pred, bool is_dotnew) in pred_print() argument
118 (void) locp; in pred_print()
123 void reg_compose(Context *c, YYLTYPE *locp, HexReg *reg, char reg_id[5]) in reg_compose() argument
153 yyassert(c, locp, false, "Unhandled register bit width!\n"); in reg_compose()
157 static void reg_arg_print(Context *c, YYLTYPE *locp, HexReg *reg) in reg_arg_print() argument
160 reg_compose(c, locp, reg, reg_id); in reg_arg_print()
164 void reg_print(Context *c, YYLTYPE *locp, HexReg *reg) in reg_print() argument
166 (void) locp; in reg_print()
170 void imm_print(Context *c, YYLTYPE *locp, HexValue *rvalue) in imm_print() argument
207 yyassert(c, locp, false, "Cannot print this expression!"); in imm_print()
211 void var_print(Context *c, YYLTYPE *locp, HexVar *var) in var_print() argument
213 (void) locp; in var_print()
217 void rvalue_print(Context *c, YYLTYPE *locp, void *pointer) in rvalue_print() argument
222 reg_print(c, locp, &rvalue->reg); in rvalue_print()
225 reg_arg_print(c, locp, &rvalue->reg); in rvalue_print()
228 tmp_print(c, locp, &rvalue->tmp); in rvalue_print()
231 imm_print(c, locp, rvalue); in rvalue_print()
234 var_print(c, locp, &rvalue->var); in rvalue_print()
237 pred_print(c, locp, &rvalue->pred, rvalue->is_dotnew); in rvalue_print()
240 yyassert(c, locp, false, "Cannot print this expression!"); in rvalue_print()
244 void out_assert(Context *c, YYLTYPE *locp, in out_assert() argument
247 yyassert(c, locp, false, "Unhandled print type!"); in out_assert()
273 static void gen_c_int_type(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_c_int_type() argument
277 OUT(c, locp, signstr, "int", &bit_width, "_t"); in gen_c_int_type()
281 YYLTYPE *locp, in gen_constant() argument
294 OUT(c, locp, "TCGv_i", &bit_width, " tmp_", &c->inst.tmp_count, in gen_constant()
302 YYLTYPE *locp, in gen_tmp() argument
314 OUT(c, locp, "TCGv_i", &bit_width, " tmp_", &c->inst.tmp_count, in gen_tmp()
321 YYLTYPE *locp, in gen_constant_from_imm() argument
344 OUT(c, locp, "TCGv_i", &rvalue.bit_width, " tmp_", &c->inst.tmp_count); in gen_constant_from_imm()
345 OUT(c, locp, " = tcg_constant_i", &rvalue.bit_width, in gen_constant_from_imm()
353 YYLTYPE *locp, in gen_imm_value() argument
358 (void) locp; in gen_imm_value()
371 HexValue gen_imm_qemu_tmp(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_imm_qemu_tmp() argument
374 (void) locp; in gen_imm_qemu_tmp()
387 HexValue rvalue_materialize(Context *c, YYLTYPE *locp, HexValue *rvalue) in rvalue_materialize() argument
390 return gen_constant_from_imm(c, locp, rvalue); in rvalue_materialize()
395 HexValue gen_rvalue_extend(Context *c, YYLTYPE *locp, HexValue *rvalue) in gen_rvalue_extend() argument
397 assert_signedness(c, locp, rvalue->signedness); in gen_rvalue_extend()
403 HexValue res = gen_imm_qemu_tmp(c, locp, 64, rvalue->signedness); in gen_rvalue_extend()
404 gen_c_int_type(c, locp, 64, rvalue->signedness); in gen_rvalue_extend()
405 OUT(c, locp, " ", &res, " = ("); in gen_rvalue_extend()
406 gen_c_int_type(c, locp, 64, rvalue->signedness); in gen_rvalue_extend()
407 OUT(c, locp, ")", rvalue, ";\n"); in gen_rvalue_extend()
410 HexValue res = gen_tmp(c, locp, 64, rvalue->signedness); in gen_rvalue_extend()
413 OUT(c, locp, "tcg_gen_ext", sign_suffix, in gen_rvalue_extend()
419 HexValue gen_rvalue_truncate(Context *c, YYLTYPE *locp, HexValue *rvalue) in gen_rvalue_truncate() argument
427 HexValue res = gen_tmp(c, locp, 32, rvalue->signedness); in gen_rvalue_truncate()
428 OUT(c, locp, "tcg_gen_trunc_i64_tl(", &res, ", ", rvalue, ");\n"); in gen_rvalue_truncate()
441 static bool try_find_variable(Context *c, YYLTYPE *locp, in try_find_variable() argument
445 yyassert(c, locp, varid, "varid to lookup is NULL"); in try_find_variable()
446 yyassert(c, locp, varid->type == VARID, in try_find_variable()
463 static void find_variable(Context *c, YYLTYPE *locp, in find_variable() argument
467 bool found = try_find_variable(c, locp, dst, varid); in find_variable()
468 yyassert(c, locp, found, "Use of undeclared variable!\n"); in find_variable()
472 static inline HexSignedness bin_op_signedness(Context *c, YYLTYPE *locp, in bin_op_signedness() argument
476 assert_signedness(c, locp, sign1); in bin_op_signedness()
477 assert_signedness(c, locp, sign2); in bin_op_signedness()
482 YYLTYPE *locp, in gen_varid_allocate() argument
488 bool found = try_find_variable(c, locp, NULL, varid); in gen_varid_allocate()
493 yyassert(c, locp, !found, "Redeclaration of variables not allowed!"); in gen_varid_allocate()
494 assert_signedness(c, locp, signedness); in gen_varid_allocate()
514 YYLTYPE *locp, in gen_bin_cmp() argument
527 HexValue res = gen_tmp(c, locp, bit_width, UNSIGNED); in gen_bin_cmp()
531 op1_m = gen_rvalue_extend(c, locp, &op1_m); in gen_bin_cmp()
532 op2_m = gen_rvalue_extend(c, locp, &op2_m); in gen_bin_cmp()
538 yyassert(c, locp, false, "Binary comparisons between IMM op IMM and" in gen_bin_cmp()
542 OUT(c, locp, "tcg_gen_setcondi_", bit_suffix, "("); in gen_bin_cmp()
543 OUT(c, locp, cond_to_str(type), ", ", &res, ", ", &op1_m, ", ", &op2_m, in gen_bin_cmp()
547 OUT(c, locp, "tcg_gen_setcond_", bit_suffix, "("); in gen_bin_cmp()
548 OUT(c, locp, cond_to_str(type), ", ", &res, ", ", &op1_m, ", ", &op2_m, in gen_bin_cmp()
558 static void gen_simple_op(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_simple_op() argument
570 HexSignedness signedness = bin_op_signedness(c, locp, in gen_simple_op()
573 gen_c_int_type(c, locp, bit_width, signedness); in gen_simple_op()
574 OUT(c, locp, " ", res, in gen_simple_op()
578 OUT(c, locp, imm_reg, bit_suffix, in gen_simple_op()
582 OUT(c, locp, reg_imm, bit_suffix, in gen_simple_op()
586 OUT(c, locp, reg_reg, bit_suffix, in gen_simple_op()
592 static void gen_sub_op(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_sub_op() argument
599 HexSignedness signedness = bin_op_signedness(c, locp, in gen_sub_op()
602 gen_c_int_type(c, locp, bit_width, signedness); in gen_sub_op()
603 OUT(c, locp, " ", res, in gen_sub_op()
607 OUT(c, locp, "tcg_gen_subfi_", bit_suffix, in gen_sub_op()
611 OUT(c, locp, "tcg_gen_subi_", bit_suffix, in gen_sub_op()
615 OUT(c, locp, "tcg_gen_sub_", bit_suffix, in gen_sub_op()
621 static void gen_asl_op(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_asl_op() argument
630 HexSignedness signedness = bin_op_signedness(c, locp, in gen_asl_op()
633 gen_c_int_type(c, locp, bit_width, signedness); in gen_asl_op()
634 OUT(c, locp, " ", res, in gen_asl_op()
638 OUT(c, locp, "if (", op2, " >= ", &bit_width, ") {\n"); in gen_asl_op()
639 OUT(c, locp, "tcg_gen_movi_", bit_suffix, "(", res, ", 0);\n"); in gen_asl_op()
640 OUT(c, locp, "} else {\n"); in gen_asl_op()
641 OUT(c, locp, "tcg_gen_shli_", bit_suffix, in gen_asl_op()
643 OUT(c, locp, "}\n"); in gen_asl_op()
647 op1_m = rvalue_materialize(c, locp, &op1_m); in gen_asl_op()
650 OUT(c, locp, "tcg_gen_shl_", bit_suffix, in gen_asl_op()
659 HexValue zero = gen_constant(c, locp, "0", bit_width, UNSIGNED); in gen_asl_op()
660 HexValue edge = gen_imm_value(c, locp, bit_width, bit_width, UNSIGNED); in gen_asl_op()
661 edge = rvalue_materialize(c, locp, &edge); in gen_asl_op()
663 op2_m = gen_rvalue_extend(c, locp, &op2_m); in gen_asl_op()
665 op1_m = rvalue_materialize(c, locp, &op1_m); in gen_asl_op()
666 op2_m = rvalue_materialize(c, locp, &op2_m); in gen_asl_op()
667 OUT(c, locp, "tcg_gen_movcond_i", &bit_width); in gen_asl_op()
668 OUT(c, locp, "(TCG_COND_GEU, ", res, ", ", &op2_m, ", ", &edge); in gen_asl_op()
669 OUT(c, locp, ", ", &zero, ", ", res, ");\n"); in gen_asl_op()
673 static void gen_asr_op(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_asr_op() argument
683 yyassert(c, locp, false, "ASR between IMM op IMM, and IMM op REG" in gen_asr_op()
687 HexSignedness signedness = bin_op_signedness(c, locp, in gen_asr_op()
690 OUT(c, locp, "{\n"); in gen_asr_op()
691 gen_c_int_type(c, locp, bit_width, signedness); in gen_asr_op()
692 OUT(c, locp, " shift = ", op2, ";\n"); in gen_asr_op()
693 OUT(c, locp, "if (", op2, " >= ", &bit_width, ") {\n"); in gen_asr_op()
694 OUT(c, locp, " shift = ", &bit_width, " - 1;\n"); in gen_asr_op()
695 OUT(c, locp, "}\n"); in gen_asr_op()
696 OUT(c, locp, "tcg_gen_sari_", bit_suffix, in gen_asr_op()
700 OUT(c, locp, "tcg_gen_sar_", bit_suffix, in gen_asr_op()
707 HexValue tmp = gen_tmp(c, locp, bit_width, SIGNED); in gen_asr_op()
708 HexValue zero = gen_constant(c, locp, "0", bit_width, SIGNED); in gen_asr_op()
709 HexValue edge = gen_imm_value(c, locp, bit_width, bit_width, UNSIGNED); in gen_asr_op()
711 edge = rvalue_materialize(c, locp, &edge); in gen_asr_op()
713 op2_m = gen_rvalue_extend(c, locp, &op2_m); in gen_asr_op()
715 op1_m = rvalue_materialize(c, locp, &op1_m); in gen_asr_op()
716 op2_m = rvalue_materialize(c, locp, &op2_m); in gen_asr_op()
718 OUT(c, locp, "tcg_gen_extract_", bit_suffix, "(", in gen_asr_op()
720 OUT(c, locp, "tcg_gen_sub_", bit_suffix, "(", in gen_asr_op()
722 OUT(c, locp, "tcg_gen_movcond_i", &bit_width); in gen_asr_op()
723 OUT(c, locp, "(TCG_COND_GEU, ", res, ", ", &op2_m, ", ", &edge); in gen_asr_op()
724 OUT(c, locp, ", ", &tmp, ", ", res, ");\n"); in gen_asr_op()
728 static void gen_lsr_op(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_lsr_op() argument
738 yyassert(c, locp, false, "LSR between IMM op IMM, and IMM op REG" in gen_lsr_op()
742 OUT(c, locp, "if (", op2, " >= ", &bit_width, ") {\n"); in gen_lsr_op()
743 OUT(c, locp, "tcg_gen_movi_", bit_suffix, "(", res, ", 0);\n"); in gen_lsr_op()
744 OUT(c, locp, "} else {\n"); in gen_lsr_op()
745 OUT(c, locp, "tcg_gen_shri_", bit_suffix, in gen_lsr_op()
747 OUT(c, locp, "}\n"); in gen_lsr_op()
750 OUT(c, locp, "tcg_gen_shr_", bit_suffix, in gen_lsr_op()
756 HexValue zero = gen_constant(c, locp, "0", bit_width, UNSIGNED); in gen_lsr_op()
757 HexValue edge = gen_imm_value(c, locp, bit_width, bit_width, UNSIGNED); in gen_lsr_op()
758 edge = rvalue_materialize(c, locp, &edge); in gen_lsr_op()
760 op2_m = gen_rvalue_extend(c, locp, &op2_m); in gen_lsr_op()
762 op1_m = rvalue_materialize(c, locp, &op1_m); in gen_lsr_op()
763 op2_m = rvalue_materialize(c, locp, &op2_m); in gen_lsr_op()
764 OUT(c, locp, "tcg_gen_movcond_i", &bit_width); in gen_lsr_op()
765 OUT(c, locp, "(TCG_COND_GEU, ", res, ", ", &op2_m, ", ", &edge); in gen_lsr_op()
766 OUT(c, locp, ", ", &zero, ", ", res, ");\n"); in gen_lsr_op()
774 static void gen_andl_op(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_andl_op() argument
781 HexValue zero = gen_constant(c, locp, "0", 32, UNSIGNED); in gen_andl_op()
788 yyassert(c, locp, false, "ANDL between IMM op IMM, IMM op REG, and" in gen_andl_op()
792 tmp1 = gen_bin_cmp(c, locp, TCG_COND_NE, op1, &zero); in gen_andl_op()
793 tmp2 = gen_bin_cmp(c, locp, TCG_COND_NE, op2, &zero); in gen_andl_op()
794 OUT(c, locp, "tcg_gen_and_", bit_suffix, in gen_andl_op()
800 static void gen_minmax_op(Context *c, YYLTYPE *locp, unsigned bit_width, in gen_minmax_op() argument
809 assert_signedness(c, locp, res->signedness); in gen_minmax_op()
821 yyassert(c, locp, false, "MINMAX between IMM op IMM, not handled!"); in gen_minmax_op()
825 op1_m = rvalue_materialize(c, locp, &op1_m); in gen_minmax_op()
826 OUT(c, locp, mm, "_i", &bit_width, "("); in gen_minmax_op()
827 OUT(c, locp, res, ", ", &op1_m, ", ", op2, ");\n"); in gen_minmax_op()
831 op2_m = rvalue_materialize(c, locp, &op2_m); in gen_minmax_op()
834 OUT(c, locp, mm, "_i", &bit_width, "("); in gen_minmax_op()
835 OUT(c, locp, res, ", ", op1, ", ", &op2_m, ");\n"); in gen_minmax_op()
842 YYLTYPE *locp, in gen_bin_op() argument
864 find_variable(c, locp, &op1_m, &op1_m); in gen_bin_op()
867 find_variable(c, locp, &op2_m, &op2_m); in gen_bin_op()
885 op1_m = gen_rvalue_extend(c, locp, &op1_m); in gen_bin_op()
886 op2_m = gen_rvalue_extend(c, locp, &op2_m); in gen_bin_op()
889 signedness = bin_op_signedness(c, locp, op1_m.signedness, op2_m.signedness); in gen_bin_op()
891 res = gen_tmp(c, locp, bit_width, signedness); in gen_bin_op()
893 res = gen_imm_qemu_tmp(c, locp, bit_width, signedness); in gen_bin_op()
898 gen_simple_op(c, locp, bit_width, bit_suffix, &res, in gen_bin_op()
906 gen_sub_op(c, locp, bit_width, bit_suffix, &res, op_types, in gen_bin_op()
910 gen_simple_op(c, locp, bit_width, bit_suffix, &res, in gen_bin_op()
918 gen_asl_op(c, locp, bit_width, op_is64bit, bit_suffix, &res, op_types, in gen_bin_op()
922 gen_asr_op(c, locp, bit_width, op_is64bit, bit_suffix, &res, op_types, in gen_bin_op()
926 gen_lsr_op(c, locp, bit_width, op_is64bit, bit_suffix, &res, op_types, in gen_bin_op()
930 gen_simple_op(c, locp, bit_width, bit_suffix, &res, in gen_bin_op()
938 gen_simple_op(c, locp, bit_width, bit_suffix, &res, in gen_bin_op()
946 gen_simple_op(c, locp, bit_width, bit_suffix, &res, in gen_bin_op()
954 gen_andl_op(c, locp, bit_width, bit_suffix, &res, op_types, &op1_m, in gen_bin_op()
958 gen_minmax_op(c, locp, bit_width, &res, op_types, &op1_m, &op2_m, in gen_bin_op()
962 gen_minmax_op(c, locp, bit_width, &res, op_types, &op1_m, &op2_m, true); in gen_bin_op()
969 YYLTYPE *locp, in gen_cast_op() argument
975 assert_signedness(c, locp, src->signedness); in gen_cast_op()
979 res = gen_rvalue_extend(c, locp, src); in gen_cast_op()
982 res = gen_rvalue_truncate(c, locp, src); in gen_cast_op()
996 YYLTYPE *locp, in gen_extend_imm_width_op() argument
1010 assert_signedness(c, locp, signedness); in gen_extend_imm_width_op()
1023 return gen_imm_value(c, locp, 0, dst_width, signedness); in gen_extend_imm_width_op()
1032 HexValue res = gen_imm_qemu_tmp(c, locp, dst_width, signedness); in gen_extend_imm_width_op()
1033 gen_c_int_type(c, locp, dst_width, signedness); in gen_extend_imm_width_op()
1034 OUT(c, locp, " ", &res, " = 0;\n"); in gen_extend_imm_width_op()
1036 OUT(c, locp, "if (", src_width, " != 0) {\n"); in gen_extend_imm_width_op()
1038 OUT(c, locp, &res, " = ", sign_prefix, "extract", &dst_width); in gen_extend_imm_width_op()
1039 OUT(c, locp, "(", value, ", 0, ", src_width, ");\n"); in gen_extend_imm_width_op()
1041 OUT(c, locp, "}\n"); in gen_extend_imm_width_op()
1049 HexValue res = gen_tmp(c, locp, dst_width, signedness); in gen_extend_imm_width_op()
1056 OUT(c, locp, "if (", src_width, " != 0) {\n"); in gen_extend_imm_width_op()
1058 OUT(c, locp, "tcg_gen_", sign_prefix, "extract_i", &dst_width); in gen_extend_imm_width_op()
1059 OUT(c, locp, "(", &res, ", ", value, ", 0, ", src_width, in gen_extend_imm_width_op()
1062 OUT(c, locp, "} else {\n"); in gen_extend_imm_width_op()
1063 OUT(c, locp, "tcg_gen_movi_i", &dst_width, "(", &res, in gen_extend_imm_width_op()
1065 OUT(c, locp, "}\n"); in gen_extend_imm_width_op()
1077 YYLTYPE *locp, in gen_extend_tcg_width_op() argument
1083 HexValue src_width_m = rvalue_materialize(c, locp, src_width); in gen_extend_tcg_width_op()
1084 HexValue zero = gen_constant(c, locp, "0", dst_width, UNSIGNED); in gen_extend_tcg_width_op()
1085 HexValue shift = gen_tmp(c, locp, dst_width, UNSIGNED); in gen_extend_tcg_width_op()
1088 assert_signedness(c, locp, signedness); in gen_extend_tcg_width_op()
1092 res = gen_tmp(c, locp, dst_width, signedness); in gen_extend_tcg_width_op()
1094 OUT(c, locp, "tcg_gen_subfi_i", &dst_width); in gen_extend_tcg_width_op()
1095 OUT(c, locp, "(", &shift, ", ", &dst_width, ", ", &src_width_m, ");\n"); in gen_extend_tcg_width_op()
1097 HexValue mask = gen_constant(c, locp, "-1", dst_width, UNSIGNED); in gen_extend_tcg_width_op()
1098 OUT(c, locp, "tcg_gen_shr_i", &dst_width, "(", in gen_extend_tcg_width_op()
1100 OUT(c, locp, "tcg_gen_and_i", &dst_width, "(", in gen_extend_tcg_width_op()
1103 OUT(c, locp, "tcg_gen_shl_i", &dst_width, "(", in gen_extend_tcg_width_op()
1105 OUT(c, locp, "tcg_gen_sar_i", &dst_width, "(", in gen_extend_tcg_width_op()
1108 OUT(c, locp, "tcg_gen_movcond_i", &dst_width, "(TCG_COND_EQ, ", &res, in gen_extend_tcg_width_op()
1110 OUT(c, locp, &src_width_m, ", ", &zero, ", ", &zero, ", ", &res, in gen_extend_tcg_width_op()
1117 YYLTYPE *locp, in gen_extend_op() argument
1127 assert_signedness(c, locp, signedness); in gen_extend_op()
1128 yyassert(c, locp, value_m.bit_width <= bit_width && in gen_extend_op()
1134 value_m = gen_rvalue_extend(c, locp, &value_m); in gen_extend_op()
1138 src_width_m = gen_rvalue_extend(c, locp, &src_width_m); in gen_extend_op()
1142 return gen_extend_imm_width_op(c, locp, &src_width_m, bit_width, in gen_extend_op()
1145 return gen_extend_tcg_width_op(c, locp, &src_width_m, bit_width, in gen_extend_op()
1159 YYLTYPE *locp, in gen_rdeposit_op() argument
1175 HexValue mask = gen_constant(c, locp, mask_str, dst->bit_width, in gen_rdeposit_op()
1178 HexValue k64 = gen_constant(c, locp, dst_width_str, dst->bit_width, in gen_rdeposit_op()
1187 yyassert(c, locp, width->type != IMMEDIATE, in gen_rdeposit_op()
1190 yyassert(c, locp, value_m.bit_width == dst->bit_width && in gen_rdeposit_op()
1196 width_m = rvalue_materialize(c, locp, &width_m); in gen_rdeposit_op()
1206 k64 = gen_bin_op(c, locp, SUB_OP, &k64, &width_m); in gen_rdeposit_op()
1207 mask = gen_bin_op(c, locp, LSR_OP, &mask, &k64); in gen_rdeposit_op()
1208 mask = gen_bin_op(c, locp, ASL_OP, &mask, &begin_m); in gen_rdeposit_op()
1209 value_m = gen_bin_op(c, locp, ASL_OP, &value_m, &begin_m); in gen_rdeposit_op()
1210 value_m = gen_bin_op(c, locp, ANDB_OP, &value_m, &mask); in gen_rdeposit_op()
1212 OUT(c, locp, "tcg_gen_not_i", &dst->bit_width, "(", &mask, ", ", in gen_rdeposit_op()
1214 res = gen_bin_op(c, locp, ANDB_OP, dst, &mask); in gen_rdeposit_op()
1215 res = gen_bin_op(c, locp, ORB_OP, &res, &value_m); in gen_rdeposit_op()
1223 zero = gen_constant(c, locp, "0", res.bit_width, UNSIGNED); in gen_rdeposit_op()
1224 OUT(c, locp, "tcg_gen_movcond_i", &res.bit_width, "(TCG_COND_NE, ", in gen_rdeposit_op()
1226 OUT(c, locp, ", ", &width_m, ", ", &zero, ", ", &res, ", ", dst, in gen_rdeposit_op()
1231 YYLTYPE *locp, in gen_deposit_op() argument
1241 yyassert(c, locp, index->type == IMMEDIATE, in gen_deposit_op()
1248 gen_inst_init_args(c, locp); in gen_deposit_op()
1253 value_m = gen_rvalue_truncate(c, locp, &value_m); in gen_deposit_op()
1255 value_m = gen_rvalue_extend(c, locp, &value_m); in gen_deposit_op()
1258 value_m = rvalue_materialize(c, locp, &value_m); in gen_deposit_op()
1259 OUT(c, locp, "tcg_gen_deposit_i", &bit_width, "(", dst, ", ", dst, ", "); in gen_deposit_op()
1260 OUT(c, locp, &value_m, ", ", index, " * ", &width, ", ", &width, ");\n"); in gen_deposit_op()
1264 YYLTYPE *locp, in gen_rextract_op() argument
1270 HexValue res = gen_tmp(c, locp, bit_width, UNSIGNED); in gen_rextract_op()
1271 OUT(c, locp, "tcg_gen_extract_i", &bit_width, "(", &res); in gen_rextract_op()
1272 OUT(c, locp, ", ", src, ", ", &begin, ", ", &width, ");\n"); in gen_rextract_op()
1277 YYLTYPE *locp, in gen_extract_op() argument
1287 yyassert(c, locp, index->type == IMMEDIATE, in gen_extract_op()
1289 assert_signedness(c, locp, extract->signedness); in gen_extract_op()
1292 res = gen_tmp(c, locp, bit_width, extract->signedness); in gen_extract_op()
1294 OUT(c, locp, "tcg_gen_", sign_prefix, "extract_i", &bit_width, in gen_extract_op()
1296 OUT(c, locp, ", ", index, " * ", &width, ", ", &width, ");\n"); in gen_extract_op()
1300 HexValue tmp = gen_tmp(c, locp, extract->storage_bit_width, in gen_extract_op()
1303 OUT(c, locp, "tcg_gen_ext", sign_suffix, "_i32_i64(", in gen_extract_op()
1310 void gen_write_reg(Context *c, YYLTYPE *locp, HexValue *reg, HexValue *value) in gen_write_reg() argument
1313 yyassert(c, locp, reg->type == REGISTER, "reg must be a register!"); in gen_write_reg()
1314 value_m = gen_rvalue_truncate(c, locp, &value_m); in gen_write_reg()
1315 value_m = rvalue_materialize(c, locp, &value_m); in gen_write_reg()
1317 locp, in gen_write_reg()
1323 YYLTYPE *locp, in gen_assign() argument
1330 yyassert(c, locp, !is_inside_ternary(c), in gen_assign()
1334 gen_write_reg(c, locp, dst, &value_m); in gen_assign()
1339 find_variable(c, locp, dst, dst); in gen_assign()
1345 value_m = gen_rvalue_extend(c, locp, &value_m); in gen_assign()
1347 value_m = gen_rvalue_truncate(c, locp, &value_m); in gen_assign()
1352 OUT(c, locp, "tcg_gen_mov", imm_suffix, "_i", &bit_width, in gen_assign()
1357 YYLTYPE *locp, in gen_convround() argument
1363 HexValue res = gen_tmp(c, locp, bit_width, src->signedness); in gen_convround()
1364 HexValue mask = gen_constant(c, locp, "0x3", bit_width, UNSIGNED); in gen_convround()
1365 HexValue one = gen_constant(c, locp, "1", bit_width, UNSIGNED); in gen_convround()
1369 and = gen_bin_op(c, locp, ANDB_OP, &src_m, &mask); in gen_convround()
1370 src_p1 = gen_bin_op(c, locp, ADD_OP, &src_m, &one); in gen_convround()
1372 OUT(c, locp, "tcg_gen_movcond_i", size, "(TCG_COND_EQ, ", &res); in gen_convround()
1373 OUT(c, locp, ", ", &and, ", ", &mask, ", "); in gen_convround()
1374 OUT(c, locp, &src_p1, ", ", &src_m, ");\n"); in gen_convround()
1380 YYLTYPE *locp, in gen_convround_n_b() argument
1384 HexValue one = gen_constant(c, locp, "1", 32, UNSIGNED); in gen_convround_n_b()
1385 HexValue res = gen_tmp(c, locp, 64, UNSIGNED); in gen_convround_n_b()
1386 HexValue tmp = gen_tmp(c, locp, 32, UNSIGNED); in gen_convround_n_b()
1387 HexValue tmp_64 = gen_tmp(c, locp, 64, UNSIGNED); in gen_convround_n_b()
1390 OUT(c, locp, "tcg_gen_ext_i32_i64(", &res, ", ", a, ");\n"); in gen_convround_n_b()
1391 OUT(c, locp, "tcg_gen_shl_i32(", &tmp); in gen_convround_n_b()
1392 OUT(c, locp, ", ", &one, ", ", n, ");\n"); in gen_convround_n_b()
1393 OUT(c, locp, "tcg_gen_and_i32(", &tmp); in gen_convround_n_b()
1394 OUT(c, locp, ", ", &tmp, ", ", a, ");\n"); in gen_convround_n_b()
1395 OUT(c, locp, "tcg_gen_shri_i32(", &tmp); in gen_convround_n_b()
1396 OUT(c, locp, ", ", &tmp, ", 1);\n"); in gen_convround_n_b()
1397 OUT(c, locp, "tcg_gen_ext_i32_i64(", &tmp_64, ", ", &tmp, ");\n"); in gen_convround_n_b()
1398 OUT(c, locp, "tcg_gen_add_i64(", &res); in gen_convround_n_b()
1399 OUT(c, locp, ", ", &res, ", ", &tmp_64, ");\n"); in gen_convround_n_b()
1405 YYLTYPE *locp, in gen_convround_n_c() argument
1409 HexValue res = gen_tmp(c, locp, 64, UNSIGNED); in gen_convround_n_c()
1410 HexValue one = gen_constant(c, locp, "1", 32, UNSIGNED); in gen_convround_n_c()
1411 HexValue tmp = gen_tmp(c, locp, 32, UNSIGNED); in gen_convround_n_c()
1412 HexValue tmp_64 = gen_tmp(c, locp, 64, UNSIGNED); in gen_convround_n_c()
1414 OUT(c, locp, "tcg_gen_ext_i32_i64(", &res, ", ", a, ");\n"); in gen_convround_n_c()
1415 OUT(c, locp, "tcg_gen_subi_i32(", &tmp); in gen_convround_n_c()
1416 OUT(c, locp, ", ", n, ", 1);\n"); in gen_convround_n_c()
1417 OUT(c, locp, "tcg_gen_shl_i32(", &tmp); in gen_convround_n_c()
1418 OUT(c, locp, ", ", &one, ", ", &tmp, ");\n"); in gen_convround_n_c()
1419 OUT(c, locp, "tcg_gen_ext_i32_i64(", &tmp_64, ", ", &tmp, ");\n"); in gen_convround_n_c()
1420 OUT(c, locp, "tcg_gen_add_i64(", &res); in gen_convround_n_c()
1421 OUT(c, locp, ", ", &res, ", ", &tmp_64, ");\n"); in gen_convround_n_c()
1427 YYLTYPE *locp, in gen_convround_n() argument
1431 HexValue zero = gen_constant(c, locp, "0", 64, UNSIGNED); in gen_convround_n()
1432 HexValue l_32 = gen_constant(c, locp, "1", 32, UNSIGNED); in gen_convround_n()
1433 HexValue cond = gen_tmp(c, locp, 32, UNSIGNED); in gen_convround_n()
1434 HexValue cond_64 = gen_tmp(c, locp, 64, UNSIGNED); in gen_convround_n()
1435 HexValue mask = gen_tmp(c, locp, 32, UNSIGNED); in gen_convround_n()
1436 HexValue n_64 = gen_tmp(c, locp, 64, UNSIGNED); in gen_convround_n()
1437 HexValue res = gen_tmp(c, locp, 64, UNSIGNED); in gen_convround_n()
1439 HexValue src_casted = gen_cast_op(c, locp, src, 32, src->signedness); in gen_convround_n()
1440 HexValue pos_casted = gen_cast_op(c, locp, pos, 32, pos->signedness); in gen_convround_n()
1445 src_casted = rvalue_materialize(c, locp, &src_casted); in gen_convround_n()
1446 pos_casted = rvalue_materialize(c, locp, &pos_casted); in gen_convround_n()
1455 r1 = gen_rvalue_extend(c, locp, &src_casted); in gen_convround_n()
1456 r2 = gen_convround_n_b(c, locp, &src_casted, &pos_casted); in gen_convround_n()
1457 r3 = gen_convround_n_c(c, locp, &src_casted, &pos_casted); in gen_convround_n()
1464 OUT(c, locp, "tcg_gen_sub_i32(", &mask); in gen_convround_n()
1465 OUT(c, locp, ", ", &pos_casted, ", ", &l_32, ");\n"); in gen_convround_n()
1466 OUT(c, locp, "tcg_gen_shl_i32(", &mask); in gen_convround_n()
1467 OUT(c, locp, ", ", &l_32, ", ", &mask, ");\n"); in gen_convround_n()
1468 OUT(c, locp, "tcg_gen_sub_i32(", &mask); in gen_convround_n()
1469 OUT(c, locp, ", ", &mask, ", ", &l_32, ");\n"); in gen_convround_n()
1470 OUT(c, locp, "tcg_gen_and_i32(", &cond); in gen_convround_n()
1471 OUT(c, locp, ", ", &src_casted, ", ", &mask, ");\n"); in gen_convround_n()
1472 OUT(c, locp, "tcg_gen_extu_i32_i64(", &cond_64, ", ", &cond, ");\n"); in gen_convround_n()
1474 OUT(c, locp, "tcg_gen_ext_i32_i64(", &n_64, ", ", &pos_casted, ");\n"); in gen_convround_n()
1480 OUT(c, locp, "tcg_gen_movcond_i64"); in gen_convround_n()
1481 OUT(c, locp, "(TCG_COND_EQ, ", &res, ", ", &cond_64, ", ", &zero); in gen_convround_n()
1482 OUT(c, locp, ", ", &r2, ", ", &r3, ");\n"); in gen_convround_n()
1485 OUT(c, locp, "tcg_gen_movcond_i64"); in gen_convround_n()
1486 OUT(c, locp, "(TCG_COND_EQ, ", &res, ", ", &n_64, ", ", &zero); in gen_convround_n()
1487 OUT(c, locp, ", ", &r1, ", ", &res, ");\n"); in gen_convround_n()
1490 OUT(c, locp, "tcg_gen_shr_i64(", &res); in gen_convround_n()
1491 OUT(c, locp, ", ", &res, ", ", &n_64, ");\n"); in gen_convround_n()
1493 res = gen_rvalue_truncate(c, locp, &res); in gen_convround_n()
1498 YYLTYPE *locp, in gen_round() argument
1502 HexValue zero = gen_constant(c, locp, "0", 64, UNSIGNED); in gen_round()
1503 HexValue one = gen_constant(c, locp, "1", 64, UNSIGNED); in gen_round()
1512 assert_signedness(c, locp, src->signedness); in gen_round()
1513 yyassert(c, locp, src->bit_width <= 32, in gen_round()
1516 res = gen_tmp(c, locp, 64, src->signedness); in gen_round()
1518 src_width = gen_imm_value(c, locp, src->bit_width, 32, UNSIGNED); in gen_round()
1519 a = gen_extend_op(c, locp, &src_width, 64, src, SIGNED); in gen_round()
1520 a = rvalue_materialize(c, locp, &a); in gen_round()
1522 src_width = gen_imm_value(c, locp, 5, 32, UNSIGNED); in gen_round()
1523 b = gen_extend_op(c, locp, &src_width, 64, pos, UNSIGNED); in gen_round()
1524 b = rvalue_materialize(c, locp, &b); in gen_round()
1526 n_m1 = gen_bin_op(c, locp, SUB_OP, &b, &one); in gen_round()
1527 shifted = gen_bin_op(c, locp, ASL_OP, &one, &n_m1); in gen_round()
1528 sum = gen_bin_op(c, locp, ADD_OP, &shifted, &a); in gen_round()
1530 OUT(c, locp, "tcg_gen_movcond_i64"); in gen_round()
1531 OUT(c, locp, "(TCG_COND_EQ, ", &res, ", ", &b, ", ", &zero); in gen_round()
1532 OUT(c, locp, ", ", &a, ", ", &sum, ");\n"); in gen_round()
1539 YYLTYPE *locp, in gen_circ_op() argument
1545 increment_m = rvalue_materialize(c, locp, &increment_m); in gen_circ_op()
1547 locp, in gen_circ_op()
1556 OUT(c, locp, ", CS);\n"); in gen_circ_op()
1559 HexValue gen_locnt_op(Context *c, YYLTYPE *locp, HexValue *src) in gen_locnt_op() argument
1565 assert_signedness(c, locp, src->signedness); in gen_locnt_op()
1566 res = gen_tmp(c, locp, src->bit_width == 64 ? 64 : 32, src->signedness); in gen_locnt_op()
1567 src_m = rvalue_materialize(c, locp, &src_m); in gen_locnt_op()
1568 OUT(c, locp, "tcg_gen_not_i", bit_suffix, "(", in gen_locnt_op()
1570 OUT(c, locp, "tcg_gen_clzi_i", bit_suffix, "(", &res, ", ", &res, ", "); in gen_locnt_op()
1571 OUT(c, locp, bit_suffix, ");\n"); in gen_locnt_op()
1575 HexValue gen_ctpop_op(Context *c, YYLTYPE *locp, HexValue *src) in gen_ctpop_op() argument
1580 assert_signedness(c, locp, src->signedness); in gen_ctpop_op()
1581 res = gen_tmp(c, locp, src->bit_width == 64 ? 64 : 32, src->signedness); in gen_ctpop_op()
1582 src_m = rvalue_materialize(c, locp, &src_m); in gen_ctpop_op()
1583 OUT(c, locp, "tcg_gen_ctpop_i", bit_suffix, in gen_ctpop_op()
1588 HexValue gen_rotl(Context *c, YYLTYPE *locp, HexValue *src, HexValue *width) in gen_rotl() argument
1593 assert_signedness(c, locp, src->signedness); in gen_rotl()
1594 res = gen_tmp(c, locp, src->bit_width, src->signedness); in gen_rotl()
1596 amount = gen_rvalue_extend(c, locp, &amount); in gen_rotl()
1598 amount = gen_rvalue_truncate(c, locp, &amount); in gen_rotl()
1600 amount = rvalue_materialize(c, locp, &amount); in gen_rotl()
1601 OUT(c, locp, "tcg_gen_rotl_", suffix, "(", in gen_rotl()
1608 YYLTYPE *locp, in gen_carry_from_add() argument
1613 HexValue zero = gen_constant(c, locp, "0", 64, UNSIGNED); in gen_carry_from_add()
1614 HexValue res = gen_tmp(c, locp, 64, UNSIGNED); in gen_carry_from_add()
1615 HexValue cf = gen_tmp(c, locp, 64, UNSIGNED); in gen_carry_from_add()
1616 HexValue op1_m = rvalue_materialize(c, locp, op1); in gen_carry_from_add()
1617 HexValue op2_m = rvalue_materialize(c, locp, op2); in gen_carry_from_add()
1618 HexValue op3_m = rvalue_materialize(c, locp, op3); in gen_carry_from_add()
1619 op3_m = gen_rvalue_extend(c, locp, &op3_m); in gen_carry_from_add()
1621 OUT(c, locp, "tcg_gen_add2_i64(", &res, ", ", &cf, ", ", &op1_m, ", ", in gen_carry_from_add()
1623 OUT(c, locp, ", ", &op3_m, ", ", &zero, ");\n"); in gen_carry_from_add()
1624 OUT(c, locp, "tcg_gen_add2_i64(", &res, ", ", &cf, ", ", &res, ", ", &cf); in gen_carry_from_add()
1625 OUT(c, locp, ", ", &op2_m, ", ", &zero, ");\n"); in gen_carry_from_add()
1631 YYLTYPE *locp, in gen_addsat64() argument
1636 HexValue op1_m = rvalue_materialize(c, locp, op1); in gen_addsat64()
1637 HexValue op2_m = rvalue_materialize(c, locp, op2); in gen_addsat64()
1638 OUT(c, locp, "gen_add_sat_i64(ctx, ", dst, ", ", &op1_m, ", ", in gen_addsat64()
1659 void gen_inst_init_args(Context *c, YYLTYPE *locp) in gen_inst_init_args() argument
1672 yyassert(c, locp, val->type == PREDICATE, in gen_inst_init_args()
1674 yyassert(c, locp, val->bit_width == 32, in gen_inst_init_args()
1684 void gen_inst_code(Context *c, YYLTYPE *locp) in gen_inst_code() argument
1700 void gen_pred_assign(Context *c, YYLTYPE *locp, HexValue *left_pred, in gen_pred_assign() argument
1705 HexValue r = rvalue_materialize(c, locp, right_pred); in gen_pred_assign()
1706 r = gen_rvalue_truncate(c, locp, &r); in gen_pred_assign()
1707 yyassert(c, locp, !is_inside_ternary(c), in gen_pred_assign()
1711 *left_pred = gen_tmp(c, locp, 32, UNSIGNED); in gen_pred_assign()
1714 OUT(c, locp, "tcg_gen_andi_i32(", left_pred, ", ", &r, ", 0xff);\n"); in gen_pred_assign()
1716 OUT(c, locp, "gen_log_pred_write(ctx, ", pred_id, ", ", left_pred, in gen_pred_assign()
1721 void gen_cancel(Context *c, YYLTYPE *locp) in gen_cancel() argument
1723 OUT(c, locp, "gen_cancel(insn->slot);\n"); in gen_cancel()
1726 void gen_load_cancel(Context *c, YYLTYPE *locp) in gen_load_cancel() argument
1728 OUT(c, locp, "if (insn->slot == 0 && pkt->pkt_has_store_s1) {\n"); in gen_load_cancel()
1729 OUT(c, locp, "ctx->s1_store_processed = false;\n"); in gen_load_cancel()
1730 OUT(c, locp, "process_store(ctx, 1);\n"); in gen_load_cancel()
1731 OUT(c, locp, "}\n"); in gen_load_cancel()
1734 void gen_load(Context *c, YYLTYPE *locp, HexValue *width, in gen_load() argument
1741 assert_signedness(c, locp, signedness); in gen_load()
1745 find_variable(c, locp, dst, dst); in gen_load()
1752 find_variable(c, locp, ea, ea); in gen_load()
1753 OUT(c, locp, "if (insn->slot == 0 && pkt->pkt_has_store_s1) {\n"); in gen_load()
1754 OUT(c, locp, "probe_noshuf_load(", ea, ", ", width, ", ctx->mem_idx);\n"); in gen_load()
1755 OUT(c, locp, "process_store(ctx, 1);\n"); in gen_load()
1756 OUT(c, locp, "}\n"); in gen_load()
1758 OUT(c, locp, "tcg_gen_qemu_ld_i", &dst_bit_width); in gen_load()
1759 OUT(c, locp, "("); in gen_load()
1760 OUT(c, locp, dst, ", ", ea, ", ctx->mem_idx, MO_", &src_bit_width); in gen_load()
1762 OUT(c, locp, " | MO_SIGN"); in gen_load()
1764 OUT(c, locp, " | MO_TE);\n"); in gen_load()
1767 void gen_store(Context *c, YYLTYPE *locp, HexValue *width, HexValue *ea, in gen_store() argument
1774 find_variable(c, locp, ea, ea); in gen_store()
1775 src_m = rvalue_materialize(c, locp, &src_m); in gen_store()
1776 OUT(c, locp, "gen_store", &mem_width, "(tcg_env, ", ea, ", ", &src_m); in gen_store()
1777 OUT(c, locp, ", insn->slot);\n"); in gen_store()
1780 void gen_sethalf(Context *c, YYLTYPE *locp, HexCast *sh, HexValue *n, in gen_sethalf() argument
1783 yyassert(c, locp, n->type == IMMEDIATE, in gen_sethalf()
1786 find_variable(c, locp, dst, dst); in gen_sethalf()
1789 gen_deposit_op(c, locp, dst, value, n, sh); in gen_sethalf()
1792 void gen_setbits(Context *c, YYLTYPE *locp, HexValue *hi, HexValue *lo, in gen_setbits() argument
1798 yyassert(c, locp, hi->type == IMMEDIATE && in gen_setbits()
1804 *value = gen_rvalue_truncate(c, locp, value); in gen_setbits()
1806 tmp = gen_tmp(c, locp, 32, value->signedness); in gen_setbits()
1808 OUT(c, locp, "tcg_gen_andi_i32(", &tmp, ", ", value, ", 1);\n"); in gen_setbits()
1810 OUT(c, locp, "tcg_gen_neg_i32(", &tmp, ", ", &tmp, ");\n"); in gen_setbits()
1811 OUT(c, locp, "tcg_gen_deposit_i32(", dst, ", ", dst, in gen_setbits()
1813 OUT(c, locp, lo, ", ", &len, ");\n"); in gen_setbits()
1816 unsigned gen_if_cond(Context *c, YYLTYPE *locp, HexValue *cond) in gen_if_cond() argument
1820 OUT(c, locp, "TCGLabel *if_label_", &c->inst.if_count, in gen_if_cond()
1822 *cond = rvalue_materialize(c, locp, cond); in gen_if_cond()
1824 OUT(c, locp, "tcg_gen_brcondi_", bit_suffix, "(TCG_COND_EQ, ", cond, in gen_if_cond()
1829 unsigned gen_if_else(Context *c, YYLTYPE *locp, unsigned index) in gen_if_else() argument
1833 OUT(c, locp, "TCGLabel *if_label_", &if_index, in gen_if_else()
1836 OUT(c, locp, "tcg_gen_br(if_label_", &if_index, ");\n"); in gen_if_else()
1838 OUT(c, locp, "gen_set_label(if_label_", &index, ");\n"); in gen_if_else()
1842 HexValue gen_rvalue_pred(Context *c, YYLTYPE *locp, HexValue *pred) in gen_rvalue_pred() argument
1845 gen_inst_init_args(c, locp); in gen_rvalue_pred()
1851 *pred = gen_tmp(c, locp, 32, UNSIGNED); in gen_rvalue_pred()
1853 OUT(c, locp, "tcg_gen_mov_i32(", pred, in gen_rvalue_pred()
1855 OUT(c, locp, pred_str, "]);\n"); in gen_rvalue_pred()
1857 OUT(c, locp, "gen_read_preg(", pred, ", ", pred_str, ");\n"); in gen_rvalue_pred()
1864 HexValue gen_rvalue_var(Context *c, YYLTYPE *locp, HexValue *var) in gen_rvalue_var() argument
1866 find_variable(c, locp, var, var); in gen_rvalue_var()
1870 HexValue gen_rvalue_mpy(Context *c, YYLTYPE *locp, HexMpy *mpy, in gen_rvalue_mpy() argument
1876 assert_signedness(c, locp, mpy->first_signedness); in gen_rvalue_mpy()
1877 assert_signedness(c, locp, mpy->second_signedness); in gen_rvalue_mpy()
1879 *op1 = gen_cast_op(c, locp, op1, mpy->first_bit_width * 2, in gen_rvalue_mpy()
1883 *op2 = gen_cast_op(c, locp, op2, 64, mpy->second_signedness); in gen_rvalue_mpy()
1885 *op2 = gen_cast_op(c, locp, op2, mpy->second_bit_width * 2, in gen_rvalue_mpy()
1888 res = gen_bin_op(c, locp, MUL_OP, op1, op2); in gen_rvalue_mpy()
1891 HexValue src_width = gen_imm_value(c, locp, 32, 32, UNSIGNED); in gen_rvalue_mpy()
1892 HexSignedness signedness = bin_op_signedness(c, locp, in gen_rvalue_mpy()
1895 res = gen_extend_op(c, locp, &src_width, 64, &res, in gen_rvalue_mpy()
1901 static inline HexValue gen_rvalue_simple_unary(Context *c, YYLTYPE *locp, in gen_rvalue_simple_unary() argument
1909 res = gen_imm_qemu_tmp(c, locp, bit_width, value->signedness); in gen_rvalue_simple_unary()
1910 gen_c_int_type(c, locp, value->bit_width, value->signedness); in gen_rvalue_simple_unary()
1911 OUT(c, locp, " ", &res, " = ", c_code, "(", value, ");\n"); in gen_rvalue_simple_unary()
1913 res = gen_tmp(c, locp, bit_width, value->signedness); in gen_rvalue_simple_unary()
1914 OUT(c, locp, tcg_code, "_i", &bit_width, "(", &res, ", ", value, in gen_rvalue_simple_unary()
1921 HexValue gen_rvalue_not(Context *c, YYLTYPE *locp, HexValue *value) in gen_rvalue_not() argument
1923 return gen_rvalue_simple_unary(c, locp, value, "~", "tcg_gen_not"); in gen_rvalue_not()
1926 HexValue gen_rvalue_notl(Context *c, YYLTYPE *locp, HexValue *value) in gen_rvalue_notl() argument
1931 res = gen_imm_qemu_tmp(c, locp, bit_width, value->signedness); in gen_rvalue_notl()
1932 gen_c_int_type(c, locp, value->bit_width, value->signedness); in gen_rvalue_notl()
1933 OUT(c, locp, " ", &res, " = !(", value, ");\n"); in gen_rvalue_notl()
1935 HexValue zero = gen_constant(c, locp, "0", bit_width, UNSIGNED); in gen_rvalue_notl()
1936 HexValue one = gen_constant(c, locp, "0xff", bit_width, UNSIGNED); in gen_rvalue_notl()
1937 res = gen_tmp(c, locp, bit_width, value->signedness); in gen_rvalue_notl()
1938 OUT(c, locp, "tcg_gen_movcond_i", &bit_width); in gen_rvalue_notl()
1939 OUT(c, locp, "(TCG_COND_EQ, ", &res, ", ", value, ", ", &zero); in gen_rvalue_notl()
1940 OUT(c, locp, ", ", &one, ", ", &zero, ");\n"); in gen_rvalue_notl()
1945 HexValue gen_rvalue_sat(Context *c, YYLTYPE *locp, HexSat *sat, in gen_rvalue_sat() argument
1957 yyassert(c, locp, width->imm.value < value->bit_width, in gen_rvalue_sat()
1960 yyassert(c, locp, !is_inside_ternary(c), in gen_rvalue_sat()
1962 assert_signedness(c, locp, sat->signedness); in gen_rvalue_sat()
1965 res = gen_tmp(c, locp, value->bit_width, sat->signedness); in gen_rvalue_sat()
1966 ovfl = gen_tmp(c, locp, 32, sat->signedness); in gen_rvalue_sat()
1967 OUT(c, locp, "gen_sat", unsigned_str, "_", bit_suffix, "_ovfl("); in gen_rvalue_sat()
1968 OUT(c, locp, &ovfl, ", ", &res, ", ", value, ", ", &width->imm.value, in gen_rvalue_sat()
1970 OUT(c, locp, "gen_set_usr_field_if(ctx, USR_OVF,", &ovfl, ");\n"); in gen_rvalue_sat()
1975 HexValue gen_rvalue_fscr(Context *c, YYLTYPE *locp, HexValue *value) in gen_rvalue_fscr() argument
1977 HexValue key = gen_tmp(c, locp, 64, UNSIGNED); in gen_rvalue_fscr()
1978 HexValue res = gen_tmp(c, locp, 64, UNSIGNED); in gen_rvalue_fscr()
1979 HexValue frame_key = gen_tmp(c, locp, 32, UNSIGNED); in gen_rvalue_fscr()
1980 *value = gen_rvalue_extend(c, locp, value); in gen_rvalue_fscr()
1981 OUT(c, locp, "gen_read_reg(", &frame_key, ", HEX_REG_FRAMEKEY);\n"); in gen_rvalue_fscr()
1982 OUT(c, locp, "tcg_gen_concat_i32_i64(", in gen_rvalue_fscr()
1984 OUT(c, locp, "tcg_gen_xor_i64(", &res, ", ", value, ", ", &key, ");\n"); in gen_rvalue_fscr()
1988 HexValue gen_rvalue_abs(Context *c, YYLTYPE *locp, HexValue *value) in gen_rvalue_abs() argument
1990 return gen_rvalue_simple_unary(c, locp, value, "abs", "tcg_gen_abs"); in gen_rvalue_abs()
1993 HexValue gen_rvalue_neg(Context *c, YYLTYPE *locp, HexValue *value) in gen_rvalue_neg() argument
1995 return gen_rvalue_simple_unary(c, locp, value, "-", "tcg_gen_neg"); in gen_rvalue_neg()
1998 HexValue gen_rvalue_brev(Context *c, YYLTYPE *locp, HexValue *value) in gen_rvalue_brev() argument
2001 yyassert(c, locp, value->bit_width <= 32, in gen_rvalue_brev()
2003 res = gen_tmp(c, locp, value->bit_width, value->signedness); in gen_rvalue_brev()
2004 *value = rvalue_materialize(c, locp, value); in gen_rvalue_brev()
2005 OUT(c, locp, "gen_helper_fbrev(", &res, ", ", value, ");\n"); in gen_rvalue_brev()
2009 HexValue gen_rvalue_ternary(Context *c, YYLTYPE *locp, HexValue *cond, in gen_rvalue_ternary() argument
2015 HexValue zero = gen_constant(c, locp, "0", bit_width, UNSIGNED); in gen_rvalue_ternary()
2016 HexValue res = gen_tmp(c, locp, bit_width, UNSIGNED); in gen_rvalue_ternary()
2019 *cond = gen_rvalue_extend(c, locp, cond); in gen_rvalue_ternary()
2020 *true_branch = gen_rvalue_extend(c, locp, true_branch); in gen_rvalue_ternary()
2021 *false_branch = gen_rvalue_extend(c, locp, false_branch); in gen_rvalue_ternary()
2023 *cond = gen_rvalue_truncate(c, locp, cond); in gen_rvalue_ternary()
2025 *cond = rvalue_materialize(c, locp, cond); in gen_rvalue_ternary()
2026 *true_branch = rvalue_materialize(c, locp, true_branch); in gen_rvalue_ternary()
2027 *false_branch = rvalue_materialize(c, locp, false_branch); in gen_rvalue_ternary()
2029 OUT(c, locp, "tcg_gen_movcond_i", &bit_width); in gen_rvalue_ternary()
2030 OUT(c, locp, "(TCG_COND_NE, ", &res, ", ", cond, ", ", &zero); in gen_rvalue_ternary()
2031 OUT(c, locp, ", ", true_branch, ", ", false_branch, ");\n"); in gen_rvalue_ternary()
2071 void emit_arg(Context *c, YYLTYPE *locp, HexValue *arg) in emit_arg() argument
2081 reg_compose(c, locp, &(arg->reg), reg_id); in emit_arg()
2142 YYLTYPE *locp, in assert_signedness() argument
2145 yyassert(c, locp, in assert_signedness()