Browse Source

[spirv] Use the correct type for bitwidth mask.

Ehsan Nasiri 6 years ago
parent
commit
701477a2d9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      tools/clang/lib/SPIRV/SPIRVEmitter.cpp

+ 3 - 0
tools/clang/lib/SPIRV/SPIRVEmitter.cpp

@@ -8812,12 +8812,15 @@ SpirvConstant *SPIRVEmitter::getMaskForBitwidthValue(QualType type) {
     switch (bitwidth) {
     case 16:
       mask = spvBuilder.getConstantUint16(bitwidth - 1);
+      elemType = astContext.UnsignedShortTy;
       break;
     case 32:
       mask = spvBuilder.getConstantUint32(bitwidth - 1);
+      elemType = astContext.UnsignedIntTy;
       break;
     case 64:
       mask = spvBuilder.getConstantUint64(bitwidth - 1);
+      elemType = astContext.UnsignedLongLongTy;
       break;
     default:
       assert(false && "this method only supports 16-, 32-, and 64-bit types");