From: Tom de Vries Date: Thu, 1 Oct 2020 09:07:20 +0000 (+0200) Subject: [nvptx] Emit mov.u32 instead of cvt.u32.u32 for truncsiqi2 X-Git-Tag: basepoints/gcc-12~4656 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3ec0de08250d7e0599e36895d5cb727016c81d3;p=thirdparty%2Fgcc.git [nvptx] Emit mov.u32 instead of cvt.u32.u32 for truncsiqi2 When running: ... $ gcc.sh src/gcc/testsuite/gcc.target/nvptx/abi-complex-arg.c -S -dP ... we have in abi-complex-arg.s: ... //(insn 3 5 4 2 // (set // (reg:QI 23) // (truncate:QI (reg:SI 22))) "abi-complex-arg.c":38:1 29 {truncsiqi2} // (nil)) cvt.u32.u32 %r23, %r22; // 3 [c=4] truncsiqi2/0 ... The cvt.u32.u32 can be written shorter and clearer as mov.u32. Fix this in define_insn "truncsi2". Tested on nvptx. gcc/ChangeLog: 2020-10-01 Tom de Vries PR target/80845 * config/nvptx/nvptx.md (define_insn "truncsi2"): Emit mov.u32 instead of cvt.u32.u32. --- diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index 035f6e0151b2..ccbcd096fd1d 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -383,9 +383,13 @@ [(set (match_operand:QHIM 0 "nvptx_nonimmediate_operand" "=R,m") (truncate:QHIM (match_operand:SI 1 "nvptx_register_operand" "R,R")))] "" - "@ - %.\\tcvt%t0.u32\\t%0, %1; - %.\\tst%A0.u%T0\\t%0, %1;" + { + if (which_alternative == 1) + return "%.\\tst%A0.u%T0\\t%0, %1;"; + if (GET_MODE (operands[0]) == QImode) + return "%.\\tmov%t0\\t%0, %1;"; + return "%.\\tcvt%t0.u32\\t%0, %1;"; + } [(set_attr "subregs_ok" "true")]) (define_insn "truncdi2"