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

Basic math and bitwise operators #154

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

tcptomato
Copy link

Implemented the basic mathematical operator ( addition, subtraction, multiplication, division ) and logical bit operators ( and, or, xor, not ) as templates and instantiated them for all data types supported by Epiphany.

@aolofsson
Copy link
Member

Cool reuse!

Does anyone object to the use of these kinds of macro functions?

What kind of efficiency do you get? Loops are quite simple and shallow? What does the generated code look like?

{ \
*c = ~*(a); \
for (;--n;) \
*c = ~*(a + n); \
Copy link
Contributor

Choose a reason for hiding this comment

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

*(c + n) = ~*(a + n); \

Copy link
Author

Choose a reason for hiding this comment

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

@mateunho Thanks, fixed.

@aolofsson Yes, loops are very shallow ( will look into the possibility of using a duff's device to do some unrolling, or if -funroll-all-loops can be used without pigging out on size). Also I noticed it can be counterproductive to have a decreasing index.

What I think we should do now is to define a number of platforms we want to target and the compiler flags we want to use ( O2 or O3, and more importantly on x86 the SSE flags. Or should we split x86 in 2 ).

What is the preferred method of implementing platform specific code? #ifdef tree?

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.

3 participants