<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.E-postmall17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=SV link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Please Richartd, try to
be patient with me. I am just trying to get some help and am truly sorry if you
are feeling “spammed”. I will try to be more precise in the future.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>My problem is that I do
not get any result from the simple division “</span></font><font size=2><span
lang=EN-GB style='font-size:10.0pt'>ppgAcDiff = ppgAcDiff/acGain;”<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>As I said, I always am
very careful about accusing the compiler as it is not normally the cause and
especially not for simple things like this. But in this case I am running it in
Studio and after just adding the </span></font><font size=2><span lang=EN-GB
style='font-size:10.0pt'>: ppgAcDiff++; (and also
a ppgACDiff--;)</span></font><font size=2 color=navy face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;color:navy'> The result is
not the same, not even the result from the function there the result from the
division is used.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>As John said, the move
should be unnecessary but in my testing, the result from the function did
change. I will try to use a test function that do something simple and see the
result. I get back. Maybe the problem is in the function. <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>And Richard again, I am
used to ask all kind of questions here, one more stupid than the other, and I
am used to get great support from you or anyone else here so I am not so used
that you being so angry with me. Could it possible be that you have little
black devil on your shoulder that triggers on the “compiler bug”
condition? It that is so, please use a frying pan or something and smash it
down, I do not want to upset anyone (maybe I did so right now which I didn’t
intended either)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Sincerely<o:p></o:p></span></font></p>
<p class=MsoNormal><st1:PersonName ProductID="Bengt Ragnemalm" w:st="on"><font
size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>Bengt Ragnemalm</span></font></st1:PersonName><font
size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>Från:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
icc-avr-bounces@imagecraft.com [mailto:icc-avr-bounces@imagecraft.com] <b><span
style='font-weight:bold'>För </span></b>John Baraclough<br>
<b><span style='font-weight:bold'>Skickat:</span></b> den 4 maj 2007 18:27<br>
<b><span style='font-weight:bold'>Till:</span></b> benra@imt.liu.se; Discussion
list for ICCAVR and ICCtiny Users. You do NOT need tosubscribe to icc-announce
if you are a member of this.<br>
<b><span style='font-weight:bold'>Ämne:</span></b> Re: [Icc-avr] Compiler bug?</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi Bengt,<br>
<br>
I assume the function at </span></font><font size=2><span style='font-size:
10.0pt'>0x00000A68 in your first listing is 'div16s', in which case the result
is returned in R16/R17. That being so, then the first parameter being passed to
the function <br>
<br>
S_ShortFilter(ppgAcDiff, &filtMem[channel], filterdjup,
&firFiltMem[channel]);<br>
<br>
is already in the correct register pair and doesn't need to be moved. Sorry,
but I don't think he problem is with the compiler.<br>
<br>
</span></font>All the best for now,<br>
John<br>
<br>
<br>
At 13:44 04/05/2007, you wrote:<br>
<br>
<o:p></o:p></p>
<p class=MsoNormal><font size=2 face="Times New Roman"><span style='font-size:
10.0pt'>Hi.<br>
<br>
I know that I am usually wrong about this but this looks like a compiler bug to
me. Please have look.<br>
<br>
ppgAcDiff and acGain are signed short.<br>
<br>
This simple line didn’t do anything so I checked the assembler. Actually
this is very similar to my previous problem but this time the variable is used
at the line right after. Just to provoke, I inserted a simple ++ in between and
yes, now the result is saved. What is going on here?<br>
<br>
ppgAcDiff = ppgAcDiff/acGain;<br>
<br>
<br>
411:
ppgAcDiff = ppgAcDiff/acGain;<br>
+0000020D: 019C
MOVW
R18,R24 Copy register
pair<br>
+0000020E: 0187
MOVW
R16,R14 Copy register
pair<br>
+0000020F: 940E0A68 CALL
0x00000A68 Call subroutine<br>
414:
subtractTotalDiffFiltered = S_ShortFilter(ppgAcDiff, &filtMem[channel],
filterdjup, &firFiltMem[channel]);<br>
<br>
<br>
<br>
411:
ppgAcDiff = ppgAcDiff/acGain;<br>
+0000020D: 019C
MOVW
R18,R24 Copy register
pair<br>
+0000020E: 0187
MOVW
R16,R14 Copy register
pair<br>
+0000020F: 940E0A6D CALL
0x00000A6D Call subroutine<br>
+00000211: 0178
MOVW
R14,R16 Copy register
pair<br>
412: ppgAcDiff++;<br>
+00000212: 01C7
MOVW
R24,R14 Copy register
pair<br>
+00000213: 9601
ADIW R24,0x01
Add immediate to word<br>
+00000214: 017C
MOVW
R14,R24 Copy register
pair<br>
414:
subtractTotalDiffFiltered = S_ShortFilter(ppgAcDiff, &filtMem[channel],
filterdjup, &firFiltMem[channel]);<br>
<br>
/Bengt<br>
________________________________________________________________<br>
</span></font><br>
<st1:PersonName ProductID="Bengt Ragnemalm" w:st="on">Bengt Ragnemalm</st1:PersonName>
Tel +46 13 22 24 97<br>
<br>
<font size=2><span style='font-size:10.0pt'>Research
engineer
FAX: +46 13 10 19 02<br>
</span></font><br>
<font size=2><span style='font-size:10.0pt'>Linköpings
Universitet
</span></font><a href="mailto:bengt.ragnemalm@imt.liu.se">mailto:bengt.ragnemalm@imt.liu.se</a><br>
<br>
<font size=2><span style='font-size:10.0pt'>Inst. för Medicinsk Teknik
Internet: </span></font><a
href="http://www.imt.liu.se/"><font color=purple><span style='color:purple'>http://www.imt.liu.se</span></font></a><font
color=purple><span style='color:purple'><br>
</span></font><br>
<font size=2><span style='font-size:10.0pt'>S-581 85 Linköping SWEDEN<br>
</span></font><br>
<br>
<br>
_______________________________________________<br>
Icc-avr mailing list<br>
Icc-avr@imagecraft.com<br>
<a href="http://dragonsgate.net/mailman/listinfo/icc-avr" eudora=autourl>http://dragonsgate.net/mailman/listinfo/icc-avr</a><o:p></o:p></p>
</div>
</div>
</body>
</html>