Thanks for the replies.
In this particular case the signature for the extern C function is
__m256 _mm256_set_ps (float e7, float e6, float e5, float e4, float e3,
> float e2, float e1, float e0);
where __m256 should be an array of 8 floats. And it does seem that the
extra parameter was generated to pass return value.
The extra parameter was not generated if __m256 was not declared as a
tuple. So returnStarTuplesByRefArg.cpp does seems like a good candidate.
I plan to explore more about this issue, maybe write a C header with a
simple C function to reproduce the error. I am not familiar with the PR
process though. If the error persists, I will send a email to the bug list.
Mike, I received you reply fine. Please keep me updated on this issue.
Thanks again.
Zhe Zhang
On Wed, Jun 8, 2016 at 4:31 PM, Zhe Zhang <[email protected]> wrote:
> Hi
>
> Chapel compiler generates extra parameter for certain extern C function
> calls. For example:
>
> require "immintrin.h";
>> extern type __m256 = 8*real(32);
>> extern proc _mm256_set_ps (in e7:real(32), in e6:real(32), in
>> e5:real(32), in e4:real(32), in e3:real(32), in e2:real(32), in
>> e1:real(32), in e0:real(32)): __m256;
>> proc main () {
>> var x: __m256;
>> x = _mm256_set_ps (1.0:real(32), 2.0:real(32), 3.0:real(32),
>> 4.0:real(32), 5.0:real(32), 6.0:real(32), 7.0:real(32), 8.0:real(32));
>> }
>
>
> This would cause an error:
>
> error: too many arguments to function '_mm256_set_ps'
>> _mm256_set_ps(call_tmp_chpl9, call_tmp_chpl10, call_tmp_chpl11,
>> call_tmp_chpl12, call_tmp_chpl13, call_tmp_chpl14, call_tmp_chpl15,
>> call_tmp_chpl16, *(tmp_chpl));
>> ^
>> /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/avxintrin.h:1219:1: note:
>> declared here
>> _mm256_set_ps (float __A, float __B, float __C, float __D,
>> ^
>
>
> where _mm256_set_ps accepts 8 parameters in C, but an extra *(tmp_chpl)
> was generated. If the implementation of __m256 was hiden from chapel:
>
> extern type __m256;
>
> extern proc _mm256_set_ps ...
>
>
> It compiled fine, but then __m256 cannot be used as a tuple.
>
> Is there a way to bypass the parameter generation and direct the extern
> function to return a tupel/array as return value? And in what situation
> would this behavior be triggered?
>
>
> Thanks
>
> Zhe Zhang
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users