scalar.clampf
← scalar dialect
Floating-point clamp with explicit NaN/comparison policy. The ordered mode preserves strict compare/select semantics, number mode uses minnum/maxnum semantics, and ieee mode propagates NaNs.
Operation contract
| Property |
Value |
| Semantic phase |
executable |
| Traits |
Pure |
Signature
| Kind |
Name |
Type |
Cardinality |
Description |
| Operand |
value |
float |
required |
— |
| Operand |
lower |
float |
required |
— |
| Operand |
upper |
float |
required |
— |
| Result |
result |
float |
required |
— |
| Attribute |
mode |
enum ClampFMode |
required |
— |
| Attribute |
fastmath |
flags FastMathFlags |
optional |
— |
Verification constraints
SameType(value, lower, upper, result)
Examples
%result = scalar.clampf<ordered> %value, %lower, %upper : f32
%result = scalar.clampf<number, nnan|nsz> %value, %lower, %upper : f32
%result = scalar.clampf<ieee> %value, %lower, %upper : f32