Lines Matching defs:opcode
525 return instr->opcode != aco_opcode::v_madmk_f32 && instr->opcode != aco_opcode::v_madak_f32 &&
526 instr->opcode != aco_opcode::v_madmk_f16 && instr->opcode != aco_opcode::v_madak_f16 &&
527 instr->opcode != aco_opcode::v_fmamk_f32 && instr->opcode != aco_opcode::v_fmaak_f32 &&
528 instr->opcode != aco_opcode::v_fmamk_f16 && instr->opcode != aco_opcode::v_fmaak_f16 &&
529 instr->opcode != aco_opcode::v_readlane_b32 &&
530 instr->opcode != aco_opcode::v_writelane_b32 &&
531 instr->opcode != aco_opcode::v_readfirstlane_b32;
541 instr->opcode == aco_opcode::p_as_uniform ||
554 switch (instr->opcode) {
588 instr->opcode = aco_opcode::p_parallelcopy;
603 return instr->opcode != aco_opcode::v_readfirstlane_b32 &&
604 instr->opcode != aco_opcode::v_readlane_b32 &&
605 instr->opcode != aco_opcode::v_readlane_b32_e64 &&
606 instr->opcode != aco_opcode::v_writelane_b32 &&
607 instr->opcode != aco_opcode::v_writelane_b32_e64 &&
608 instr->opcode != aco_opcode::v_permlane16_b32 &&
609 instr->opcode != aco_opcode::v_permlanex16_b32;
620 instr.reset(create_instruction<VOP3_instruction>(tmp->opcode, format, tmp->operands.size(),
659 alu_can_accept_constant(aco_opcode opcode, unsigned operand)
661 switch (opcode) {
684 if (instr->opcode == aco_opcode::v_readlane_b32 ||
685 instr->opcode == aco_opcode::v_readlane_b32_e64 ||
686 instr->opcode == aco_opcode::v_writelane_b32 ||
687 instr->opcode == aco_opcode::v_writelane_b32_e64)
689 if (instr->opcode == aco_opcode::v_permlane16_b32 ||
690 instr->opcode == aco_opcode::v_permlanex16_b32)
760 switch (add_instr->opcode) {
828 if (bitwise_instr->opcode != aco_opcode::s_and_b32)
871 smem.opcode, Format::SMEM, smem.operands.size() + 1, smem.definitions.size());
899 else if (instr->opcode == aco_opcode::v_mad_u64_u32 ||
900 instr->opcode == aco_opcode::v_mad_i64_i32)
902 else if (instr->opcode == aco_opcode::v_fma_mix_f32 ||
903 instr->opcode == aco_opcode::v_fma_mixlo_f16)
906 return instr_info.operand_size[(int)instr->opcode];
934 (instr->opcode == aco_opcode::v_dot4_i32_i8 || instr->opcode == aco_opcode::v_dot2_i32_i16 ||
935 instr->opcode == aco_opcode::v_dot4_u32_u8 || instr->opcode == aco_opcode::v_dot2_u32_u16) &&
1001 if (!instr_info.can_use_input_modifiers[(int)instr->opcode])
1027 if (instr->opcode == aco_opcode::p_extract) {
1032 } else if (instr->opcode == aco_opcode::p_insert && instr->operands[1].constantEquals(0)) {
1034 } else if (instr->opcode == aco_opcode::p_extract_vector) {
1039 } else if (instr->opcode == aco_opcode::p_split_vector) {
1050 if (instr->opcode == aco_opcode::p_extract && instr->operands[3].constantEquals(0) &&
1053 } else if (instr->opcode == aco_opcode::p_insert) {
1075 } else if (instr->opcode == aco_opcode::v_cvt_f32_u32 && sel.size() == 1 && !sel.sign_extend()) {
1083 can_use_opsel(ctx.program->gfx_level, instr->opcode, idx) &&
1086 } else if (instr->opcode == aco_opcode::p_extract) {
1120 } else if (instr->opcode == aco_opcode::v_cvt_f32_u32 && sel.size() == 1 && !sel.sign_extend()) {
1122 case 0: instr->opcode = aco_opcode::v_cvt_f32_ubyte0; break;
1123 case 1: instr->opcode = aco_opcode::v_cvt_f32_ubyte1; break;
1124 case 2: instr->opcode = aco_opcode::v_cvt_f32_ubyte2; break;
1125 case 3: instr->opcode = aco_opcode::v_cvt_f32_ubyte3; break;
1127 } else if (instr->opcode == aco_opcode::v_lshlrev_b32 && instr->operands[0].isConstant() &&
1140 } else if (instr->opcode == aco_opcode::p_extract) {
1203 aco_opcode op = instr->opcode;
1277 ASSERTED bool is_copy = instr->opcode == aco_opcode::s_mov_b32 ||
1278 instr->opcode == aco_opcode::s_mov_b64 ||
1279 instr->opcode == aco_opcode::v_mov_b32;
1313 !instr->operands[i].isFixed() && alu_can_accept_constant(instr->opcode, i)) {
1337 instr->opcode != aco_opcode::v_cndmask_b32 || instr->operands[i].getTemp().bytes() == 4;
1338 can_use_mod = can_use_mod && instr_info.can_use_input_modifiers[(int)instr->opcode];
1348 if (info.is_neg() && instr->opcode == aco_opcode::v_add_f32 && mod_bitsize_compat) {
1349 instr->opcode = i ? aco_opcode::v_sub_f32 : aco_opcode::v_subrev_f32;
1351 } else if (info.is_neg() && instr->opcode == aco_opcode::v_add_f16 && mod_bitsize_compat) {
1352 instr->opcode = i ? aco_opcode::v_sub_f16 : aco_opcode::v_subrev_f16;
1385 if (info.is_constant(bits) && alu_can_accept_constant(instr->opcode, i) &&
1388 perfwarn(ctx.program, instr->opcode == aco_opcode::v_cndmask_b32 && i == 2,
1390 if (i == 0 || instr->isSDWA() || instr->opcode == aco_opcode::v_readlane_b32 ||
1391 instr->opcode == aco_opcode::v_writelane_b32) {
1395 } else if (!instr->isVOP3() && can_swap_operands(instr, &instr->opcode)) {
1484 instr->opcode != aco_opcode::ds_swizzle_b32) {
1485 if (instr->opcode == aco_opcode::ds_write2_b32 ||
1486 instr->opcode == aco_opcode::ds_read2_b32 ||
1487 instr->opcode == aco_opcode::ds_write2_b64 ||
1488 instr->opcode == aco_opcode::ds_read2_b64 ||
1489 instr->opcode == aco_opcode::ds_write2st64_b32 ||
1490 instr->opcode == aco_opcode::ds_read2st64_b32 ||
1491 instr->opcode == aco_opcode::ds_write2st64_b64 ||
1492 instr->opcode == aco_opcode::ds_read2st64_b64) {
1493 bool is64bit = instr->opcode == aco_opcode::ds_write2_b64 ||
1494 instr->opcode == aco_opcode::ds_read2_b64 ||
1495 instr->opcode == aco_opcode::ds_write2st64_b64 ||
1496 instr->opcode == aco_opcode::ds_read2st64_b64;
1497 bool st64 = instr->opcode == aco_opcode::ds_write2st64_b32 ||
1498 instr->opcode == aco_opcode::ds_read2st64_b32 ||
1499 instr->opcode == aco_opcode::ds_write2st64_b64 ||
1500 instr->opcode == aco_opcode::ds_read2st64_b64;
1522 instr->opcode = instr->opcode == aco_opcode::p_cbranch_z ? aco_opcode::p_cbranch_nz
1536 if (instr_info.can_use_output_modifiers[(int)instr->opcode] || instr->isVINTRP() ||
1537 instr->opcode == aco_opcode::v_cndmask_b32) {
1539 if (!does_fp_op_flush_denorms(ctx, instr->opcode)) {
1540 unsigned ops = instr->opcode == aco_opcode::v_cndmask_b32 ? 2 : instr->operands.size();
1559 switch (instr->opcode) {
1706 instr->opcode = aco_opcode::p_parallelcopy;
1770 bool fp16 = instr->opcode == aco_opcode::v_mul_f16;
1809 instr->opcode == aco_opcode::v_mul_legacy_f32)) { /* 0.0 */
1833 bool is_fp16 = instr->opcode == aco_opcode::v_med3_f16;
2105 bool is_or = instr->opcode == aco_opcode::s_or_b64 || instr->opcode == aco_opcode::s_or_b32;
2120 unsigned op_bitsize = get_cmp_bitsize(op_instr[i]->opcode);
2122 if (get_f32_cmp(op_instr[i]->opcode) != expected_cmp)
2202 bool is_or = instr->opcode == aco_opcode::s_or_b64 || instr->opcode == aco_opcode::s_or_b32;
2212 if (get_f32_cmp(cmp->opcode) == expected_nan_test)
2214 else if (get_f32_cmp(nan_test->opcode) != expected_nan_test)
2217 if (!is_cmp(cmp->opcode) || get_cmp_bitsize(cmp->opcode) != get_cmp_bitsize(nan_test->opcode))
2239 aco_opcode new_op = is_or ? get_unordered(cmp->opcode) : get_ordered(cmp->opcode);
2303 bool is_or = instr->opcode == aco_opcode::s_or_b64 || instr->opcode == aco_opcode::s_or_b32;
2314 if (get_f32_cmp(cmp->opcode) == expected_nan_test)
2316 else if (get_f32_cmp(nan_test->opcode) != expected_nan_test)
2319 unsigned bit_size = get_cmp_bitsize(cmp->opcode);
2320 if (!is_cmp(cmp->opcode) || get_cmp_bitsize(nan_test->opcode) != bit_size)
2364 aco_opcode new_op = is_or ? get_unordered(cmp->opcode) : get_ordered(cmp->opcode);
2404 aco_opcode new_opcode = get_inverse(cmp->opcode);
2479 if (op1_instr->opcode != op1)
2483 if (!op2_instr || op2_instr->opcode != op2)
2548 create_vop3_for_op3(opt_ctx& ctx, aco_opcode opcode, aco_ptr<Instruction>& instr,
2552 VOP3_instruction* new_instr = create_instruction<VOP3_instruction>(opcode, Format::VOP3, 3, 1);
2578 if (match_op3_for_vop3(ctx, instr->opcode, op2, instr.get(), swap, shuffle, operands, neg,
2592 bool is_or = instr->opcode == aco_opcode::v_or_b32;
2622 if (extins->opcode == aco_opcode::p_insert &&
2628 (extins->opcode == aco_opcode::p_insert ||
2629 (extins->opcode == aco_opcode::p_extract &&
2662 if (combine_three_valu_op(ctx, instr, instr->opcode, minmax3, "012", 1 | 2))
2672 if (match_op3_for_vop3(ctx, instr->opcode, opposite, instr.get(), swap, "012", operands, neg,
2703 switch (op2_instr->opcode) {
2719 switch (op2_instr->opcode) {
2720 case aco_opcode::s_and_b32: op2_instr->opcode = aco_opcode::s_nand_b32; break;
2721 case aco_opcode::s_or_b32: op2_instr->opcode = aco_opcode::s_nor_b32; break;
2722 case aco_opcode::s_xor_b32: op2_instr->opcode = aco_opcode::s_xnor_b32; break;
2723 case aco_opcode::s_and_b64: op2_instr->opcode = aco_opcode::s_nand_b64; break;
2724 case aco_opcode::s_or_b64: op2_instr->opcode = aco_opcode::s_nor_b64; break;
2725 case aco_opcode::s_xor_b64: op2_instr->opcode = aco_opcode::s_xnor_b64; break;
2744 if (!op2_instr || (op2_instr->opcode != aco_opcode::s_not_b32 &&
2745 op2_instr->opcode != aco_opcode::s_not_b64))
2759 switch (instr->opcode) {
2760 case aco_opcode::s_and_b32: instr->opcode = aco_opcode::s_andn2_b32; break;
2761 case aco_opcode::s_or_b32: instr->opcode = aco_opcode::s_orn2_b32; break;
2762 case aco_opcode::s_and_b64: instr->opcode = aco_opcode::s_andn2_b64; break;
2763 case aco_opcode::s_or_b64: instr->opcode = aco_opcode::s_orn2_b64; break;
2776 if (instr->opcode == aco_opcode::s_add_i32 && ctx.uses[instr->definitions[1].tempId()])
2781 if (!op2_instr || op2_instr->opcode != aco_opcode::s_lshl_b32 ||
2800 instr->opcode = std::array<aco_opcode, 4>{
2864 if (op_instr && op_instr->opcode == aco_opcode::v_bcnt_u32_b32 &&
2935 if (instr->opcode == min)
2937 else if (instr->opcode == max)
2946 if (match_op3_for_vop3(ctx, instr->opcode, other_op, instr.get(), swap, "012", operands, neg,
2951 if (precise && instr->opcode != min &&
3030 if (instr->opcode == min) {
3051 bool is_shift64 = instr->opcode == aco_opcode::v_lshlrev_b64 ||
3052 instr->opcode == aco_opcode::v_lshrrev_b64 ||
3053 instr->opcode == aco_opcode::v_ashrrev_i64;
3123 } else if (can_swap_operands(instr, &instr->opcode)) {
3172 !instr_info.can_use_output_modifiers[(int)instr->opcode])
3177 instr->opcode == aco_opcode::v_fma_mix_f32 || instr->opcode == aco_opcode::v_fma_mixlo_f16;
3289 if (ds->opcode == aco_opcode::ds_read_u8 || ds->opcode == aco_opcode::ds_read_u8_d16)
3291 else if (ds->opcode == aco_opcode::ds_read_u16 || ds->opcode == aco_opcode::ds_read_u16_d16)
3299 /* Change the DS opcode so it writes the full register. */
3301 ds->opcode = aco_opcode::ds_read_u8;
3303 ds->opcode = aco_opcode::ds_read_u16;
3305 unreachable("Forgot to add DS opcode above.");
3323 if (op_instr && op_instr->opcode == aco_opcode::v_subbrev_co_u32 &&
3383 if (op_instr->opcode != aco_opcode::s_lshl_b32 &&
3384 op_instr->opcode != aco_opcode::v_lshlrev_b32)
3387 int shift_op_idx = op_instr->opcode == aco_opcode::s_lshl_b32 ? 1 : 0;
3452 if (instr->opcode == aco_opcode::v_pk_mul_f16 && instr->operands[1].constantEquals(0x3C00) &&
3457 if (info.is_vop3p() && instr_info.can_use_output_modifiers[(int)info.instr->opcode]) {
3469 if (instr_info.can_use_input_modifiers[(int)instr->opcode]) {
3476 if (info.is_vop3p() && info.instr->opcode == aco_opcode::v_pk_mul_f16 &&
3514 if (instr->opcode == aco_opcode::v_pk_add_f16 || instr->opcode == aco_opcode::v_pk_add_u16) {
3515 bool fadd = instr->opcode == aco_opcode::v_pk_add_f16;
3530 if (info.instr->opcode != aco_opcode::v_pk_mul_f16 ||
3534 if (info.instr->opcode != aco_opcode::v_pk_mul_lo_u16)
3605 switch (instr->opcode) {
3616 if (instr->opcode == aco_opcode::v_fma_f32 && !ctx.program->dev.fused_mad_mix &&
3629 bool is_add = instr->opcode != aco_opcode::v_mul_f32 && instr->opcode != aco_opcode::v_fma_f32;
3644 if (instr->opcode == aco_opcode::v_mul_f32) {
3651 if (instr->opcode == aco_opcode::v_sub_f32)
3653 else if (instr->opcode == aco_opcode::v_subrev_f32)
3685 instr->opcode = aco_opcode::v_fma_mixlo_f16;
3732 instr->opcode != aco_opcode::v_mul_f32 && instr->opcode != aco_opcode::v_fma_f32;
3826 if (instr->isVOP3P() && instr->opcode != aco_opcode::v_fma_mix_f32 &&
3827 instr->opcode != aco_opcode::v_fma_mixlo_f16)
3833 if (instr->opcode == aco_opcode::p_extract) {
3871 if (mul_instr->opcode == aco_opcode::v_mul_legacy_f32 &&
3883 create_instruction<VOP3_instruction>(mul_instr->opcode, asVOP3(Format::VOP2), 2, 1));
3909 (instr->opcode == aco_opcode::v_fma_mix_f32 ||
3910 instr->opcode == aco_opcode::v_fma_mixlo_f16) &&
3915 bool mad32 = instr->opcode == aco_opcode::v_add_f32 || instr->opcode == aco_opcode::v_sub_f32 ||
3916 instr->opcode == aco_opcode::v_subrev_f32;
3917 bool mad16 = instr->opcode == aco_opcode::v_add_f16 || instr->opcode == aco_opcode::v_sub_f16 ||
3918 instr->opcode == aco_opcode::v_subrev_f16;
3919 bool mad64 = instr->opcode == aco_opcode::v_add_f64;
3946 bool legacy = info.instr->opcode == aco_opcode::v_mul_legacy_f32;
4060 if (instr->opcode == aco_opcode::v_sub_f32 || instr->opcode == aco_opcode::v_sub_f16)
4062 else if (instr->opcode == aco_opcode::v_subrev_f32 ||
4063 instr->opcode == aco_opcode::v_subrev_f16)
4086 if (mul_instr->opcode == aco_opcode::v_mul_legacy_f32) {
4119 else if (((instr->opcode == aco_opcode::v_mul_f32 &&
4121 instr->opcode == aco_opcode::v_mul_legacy_f32) &&
4141 } else if (instr->opcode == aco_opcode::v_or_b32 && ctx.program->gfx_level >= GFX9) {
4148 } else if (instr->opcode == aco_opcode::v_xor_b32 && ctx.program->gfx_level >= GFX10) {
4154 } else if (instr->opcode == aco_opcode::v_add_u16) {
4159 } else if (instr->opcode == aco_opcode::v_add_u16_e64) {
4162 } else if (instr->opcode == aco_opcode::v_add_u32) {
4181 } else if (instr->opcode == aco_opcode::v_add_co_u32 ||
4182 instr->opcode == aco_opcode::v_add_co_u32_e64) {
4190 } else if (instr->opcode == aco_opcode::v_sub_u32 || instr->opcode == aco_opcode::v_sub_co_u32 ||
4191 instr->opcode == aco_opcode::v_sub_co_u32_e64) {
4193 instr->opcode != aco_opcode::v_sub_u32 && ctx.uses[instr->definitions[1].tempId()] > 0;
4197 } else if (instr->opcode == aco_opcode::v_subrev_u32 ||
4198 instr->opcode == aco_opcode::v_subrev_co_u32 ||
4199 instr->opcode == aco_opcode::v_subrev_co_u32_e64) {
4201 } else if (instr->opcode == aco_opcode::v_lshlrev_b32 && ctx.program->gfx_level >= GFX9) {
4204 } else if ((instr->opcode == aco_opcode::s_add_u32 || instr->opcode == aco_opcode::s_add_i32) &&
4207 } else if (instr->opcode == aco_opcode::s_not_b32 || instr->opcode == aco_opcode::s_not_b64) {
4209 } else if (instr->opcode == aco_opcode::s_and_b32 || instr->opcode == aco_opcode::s_or_b32 ||
4210 instr->opcode == aco_opcode::s_and_b64 || instr->opcode == aco_opcode::s_or_b64) {
4216 } else if (instr->opcode == aco_opcode::v_and_b32) {
4218 } else if (instr->opcode == aco_opcode::v_fma_f32 || instr->opcode == aco_opcode::v_fma_f16) {
4228 if (get_minmax_info(instr->opcode, &min, &max, &min3, &max3, &med3, &some_gfx9_only) &&
4230 if (combine_minmax(ctx, instr, instr->opcode == min ? max : min,
4231 instr->opcode == min ? min3 : max3)) {
4239 if (instr->opcode == aco_opcode::s_andn2_b32 || instr->opcode == aco_opcode::s_andn2_b64)
4254 switch (instr->opcode) {
4256 case aco_opcode::s_and_b64: instr->opcode = aco_opcode::s_and_b32; break;
4258 case aco_opcode::s_or_b64: instr->opcode = aco_opcode::s_or_b32; break;
4260 case aco_opcode::s_xor_b64: instr->opcode = aco_opcode::s_absdiff_i32; break;
4307 if (instr->opcode == aco_opcode::p_split_vector) {
4380 instr->opcode != aco_opcode::v_fma_f64 &&
4381 instr->opcode != aco_opcode::v_mad_legacy_f32 &&
4382 instr->opcode != aco_opcode::v_fma_legacy_f32) {
4384 if ((instr->opcode == aco_opcode::v_fma_f32 || instr->opcode == aco_opcode::v_fma_f16) &&
4390 if (instr->opcode == aco_opcode::v_fma_legacy_f16)
4458 } else if ((instr->opcode == aco_opcode::s_cselect_b64 ||
4459 instr->opcode == aco_opcode::s_cselect_b32) &&
4462 } else if (instr->opcode == aco_opcode::p_wqm && instr->operands[0].isTemp() &&
4510 instr->opcode = swapped_op;
4516 instr->opcode = swapped_op;
4572 if (!alu_can_accept_constant(instr->opcode, i))
4587 bool is_shift64 = instr->opcode == aco_opcode::v_lshlrev_b64 ||
4588 instr->opcode == aco_opcode::v_lshrrev_b64 ||
4589 instr->opcode == aco_opcode::v_ashrrev_i64;
4612 sopk_opcode_for_sopc(aco_opcode opcode)
4617 switch (opcode) {
4630 sopc_is_signed(aco_opcode opcode)
4635 switch (opcode) {
4648 sopc_32_swapped(aco_opcode opcode)
4653 switch (opcode) {
4668 if (sopk_opcode_for_sopc(instr->opcode) == aco_opcode::num_opcodes)
4673 instr->opcode = sopc_32_swapped(instr->opcode);
4692 if (!value_is_i16 && sopc_is_signed(instr->opcode)) {
4693 if (instr->opcode == aco_opcode::s_cmp_lg_i32)
4694 instr->opcode = aco_opcode::s_cmp_lg_u32;
4695 else if (instr->opcode == aco_opcode::s_cmp_eq_i32)
4696 instr->opcode = aco_opcode::s_cmp_eq_u32;
4699 } else if (!value_is_u16 && !sopc_is_signed(instr->opcode)) {
4700 if (instr->opcode == aco_opcode::s_cmp_lg_u32)
4701 instr->opcode = aco_opcode::s_cmp_lg_i32;
4702 else if (instr->opcode == aco_opcode::s_cmp_eq_u32)
4703 instr->opcode = aco_opcode::s_cmp_eq_i32;
4714 instr_sopk->opcode = sopk_opcode_for_sopc(instr_sopk->opcode);
4734 if (instr->opcode == aco_opcode::v_fma_f32)
4736 else if (instr->opcode == aco_opcode::v_mad_f16 ||
4737 instr->opcode == aco_opcode::v_mad_legacy_f16)
4739 else if (instr->opcode == aco_opcode::v_fma_f16)
4780 if (instr->opcode == aco_opcode::s_add_u32 && ctx.uses[instr->definitions[1].tempId()] == 0 &&
4782 instr->opcode = aco_opcode::s_add_i32;