Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Comparing two vectors of floats returns a vector of floats

$
0
0

It should return a vector of integers.  The GCC documentation is pretty clear:

Vector comparison is supported with standard comparison operators: ==, !=, <, <=, >, >=. Comparison operands can be vector expressions of integer-type or real-type. Comparison between integer-type vectors and real-type vectors are not supported. The result of the comparison is a vector of the same width and number of elements as the comparison operands with a signed integral element type.

Note the last sentence.

GCC and clang both return the expected result, but ICC has other ideas and I end up with 1 << 31 instead of -1 for true.

Luckily the workaround is pretty straightforward: an explicit cast to the correct type.

TCE Level: 

TCE Open Date: 

Sunday, January 19, 2020 - 15:43

Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>