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

Reply via email to