Skip to content
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

optimize comparison with zero to TST #6

Merged
2 commits merged into from
Mar 5, 2019
Merged

optimize comparison with zero to TST #6

2 commits merged into from
Mar 5, 2019

Conversation

benshi001
Copy link

@benshi001 benshi001 commented Mar 5, 2019

optimize

and	a1, a0, a1
cmpnei	a1, 0

to

tst	a1, a0

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but has some minor problems

@@ -3188,6 +3188,15 @@
[(set_attr "type" "cmp")]
)

(define_insn "*cskyv2_tstsi2"
[(set (reg:CC CSKY_CC_REGNUM) (ne:CC (and:SI (match_operand:SI 0 "register_operand" "b")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constraint should not only be "b", because 'tst rx, ry' support register range '0-31'. You can add another constraint 'r', the corresponding size constraint 'b' is 2, and the corresponding size constraint 'r' is 4

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. Thank you!

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good

@ghost ghost merged commit a84c197 into c-sky:gcc-6-branch-csky Mar 5, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant