public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98387] New: GCC >= 6 cannot inline _mm_cmp_ps on SSE targets
@ 2020-12-19  5:36 danielhanchen at gmail dot com
  2020-12-19  6:10 ` [Bug target/98387] " danielhanchen at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: danielhanchen at gmail dot com @ 2020-12-19  5:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98387

            Bug ID: 98387
           Summary: GCC >= 6 cannot inline _mm_cmp_ps on SSE targets
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danielhanchen at gmail dot com
  Target Milestone: ---

https://gcc.godbolt.org/z/493ead

GCC since version 6.1 cannot inline _mm_cmp_ps on targets supporting only SSE
(Nehalem, Tremont etc). From >= SandyBridge, everything inlines fine.

_mm_cmp_ps is called by using it as a function argument (ie auto function).

All SSE only machines use a jmp to _mm_cmp_ps, but it should be inlined.

O3 ffast-math is also used, and the function is declared inline.

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

* [Bug target/98387] GCC >= 6 cannot inline _mm_cmp_ps on SSE targets
  2020-12-19  5:36 [Bug c++/98387] New: GCC >= 6 cannot inline _mm_cmp_ps on SSE targets danielhanchen at gmail dot com
@ 2020-12-19  6:10 ` danielhanchen at gmail dot com
  2020-12-19 14:21 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: danielhanchen at gmail dot com @ 2020-12-19  6:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98387

--- Comment #1 from Daniel Han-Chen <danielhanchen at gmail dot com> ---
Oh I just noticed _mm_cmp_ps isn't actually supported for SSE targets even in
Intel's Intrinsics Guide: [_mm_cmp_ps first was supported in AVX]

https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=5236,827,33,5224,447,456,4085,3864,5224,4179,4118,4115,4115,4121,3864,3870,5579,2030,3319,2809,4127,5156,4179,4201,3536,3539,3533,2184,3505,3533,3542,3505,3533,1606,4174,2809,5576,5578,2063,3895,3893,2484,3864,4076,3864,687,689,689,3544,771,1648,1647,5878,5903,743&techs=SSE,SSE2,SSE3,SSSE3,SSE4_1,SSE4_2&text=cmpps



error: inlining failed in call to always_inline '__m128 _mm_cmp_ps(__m128,
__m128, int)': target specific option mismatch
  390 | _mm_cmp_ps (__m128 __X, __m128 __Y, const int __P)


_mm_cmp[*]_ps ie _mm_cmpeq_ps and derivatives successfully inline.

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

* [Bug target/98387] GCC >= 6 cannot inline _mm_cmp_ps on SSE targets
  2020-12-19  5:36 [Bug c++/98387] New: GCC >= 6 cannot inline _mm_cmp_ps on SSE targets danielhanchen at gmail dot com
  2020-12-19  6:10 ` [Bug target/98387] " danielhanchen at gmail dot com
@ 2020-12-19 14:21 ` hjl.tools at gmail dot com
  2020-12-19 14:52 ` danielhanchen at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-12-19 14:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98387

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
_mm_cmp_ps is an AVX intrinsic.

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

* [Bug target/98387] GCC >= 6 cannot inline _mm_cmp_ps on SSE targets
  2020-12-19  5:36 [Bug c++/98387] New: GCC >= 6 cannot inline _mm_cmp_ps on SSE targets danielhanchen at gmail dot com
  2020-12-19  6:10 ` [Bug target/98387] " danielhanchen at gmail dot com
  2020-12-19 14:21 ` hjl.tools at gmail dot com
@ 2020-12-19 14:52 ` danielhanchen at gmail dot com
  2020-12-19 18:01 ` hjl.tools at gmail dot com
  2020-12-20  2:53 ` danielhanchen at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: danielhanchen at gmail dot com @ 2020-12-19 14:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98387

--- Comment #3 from Daniel Han-Chen <danielhanchen at gmail dot com> ---
(In reply to H.J. Lu from comment #2)
> _mm_cmp_ps is an AVX intrinsic.

Yep noticed _mm_cmp_ps is only in AVX. The weird part is it actually causes no
errors when used on SSE only targets [ie Nehalem], and GCC continues compiling.

Is this supposed to be normal behaivor?

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

* [Bug target/98387] GCC >= 6 cannot inline _mm_cmp_ps on SSE targets
  2020-12-19  5:36 [Bug c++/98387] New: GCC >= 6 cannot inline _mm_cmp_ps on SSE targets danielhanchen at gmail dot com
                   ` (2 preceding siblings ...)
  2020-12-19 14:52 ` danielhanchen at gmail dot com
@ 2020-12-19 18:01 ` hjl.tools at gmail dot com
  2020-12-20  2:53 ` danielhanchen at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-12-19 18:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98387

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Daniel Han-Chen from comment #3)
> (In reply to H.J. Lu from comment #2)
> > _mm_cmp_ps is an AVX intrinsic.
> 
> Yep noticed _mm_cmp_ps is only in AVX. The weird part is it actually causes
> no errors when used on SSE only targets [ie Nehalem], and GCC continues
> compiling.
> 
> Is this supposed to be normal behaivor?

GCC treats it like an undefined function.

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

* [Bug target/98387] GCC >= 6 cannot inline _mm_cmp_ps on SSE targets
  2020-12-19  5:36 [Bug c++/98387] New: GCC >= 6 cannot inline _mm_cmp_ps on SSE targets danielhanchen at gmail dot com
                   ` (3 preceding siblings ...)
  2020-12-19 18:01 ` hjl.tools at gmail dot com
@ 2020-12-20  2:53 ` danielhanchen at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: danielhanchen at gmail dot com @ 2020-12-20  2:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98387

--- Comment #5 from Daniel Han-Chen <danielhanchen at gmail dot com> ---
(In reply to H.J. Lu from comment #4)
> (In reply to Daniel Han-Chen from comment #3)
> > (In reply to H.J. Lu from comment #2)
> > > _mm_cmp_ps is an AVX intrinsic.
> > 
> > Yep noticed _mm_cmp_ps is only in AVX. The weird part is it actually causes
> > no errors when used on SSE only targets [ie Nehalem], and GCC continues
> > compiling.
> > 
> > Is this supposed to be normal behaivor?
> 
> GCC treats it like an undefined function.

Thanks! Sorry I probably might have asked some really dumb questions. But also
thanks for taking your time in answering them! :) Appreciate it!

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

end of thread, other threads:[~2020-12-20  2:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-19  5:36 [Bug c++/98387] New: GCC >= 6 cannot inline _mm_cmp_ps on SSE targets danielhanchen at gmail dot com
2020-12-19  6:10 ` [Bug target/98387] " danielhanchen at gmail dot com
2020-12-19 14:21 ` hjl.tools at gmail dot com
2020-12-19 14:52 ` danielhanchen at gmail dot com
2020-12-19 18:01 ` hjl.tools at gmail dot com
2020-12-20  2:53 ` danielhanchen at gmail dot com

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