Skip to content

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

@kaushikcfd

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".

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