From f7f281a256c38c1986860baec81736fcb4f5b6d1 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Tue, 23 Jul 2013 17:01:03 -0700 Subject: [PATCH] Choose type for integer literals to match the target mask size (if possible). On a target with a 16-bit mask (for example), we would choose the type of an integer literal "1024" to be an int16. Previously, we used an int32, which is a worse fit and leads to less efficient code than an int16 on a 16-bit mask target. (However, we'd still give an integer literal 1000000 the type int32, even in a 16-bit target.) Updated the tests to still pass with 8 and 16-bit targets, given this change. --- lex.ll | 27 +++++++- parse.yy | 23 ++++++- run_tests.py | 4 +- stdlib.ispc | 74 ++++++++++----------- tests/aossoa-1.ispc | 4 +- tests/aossoa-2.ispc | 4 +- tests/aossoa-5.ispc | 4 +- tests/aossoa-6.ispc | 4 +- tests/atomics-12.ispc | 4 +- tests/atomics-13.ispc | 2 +- tests/atomics-4.ispc | 4 +- tests/coalesce-1.ispc | 4 +- tests/coalesce-2.ispc | 4 +- tests/coalesce-3.ispc | 4 +- tests/coalesce-4.ispc | 4 +- tests/coalesce-5.ispc | 4 +- tests/coalesce-6.ispc | 4 +- tests/coalesce-7.ispc | 4 +- tests/coalesce-8.ispc | 4 +- tests/count-leading-trailing-zeros-1.ispc | 2 +- tests/count-leading-trailing-zeros-4.ispc | 2 +- tests/exclusive-scan-and-2.ispc | 4 +- tests/exclusive-scan-or-1.ispc | 4 +- tests/frexp-double-1.ispc | 2 +- tests/frexp-double.ispc | 2 +- tests/frexp-float-1.ispc | 2 +- tests/frexp-float.ispc | 2 +- tests/kilo-mega-giga-2.ispc | 2 +- tests/ldexp-double.ispc | 4 +- tests/ldexp-float.ispc | 4 +- tests/local-atomics-12.ispc | 4 +- tests/local-atomics-13.ispc | 2 +- tests/local-atomics-14.ispc | 4 +- tests/local-atomics-4.ispc | 4 +- tests/rand-distrib-1.ispc | 2 +- tests/sizeof-9.ispc | 2 +- tests/test-83.ispc | 2 +- tests/test-84.ispc | 2 +- tests/test-85.ispc | 2 +- tests_errors/array-plus-equals.ispc | 2 +- tests_errors/array-pointer-assign.ispc | 2 +- tests_errors/float-logical.ispc | 2 +- tests_errors/fptr-typecheck-2.ispc | 2 +- tests_errors/fptr-typecheck-3.ispc | 2 +- tests_errors/initexpr-2.ispc | 2 +- tests_errors/int-ptr-fail.ispc | 4 +- tests_errors/lvalue-2.ispc | 2 +- tests_errors/lvalue-3.ispc | 2 +- tests_errors/new-delete-3.ispc | 2 +- tests_errors/new-delete-6.ispc | 2 +- tests_errors/ptr-1.ispc | 2 +- tests_errors/ptr-const-1.ispc | 2 +- tests_errors/ptrcast-lose-info.ispc | 2 +- tests_errors/ref-3.ispc | 2 +- tests_errors/soa-11.ispc | 2 +- tests_errors/soa-12.ispc | 2 +- tests_errors/soa-3.ispc | 2 +- tests_errors/soa-4.ispc | 2 +- tests_errors/soa-9.ispc | 2 +- tests_errors/struct_arith.ispc | 2 +- tests_errors/vec-size-compile-constant.ispc | 2 +- 61 files changed, 166 insertions(+), 120 deletions(-) diff --git a/lex.ll b/lex.ll index f6633fce..8baa627a 100644 --- a/lex.ll +++ b/lex.ll @@ -77,6 +77,8 @@ static int allTokens[] = { TOKEN_UNSIGNED, TOKEN_VARYING, TOKEN_VOID, TOKEN_WHILE, TOKEN_STRING_C_LITERAL, TOKEN_DOTDOTDOT, TOKEN_FLOAT_CONSTANT, + TOKEN_INT8_CONSTANT, TOKEN_UINT8_CONSTANT, + TOKEN_INT16_CONSTANT, TOKEN_UINT16_CONSTANT, TOKEN_INT32_CONSTANT, TOKEN_UINT32_CONSTANT, TOKEN_INT64_CONSTANT, TOKEN_UINT64_CONSTANT, TOKEN_INC_OP, TOKEN_DEC_OP, TOKEN_LEFT_OP, TOKEN_RIGHT_OP, TOKEN_LE_OP, @@ -150,6 +152,10 @@ void ParserInit() { tokenToName[TOKEN_STRING_C_LITERAL] = "\"C\""; tokenToName[TOKEN_DOTDOTDOT] = "..."; tokenToName[TOKEN_FLOAT_CONSTANT] = "TOKEN_FLOAT_CONSTANT"; + tokenToName[TOKEN_INT8_CONSTANT] = "TOKEN_INT8_CONSTANT"; + tokenToName[TOKEN_UINT8_CONSTANT] = "TOKEN_UINT8_CONSTANT"; + tokenToName[TOKEN_INT16_CONSTANT] = "TOKEN_INT16_CONSTANT"; + tokenToName[TOKEN_UINT16_CONSTANT] = "TOKEN_UINT16_CONSTANT"; tokenToName[TOKEN_INT32_CONSTANT] = "TOKEN_INT32_CONSTANT"; tokenToName[TOKEN_UINT32_CONSTANT] = "TOKEN_UINT32_CONSTANT"; tokenToName[TOKEN_INT64_CONSTANT] = "TOKEN_INT64_CONSTANT"; @@ -260,6 +266,10 @@ void ParserInit() { tokenNameRemap["TOKEN_STRING_C_LITERAL"] = "\"C\""; tokenNameRemap["TOKEN_DOTDOTDOT"] = "\'...\'"; tokenNameRemap["TOKEN_FLOAT_CONSTANT"] = "float constant"; + tokenNameRemap["TOKEN_INT8_CONSTANT"] = "int8 constant"; + tokenNameRemap["TOKEN_UINT8_CONSTANT"] = "unsigned int8 constant"; + tokenNameRemap["TOKEN_INT16_CONSTANT"] = "int16 constant"; + tokenNameRemap["TOKEN_UINT16_CONSTANT"] = "unsigned int16 constant"; tokenNameRemap["TOKEN_INT32_CONSTANT"] = "int32 constant"; tokenNameRemap["TOKEN_UINT32_CONSTANT"] = "unsigned int32 constant"; tokenNameRemap["TOKEN_INT64_CONSTANT"] = "int64 constant"; @@ -599,7 +609,22 @@ lParseInteger(bool dotdotdot) { } else { // No u or l suffix - // First, see if we can fit this into a 32-bit integer... + // If we're compiling to an 8-bit mask target and the constant + // fits into 8 bits, return an 8-bit int. + if (g->target->getMaskBitCount() == 8) { + if (yylval.intVal <= 0x7fULL) + return TOKEN_INT8_CONSTANT; + else if (yylval.intVal <= 0xffULL) + return TOKEN_UINT8_CONSTANT; + } + // And similarly for 16-bit masks and constants + if (g->target->getMaskBitCount() == 16) { + if (yylval.intVal <= 0x7fffULL) + return TOKEN_INT16_CONSTANT; + else if (yylval.intVal <= 0xffffULL) + return TOKEN_UINT16_CONSTANT; + } + // Otherwise, see if we can fit this into a 32-bit integer... if (yylval.intVal <= 0x7fffffffULL) return TOKEN_INT32_CONSTANT; else if (yylval.intVal <= 0xffffffffULL) diff --git a/parse.yy b/parse.yy index 488c864a..6ed2a43d 100644 --- a/parse.yy +++ b/parse.yy @@ -179,6 +179,8 @@ struct ForeachDimension { } +%token TOKEN_INT8_CONSTANT TOKEN_UINT8_CONSTANT +%token TOKEN_INT16_CONSTANT TOKEN_UINT16_CONSTANT %token TOKEN_INT32_CONSTANT TOKEN_UINT32_CONSTANT %token TOKEN_INT64_CONSTANT TOKEN_UINT64_CONSTANT %token TOKEN_INT32DOTDOTDOT_CONSTANT TOKEN_UINT32DOTDOTDOT_CONSTANT @@ -291,6 +293,22 @@ primary_expression Error(@1, "Undeclared symbol \"%s\".%s", name, alts.c_str()); } } + | TOKEN_INT8_CONSTANT { + $$ = new ConstExpr(AtomicType::UniformInt8->GetAsConstType(), + (int8_t)yylval.intVal, @1); + } + | TOKEN_UINT8_CONSTANT { + $$ = new ConstExpr(AtomicType::UniformUInt8->GetAsConstType(), + (uint8_t)yylval.intVal, @1); + } + | TOKEN_INT16_CONSTANT { + $$ = new ConstExpr(AtomicType::UniformInt16->GetAsConstType(), + (int16_t)yylval.intVal, @1); + } + | TOKEN_UINT16_CONSTANT { + $$ = new ConstExpr(AtomicType::UniformUInt16->GetAsConstType(), + (uint16_t)yylval.intVal, @1); + } | TOKEN_INT32_CONSTANT { $$ = new ConstExpr(AtomicType::UniformInt32->GetAsConstType(), (int32_t)yylval.intVal, @1); @@ -1233,7 +1251,10 @@ declarator ; int_constant - : TOKEN_INT32_CONSTANT { $$ = yylval.intVal; } + : TOKEN_INT8_CONSTANT { $$ = yylval.intVal; } + | TOKEN_INT16_CONSTANT { $$ = yylval.intVal; } + | TOKEN_INT32_CONSTANT { $$ = yylval.intVal; } + | TOKEN_INT64_CONSTANT { $$ = yylval.intVal; } ; direct_declarator diff --git a/run_tests.py b/run_tests.py index 7c6b1eb8..296db867 100755 --- a/run_tests.py +++ b/run_tests.py @@ -37,7 +37,7 @@ parser.add_option("-g", "--generics-include", dest="include_file", help="Filenam parser.add_option("-f", "--ispc-flags", dest="ispc_flags", help="Additional flags for ispc (-g, -O1, ...)", default="") parser.add_option('-t', '--target', dest='target', - help='Set compilation target (neon, sse2, sse2-x2, sse4, sse4-x2, avx, avx-x2, generic-4, generic-8, generic-16, generic-32)', + help='Set compilation target (neon, sse2, sse2-x2, sse4, sse4-x2, sse4-8, avx, avx-x2, generic-4, generic-8, generic-16, generic-32)', default="sse4") parser.add_option('-a', '--arch', dest='arch', help='Set architecture (arm, x86, x86-64)', @@ -294,7 +294,7 @@ def run_test(testname): firstline = firstline.rstrip() file.close() - if (output.find(firstline) == -1): + if re.search(firstline, output) == None: sys.stderr.write("Didn't see expected error message %s from test %s.\nActual output:\n%s\n" % \ (firstline, testname, output)) return (1, 0) diff --git a/stdlib.ispc b/stdlib.ispc index 9a2b191f..7e848481 100644 --- a/stdlib.ispc +++ b/stdlib.ispc @@ -3126,7 +3126,7 @@ static inline void __range_reduce_log(float input, varying float * uniform reduc static const int nonexponent_mask = 0x807FFFFF; // We want the reduced version to have an exponent of -1 which is -1 + 127 after biasing or 126 - static const int exponent_neg1 = (126 << 23); + static const int exponent_neg1 = (126l << 23); // NOTE(boulos): We don't need to mask anything out since we know // the sign bit has to be 0. If it's 1, we need to return infinity/nan // anyway (log(x), x = +-0 -> infinity, x < 0 -> NaN). @@ -3149,7 +3149,7 @@ static inline void __range_reduce_log(uniform float input, uniform float * unifo uniform int int_version = intbits(input); static const uniform int nonexponent_mask = 0x807FFFFF; - static const uniform int exponent_neg1 = (126 << 23); + static const uniform int exponent_neg1 = (126ul << 23); uniform int biased_exponent = int_version >> 23; uniform int offset_exponent = biased_exponent + 1; *exponent = offset_exponent - 127; // get the real value @@ -3647,18 +3647,18 @@ static inline uniform float half_to_float(uniform unsigned int16 h) { else { // https://gist.github.com/2144712 // Fabian "ryg" Giesen. - static const uniform unsigned int32 shifted_exp = 0x7c00 << 13; // exponent mask after shift + static const uniform unsigned int32 shifted_exp = 0x7c00ul << 13; // exponent mask after shift uniform int32 o = ((int32)(h & 0x7fff)) << 13; // exponent/mantissa bits uniform unsigned int32 exp = shifted_exp & o; // just the exponent - o += (127 - 15) << 23; // exponent adjust + o += (uniform int32)(127 - 15) << 23; // exponent adjust // handle exponent special cases if (exp == shifted_exp) // Inf/NaN? - o += (128 - 16) << 23; // extra exp adjust + o += (uniform unsigned int32)(128 - 16) << 23; // extra exp adjust else if (exp == 0) { // Zero/Denormal? - o += 1 << 23; // extra exp adjust - o = intbits(floatbits(o) - floatbits(113 << 23)); // renormalize + o += 1ul << 23; // extra exp adjust + o = intbits(floatbits(o) - floatbits(113ul << 23)); // renormalize } o |= ((int32)(h & 0x8000)) << 16; // sign bit @@ -3675,17 +3675,17 @@ static inline float half_to_float(unsigned int16 h) { // https://gist.github.com/2144712 // Fabian "ryg" Giesen. - const unsigned int32 shifted_exp = 0x7c00 << 13; // exponent mask after shift + const unsigned int32 shifted_exp = 0x7c00ul << 13; // exponent mask after shift - int32 o = ((int32)(h & 0x7fff)) << 13; // exponent/mantissa bits + int32 o = ((int32)(h & 0x7ffful)) << 13; // exponent/mantissa bits unsigned int32 exp = shifted_exp & o; // just the exponent - o += (127 - 15) << 23; // exponent adjust + o += (int32)(127 - 15) << 23; // exponent adjust - int32 infnan_val = o + ((128 - 16) << 23); - int32 zerodenorm_val = intbits(floatbits(o + (1<<23)) - floatbits(113 << 23)); + int32 infnan_val = o + ((int32)(128 - 16) << 23); + int32 zerodenorm_val = intbits(floatbits(o + (1ul<<23)) - floatbits(113ul << 23)); int32 reg_val = (exp == 0) ? zerodenorm_val : o; - int32 sign_bit = ((int32)(h & 0x8000)) << 16; + int32 sign_bit = ((int32)(h & 0x8000ul)) << 16; return floatbits(((exp == shifted_exp) ? infnan_val : reg_val) | sign_bit); } } @@ -3715,16 +3715,16 @@ static inline uniform int16 float_to_half(uniform float f) { // NaN->qNaN and Inf->Inf // unconditional assignment here, will override with right value for // the regular case below. - uniform int32 f32infty = 255 << 23; - o = (fint > f32infty) ? 0x7e00 : 0x7c00; + uniform int32 f32infty = 255ul << 23; + o = (fint > f32infty) ? 0x7e00u : 0x7c00u; // (De)normalized number or zero // update fint unconditionally to save the blending; we don't need it // anymore for the Inf/NaN case anyway. - const uniform unsigned int32 round_mask = ~0xfffu; - const uniform int32 magic = 15 << 23; - const uniform int32 f16infty = 31 << 23; + const uniform unsigned int32 round_mask = ~0xffful; + const uniform int32 magic = 15ul << 23; + const uniform int32 f16infty = 31ul << 23; uniform int32 fint2 = intbits(floatbits(fint & round_mask) * floatbits(magic)) - round_mask; fint2 = (fint2 > f16infty) ? f16infty : fint2; // Clamp to signed infinity if overflowed @@ -3761,16 +3761,16 @@ static inline int16 float_to_half(float f) { // NaN->qNaN and Inf->Inf // unconditional assignment here, will override with right value for // the regular case below. - int32 f32infty = 255 << 23; - o = (fint > f32infty) ? 0x7e00 : 0x7c00; + int32 f32infty = 255ul << 23; + o = (fint > f32infty) ? 0x7e00u : 0x7c00u; // (De)normalized number or zero // update fint unconditionally to save the blending; we don't need it // anymore for the Inf/NaN case anyway. - const unsigned int32 round_mask = ~0xfffu; - const int32 magic = 15 << 23; - const int32 f16infty = 31 << 23; + const unsigned int32 round_mask = ~0xffful; + const int32 magic = 15ul << 23; + const int32 f16infty = 31ul << 23; // Shift exponent down, denormalize if necessary. // NOTE This represents half-float denormals using single precision denormals. @@ -3789,7 +3789,7 @@ static inline int16 float_to_half(float f) { // FP16 denormals are rare in practice, I don't know. Whatever slow path your HW // may or may not have for denormals, this may well hit it. float fscale = floatbits(fint & round_mask) * floatbits(magic); - fscale = min(fscale, floatbits((31 << 23) - 0x1000)); + fscale = min(fscale, floatbits((31ul << 23) - 0x1000ul)); int32 fint2 = intbits(fscale) - round_mask; if (fint < f32infty) @@ -3956,7 +3956,7 @@ float_to_srgb8(float inval) // Do the table lookup and unpack bias, scale unsigned int tab = table[(intbits(inval) - 0x39000000u) >> 20]; unsigned int bias = (tab >> 16) << 9; - unsigned int scale = tab & 0xffff; + unsigned int scale = tab & 0xfffful; // Grab next-highest mantissa bits and perform linear interpolation unsigned int t = (intbits(inval) >> 12) & 0xff; @@ -4006,7 +4006,7 @@ float_to_srgb8(uniform float inval) // Do the table lookup and unpack bias, scale uniform unsigned int tab = table[(intbits(inval) - 0x39000000u) >> 20]; uniform unsigned int bias = (tab >> 16) << 9; - uniform unsigned int scale = tab & 0xffff; + uniform unsigned int scale = tab & 0xfffful; // Grab next-highest mantissa bits and perform linear interpolation uniform unsigned int t = (intbits(inval) >> 12) & 0xff; @@ -4053,14 +4053,14 @@ static inline uniform unsigned int random(uniform RNGState * uniform state) static inline float frandom(varying RNGState * uniform state) { unsigned int irand = random(state); - irand &= (1<<23)-1; + irand &= (1ul<<23)-1; return floatbits(0x3F800000 | irand)-1.0f; } static inline uniform float frandom(uniform RNGState * uniform state) { uniform unsigned int irand = random(state); - irand &= (1<<23)-1; + irand &= (1ul<<23)-1; return floatbits(0x3F800000 | irand)-1.0f; } @@ -4068,18 +4068,18 @@ static inline void seed_rng(varying RNGState * uniform state, unsigned int seed) { state->z1 = seed; state->z2 = seed ^ 0xbeeff00d; - state->z3 = ((seed & 0xffff) << 16) | (seed >> 16); - state->z4 = (((seed & 0xff) << 24) | ((seed & 0xff00) << 8) | - ((seed & 0xff0000) >> 8) | (seed & 0xff000000) >> 24); + state->z3 = ((seed & 0xfffful) << 16) | (seed >> 16); + state->z4 = (((seed & 0xfful) << 24) | ((seed & 0xff00ul) << 8) | + ((seed & 0xff0000ul) >> 8) | (seed & 0xff000000ul) >> 24); } static inline void seed_rng(uniform RNGState * uniform state, uniform unsigned int seed) { state->z1 = seed; state->z2 = seed ^ 0xbeeff00d; - state->z3 = ((seed & 0xffff) << 16) | (seed >> 16); - state->z4 = (((seed & 0xff) << 24) | ((seed & 0xff00) << 8) | - ((seed & 0xff0000) >> 8) | (seed & 0xff000000) >> 24); + state->z3 = ((seed & 0xfffful) << 16) | (seed >> 16); + state->z4 = (((seed & 0xfful) << 24) | ((seed & 0xff00ul) << 8) | + ((seed & 0xff0000ul) >> 8) | (seed & 0xff000000ul) >> 24); } @@ -4097,7 +4097,7 @@ static inline uniform bool rdrand(float * uniform ptr) { uniform int32 irand; uniform bool success = __rdrand_i32(&irand); if (success) { - irand &= (1<<23)-1; + irand &= (1ul<<23)-1; *ptr = floatbits(0x3F800000 | irand)-1.0f; } return success; @@ -4117,7 +4117,7 @@ static inline bool rdrand(varying float * uniform ptr) { // in vector form. However, we need to be careful to not // clobber any existing already-set values in *ptr with // inactive lanes here... - irand &= (1<<23)-1; + irand &= (1ul<<23)-1; *ptr = floatbits(0x3F800000 | irand)-1.0f; success = true; } @@ -4137,7 +4137,7 @@ static inline bool rdrand(float * ptr) { foreach_active (index) { uniform int32 irand; if (__rdrand_i32(&irand)) { - irand &= (1<<23)-1; + irand &= (1ul<<23)-1; *ptrs[index] = floatbits(0x3F800000 | irand)-1.0f; success = true; } diff --git a/tests/aossoa-1.ispc b/tests/aossoa-1.ispc index 59964d6d..32d3bcba 100644 --- a/tests/aossoa-1.ispc +++ b/tests/aossoa-1.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_v(uniform float RET[]) { -#define width 3 -#define maxProgramCount 64 +#define width 3ul +#define maxProgramCount 64ul assert(programCount <= maxProgramCount); //CO const uniform int width = 3; diff --git a/tests/aossoa-2.ispc b/tests/aossoa-2.ispc index 9ff82226..df8eae5c 100644 --- a/tests/aossoa-2.ispc +++ b/tests/aossoa-2.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_v(uniform float RET[]) { -#define width 4 -#define maxProgramCount 64 +#define width 4ul +#define maxProgramCount 64ul assert(programCount <= maxProgramCount); //CO const uniform int width = 4; diff --git a/tests/aossoa-5.ispc b/tests/aossoa-5.ispc index eb4fed3a..d6346455 100644 --- a/tests/aossoa-5.ispc +++ b/tests/aossoa-5.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_v(uniform float RET[]) { -#define width 3 -#define maxProgramCount 64 +#define width 3ul +#define maxProgramCount 64ul assert(programCount <= maxProgramCount); //CO const uniform int width = 3; diff --git a/tests/aossoa-6.ispc b/tests/aossoa-6.ispc index b64cd10b..7c177fde 100644 --- a/tests/aossoa-6.ispc +++ b/tests/aossoa-6.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_v(uniform float RET[]) { -#define width 4 -#define maxProgramCount 64 +#define width 4ul +#define maxProgramCount 64ul assert(programCount <= maxProgramCount); //CO const uniform int width = 4; diff --git a/tests/atomics-12.ispc b/tests/atomics-12.ispc index c27ad99c..d6359555 100644 --- a/tests/atomics-12.ispc +++ b/tests/atomics-12.ispc @@ -7,7 +7,7 @@ export void f_f(uniform float RET[], uniform float aFOO[]) { float a = aFOO[programIndex]; float b = 0; if (programIndex < 30 && programIndex & 1) - b = atomic_or_global(&s, (1 << programIndex)); + b = atomic_or_global(&s, (1ul << programIndex)); RET[programIndex] = s; } @@ -15,6 +15,6 @@ export void result(uniform float RET[]) { uniform int sum = 0; for (uniform int i = 0; i < min(30, programCount); ++i) if (i & 1) - sum += (1 << i); + sum += (1ul << i); RET[programIndex] = sum; } diff --git a/tests/atomics-13.ispc b/tests/atomics-13.ispc index 86faaddb..dea3bfc3 100644 --- a/tests/atomics-13.ispc +++ b/tests/atomics-13.ispc @@ -7,7 +7,7 @@ export void f_f(uniform float RET[], uniform float aFOO[]) { float a = aFOO[programIndex]; int32 b = 0; if (programIndex < 32 && programIndex & 1) - b = atomic_or_global(&s, (1 << programIndex)); + b = atomic_or_global(&s, (1ul << programIndex)); RET[programIndex] = popcnt(reduce_max((int32)b)); } diff --git a/tests/atomics-4.ispc b/tests/atomics-4.ispc index 30b343d1..ac746ad2 100644 --- a/tests/atomics-4.ispc +++ b/tests/atomics-4.ispc @@ -5,10 +5,10 @@ uniform int32 s = 0; export void f_f(uniform float RET[], uniform float aFOO[]) { float a = aFOO[programIndex]; - float b = atomic_or_global(&s, (1<> 2) * 16 + (programIndex & 3)]; diff --git a/tests/coalesce-4.ispc b/tests/coalesce-4.ispc index 1ddd4b89..182a4d4f 100644 --- a/tests/coalesce-4.ispc +++ b/tests/coalesce-4.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { - uniform float * uniform buf = uniform new uniform float[32*32]; - for (uniform int i = 0; i < 32*32; ++i) + uniform float * uniform buf = uniform new uniform float[32l*32l]; + for (uniform int i = 0; i < 32l*32l; ++i) buf[i] = i; float a = buf[2*programIndex]; diff --git a/tests/coalesce-5.ispc b/tests/coalesce-5.ispc index 2dd8d44e..385e8526 100644 --- a/tests/coalesce-5.ispc +++ b/tests/coalesce-5.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { - uniform float * uniform buf = uniform new uniform float[32*32]; - for (uniform int i = 0; i < 32*32; ++i) + uniform float * uniform buf = uniform new uniform float[32l*32l]; + for (uniform int i = 0; i < 32l*32l; ++i) buf[i] = i; float a = buf[4*programIndex]; diff --git a/tests/coalesce-6.ispc b/tests/coalesce-6.ispc index 2a54a2db..8c630a45 100644 --- a/tests/coalesce-6.ispc +++ b/tests/coalesce-6.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { - uniform float * uniform buf = uniform new uniform float[32*32]; - for (uniform int i = 0; i < 32*32; ++i) + uniform float * uniform buf = uniform new uniform float[32l*32l]; + for (uniform int i = 0; i < 32l*32l; ++i) buf[i] = i; float a = buf[4*programIndex]; diff --git a/tests/coalesce-7.ispc b/tests/coalesce-7.ispc index 8ed628bd..29b56b8d 100644 --- a/tests/coalesce-7.ispc +++ b/tests/coalesce-7.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { - uniform float * uniform buf = uniform new uniform float[32*32]; - for (uniform int i = 0; i < 32*32; ++i) + uniform float * uniform buf = uniform new uniform float[32l*32l]; + for (uniform int i = 0; i < 32l*32l; ++i) buf[i] = i; float a = buf[4*programIndex]; diff --git a/tests/coalesce-8.ispc b/tests/coalesce-8.ispc index dfefaa19..f01ca9c3 100644 --- a/tests/coalesce-8.ispc +++ b/tests/coalesce-8.ispc @@ -2,8 +2,8 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { - uniform float * uniform buf = uniform new uniform float[32*32]; - for (uniform int i = 0; i < 32*32; ++i) + uniform float * uniform buf = uniform new uniform float[32l*32l]; + for (uniform int i = 0; i < 32l*32l; ++i) buf[i] = i; int index = (programIndex < 4) ? (programIndex & 1) : diff --git a/tests/count-leading-trailing-zeros-1.ispc b/tests/count-leading-trailing-zeros-1.ispc index 221d066d..3f12c07d 100644 --- a/tests/count-leading-trailing-zeros-1.ispc +++ b/tests/count-leading-trailing-zeros-1.ispc @@ -3,7 +3,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { - RET[programIndex] = count_trailing_zeros(0xf0); + RET[programIndex] = count_trailing_zeros(0xf0ul); } export void result(uniform float RET[]) { diff --git a/tests/count-leading-trailing-zeros-4.ispc b/tests/count-leading-trailing-zeros-4.ispc index 475c18ca..4b849018 100644 --- a/tests/count-leading-trailing-zeros-4.ispc +++ b/tests/count-leading-trailing-zeros-4.ispc @@ -3,7 +3,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { - int32 i = (1 << (programIndex % 28)); + int32 i = (1ul << (programIndex % 28)); RET[programIndex] = count_leading_zeros(i); } diff --git a/tests/exclusive-scan-and-2.ispc b/tests/exclusive-scan-and-2.ispc index 5d2bcd1f..b742a91e 100644 --- a/tests/exclusive-scan-and-2.ispc +++ b/tests/exclusive-scan-and-2.ispc @@ -3,7 +3,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { RET[programIndex] = -1; - int32 a = ~(1 << programIndex); + int32 a = ~(1ul << programIndex); if ((programIndex < 32) && (programIndex & 1) == 0) { RET[programIndex] = exclusive_scan_and(a); } @@ -15,7 +15,7 @@ export void result(uniform float RET[]) { if ((programIndex & 1) == 0 && programIndex > 0 && programIndex < 32) { int val = 0xffffffff; for (int i = 0; i < programIndex-1; i += 2) - val &= ~(1<>20); } @@ -15,6 +15,6 @@ export void result(uniform float RET[]) { uniform int sum = 0; for (uniform int i = 0; i < min(32, programCount); ++i) if (i & 1) - sum += (1 << i); + sum += (1ul << i); RET[programIndex] = ((unsigned int64)(0xffffffffff000000 | sum)) >> 20; } diff --git a/tests/local-atomics-4.ispc b/tests/local-atomics-4.ispc index f7f6a04a..b3648ab5 100644 --- a/tests/local-atomics-4.ispc +++ b/tests/local-atomics-4.ispc @@ -7,10 +7,10 @@ export void f_f(uniform float RET[], uniform float aFOO[]) { float a = aFOO[programIndex]; float b = 0; if (programIndex < 29) - atomic_or_local(&s, (1< struct Foo" for assignment operator is not possible +// Type conversion from "const uniform int[0-9]*" to "soa<4> struct Foo" for assignment operator is not possible struct Pt { float x, y, z; }; diff --git a/tests_errors/soa-12.ispc b/tests_errors/soa-12.ispc index e2cd3242..c0420614 100644 --- a/tests_errors/soa-12.ispc +++ b/tests_errors/soa-12.ispc @@ -1,4 +1,4 @@ -// Can't convert between types "const uniform int32" and "soa<4> float" with different SOA widths +// Can't convert between types "const uniform int[0-9]*" and "soa<4> float" with different SOA widths struct Pt { float x, y, z; }; diff --git a/tests_errors/soa-3.ispc b/tests_errors/soa-3.ispc index b2be1b59..04dc84bc 100644 --- a/tests_errors/soa-3.ispc +++ b/tests_errors/soa-3.ispc @@ -1,4 +1,4 @@ -// syntax error, unexpected '-', expecting int32 constant +// syntax error, unexpected '-', expecting int struct F { float a, b, c; }; diff --git a/tests_errors/soa-4.ispc b/tests_errors/soa-4.ispc index b2be1b59..04dc84bc 100644 --- a/tests_errors/soa-4.ispc +++ b/tests_errors/soa-4.ispc @@ -1,4 +1,4 @@ -// syntax error, unexpected '-', expecting int32 constant +// syntax error, unexpected '-', expecting int struct F { float a, b, c; }; diff --git a/tests_errors/soa-9.ispc b/tests_errors/soa-9.ispc index 7c6a1df9..e9e7509a 100644 --- a/tests_errors/soa-9.ispc +++ b/tests_errors/soa-9.ispc @@ -1,4 +1,4 @@ -// Can't convert from pointer to SOA type "soa<8> struct A * uniform" to pointer to non-SOA type "void * varying" +// Can't convert from pointer to SOA type "soa<8> struct A \* uniform" to pointer to non-SOA type "void \* varying" struct A { float a, b; }; diff --git a/tests_errors/struct_arith.ispc b/tests_errors/struct_arith.ispc index 9d942880..df729d02 100644 --- a/tests_errors/struct_arith.ispc +++ b/tests_errors/struct_arith.ispc @@ -1,4 +1,4 @@ -// Assignment operator "+=" is illegal with struct type +// Assignment operator "\+=" is illegal with struct type struct Point { float x, y, z; }; diff --git a/tests_errors/vec-size-compile-constant.ispc b/tests_errors/vec-size-compile-constant.ispc index b9e61721..0eb6f90e 100644 --- a/tests_errors/vec-size-compile-constant.ispc +++ b/tests_errors/vec-size-compile-constant.ispc @@ -1,4 +1,4 @@ -// syntax error, unexpected identifier, expecting int32 constant +// syntax error, unexpected identifier, expecting int void foo(uniform int i) { float a;