Skip to content
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

Truncation from i32 to i8 should keep only the bottom 8 bits #48

Closed
dneto0 opened this issue Aug 28, 2017 · 0 comments
Closed

Truncation from i32 to i8 should keep only the bottom 8 bits #48

dneto0 opened this issue Aug 28, 2017 · 0 comments
Assignees

Comments

@dneto0
Copy link
Collaborator

dneto0 commented Aug 28, 2017

Example from test/char4_insert.cl

kernel void foo(global uchar4* A, int n) {
 *A = (uchar4)(1,2,(uchar)n,4);
}

Currently produces:

         %27 = OpLoad %uint %26
         %28 = OpUConvert %uint %27  ;  This is a no-op.
         %29 = OpLoad %uint %25
         %30 = OpShiftLeftLogical %uint %uint_255 %uint_8
         %31 = OpNot %uint %30
         %32 = OpBitwiseAnd %uint %29 %31
         %33 = OpShiftLeftLogical %uint %28 %uint_8
         %34 = OpBitwiseOr %uint %32 %33
               OpStore %25 %34

The UConvert to produce %28 is a no-op. The i8 LLVM type maps to a 32-bit SPIR-V int. The LLVM truncation should become an "and" with 255.

@dneto0 dneto0 self-assigned this Aug 28, 2017
dneto0 added a commit to dneto0/clspv that referenced this issue Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant