Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. static Temp emit_bpermute(isel_context *ctx, Builder &bld, Definition dst, Temp index, Temp data)
  2. {
  3. if (ctx->options->chip_class <= GFX9) {
  4. return bld.ds(aco_opcode::ds_bpermute_b32, dst, index, data);
  5. }
  6.  
  7. /* XXX: only do this for wave64 */
  8.  
  9. Temp swapped_data = bld.pseudo(aco_opcode::p_swap_half_waves, bld.def(v1), data, Operand(s1));
  10.  
  11. Temp lane_id = bld.vop3(aco_opcode::v_mbcnt_lo_u32_b32, bld.def(v1), Operand((uint32_t) -1), Operand(0u));
  12. lane_id = bld.vop3(aco_opcode::v_mbcnt_hi_u32_b32, bld.def(v1), Operand((uint32_t) -1), lane_id);
  13. Temp lane_is_hi = bld.vop2(aco_opcode::v_and_b32, bld.def(v1), lane_id, Operand(0x20u));
  14. Temp index_is_hi = bld.vop2(aco_opcode::v_and_b32, bld.def(v1), index, Operand(0x20u));
  15.  
  16. Temp bperm_1 = bld.ds(aco_opcode::ds_bpermute_b32, bld.def(v1), index, data);
  17. Temp bperm_2 = bld.ds(aco_opcode::ds_bpermute_b32, bld.def(v1), index, swapped_data);
  18.  
  19. Definition vcc_def = bld.def(v1);
  20. vcc_def.setHint(vcc);
  21. Temp vcc_tmp = bld.vopc(aco_opcode::v_cmp_eq_u32, vcc_def, lane_is_hi, index_is_hi);
  22. return bld.vop2(aco_opcode::v_cndmask_b32, dst, bperm_2, bperm_1, vcc_tmp);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement