Tiny cleanups, doc update re int8/16 performance
This commit is contained in:
@@ -93,6 +93,7 @@ Contents:
|
||||
+ `Understanding How to Interoperate With the Application's Data`_
|
||||
+ `Communicating Between SPMD Program Instances`_
|
||||
+ `Gather and Scatter`_
|
||||
+ `8 and 16-bit Integer Types`_
|
||||
+ `Low-level Vector Tricks`_
|
||||
+ `Debugging`_
|
||||
+ `The "Fast math" Option`_
|
||||
@@ -2528,6 +2529,15 @@ do a vector load. For example, given:
|
||||
|
||||
A regular vector load is done from array, starting at offset ``2*x``.
|
||||
|
||||
|
||||
8 and 16-bit Integer Types
|
||||
--------------------------
|
||||
|
||||
The code generated for 8 and 16-bit integer types is generally not as
|
||||
efficient as the code generated for 32-bit integer types. It is generally
|
||||
worthwhile to use 32-bit integer types for intermediate computations, even
|
||||
if the final result will be stored in a smaller integer type.
|
||||
|
||||
Low-level Vector Tricks
|
||||
-----------------------
|
||||
|
||||
|
||||
2
expr.cpp
2
expr.cpp
@@ -1659,7 +1659,7 @@ AssignExpr::TypeCheck() {
|
||||
if (rvalue != NULL)
|
||||
rvalue = rvalue->TypeCheck();
|
||||
if (rvalue != NULL && lvalue != NULL)
|
||||
rvalue = rvalue->TypeConv(lvalue->GetType(), "operator =");
|
||||
rvalue = rvalue->TypeConv(lvalue->GetType(), "assignment");
|
||||
if (rvalue == NULL || lvalue == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -2363,7 +2363,7 @@ static inline uniform float half_to_float(uniform unsigned int16 h) {
|
||||
uniform unsigned int32 hs = h & (int32)0x8000u; // Pick off sign bit
|
||||
uniform unsigned int32 he = h & (int32)0x7C00u; // Pick off exponent bits
|
||||
uniform unsigned int32 hm = h & (int32)0x03FFu; // Pick off mantissa bits
|
||||
cif (he == 0) {
|
||||
if (he == 0) {
|
||||
// Denormal will convert to normalized
|
||||
uniform int e = -1;
|
||||
// The following loop figures out how much extra to adjust the exponent
|
||||
@@ -2485,7 +2485,7 @@ static inline uniform int16 float_to_half(uniform float f) {
|
||||
ret = (xs >> 16);
|
||||
}
|
||||
else {
|
||||
cif (xe == 0x7F800000u) {
|
||||
if (xe == 0x7F800000u) {
|
||||
// Inf or NaN (all the exponent bits are set)
|
||||
if (xm == 0)
|
||||
// Zero mantissa -> signed infinity
|
||||
|
||||
Reference in New Issue
Block a user