Re: Fwd: [x86, PATCH] More effecient code for short unsigned conversion to float-point.

2013-08-12 Thread Uros Bizjak
On Mon, Aug 12, 2013 at 2:31 PM, Kirill Yukhin  wrote:
>
> part of the thread was accidentally removed from gcc-patches.
>
> I've comitted Yuri's patch into ML: 
> http://gcc.gnu.org/ml/gcc-cvs/2013-08/msg00272.html
>
> As far as discussion was out of ML - feel free to object.

I have changed X87MODEF mode iterator to MODEF, since SSE_FLOAT_MODE_P
is always false for XFmode.

2013-08-12  Uros Bizjak  

* config/i386/i386.md (floatunssi2 expand): Use MODEF mode
iterator instead of X87MODEF.

Tested on x86_64-pc-linux-gnu {,-m32}, will be committed to mainline SVN.

Uros.

Index: i386.md
===
--- i386.md (revision 201665)
+++ i386.md (working copy)
@@ -5037,15 +5037,15 @@
&& reload_completed"
   [(set (match_dup 0) (float:X87MODEF (match_dup 1)))])

-(define_expand "floatuns2"
-  [(set (match_operand:X87MODEF 0 "register_operand")
-   (unsigned_float:X87MODEF
+(define_expand "floatuns2"
+  [(set (match_operand:MODEF 0 "register_operand")
+   (unsigned_float:MODEF
  (match_operand:SWI12 1 "nonimmediate_operand")))]
   "!TARGET_64BIT
-   && SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH"
+   && SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH"
 {
   operands[1] = convert_to_mode (SImode, operands[1], 1);
-  emit_insn (gen_floatsi2 (operands[0], operands[1]));
+  emit_insn (gen_floatsi2 (operands[0], operands[1]));
   DONE;
 })


Re: Fwd: [x86, PATCH] More effecient code for short unsigned conversion to float-point.

2013-08-12 Thread Kirill Yukhin
On 12 Aug 16:12, Yuri Rumyantsev wrote:

Hello,
part of the thread was accidentally removed from gcc-patches.

I've comitted Yuri's patch into ML: 
http://gcc.gnu.org/ml/gcc-cvs/2013-08/msg00272.html

As far as discussion was out of ML - feel free to object.

Thanks, K

> -- Forwarded message --
> From: Uros Bizjak 
> Date: 2013/8/7
> Subject: Re: [x86, PATCH] More effecient code for short unsigned
> conversion to float-point.
> To: Yuri Rumyantsev 
> 
> 
> Ah, OK, I see where I did a thinko.
> 
> The patch looks OK, then.
> 
> Uros.
> 


Re: [x86, PATCH] More effecient code for short unsigned conversion to float-point.

2013-08-06 Thread Richard Henderson
On 08/06/2013 04:33 AM, Yuri Rumyantsev wrote:
> -(define_expand "floatunssi2"
> +(define_expand "floatuns2"
>[(parallel
>   [(set (match_operand:X87MODEF 0 "register_operand")
>  (unsigned_float:X87MODEF
> -  (match_operand:SI 1 "nonimmediate_operand")))
> +  (match_operand:SWI124 1 "nonimmediate_operand")))
>(clobber (match_dup 2))
>(clobber (match_scratch:SI 3))])]
>"!TARGET_64BIT
> && ((TARGET_80387 && X87_ENABLE_FLOAT (mode, DImode)
>   && TARGET_SSE)
> -   || (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH))"
> +   || (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH))"
>  {
> -  if (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH)
> +  if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (SImode))
> +{ 
> +  operands[1] = convert_to_mode (SImode, operands[1], 1);
> +  emit_insn (gen_floatsi2 (operands[0], operands[1]));
> +  DONE;
> +}
> +  

The idea is correct, but there's no need to share the same expand,
adding a runtime test against the mode.


r~


Re: [x86, PATCH] More effecient code for short unsigned conversion to float-point.

2013-08-06 Thread Andreas Schwab
Yuri Rumyantsev  writes:

> * config/i386/i386.md (floatunssi2 expand): Add support
> for QI/HImode operand to produce more effecient code for

s/effecient/efficient/

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


[x86, PATCH] More effecient code for short unsigned conversion to float-point.

2013-08-06 Thread Yuri Rumyantsev
Hi All,

Here is simple fix which produces more optimal code unsigned
char(short) to float(double) with direct rtl-generation.

Bootstrapping and regression testing were successful for x86-64.

Is it OK for trunk?

ChangeLog:

2013-08-06  Yuri Rumyantsev  

* config/i386/i386.md (floatunssi2 expand): Add support
for QI/HImode operand to produce more effecient code for
unsigned char(short) --> float(double) conversion.


i386-short-uns-conversion-to-fp.patch
Description: Binary data