ispc/ispc — pull request #402 by pengtu (2012-11-05 23:15:46+00:00)
Title: Fix a bug where an unsigned index variable in subscript is sxt to 64 bit

Inside LLVM, both signed and unsigned integer are represented with the same type - i32 - effectively a signed int32. On 64 bit target, we must generate explicit sxt/zxt during the LLVM IR creation to promote the array index into 64 bit. Otherwise, an unsigned int index becomes signed int index in the LLVM IR.

I limit the fix to uniformed index to avoid widening a varying index vector to 64 bits. This means that the 32 bit values in the varying indices must be positive and smaller than 2^31 at the runtime for a program to behave correctly - as in the user's guide under --addressing=32.