From: Tom de Vries Date: Tue, 22 Sep 2020 11:16:39 +0000 (+0200) Subject: [nvptx] Handle move from DF subreg to DF reg in nvptx_output_mov_insn X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ca52f937fff52c494ef2951490c1654750ef8157;p=gcc.git [nvptx] Handle move from DF subreg to DF reg in nvptx_output_mov_insn When compiling test-case gcc.dg/atomic/c11-atomic-exec-1.c, we run into these ptxas errors: ... line 100; error: Rounding modifier required for instruction 'cvt' line 105; error: Rounding modifier required for instruction 'cvt' ... The problem is that this move: ... //(insn 13 11 14 2 // (set (reg:DF 28 [ _9 ]) // (subreg:DF (reg:TI 22 [ _1 ]) 0)) 9 {*movdf_insn} // (nil)) cvt.f64.u64 %r28, %r22$0; ... is emitted as cvt.f64.u64, while it should be a mov.b64 instead. Fix this by handling this case in nvptx_output_mov_insn. Tested on nvptx. gcc/ChangeLog: PR target/97158 * config/nvptx/nvptx.c (nvptx_output_mov_insn): Handle move from DF subreg to DF reg. --- diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 0c590d8d1f6..54b1fdf669b 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -2349,6 +2349,7 @@ const char * nvptx_output_mov_insn (rtx dst, rtx src) { machine_mode dst_mode = GET_MODE (dst); + machine_mode src_mode = GET_MODE (src); machine_mode dst_inner = (GET_CODE (dst) == SUBREG ? GET_MODE (XEXP (dst, 0)) : dst_mode); machine_mode src_inner = (GET_CODE (src) == SUBREG @@ -2375,7 +2376,7 @@ nvptx_output_mov_insn (rtx dst, rtx src) if (GET_MODE_SIZE (dst_inner) == GET_MODE_SIZE (src_inner)) { if (GET_MODE_BITSIZE (dst_mode) == 128 - && GET_MODE_BITSIZE (GET_MODE (src)) == 128) + && GET_MODE_BITSIZE (src_mode) == 128) { /* mov.b128 is not supported. */ if (dst_inner == V2DImode && src_inner == TImode) @@ -2388,6 +2389,10 @@ nvptx_output_mov_insn (rtx dst, rtx src) return "%.\tmov.b%T0\t%0, %1;"; } + if (GET_MODE_BITSIZE (src_inner) == 128 + && GET_MODE_BITSIZE (src_mode) == 64) + return "%.\tmov.b%T0\t%0, %1;"; + return "%.\tcvt%t0%t1\t%0, %1;"; }