-
Notifications
You must be signed in to change notification settings - Fork 274
Support ==,!=,<,<=,>,>= over vectors #5940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
What happens when the vector subtype is unsigned? |
GCC's documentation says "constant of the appropriate type where all bits are set" (https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html), so this should work (as we use two's complement). |
4c24ace
to
b691fad
Compare
Does that operation exist for vectors of type |
The docs say: "Comparison operands can be vector expressions of integer-type or real-type." |
Won't the |
|
A quick test confirms that clang generates NaN, not -1. |
Ah, just noting that |
Ah, I overlooked "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". Right now, the result type is an array type, but should be a vector type. |
Ah, sorry, wrong again -- the frontend does produce a vector type, of signed integers, but it does fail to meet the requirement "same width". |
Newly created expressions did not have a source location, which may, however, be useful in debugging.
As specified in GCC's documentation, the result type is a vector of signed integers of the same width as the operand subtypes. As the semantics are different from relational expressions over scalars, introduce a different expression id: each operation is now prefixed with vector-.
These need to be rewritten to point-wise applications and return -1 (true) or 0 (false) per element. Fixes: diffblue#5930
Codecov Report
@@ Coverage Diff @@
## develop #5940 +/- ##
===========================================
+ Coverage 73.55% 73.56% +0.01%
===========================================
Files 1431 1431
Lines 155248 155291 +43
===========================================
+ Hits 114189 114243 +54
+ Misses 41059 41048 -11
Continue to review full report at Codecov.
|
if(expr.id() == ID_notequal) | ||
expr.id(ID_vector_notequal); | ||
else | ||
expr.id("vector-" + id2string(expr.id())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be vector-=, vector-<= etc?
These need to be rewritten to point-wise applications and return -1
(true) or 0 (false) per element.
Fixes: #5930