public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/19274] New: temporary not eliminated in composite _mm_set_ps1
@ 2005-01-05 18:07 tbptbp at gmail dot com
  2005-01-05 18:46 ` [Bug target/19274] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tbptbp at gmail dot com @ 2005-01-05 18:07 UTC (permalink / raw)
  To: gcc-bugs

Sometime the temporary in that composite intrinsic doesn't get eliminated.

Test case: -O3 -march=k8  -fomit-frame-pointer
#include <xmmintrin.h>

__m128 not_eliminated(const float f1, const float f2) {
	const __m128
		a = _mm_set_ps1(f1),
		b = _mm_set_ps1(f2),
		c = _mm_mul_ps(a, b);
	return c;
}

#define broadcast(f) _mm_shuffle_ps(_mm_load_ss(&(f)),_mm_load_ss(&(f)),0)
__m128 eliminated(const float f1, const float f2) {
	const __m128
		a = broadcast(f1),
		b = broadcast(f2),
		c = _mm_mul_ps(a, b);
	return c;
}

int main() { return 0; }

With gcc4-20040102 + patch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19240
(happens in older version too), i still get:
00401070 <not_eliminated(float, float)>:
  401070:       sub    $0x10,%esp
  401073:       mov    0x14(%esp),%eax
  401077:       mov    %eax,0xc(%esp)
  40107b:       mov    0x18(%esp),%eax
  40107f:       movss  0xc(%esp),%xmm0
  401085:       shufps $0x0,%xmm0,%xmm0
  401089:       mov    %eax,0xc(%esp)
  40108d:       movss  0xc(%esp),%xmm1
  401093:       add    $0x10,%esp
  401096:       shufps $0x0,%xmm1,%xmm1
  40109a:       mulps  %xmm1,%xmm0
  40109d:       ret    

and:
004010a0 <eliminated(float, float)>:
  4010a0:       movss  0x4(%esp),%xmm0
  4010a6:       movss  0x8(%esp),%xmm1
  4010ac:       shufps $0x0,%xmm0,%xmm0
  4010b0:       shufps $0x0,%xmm1,%xmm1
  4010b4:       mulps  %xmm1,%xmm0
  4010b7:       ret    

It might happens with other intrinsics, but i haven't spotted it yet :)

-- 
           Summary: temporary not eliminated in composite _mm_set_ps1
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbptbp at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19274


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

* [Bug target/19274] temporary not eliminated in composite _mm_set_ps1
  2005-01-05 18:07 [Bug rtl-optimization/19274] New: temporary not eliminated in composite _mm_set_ps1 tbptbp at gmail dot com
@ 2005-01-05 18:46 ` pinskia at gcc dot gnu dot org
  2005-01-12  6:07 ` pinskia at gcc dot gnu dot org
  2005-08-13 21:24 ` tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-05 18:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-05 18:45 -------
Confirmed, it comes down to the defintion of _mm_set1_ps and __builtin_ia32_loadss.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|rtl-optimization            |target
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-05 18:45:57
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19274


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

* [Bug target/19274] temporary not eliminated in composite _mm_set_ps1
  2005-01-05 18:07 [Bug rtl-optimization/19274] New: temporary not eliminated in composite _mm_set_ps1 tbptbp at gmail dot com
  2005-01-05 18:46 ` [Bug target/19274] " pinskia at gcc dot gnu dot org
@ 2005-01-12  6:07 ` pinskia at gcc dot gnu dot org
  2005-08-13 21:24 ` tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-12  6:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-12 06:07 -------
This has been fixed now, I think by a patch which also fixed PR 13366.
We get the same code for both functions in 32bit mode.
But note in 64bit mode, we get better code for not_eliminated:
not_eliminated:
.LFB473:
        shufps  $0, %xmm1, %xmm1
        shufps  $0, %xmm0, %xmm0
        mulps   %xmm1, %xmm0
        ret

Vs:
eliminated:
.LFB474:
        movss   %xmm0, -4(%rsp)
        movl    -4(%rsp), %eax
        movss   %xmm1, -4(%rsp)
        movd    %eax, %xmm0
        movl    -4(%rsp), %eax
        shufps  $0, %xmm0, %xmm0
        movd    %eax, %xmm1
        shufps  $0, %xmm1, %xmm1
        mulps   %xmm1, %xmm0
        ret

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19274


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

* [Bug target/19274] temporary not eliminated in composite _mm_set_ps1
  2005-01-05 18:07 [Bug rtl-optimization/19274] New: temporary not eliminated in composite _mm_set_ps1 tbptbp at gmail dot com
  2005-01-05 18:46 ` [Bug target/19274] " pinskia at gcc dot gnu dot org
  2005-01-12  6:07 ` pinskia at gcc dot gnu dot org
@ 2005-08-13 21:24 ` tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-08-13 21:24 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |23379


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19274


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

end of thread, other threads:[~2005-08-13 21:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-05 18:07 [Bug rtl-optimization/19274] New: temporary not eliminated in composite _mm_set_ps1 tbptbp at gmail dot com
2005-01-05 18:46 ` [Bug target/19274] " pinskia at gcc dot gnu dot org
2005-01-12  6:07 ` pinskia at gcc dot gnu dot org
2005-08-13 21:24 ` tkoenig at gcc dot gnu dot org

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