Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static Temp emit_bpermute(isel_context *ctx, Builder &bld, Definition dst, Temp index, Temp data)
- {
- if (ctx->options->chip_class <= GFX9) {
- return bld.ds(aco_opcode::ds_bpermute_b32, dst, index, data);
- }
- /* XXX: only do this for wave64 */
- Temp swapped_data = bld.pseudo(aco_opcode::p_swap_half_waves, bld.def(v1), data, Operand(s1));
- Temp lane_id = bld.vop3(aco_opcode::v_mbcnt_lo_u32_b32, bld.def(v1), Operand((uint32_t) -1), Operand(0u));
- lane_id = bld.vop3(aco_opcode::v_mbcnt_hi_u32_b32, bld.def(v1), Operand((uint32_t) -1), lane_id);
- Temp lane_is_hi = bld.vop2(aco_opcode::v_and_b32, bld.def(v1), lane_id, Operand(0x20u));
- Temp index_is_hi = bld.vop2(aco_opcode::v_and_b32, bld.def(v1), index, Operand(0x20u));
- Temp bperm_1 = bld.ds(aco_opcode::ds_bpermute_b32, bld.def(v1), index, data);
- Temp bperm_2 = bld.ds(aco_opcode::ds_bpermute_b32, bld.def(v1), index, swapped_data);
- Definition vcc_def = bld.def(v1);
- vcc_def.setHint(vcc);
- Temp vcc_tmp = bld.vopc(aco_opcode::v_cmp_eq_u32, vcc_def, lane_is_hi, index_is_hi);
- return bld.vop2(aco_opcode::v_cndmask_b32, dst, bperm_2, bperm_1, vcc_tmp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement