You're right about rand(). printf() does not matter here, as using the
computed value via the return code of main() suffices to "use" the value as
far as optimization is concerned.

Checked in a new test.

E.





On Tue, Sep 24, 2013 at 10:55 AM, Andrew Fiori <algi...@gmail.com> wrote:

> On closer inspection, the sse2 test code in:
>    http://www.loria.fr/~thome/vrac/gf2x-201309240733-4b5636d.tar.gz
> the previously linked
>    http://www.loria.fr/~thome/vracgf2x-201309232352-49027b2.tar.gz
> and the code above all compile (gcc -msse2 test.c), however when they are
> run the output of:
>    ./a.out || echo $?
> is
>    Illegal instruction (core dumped)
>    132
>
> However... If I add in the flags that I think you are using -std=gnu99 -g
> -O4 -Wall -W, it now compiles and runs.
>
> I am attaching the file that compiles and its object dump.
>
> You may be able to come up with something better that breaks optimization.
> For reference the following does, it may be simpler to just drop the
> optimization flags for the purpose of the system testing (since there could
> in principle be other tests going on that also silently pass when they
> should fail).
> #include <stdlib.h>
> #include <emmintrin.h>
> #include <stdio.h>
> __v2di x;       /* Our code currently uses these, but it should not */
> int main() {
>      __m128i foo = _mm_setr_epi32(rand(), rand(), rand(), rand());
>      __m128i bar = _mm_setr_epi32(rand(), 0x26622626, 0xabbabbab,
> 0xfeed1664);
>     foo = _mm_mullo_epi16(foo, bar);
>     if( _mm_extract_epi16(foo, 0) )
>     {
>        printf("XX");
>        return 0;
>     }
>     else
>     {
>        printf("YY");
>        return _mm_extract_epi16(foo, 0);
>     }
> }
>
> - Andrew
>
>
>
> On Tue, Sep 24, 2013 at 1:44 AM, Emmanuel Thomé 
> <emmanuel.th...@gmail.com>wrote:
>
>>
>> On Tuesday, September 24, 2013 2:41:58 AM UTC+2, Andrew Fiori wrote:
>>
>>> The linked tar.gz file doesn't appear to fix the problem (I am assuming
>>> this is what you wanted me to test).
>>> It still tries to compile with sse2 on the non-sse 2 machine
>>>
>>> I am attaching the config.log as well as the output from both make and
>>> make tune-lowlevel.
>>>
>>
>> ok ; It seems that optimization got me.
>> Please try again with the repository tip, or
>> http://www.loria.fr/~thome/vrac/gf2x-201309240733-4b5636d.tar.gz
>>
>> E.
>>
>>>
>>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sage-devel" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sage-devel/Cp1lDMzyCrU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> sage-devel+unsubscr...@googlegroups.com.
>> To post to this group, send email to sage-devel@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-devel/Cp1lDMzyCrU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to