simd comparison operator?

monarch_dodra monarchdodra at gmail.com
Tue Feb 19 06:03:52 PST 2013


Are there any plans that would allow using opEqual or opCmp 
operators with simd?

My use case is that I have arrays, and I need to verify that ALL 
the elements in my array are comprised between two values (in 
this specific case 10 and 93).

I was hoping I would be able to use:
ubyte[] arr = ...
if (arr []< 10 || arr[]> 93) throw Exception();

But that doesn't seem to work.

Neither does simple opEqual comparison.
//Make sure arr is initialized to 0
if (arr[] != 0)

Is this a "never thought of this and not implemented" issue, or 
is there a reason that simd can't do this? I find it strange, 
since simd allows for straight up array to array opEquals, but 
not array to value?

--------

Anybody have any idea as a workaround? My program has very high 
data throughput, and never actually handles the array elements 
individually, just manipulates them simd chunks at once. 
Validating the content is important, but performance is taking a 
real toll...


More information about the Digitalmars-d mailing list