]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Implement `riscv_emit_unary' helper
authorMaciej W. Rozycki <macro@embecosm.com>
Wed, 22 Nov 2023 01:18:28 +0000 (01:18 +0000)
committerMaciej W. Rozycki <macro@embecosm.com>
Wed, 22 Nov 2023 01:18:28 +0000 (01:18 +0000)
Add a `riscv_emit_unary' helper for unary operations, complementing
`riscv_emit_binary'.

gcc/
* config/riscv/riscv-protos.h (riscv_emit_unary): New prototype.
* config/riscv/riscv.cc (riscv_emit_unary): New function.

gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv.cc

index ae528db1898df6d0879c8a5b8164fedc1f6b8958..0050a8b0edf15dae77560a17eed6be566cdb3a4d 100644 (file)
@@ -134,6 +134,7 @@ riscv_zcmp_valid_stack_adj_bytes_p (HOST_WIDE_INT, int);
 extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx, bool *invert_ptr = 0);
 extern void riscv_expand_float_scc (rtx, enum rtx_code, rtx, rtx);
 extern void riscv_expand_conditional_branch (rtx, enum rtx_code, rtx, rtx);
+extern rtx riscv_emit_unary (enum rtx_code code, rtx dest, rtx x);
 extern rtx riscv_emit_binary (enum rtx_code code, rtx dest, rtx x, rtx y);
 #endif
 extern bool riscv_expand_conditional_move (rtx, rtx, rtx, rtx);
index 4424882ec3a1dea54c1cf9b36cc4f9f58722dad0..5198da6d9360cd77bfd3fe3393857530f2364eb7 100644 (file)
@@ -1732,6 +1732,14 @@ riscv_emit_set (rtx target, rtx src)
   return target;
 }
 
+/* Emit an instruction of the form (set DEST (CODE X)).  */
+
+rtx
+riscv_emit_unary (enum rtx_code code, rtx dest, rtx x)
+{
+  return riscv_emit_set (dest, gen_rtx_fmt_e (code, GET_MODE (dest), x));
+}
+
 /* Emit an instruction of the form (set DEST (CODE X Y)).  */
 
 rtx