Parses a DivByAttr attribute.
| 1420 | |
| 1421 | /// Parses a DivByAttr attribute. |
| 1422 | static LogicalResult parseDivByAttr(EncodingReader &reader, |
| 1423 | MLIRContext &context, |
| 1424 | cuda_tile::DivByAttr &nativeValue) { |
| 1425 | uint64_t divisor; |
| 1426 | if (failed(reader.readVarInt(divisor))) |
| 1427 | return reader.emitError() << "failed to read divisor for DivByAttr"; |
| 1428 | |
| 1429 | uint8_t flagsByte; |
| 1430 | if (failed(reader.readLE(flagsByte))) |
| 1431 | return reader.emitError() << "failed to read flags byte for DivByAttr"; |
| 1432 | |
| 1433 | bool has_every = (flagsByte & 0x01) != 0; |
| 1434 | bool has_along = (flagsByte & 0x02) != 0; |
| 1435 | |
| 1436 | std::optional<int64_t> every_opt; |
| 1437 | if (has_every) { |
| 1438 | uint64_t val; |
| 1439 | if (failed(reader.readSignedVarInt(val))) |
| 1440 | return reader.emitError() |
| 1441 | << "failed to read value for 'every' in DivByAttr"; |
| 1442 | every_opt = val; |
| 1443 | } |
| 1444 | |
| 1445 | std::optional<int64_t> along_opt; |
| 1446 | if (has_along) { |
| 1447 | uint64_t val; |
| 1448 | if (failed(reader.readSignedVarInt(val))) |
| 1449 | return reader.emitError() |
| 1450 | << "failed to read value for 'along' in DivByAttr"; |
| 1451 | along_opt = val; |
| 1452 | } |
| 1453 | |
| 1454 | nativeValue = |
| 1455 | cuda_tile::DivByAttr::get(&context, divisor, every_opt, along_opt); |
| 1456 | return success(); |
| 1457 | } |
| 1458 | |
| 1459 | #ifdef TILE_IR_INCLUDE_TESTS |
| 1460 | /// Parses a BytecodeTestValueAttr attribute. |
nothing calls this directly
no test coverage detected