public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Change truncate to float_truncate in narrowing
@ 2023-07-05 13:00 Robin Dapp
  2023-07-05 13:03 ` juzhe.zhong
  0 siblings, 1 reply; 3+ messages in thread
From: Robin Dapp @ 2023-07-05 13:00 UTC (permalink / raw)
  To: gcc-patches, palmer, Kito Cheng, juzhe.zhong, jeffreyalaw; +Cc: rdapp.gcc

Hi,

Juzhe noticed that several floating-point conversion tests
FAIL on 32 bit.  This is due to the autovect FP narrowing patterns
using a truncate instead of a float_truncate which results in
a combine ICE.  It would try to e.g. simplify a unary operation by
simplify_const_unary_operation which obviously expects a float_truncate
and not a truncate for a floating-point mode.

Regards
 Robin

gcc/ChangeLog:

	* config/riscv/autovec.md: Use float_truncate.
---
 gcc/config/riscv/autovec.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
index 466b27d5c49..3884dfc363c 100644
--- a/gcc/config/riscv/autovec.md
+++ b/gcc/config/riscv/autovec.md
@@ -473,7 +473,7 @@ (define_expand "extend<v_quad_trunc><mode>2"
 ;; -------------------------------------------------------------------------
 (define_insn_and_split "trunc<mode><v_double_trunc>2"
   [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vr")
-    (truncate:<V_DOUBLE_TRUNC>
+    (float_truncate:<V_DOUBLE_TRUNC>
      (match_operand:VWEXTF_ZVFHMIN 1 "register_operand"      " vr")))]
   "TARGET_VECTOR && can_create_pseudo_p ()"
   "#"
@@ -493,7 +493,7 @@ (define_insn_and_split "trunc<mode><v_double_trunc>2"
 ;; -------------------------------------------------------------------------
 (define_expand "trunc<mode><v_quad_trunc>2"
   [(set (match_operand:<V_QUAD_TRUNC> 0 "register_operand")
-    (truncate:<V_QUAD_TRUNC>
+    (float_truncate:<V_QUAD_TRUNC>
      (match_operand:VQEXTF 1 "register_operand")))]
   "TARGET_VECTOR && (TARGET_ZVFHMIN || TARGET_ZVFH)"
 {
-- 
2.41.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Change truncate to float_truncate in narrowing
  2023-07-05 13:00 [PATCH] RISC-V: Change truncate to float_truncate in narrowing Robin Dapp
@ 2023-07-05 13:03 ` juzhe.zhong
  2023-07-05 13:52   ` Kito Cheng
  0 siblings, 1 reply; 3+ messages in thread
From: juzhe.zhong @ 2023-07-05 13:03 UTC (permalink / raw)
  To: Robin Dapp, gcc-patches, palmer, kito.cheng, jeffreyalaw; +Cc: Robin Dapp

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

LGTM. Thanks for fixing this.



juzhe.zhong@rivai.ai
 
From: Robin Dapp
Date: 2023-07-05 21:00
To: gcc-patches; palmer; Kito Cheng; juzhe.zhong@rivai.ai; jeffreyalaw
CC: rdapp.gcc
Subject: [PATCH] RISC-V: Change truncate to float_truncate in narrowing
Hi,
 
Juzhe noticed that several floating-point conversion tests
FAIL on 32 bit.  This is due to the autovect FP narrowing patterns
using a truncate instead of a float_truncate which results in
a combine ICE.  It would try to e.g. simplify a unary operation by
simplify_const_unary_operation which obviously expects a float_truncate
and not a truncate for a floating-point mode.
 
Regards
Robin
 
gcc/ChangeLog:
 
* config/riscv/autovec.md: Use float_truncate.
---
gcc/config/riscv/autovec.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
 
diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
index 466b27d5c49..3884dfc363c 100644
--- a/gcc/config/riscv/autovec.md
+++ b/gcc/config/riscv/autovec.md
@@ -473,7 +473,7 @@ (define_expand "extend<v_quad_trunc><mode>2"
;; -------------------------------------------------------------------------
(define_insn_and_split "trunc<mode><v_double_trunc>2"
   [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vr")
-    (truncate:<V_DOUBLE_TRUNC>
+    (float_truncate:<V_DOUBLE_TRUNC>
      (match_operand:VWEXTF_ZVFHMIN 1 "register_operand"      " vr")))]
   "TARGET_VECTOR && can_create_pseudo_p ()"
   "#"
@@ -493,7 +493,7 @@ (define_insn_and_split "trunc<mode><v_double_trunc>2"
;; -------------------------------------------------------------------------
(define_expand "trunc<mode><v_quad_trunc>2"
   [(set (match_operand:<V_QUAD_TRUNC> 0 "register_operand")
-    (truncate:<V_QUAD_TRUNC>
+    (float_truncate:<V_QUAD_TRUNC>
      (match_operand:VQEXTF 1 "register_operand")))]
   "TARGET_VECTOR && (TARGET_ZVFHMIN || TARGET_ZVFH)"
{
-- 
2.41.0
 
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Change truncate to float_truncate in narrowing
  2023-07-05 13:03 ` juzhe.zhong
@ 2023-07-05 13:52   ` Kito Cheng
  0 siblings, 0 replies; 3+ messages in thread
From: Kito Cheng @ 2023-07-05 13:52 UTC (permalink / raw)
  To: juzhe.zhong; +Cc: Robin Dapp, gcc-patches, jeffreyalaw, palmer

[-- Attachment #1: Type: text/plain, Size: 2142 bytes --]

Lgtm

juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>於 2023年7月5日 週三,21:04寫道:

> LGTM. Thanks for fixing this.
>
>
>
> juzhe.zhong@rivai.ai
>
> From: Robin Dapp
> Date: 2023-07-05 21:00
> To: gcc-patches; palmer; Kito Cheng; juzhe.zhong@rivai.ai; jeffreyalaw
> CC: rdapp.gcc
> Subject: [PATCH] RISC-V: Change truncate to float_truncate in narrowing
> Hi,
>
> Juzhe noticed that several floating-point conversion tests
> FAIL on 32 bit.  This is due to the autovect FP narrowing patterns
> using a truncate instead of a float_truncate which results in
> a combine ICE.  It would try to e.g. simplify a unary operation by
> simplify_const_unary_operation which obviously expects a float_truncate
> and not a truncate for a floating-point mode.
>
> Regards
> Robin
>
> gcc/ChangeLog:
>
> * config/riscv/autovec.md: Use float_truncate.
> ---
> gcc/config/riscv/autovec.md | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
> index 466b27d5c49..3884dfc363c 100644
> --- a/gcc/config/riscv/autovec.md
> +++ b/gcc/config/riscv/autovec.md
> @@ -473,7 +473,7 @@ (define_expand "extend<v_quad_trunc><mode>2"
> ;;
> -------------------------------------------------------------------------
> (define_insn_and_split "trunc<mode><v_double_trunc>2"
>    [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vr")
> -    (truncate:<V_DOUBLE_TRUNC>
> +    (float_truncate:<V_DOUBLE_TRUNC>
>       (match_operand:VWEXTF_ZVFHMIN 1 "register_operand"      " vr")))]
>    "TARGET_VECTOR && can_create_pseudo_p ()"
>    "#"
> @@ -493,7 +493,7 @@ (define_insn_and_split "trunc<mode><v_double_trunc>2"
> ;;
> -------------------------------------------------------------------------
> (define_expand "trunc<mode><v_quad_trunc>2"
>    [(set (match_operand:<V_QUAD_TRUNC> 0 "register_operand")
> -    (truncate:<V_QUAD_TRUNC>
> +    (float_truncate:<V_QUAD_TRUNC>
>       (match_operand:VQEXTF 1 "register_operand")))]
>    "TARGET_VECTOR && (TARGET_ZVFHMIN || TARGET_ZVFH)"
> {
> --
> 2.41.0
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-05 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 13:00 [PATCH] RISC-V: Change truncate to float_truncate in narrowing Robin Dapp
2023-07-05 13:03 ` juzhe.zhong
2023-07-05 13:52   ` Kito Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).