[PPL-devel] IEEE inexact-flag not working on the Alpha (despite -mieee-with-inexact)?

Roberto Bagnara bagnara at cs.unipr.it
Thu Sep 18 15:17:41 CEST 2008


Tim Prince wrote:
> Roberto Bagnara wrote:
> 
>> #include <fenv.h>
>> #include <cstdio>
>>
>> int main() {
>>   float x = 2;
>>   float y = 3;
>>   feclearexcept(FE_INEXACT);
>>   x = x / y;
>>   printf("%d %.1000g\n", fetestexcept(FE_INEXACT) != 0, x);
>> }
> 
> Is this a way of testing whether the division is performed at compile
> time?  Do you call it a bug if constant propagation occurs when you don't
> take action to prevent it?

Hi Tim,

I am not sure I understand your message.  However, before mailing I did
check that constant propagation is not an issue by checking the generated
assembly:

         ldq $27,feclearexcept($29)              !literal!2
         jsr $26,($27),0         !lituse_jsr!2
         ldah $29,0($26)         !gpdisp!3
         lda $29,0($29)          !gpdisp!3
         lds $f11,20($15)
         lds $f10,16($15)
         divs/sui $f11,$f10,$f12
         trapb
         cpys $f12,$f12,$f10
         sts $f10,20($15)
         ldah $16,32($31)
         ldq $27,fetestexcept($29)               !literal!4
         jsr $26,($27),0         !lituse_jsr!4

Note that I am not compiling with optimizations and that the
divs/sui opcode is generated.
All the best,

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list