delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/01/02/06:46:24

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Tatu Portin <axel86 AT mbnet DOT fi>
User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gcc with processor optimizations
References: <ZnDBd.346$OM1 DOT 294 AT read3 DOT inet DOT fi>
In-Reply-To: <ZnDBd.346$OM1.294@read3.inet.fi>
Lines: 55
Message-ID: <6XQBd.66$HO2.52@read3.inet.fi>
Date: Sun, 02 Jan 2005 11:30:10 GMT
NNTP-Posting-Host: 80.221.74.208
X-Complaints-To: abuse AT inet DOT fi
X-Trace: read3.inet.fi 1104665410 80.221.74.208 (Sun, 02 Jan 2005 13:30:10 EET)
NNTP-Posting-Date: Sun, 02 Jan 2005 13:30:10 EET
Organization: Sonera corp Internet services
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Tatu Portin wrote:
> Does for example 'gcc -mcpu=athlon' have any real impact on compiling 
> under DJGPP?
> What about '-mfpmath=sse'?

Found out that to use SSE, you must code it in. And that gcc gives incomplete 
warning when using built-in functions on platforms where not supported.
But can one use any processor specific extensions with DJGPP?

Here is code which failed on DJGPP, althougth it compiled fine with MinGW.
MinGW version: 3.2.3
DJGPP version: 2.3
DJGPP's gcc version: 3.4.3

This code fails with:
example1.c:7: error: mode `V4SF' applied to inappropriate type
example1.c: In function `main':
example1.c:25: error: incompatible type for argument 1 of `__builtin_ia32_addps'
example1.c:25: error: incompatible type for argument 2 of `__builtin_ia32_addps'
example1.c:25: error: incompatible types in assignment

/* Start of file */
#include <stdio.h>

/* SIMD 'Hello, world' equivalent, uses regular FP, AltiVec, SSE or 3DNow!
  * depending on compilation flags */

/* vector of four single floats */
typedef int v4sf __attribute__ ((mode(V4SF)));

/* this is an aid to easily access the underlying floats */
union f4vector {
	v4sf v;
	float f[4];
};

int main
	( void)
{
	union f4vector a, b, c;
	unsigned int n;

	a.f[0] = 1; a.f[1] = 2; a.f[2] = 3; a.f[3] = 4; // fill
	b.f[0] = 5; b.f[1] = 6; b.f[2] = 7; b.f[3] = 8;

	for (n = 0 ; n < 100000000 ; n++) {
		c.v = __builtin_ia32_addps (a.v, b.v);
		/* c.v = a.v + b.v; */
	}

	printf ("%f, %f, %f, %f\n", c.f[0], c.f[1], c.f[2], c.f[3]);

	return 0;
}
/* End Of File */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019