about +DSnative of cc (156 Views)
Reply
Occasional Visitor
hk_3
Posts: 4
Registered: ‎07-28-2009
Message 1 of 6 (156 Views)

about +DSnative of cc

Hello,

I'm hk from Korea.

I compiled the c program using +DSnative on 11.31 Montvale processor

But I plan to run my program on 11.31 madison processor.

Compile on :
HP-UX 11.31 Montvale (dual core cpu, HyperThreading Enabled)

Run on :
HP-UX 11.31, Madison(single core, NO Hyper Threading supported)

So I'm worrying about +DSnative on montvale affect my binary program on madison.

I want to know how +DSnative work exactly.

I'm sure it check the processor type on PARISC (uname -m)

But the result of "uname -m" is all same in IA2.
+DSnative check the type of processor another way on IA2 or it's all same working as +DSitanium2 ?

Help plz. I can't find the answer.


* How to see a processor type:
# machinfo
Madison - Intel(R) Itanium 2 processor
Montecito - Intel(R) Itanium 2 9000 series
Montvale - Intel(R) Itanium 2 9100 series
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,957
Registered: ‎03-06-2006
Message 2 of 6 (156 Views)

Re: about +DSnative of cc

>I compiled a C program using +DSnative on 11.31 Montvale processor. But I plan to run my program on 11.31 Madison processor.

There should be little difference in the code generated for Montvale vs Madison. If you are worried you can use +DSblended.

>I'm sure it check the processor type on PA-RISC (uname -m)

The PA compiler knows how to get the processor type and doesn't use uname(2).
Similarly for IPF, the compiler gets the processor type.
Please use plain text.
Occasional Visitor
hk_3
Posts: 4
Registered: ‎07-28-2009
Message 3 of 6 (156 Views)

Re: about +DSnative of cc

Thank you for your reply.

I know It would be fine compile again using +DSitanium2 or +DSblended on Montvale.

But project is too big and above all my customer didn't want to recompile.
He ordered me the report which I asked for.

So I have to invest how it affect the binary file.
I converted sample program into machine code using +DSnative and +DSitanium2.
the result is same.



# cat sample.c
#include
main()
{
int i,j,a,b,c,d,e,f,g,h,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
int sum;
a = 2;
b = 2;
c = 2;
d = 2;
e = 2;
sum = a +b;
sum = sum +e;
f = 2;
g = 2;
h = 2;
i = 2;
k = 2;
j = 5;
l = 5;
m = 5;
n = 5;
o = 5;
p = 5;
sum = sum + n+ o;
q = 5;
r = 5;
s = 5;
t = 5;
u = 5;
v = 5;
w = 5;
y = 5;
z = 5;
x = 5;
sum = q + j;
sum = r + s;
sum = i + j;

printf("sum = %d\n", sum);
}


# cc -o sample +DSnative sample.c
# tdas -F main sample > native.out
# cc -o sample +DSitanium2 sample.c
# tdas -F main sample > itanium2.out
# diff native.out itanium2.out
#


* tdas is wtec tool

Once I compiled sample.c using +DSitanium, (not +DSitanium"2"), converting into machine code, It looks scheduling instructions in a different order.


I wonder if +DSmodel using instruction scheduler tuned to the model, It might be affect building machine code?

I'm sorry I'm not good at English.
If you don't understand my words, plz tell me. I'll try to.
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,957
Registered: ‎03-06-2006
Message 4 of 6 (156 Views)

Re: about +DSnative of cc

>But project is too big and above all my customer didn't want to recompile. He ordered me the report which I asked for.

If he doesn't want to recompile, there isn't much to say other than try it. Compiling for Montecito/Montvale will make things run only a little slower on Madison. The best thing to do is just run it.

>the result is same.
# cc +DSnative sample.c

You need something more complex. Also if you aren't optimizing, you are wasting performance.

>* tdas is WTEC tool

No need to use that. Just use -S and look at the .s file.

In fact if you optimize, your program is changed to just:
printf("sum = %d\n", 7);

>I wonder if +DSmodel using instruction scheduler tuned to the model, It might be affect machine code?

Of course. But you have to optimize.
Please use plain text.
Occasional Visitor
hk_3
Posts: 4
Registered: ‎07-28-2009
Message 5 of 6 (156 Views)

Re: about +DSnative of cc

Yeah, You're right.
Just run it. That's all.

But if the report says there's big difference for performance.
My customer might be agree to recompile.

Anyway, I've been wasting my time for unproductable question. I'll suggest him between "run it" or "recompile it"
that'll be more effiency to this project

And your answer gave me a big help.

Thank you so much.

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,957
Registered: ‎03-06-2006
Message 6 of 6 (156 Views)

Re: about +DSnative of cc

>But if the report says there's big difference for performance.

We don't think there will be anything big. But an important point is the optimization level.
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation