llvm-project/libclc/generic/include/clc/integer
Aaron Watry 43ee367d1e integer: Update integer limits to comply with spec
The values for the char/short/integer/long minimums were declared with
their actual values, not the definitions from the CL spec (v1.1).  As
a result, (-2147483648) was actually being treated as a long by the
compiler, not an int, which caused issues when trying to add/subtract
that value from a vector.

Update the definitions to use the values declared by the spec, and also
add explicit casts for the char/short/int minimums so that the compiler
actually treats them as shorts/chars. Without those casts, they
actually end up stored as integers, and the compiler may end up storing
the INT_MIN as a long.

The compiler can sign extend the values if it needs to convert the
char->short, short->int, or int->long

v2: Add explicit cast for INT_MIN and fix some type-o's and wrapping
    in the commit message.

Reported-by: Moritz Pflanzer <moritz.pflanzer14@imperial.ac.uk>
CC: Moritz Pflanzer <moritz.pflanzer14@imperial.ac.uk>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 247661
2015-09-15 03:56:21 +00:00
..
abs.h Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
abs.inc Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
abs_diff.h Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
abs_diff.inc Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
add_sat.h Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
add_sat.inc Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
clz.h Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
clz.inc Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
definitions.h integer: Update integer limits to comply with spec 2015-09-15 03:56:21 +00:00
gentype.inc Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
hadd.h Add hadd builtin 2013-08-15 19:21:07 +00:00
hadd.inc Add hadd builtin 2013-08-15 19:21:07 +00:00
integer-gentype.inc Add int3/uint3 to integer-gentype.inc 2014-08-23 14:04:36 +00:00
mad24.h Implement mad24() and mul24() builtins 2013-07-08 17:27:13 +00:00
mad24.inc Implement mad24() and mul24() builtins 2013-07-08 17:27:13 +00:00
mad_hi.h Parenthesize arguments for mad_hi 2013-09-09 14:36:21 +00:00
mad_sat.h Implement generic mad_sat 2014-09-02 17:55:02 +00:00
mad_sat.inc Implement generic mad_sat 2014-09-02 17:55:02 +00:00
mul24.h Implement mad24() and mul24() builtins 2013-07-08 17:27:13 +00:00
mul24.inc Implement mad24() and mul24() builtins 2013-07-08 17:27:13 +00:00
mul_hi.h Add mul_hi implementation [v2] 2013-08-19 18:31:49 +00:00
mul_hi.inc Add mul_hi implementation [v2] 2013-08-19 18:31:49 +00:00
rhadd.h Add rhadd builtin 2013-08-15 19:21:10 +00:00
rhadd.inc Add rhadd builtin 2013-08-15 19:21:10 +00:00
rotate.h Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
rotate.inc Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
sub_sat.h Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
sub_sat.inc Add __CLC_ prefix to all macro definitions in headers 2013-07-08 17:27:02 +00:00
upsample.h Remove unneeded semi-colons 2013-09-05 16:04:07 +00:00