diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc index f3179efa8d6..6ca99a61cbd 100644 --- a/gcc/config/nvptx/nvptx.cc +++ b/gcc/config/nvptx/nvptx.cc @@ -1941,6 +1941,23 @@ nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind) switch (GET_MODE (dst)) { + case E_DCmode: + case E_CDImode: + { + gcc_assert (GET_CODE (dst) == CONCAT); + gcc_assert (GET_CODE (src) == CONCAT); + rtx dst_real = XEXP (dst, 0); + rtx dst_imag = XEXP (dst, 1); + rtx src_real = XEXP (src, 0); + rtx src_imag = XEXP (src, 1); + + start_sequence (); + emit_insn (nvptx_gen_shuffle (dst_real, src_real, idx, kind)); + emit_insn (nvptx_gen_shuffle (dst_imag, src_imag, idx, kind)); + res = get_insns (); + end_sequence (); + } + break; case E_SImode: res = gen_nvptx_shufflesi (dst, src, idx, GEN_INT (kind)); break; diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index 4989b5642e2..a453c1de503 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -94,6 +94,18 @@ return register_operand (op, mode); }) +(define_predicate "nvptx_register_or_complex_di_df_register_operand" + (ior (match_code "reg") + (match_code "concat")) +{ + if (GET_CODE (op) == CONCAT) + return ((GET_MODE (op) == DCmode || GET_MODE (op) == CDImode) + && nvptx_register_operand (XEXP (op, 0), mode) + && nvptx_register_operand (XEXP (op, 1), mode)); + + return nvptx_register_operand (op, mode); +}) + (define_predicate "nvptx_nonimmediate_operand" (match_code "mem,reg") { @@ -1902,8 +1914,8 @@ ;; Implement IFN_GOMP_SIMT_XCHG_BFLY: perform a "butterfly" exchange ;; across lanes (define_expand "omp_simt_xchg_bfly" - [(match_operand 0 "nvptx_register_operand" "=R") - (match_operand 1 "nvptx_register_operand" "R") + [(match_operand 0 "nvptx_register_or_complex_di_df_register_operand" "=R") + (match_operand 1 "nvptx_register_or_complex_di_df_register_operand" "R") (match_operand:SI 2 "nvptx_nonmemory_operand" "Ri")] "" { @@ -1915,8 +1927,8 @@ ;; Implement IFN_GOMP_SIMT_XCHG_IDX: broadcast value in operand 1 ;; from lane given by index in operand 2 to operand 0 in all lanes (define_expand "omp_simt_xchg_idx" - [(match_operand 0 "nvptx_register_operand" "=R") - (match_operand 1 "nvptx_register_operand" "R") + [(match_operand 0 "nvptx_register_or_complex_di_df_register_operand" "=R") + (match_operand 1 "nvptx_register_or_complex_di_df_register_operand" "R") (match_operand:SI 2 "nvptx_nonmemory_operand" "Ri")] "" {