Skip to content

Index arrays must be unsigned ints (instead of signed) #497

Description

@kaushikcfd

Generated code typically involves integer modulo operations on them and loopy would end up performing them using:

#define LOOPY_DEFINE_MOD_POS_B(SUFFIX, TYPE) \
    static inline TYPE loopy_mod_pos_b_##SUFFIX(TYPE a, TYPE b) \
    { \
        TYPE result = a%b; \
        if (result < 0) \
            result += b; \
        return result; \
    }
LOOPY_CALL_WITH_INTEGER_TYPES(LOOPY_DEFINE_MOD_POS_B)

if loopy knew "a" was unsigned it would optimize this away and simply generate "a % b".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions