Skip to content

Commit

Permalink
more formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
natevm committed Dec 8, 2024
1 parent d0bd3f9 commit 5e8e720
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 48 deletions.
86 changes: 43 additions & 43 deletions source/slang/slang-emit-c-like.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3869,34 +3869,34 @@ void CLikeSourceEmitter::emitVecNOrScalar(
{
m_writer->emit("make_");

switch (elementType->getOp())
switch (elementType->getOp())
{
case kIROp_Int8Type:
m_writer->emit("char");
break;
case kIROp_Int16Type:
m_writer->emit("short");
break;
case kIROp_IntType:
m_writer->emit("int");
break;
case kIROp_Int64Type:
m_writer->emit("longlong");
break;
case kIROp_UInt8Type:
m_writer->emit("uchar");
break;
case kIROp_UInt16Type:
m_writer->emit("ushort");
break;
case kIROp_UIntType:
m_writer->emit("uint");
break;
case kIROp_UInt64Type:
m_writer->emit("ulonglong");
break;
default:
SLANG_ABORT_COMPILATION("Unhandled type emitting CUDA vector");
case kIROp_Int8Type:
m_writer->emit("char");
break;
case kIROp_Int16Type:
m_writer->emit("short");
break;
case kIROp_IntType:
m_writer->emit("int");
break;
case kIROp_Int64Type:
m_writer->emit("longlong");
break;
case kIROp_UInt8Type:
m_writer->emit("uchar");
break;
case kIROp_UInt16Type:
m_writer->emit("ushort");
break;
case kIROp_UIntType:
m_writer->emit("uint");
break;
case kIROp_UInt64Type:
m_writer->emit("ulonglong");
break;
default:
SLANG_ABORT_COMPILATION("Unhandled type emitting CUDA vector");
}

m_writer->emitRawText(std::to_string(N).c_str());
Expand All @@ -3912,7 +3912,7 @@ void CLikeSourceEmitter::emitVecNOrScalar(
}

// In other languages, we can output the Slang vector type directly
else
else
{
emitType(vectorType);
}
Expand Down Expand Up @@ -3965,22 +3965,22 @@ void CLikeSourceEmitter::emitBitfieldExtractImpl(IRInst* inst)
String one;
switch (bitWidth)
{
case 8:
one = "uint8_t(1)";
break;
case 16:
one = "uint16_t(1)";
break;
case 32:
one = "uint32_t(1)";
break;
case 64:
one = "uint64_t(1)";
break;
default:
SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unexpected bit width");
case 8:
one = "uint8_t(1)";
break;
case 16:
one = "uint16_t(1)";
break;
case 32:
one = "uint32_t(1)";
break;
case 64:
one = "uint64_t(1)";
break;
default:
SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unexpected bit width");
}

// Emit open paren and type cast for later sign extension
if (isSigned)
{
Expand Down
4 changes: 2 additions & 2 deletions source/slang/slang-emit-metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ void MetalSourceEmitter::emitSimpleTypeKnowingCount(IRType* type, IRIntegerValue
{
// NM: note, "ulong/ushort" is only type that works for i16/i64 vec, but can't be used for
// scalars. (See metal specification pg 26)

switch (type->getOp())
{
case kIROp_VoidType:
Expand All @@ -1065,7 +1065,7 @@ void MetalSourceEmitter::emitSimpleTypeKnowingCount(IRType* type, IRIntegerValue
m_writer->emit("long");
return;
case kIROp_UInt64Type:
if (elementCount > 1)
if (elementCount > 1)
m_writer->emit("ulong");
else
m_writer->emit("uint64_t");
Expand Down
4 changes: 2 additions & 2 deletions source/slang/slang-emit-spirv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6529,7 +6529,7 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex
Slang::IRType* elementType = dataType;
if (vectorType)
elementType = vectorType->getElementType();

const IntInfo i = getIntTypeInfo(elementType);

// NM: technically, using bitfield intrinsics for anything non-32-bit goes against
Expand All @@ -6554,7 +6554,7 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex
Slang::IRType* elementType = dataType;
if (vectorType)
elementType = vectorType->getElementType();

const IntInfo i = getIntTypeInfo(elementType);

if (i.width == 64)
Expand Down
2 changes: 1 addition & 1 deletion source/slang/slang-ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3642,7 +3642,7 @@ IRInst* IRBuilder::emitGetSequentialIDInst(IRInst* rttiObj)
addInst(inst);
return inst;
}

IRInst* IRBuilder::emitBitfieldExtract(IRType* type, IRInst* value, IRInst* offset, IRInst* bits)
{
auto inst = createInst<IRInst>(this, kIROp_BitfieldExtract, type, value, offset, bits);
Expand Down

0 comments on commit 5e8e720

Please sign in to comment.