-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signed char extraction fails to take sign into account #46
Comments
The root cause is the translation of
The i8 is mapped to a SPIR-V 32-bit unsigned int. But the conversion of the SExt doesn't take that into account. Original OpenCL C:
last LLVM:
becomes SPIR-V:
|
There's a corresponding problem with unsigned char. |
Also sitofp i8 to float
Final LLVM:
becomes SPIR-V:
|
I can't reproduce a problem with unsigned char. |
Default behaviour (when char support is enabled) is ok, but disabling char support is still problematic. |
Generates, in part, this code:
The bug is that the LLVM i8 is converted to a SPIR-V uint, and so the SConvert is from a uint to a uint. This does not do the sign extension that LLVM expects will be implicitly done as part of the conversion.
The clspv compiler needs to insert more instructions to replicate the sign bit from position 7 to all the remainder.
The text was updated successfully, but these errors were encountered: