public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Intrinsics with -march=pentium3
@ 2004-01-16 19:11 Jean-Marc Valin
  2004-01-16 20:45 ` Eljay Love-Jensen
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Marc Valin @ 2004-01-16 19:11 UTC (permalink / raw)
  To: gcc-help

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

Hi,

I'd like to compile code containing SSE intrinsics, but without having
to enable -march=pentium3. The reason for that is that I want the code
to run on any x86 and then enable the SSE parts only if SSE is detected.
So far, the only way I've found would be defining __SSE__, but I'm not
sure it's the right thing to do. Is there any other way?

	Jean-Marc

-- 
Jean-Marc Valin, M.Sc.A., ing. jr.
LABORIUS (http://www.gel.usherb.ca/laborius)
Université de Sherbrooke, Québec, Canada

[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Intrinsics with -march=pentium3
  2004-01-16 19:11 Intrinsics with -march=pentium3 Jean-Marc Valin
@ 2004-01-16 20:45 ` Eljay Love-Jensen
  2004-01-16 21:43   ` Jean-Marc Valin
  2004-01-18  6:57   ` Jean-Marc Valin
  0 siblings, 2 replies; 5+ messages in thread
From: Eljay Love-Jensen @ 2004-01-16 20:45 UTC (permalink / raw)
  To: Jean-Marc Valin, gcc-help

Hi Jean-Marc,

Wouldn't you compile the SSE routine in one source file with the switch, and the non-SSE routine in a different source file (along with all the rest of the other source code) without the switch.

Then algorithmically determine if the SSE support is available and programmatically set a function pointer to the correct routine, and utilize the SSE or non-SSE routine via that function pointer mechanism.

?

--Eljay


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

* Re: Intrinsics with -march=pentium3
  2004-01-16 20:45 ` Eljay Love-Jensen
@ 2004-01-16 21:43   ` Jean-Marc Valin
  2004-01-16 21:57     ` Eljay Love-Jensen
  2004-01-18  6:57   ` Jean-Marc Valin
  1 sibling, 1 reply; 5+ messages in thread
From: Jean-Marc Valin @ 2004-01-16 21:43 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: gcc-help

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

> Wouldn't you compile the SSE routine in one source file with the switch, and the non-SSE routine in a different source file (along with all the rest of the other source code) without the switch.

I guess I can always do that, but it's going to be messy trying to tell
autoconf "compile this file with a different switch and only if this
switch is enabled". Any idea how one would do that?

> Then algorithmically determine if the SSE support is available and programmatically set a function pointer to the correct routine, and utilize the SSE or non-SSE routine via that function pointer mechanism.

For simple functions, wouldn't that be slower than a plain "if" because
of the branch prediction?

	Jean-Marc

-- 
Jean-Marc Valin, M.Sc.A., ing. jr.
LABORIUS (http://www.gel.usherb.ca/laborius)
Université de Sherbrooke, Québec, Canada

[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Intrinsics with -march=pentium3
  2004-01-16 21:43   ` Jean-Marc Valin
@ 2004-01-16 21:57     ` Eljay Love-Jensen
  0 siblings, 0 replies; 5+ messages in thread
From: Eljay Love-Jensen @ 2004-01-16 21:57 UTC (permalink / raw)
  To: Jean-Marc Valin; +Cc: gcc-help

Hi Jean-Marc,

>Any idea how one would do that?

Nope.  I'm not knowledgable about autoconf and it's idiosyncracies.

>For simple functions, wouldn't that be slower than a plain "if" because of the branch prediction?

Nope.  It would be a skosh faster since the other code wouldn't need to be loaded into the instruction cache.

HTH,
--Eljay


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

* Re: Intrinsics with -march=pentium3
  2004-01-16 20:45 ` Eljay Love-Jensen
  2004-01-16 21:43   ` Jean-Marc Valin
@ 2004-01-18  6:57   ` Jean-Marc Valin
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Marc Valin @ 2004-01-18  6:57 UTC (permalink / raw)
  To: gcc-help

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

> Wouldn't you compile the SSE routine in one source file with the
switch, and the non-SSE routine in a different source file (along with
all the rest of the other source code) without the switch.

But is there any real reason for the
#ifndef __SSE__
# error "SSE instruction set not enabled"

Maybe it could only be a warning or something? I think there are many
legitimate uses for SSE intrinsics in non-pentium3-specific code. Also,
I see no reason to force the move of intrinsics to separate files.

        Jean-Marc

-- 
Jean-Marc Valin, M.Sc.A., ing. jr.
LABORIUS (http://www.gel.usherb.ca/laborius)
Université de Sherbrooke, Québec, Canada

[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2004-01-18  6:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-16 19:11 Intrinsics with -march=pentium3 Jean-Marc Valin
2004-01-16 20:45 ` Eljay Love-Jensen
2004-01-16 21:43   ` Jean-Marc Valin
2004-01-16 21:57     ` Eljay Love-Jensen
2004-01-18  6:57   ` Jean-Marc Valin

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