public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] x86: replace "extendhfdf2" expander
@ 2023-07-14  9:44 Jan Beulich
  2023-07-14 10:10 ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2023-07-14  9:44 UTC (permalink / raw)
  To: gcc-patches; +Cc: Hongtao Liu, Kirill Yukhin, Uros Bizjak, Jan Hubicka

The corresponding insn serves this purpose quite fine, and leads to
slightly less (generated) code. All we need is the insn to not have a
leading * in its name, while retaining that * for "extendhfsf2".
Introduce a mode attribute in exchange to achieve that.

gcc/

	* config/i386/i386.md (extendhfdf2): Delete expander.
	(extendhf): New mode attribute.
	(*extendhf<mode>2): Use it.
---
Of course the mode attribute could as well supply the full names.

--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -5221,13 +5221,9 @@
     }
 })
 
-(define_expand "extendhfdf2"
-  [(set (match_operand:DF 0 "register_operand")
-	(float_extend:DF
-	  (match_operand:HF 1 "nonimmediate_operand")))]
-  "TARGET_AVX512FP16")
+(define_mode_attr extendhf [(SF "*") (DF "")])
 
-(define_insn "*extendhf<mode>2"
+(define_insn "<extendhf>extendhf<mode>2"
   [(set (match_operand:MODEF 0 "register_operand" "=v")
         (float_extend:MODEF
 	  (match_operand:HF 1 "nonimmediate_operand" "vm")))]

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

* Re: [PATCH] x86: replace "extendhfdf2" expander
  2023-07-14  9:44 [PATCH] x86: replace "extendhfdf2" expander Jan Beulich
@ 2023-07-14 10:10 ` Uros Bizjak
  2023-07-14 10:40   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2023-07-14 10:10 UTC (permalink / raw)
  To: Jan Beulich; +Cc: gcc-patches, Hongtao Liu, Kirill Yukhin, Jan Hubicka

On Fri, Jul 14, 2023 at 11:44 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> The corresponding insn serves this purpose quite fine, and leads to
> slightly less (generated) code. All we need is the insn to not have a
> leading * in its name, while retaining that * for "extendhfsf2".
> Introduce a mode attribute in exchange to achieve that.
>
> gcc/
>
>         * config/i386/i386.md (extendhfdf2): Delete expander.
>         (extendhf): New mode attribute.
>         (*extendhf<mode>2): Use it.

No, please leave the expander, it is there due to extendhfsf2 that
prevents effective macroization.

FYI, there is no less generated code when the named pattern is used,
the same code is generated from the named pattern as from the
expander. Source code can be shrinked, but in this particular case,
forced macroization complicates things more.

Uros.

> ---
> Of course the mode attribute could as well supply the full names.
>
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -5221,13 +5221,9 @@
>      }
>  })
>
> -(define_expand "extendhfdf2"
> -  [(set (match_operand:DF 0 "register_operand")
> -       (float_extend:DF
> -         (match_operand:HF 1 "nonimmediate_operand")))]
> -  "TARGET_AVX512FP16")
> +(define_mode_attr extendhf [(SF "*") (DF "")])
>
> -(define_insn "*extendhf<mode>2"
> +(define_insn "<extendhf>extendhf<mode>2"
>    [(set (match_operand:MODEF 0 "register_operand" "=v")
>          (float_extend:MODEF
>           (match_operand:HF 1 "nonimmediate_operand" "vm")))]

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

* Re: [PATCH] x86: replace "extendhfdf2" expander
  2023-07-14 10:10 ` Uros Bizjak
@ 2023-07-14 10:40   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2023-07-14 10:40 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches, Hongtao Liu, Kirill Yukhin, Jan Hubicka

On 14.07.2023 12:10, Uros Bizjak wrote:
> On Fri, Jul 14, 2023 at 11:44 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> The corresponding insn serves this purpose quite fine, and leads to
>> slightly less (generated) code. All we need is the insn to not have a
>> leading * in its name, while retaining that * for "extendhfsf2".
>> Introduce a mode attribute in exchange to achieve that.
>>
>> gcc/
>>
>>         * config/i386/i386.md (extendhfdf2): Delete expander.
>>         (extendhf): New mode attribute.
>>         (*extendhf<mode>2): Use it.
> 
> No, please leave the expander, it is there due to extendhfsf2 that
> prevents effective macroization.

Well, okay then.

> FYI, there is no less generated code when the named pattern is used,
> the same code is generated from the named pattern as from the
> expander. Source code can be shrinked, but in this particular case,
> forced macroization complicates things more.

Hmm, I'm pretty sure I checked and found some reduction.

Jan

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

end of thread, other threads:[~2023-07-14 10:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14  9:44 [PATCH] x86: replace "extendhfdf2" expander Jan Beulich
2023-07-14 10:10 ` Uros Bizjak
2023-07-14 10:40   ` Jan Beulich

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).