-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Add new tests for RISCV zicond extension #143580
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
Please test |
We plan to remove 'xventanacondops' and just go with zicondops |
Did xventanacondops ever ship in real hardware? |
No |
2a23721
to
98eed72
Compare
Pushed to address the above suggestions. |
98eed72
to
7d64e5c
Compare
} | ||
|
||
; (select cond, -2048, t) -> (xor (czero_nez (xor t, -2048), cond), -2048) | ||
define i64 @select_imm_reg_2048(i64 %0, i64 %1) { |
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.
I believe the constant operand of select will alway be last due to canonicalization of IR in the midend
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.
Isn't rhs same cost as lhs?
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.
Before:
%imm = li -2048
%res0 = czero.eqz %imm, %cond
%res1 = czero.nez %input, %cond
%return = or %res0, %res1
ret %return
After:
%xor = xori %input, -2048
%czero = czero.nez, %input, %cond
%return = xori %czero, -2048
ret %return
DAG of height 3 for both, transformed has one fewer instruction
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.
I believe the constant operand of select will alway be last due to canonicalization of IR in the midend
Will this always be true, I though the order of %select was dependent on the condition, or will the mid-end flip the SETCC
condition code so that this is true?
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.
I believe the constant operand of select will alway be last due to canonicalization of IR in the midend
I don't want to rely on this. Selects can be created in the backend and I don't think we have the same canonicalization in DAGCombine, but I might be wrong.
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.
Oh, sorry, my bad. I don't know what I was thinking when I wrote this.
ret i64 %4 | ||
} | ||
|
||
; (select c, (and f, ~x), f) -> (andn f, (czero_nez x, c)) |
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.
note that "0" is identity for "andn" so in terms of implementation this case could be combined with conditional rotation.
7d64e5c
to
cff8037
Compare
Updated:
|
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.
LGTM
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.
LGTM
cff8037
to
d3f5efa
Compare
Pushed one last time, I had a small typo in the rotl test. |
I have a few patches to improve compilation for these tests which I will be posting as separate MRs.
llvm#143581) See llvm#143580 for MR with the test commit. Performs the following transformations: (select c, c1, t) -> (add (czero_nez t - c1, c), c1) (select c, t, c1) -> (add (czero_eqz t - c1, c), c1) @mgudim
I have a few patches to improve compilation for these tests which I will be posting as separate MRs.
llvm#143581) See llvm#143580 for MR with the test commit. Performs the following transformations: (select c, c1, t) -> (add (czero_nez t - c1, c), c1) (select c, t, c1) -> (add (czero_eqz t - c1, c), c1) @mgudim
I have a few patches to improve compilation for these tests which I will be posting as separate MRs.