Skip to content

low.scf.if

low dialect

Conditional execution over target-low register values.

Operation contract

Property Value
Semantic phase executable
Traits ImplicitTerminator(low.scf.yield)
Interfaces RegionBranch

Signature

Kind Name Type Cardinality Description
Operand condition register required Register predicate controlling the branch.
Result results register variadic
Region then_region region required Executed when condition is true. Terminated by low.scf.yield. (single block, terminator low.scf.yield.)
Region else_region region optional Executed when condition is false. Terminated by low.scf.yield. (single block, terminator low.scf.yield.)

Verification constraints

  • BlockArgsSatisfy(then_region)
  • BlockArgsSatisfy(else_region)
  • YieldCountMatchesResults(then_region, results)
  • YieldTypesMatchResults(then_region, results)
  • YieldCountMatchesResults(else_region, results)
  • YieldTypesMatchResults(else_region, results)

Examples

low.scf.if %cond {
  low.scf.yield
}
low.scf.if %cond {
  low.scf.yield
} else {
  low.scf.yield
}
%result = low.scf.if %cond -> (reg<amdgpu.vgpr x1>) {
  low.scf.yield %a : reg<amdgpu.vgpr x1>
} else {
  low.scf.yield %b : reg<amdgpu.vgpr x1>
}