| 263 | } |
| 264 | |
| 265 | uint32_t GcnCompiler::emitControlFlowCondition(const GcnTokenCondition& condition) |
| 266 | { |
| 267 | uint32_t result = 0; |
| 268 | |
| 269 | const uint32_t typeId = m_module.defBoolType(); |
| 270 | |
| 271 | auto loadCompareValue = [&]() |
| 272 | { |
| 273 | auto key = condition.condVar; |
| 274 | const auto& condVar = m_tokenVariables[key]; |
| 275 | uint32_t lhs = m_module.opLoad(getVectorTypeId(condVar.type), condVar.id); |
| 276 | |
| 277 | auto cmpValue = emitBuildConstValue(condition.cmpValue, condVar.type.ctype); |
| 278 | uint32_t rhs = cmpValue.id; |
| 279 | return std::make_pair(lhs, rhs); |
| 280 | }; |
| 281 | |
| 282 | auto op = condition.op; |
| 283 | switch (op) |
| 284 | { |
| 285 | case GcnConditionOp::EqBool: |
| 286 | { |
| 287 | auto cmpValue = loadCompareValue(); |
| 288 | result = m_module.opLogicalEqual(typeId, cmpValue.first, cmpValue.second); |
| 289 | } |
| 290 | break; |
| 291 | case GcnConditionOp::NeBool: |
| 292 | { |
| 293 | auto cmpValue = loadCompareValue(); |
| 294 | result = m_module.opLogicalNotEqual(typeId, cmpValue.first, cmpValue.second); |
| 295 | } |
| 296 | break; |
| 297 | case GcnConditionOp::Scc0: |
| 298 | { |
| 299 | uint32_t scc = m_module.opLoad(typeId, m_state.scc.id); |
| 300 | result = m_module.opLogicalNot(typeId, scc); |
| 301 | } |
| 302 | break; |
| 303 | case GcnConditionOp::Scc1: |
| 304 | result = m_module.opLoad(typeId, m_state.scc.id); |
| 305 | break; |
| 306 | case GcnConditionOp::Vccz: |
| 307 | result = m_state.vcc.zflag(); |
| 308 | break; |
| 309 | case GcnConditionOp::Vccnz: |
| 310 | { |
| 311 | uint32_t vccz = m_state.vcc.zflag(); |
| 312 | result = m_module.opLogicalNot(typeId, vccz); |
| 313 | } |
| 314 | break; |
| 315 | case GcnConditionOp::Execz: |
| 316 | result = m_state.exec.zflag(); |
| 317 | break; |
| 318 | case GcnConditionOp::Execnz: |
| 319 | { |
| 320 | uint32_t execz = m_state.exec.zflag(); |
| 321 | result = m_module.opLogicalNot(typeId, execz); |
| 322 | } |
nothing calls this directly
no test coverage detected