tools/clang/lib/SPIRV/SPIRVEmitter.cpp
/// Translates atomic HLSL opcodes into the equivalent SPIR-V opcode.
Translates atomic HLSL opcodes into the equivalent SPIR-V opcode.
Translates atomic HLSL opcodes into the equivalent SPIR - V opcode .
spv::Op translateAtomicHlslOpcodeToSpirvOpcode(hlsl::IntrinsicOp opcode) {
  using namespace hlsl;
  using namespace spv;
  switch (opcode) {
  case IntrinsicOp::IOP_InterlockedAdd:
  case IntrinsicOp::MOP_InterlockedAdd:
    return Op::OpAtomicIAdd;
  case IntrinsicOp::IOP_InterlockedAnd:
  case IntrinsicOp::MOP_InterlockedAnd:
    return Op::OpAtomicAnd;
  case IntrinsicOp::IOP_InterlockedOr:
  case IntrinsicOp::MOP_InterlockedOr:
    return Op::OpAtomicOr;
  case IntrinsicOp::IOP_InterlockedXor:
  case IntrinsicOp::MOP_InterlockedXor:
    return Op::OpAtomicXor;
  case IntrinsicOp::IOP_InterlockedUMax:
  case IntrinsicOp::MOP_InterlockedUMax:
    return Op::OpAtomicUMax;
  case IntrinsicOp::IOP_InterlockedUMin:
  case IntrinsicOp::MOP_InterlockedUMin:
    return Op::OpAtomicUMin;
  case IntrinsicOp::IOP_InterlockedMax:
  case IntrinsicOp::MOP_InterlockedMax:
    return Op::OpAtomicSMax;
  case IntrinsicOp::IOP_InterlockedMin:
  case IntrinsicOp::MOP_InterlockedMin:
    return Op::OpAtomicSMin;
  case IntrinsicOp::IOP_InterlockedExchange:
  case IntrinsicOp::MOP_InterlockedExchange:
    return Op::OpAtomicExchange;
  }
  assert(false && "unimplemented hlsl intrinsic opcode");
  return Op::Max;
}
spv :: Op translateAtomicHlslOpcodeToSpirvOpcode ( hlsl :: IntrinsicOp opcode ) { using namespace hlsl ; using namespace spv ; switch ( opcode ) { case IntrinsicOp :: IOP_InterlockedAdd : case IntrinsicOp :: MOP_InterlockedAdd : return Op :: OpAtomicIAdd ; case IntrinsicOp :: IOP_InterlockedAnd : case IntrinsicOp :: MOP_InterlockedAnd : return Op :: OpAtomicAnd ; case IntrinsicOp :: IOP_InterlockedOr : case IntrinsicOp :: MOP_InterlockedOr : return Op :: OpAtomicOr ; case IntrinsicOp :: IOP_InterlockedXor : case IntrinsicOp :: MOP_InterlockedXor : return Op :: OpAtomicXor ; case IntrinsicOp :: IOP_InterlockedUMax : case IntrinsicOp :: MOP_InterlockedUMax : return Op :: OpAtomicUMax ; case IntrinsicOp :: IOP_InterlockedUMin : case IntrinsicOp :: MOP_InterlockedUMin : return Op :: OpAtomicUMin ; case IntrinsicOp :: IOP_InterlockedMax : case IntrinsicOp :: MOP_InterlockedMax : return Op :: OpAtomicSMax ; case IntrinsicOp :: IOP_InterlockedMin : case IntrinsicOp :: MOP_InterlockedMin : return Op :: OpAtomicSMin ; case IntrinsicOp :: IOP_InterlockedExchange : case IntrinsicOp :: MOP_InterlockedExchange : return Op :: OpAtomicExchange ; } assert ( false && " " ) ; return Op :: Max ; }
Translates atomic HLSL opcodes into the equivalent SPIR-V opcode.
Translates atomic HLSL opcodes into the equivalent SPIR - V opcode .