authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-08-07 04:23:02-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-08-08 21:32:50-04:00
loge1efd4d3c22cad89ed89ea152c92b1c3260ddb8a
tree84acb00487739e068c9603263bc243b601b5de93
parent5b79f08ee82a48d84146706faf2229e7c298340d

Builder: simplify intrinsic table

This format removes back-references allowing it to be parsed in a single pass. It also reduces the number of kinds, simplifying the code.

1 files changed, 139 insertions(+), 56 deletions(-)

src/codegen/llvm/Builder.zig+139-56
...@@ -2462,7 +2462,8 @@ pub const Intrinsic = enum {...@@ -2462,7 +2462,8 @@ pub const Intrinsic = enum {
2462 @"wasm.memory.grow",2462 @"wasm.memory.grow",
24632463
2464 const Signature = struct {2464 const Signature = struct {
2465 params: []const Parameter = &.{},2465 ret_len: u8,
2466 params: []const Parameter,
2466 attrs: []const Attribute = &.{},2467 attrs: []const Attribute = &.{},
24672468
2468 const Parameter = struct {2469 const Parameter = struct {
...@@ -2471,33 +2472,37 @@ pub const Intrinsic = enum {...@@ -2471,33 +2472,37 @@ pub const Intrinsic = enum {
24712472
2472 const Kind = union(enum) {2473 const Kind = union(enum) {
2473 type: Type,2474 type: Type,
2475 change_scalar: struct {
2476 index: u8,
2477 scalar: Type,
2478 },
2474 overloaded,2479 overloaded,
2475 overloaded_tuple: u8,
2476 matches: u8,2480 matches: u8,
2477 matches_tuple: packed struct { param: u4, field: u4 },
2478 matches_with_overflow: u8,
2479 };2481 };
2480 };2482 };
2481 };2483 };
24822484
2483 const signatures = std.enums.EnumArray(Intrinsic, Signature).initDefault(.{}, .{2485 const signatures = std.enums.EnumArray(Intrinsic, Signature).initDefault(.{
2486 .ret_len = 0,
2487 .params = &.{},
2488 }, .{
2484 .va_start = .{2489 .va_start = .{
2490 .ret_len = 0,
2485 .params = &.{2491 .params = &.{
2486 .{ .kind = .{ .type = .void } },
2487 .{ .kind = .{ .type = .ptr } },2492 .{ .kind = .{ .type = .ptr } },
2488 },2493 },
2489 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn },2494 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn },
2490 },2495 },
2491 .va_end = .{2496 .va_end = .{
2497 .ret_len = 0,
2492 .params = &.{2498 .params = &.{
2493 .{ .kind = .{ .type = .void } },
2494 .{ .kind = .{ .type = .ptr } },2499 .{ .kind = .{ .type = .ptr } },
2495 },2500 },
2496 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn },2501 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn },
2497 },2502 },
2498 .va_copy = .{2503 .va_copy = .{
2504 .ret_len = 0,
2499 .params = &.{2505 .params = &.{
2500 .{ .kind = .{ .type = .void } },
2501 .{ .kind = .{ .type = .ptr } },2506 .{ .kind = .{ .type = .ptr } },
2502 .{ .kind = .{ .type = .ptr } },2507 .{ .kind = .{ .type = .ptr } },
2503 },2508 },
...@@ -2505,6 +2510,7 @@ pub const Intrinsic = enum {...@@ -2505,6 +2510,7 @@ pub const Intrinsic = enum {
2505 },2510 },
25062511
2507 .returnaddress = .{2512 .returnaddress = .{
2513 .ret_len = 1,
2508 .params = &.{2514 .params = &.{
2509 .{ .kind = .{ .type = .ptr } },2515 .{ .kind = .{ .type = .ptr } },
2510 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },2516 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },
...@@ -2512,18 +2518,21 @@ pub const Intrinsic = enum {...@@ -2512,18 +2518,21 @@ pub const Intrinsic = enum {
2512 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2518 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2513 },2519 },
2514 .addressofreturnaddress = .{2520 .addressofreturnaddress = .{
2521 .ret_len = 1,
2515 .params = &.{2522 .params = &.{
2516 .{ .kind = .overloaded },2523 .{ .kind = .overloaded },
2517 },2524 },
2518 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2525 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2519 },2526 },
2520 .sponentry = .{2527 .sponentry = .{
2528 .ret_len = 1,
2521 .params = &.{2529 .params = &.{
2522 .{ .kind = .overloaded },2530 .{ .kind = .overloaded },
2523 },2531 },
2524 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2532 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2525 },2533 },
2526 .frameaddress = .{2534 .frameaddress = .{
2535 .ret_len = 1,
2527 .params = &.{2536 .params = &.{
2528 .{ .kind = .overloaded },2537 .{ .kind = .overloaded },
2529 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },2538 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },
...@@ -2531,8 +2540,8 @@ pub const Intrinsic = enum {...@@ -2531,8 +2540,8 @@ pub const Intrinsic = enum {
2531 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2540 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2532 },2541 },
2533 .prefetch = .{2542 .prefetch = .{
2543 .ret_len = 0,
2534 .params = &.{2544 .params = &.{
2535 .{ .kind = .{ .type = .void } },
2536 .{ .kind = .overloaded, .attrs = &.{ .nocapture, .readonly } },2545 .{ .kind = .overloaded, .attrs = &.{ .nocapture, .readonly } },
2537 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },2546 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },
2538 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },2547 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },
...@@ -2541,6 +2550,7 @@ pub const Intrinsic = enum {...@@ -2541,6 +2550,7 @@ pub const Intrinsic = enum {
2541 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.readwrite) } },2550 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.readwrite) } },
2542 },2551 },
2543 .@"thread.pointer" = .{2552 .@"thread.pointer" = .{
2553 .ret_len = 1,
2544 .params = &.{2554 .params = &.{
2545 .{ .kind = .{ .type = .ptr } },2555 .{ .kind = .{ .type = .ptr } },
2546 },2556 },
...@@ -2548,6 +2558,7 @@ pub const Intrinsic = enum {...@@ -2548,6 +2558,7 @@ pub const Intrinsic = enum {
2548 },2558 },
25492559
2550 .abs = .{2560 .abs = .{
2561 .ret_len = 1,
2551 .params = &.{2562 .params = &.{
2552 .{ .kind = .overloaded },2563 .{ .kind = .overloaded },
2553 .{ .kind = .{ .matches = 0 } },2564 .{ .kind = .{ .matches = 0 } },
...@@ -2556,6 +2567,7 @@ pub const Intrinsic = enum {...@@ -2556,6 +2567,7 @@ pub const Intrinsic = enum {
2556 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2567 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2557 },2568 },
2558 .smax = .{2569 .smax = .{
2570 .ret_len = 1,
2559 .params = &.{2571 .params = &.{
2560 .{ .kind = .overloaded },2572 .{ .kind = .overloaded },
2561 .{ .kind = .{ .matches = 0 } },2573 .{ .kind = .{ .matches = 0 } },
...@@ -2564,6 +2576,7 @@ pub const Intrinsic = enum {...@@ -2564,6 +2576,7 @@ pub const Intrinsic = enum {
2564 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2576 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2565 },2577 },
2566 .smin = .{2578 .smin = .{
2579 .ret_len = 1,
2567 .params = &.{2580 .params = &.{
2568 .{ .kind = .overloaded },2581 .{ .kind = .overloaded },
2569 .{ .kind = .{ .matches = 0 } },2582 .{ .kind = .{ .matches = 0 } },
...@@ -2572,6 +2585,7 @@ pub const Intrinsic = enum {...@@ -2572,6 +2585,7 @@ pub const Intrinsic = enum {
2572 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2585 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2573 },2586 },
2574 .umax = .{2587 .umax = .{
2588 .ret_len = 1,
2575 .params = &.{2589 .params = &.{
2576 .{ .kind = .overloaded },2590 .{ .kind = .overloaded },
2577 .{ .kind = .{ .matches = 0 } },2591 .{ .kind = .{ .matches = 0 } },
...@@ -2580,6 +2594,7 @@ pub const Intrinsic = enum {...@@ -2580,6 +2594,7 @@ pub const Intrinsic = enum {
2580 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2594 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2581 },2595 },
2582 .umin = .{2596 .umin = .{
2597 .ret_len = 1,
2583 .params = &.{2598 .params = &.{
2584 .{ .kind = .overloaded },2599 .{ .kind = .overloaded },
2585 .{ .kind = .{ .matches = 0 } },2600 .{ .kind = .{ .matches = 0 } },
...@@ -2588,6 +2603,7 @@ pub const Intrinsic = enum {...@@ -2588,6 +2603,7 @@ pub const Intrinsic = enum {
2588 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2603 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2589 },2604 },
2590 .sqrt = .{2605 .sqrt = .{
2606 .ret_len = 1,
2591 .params = &.{2607 .params = &.{
2592 .{ .kind = .overloaded },2608 .{ .kind = .overloaded },
2593 .{ .kind = .{ .matches = 0 } },2609 .{ .kind = .{ .matches = 0 } },
...@@ -2595,6 +2611,7 @@ pub const Intrinsic = enum {...@@ -2595,6 +2611,7 @@ pub const Intrinsic = enum {
2595 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2611 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2596 },2612 },
2597 .powi = .{2613 .powi = .{
2614 .ret_len = 1,
2598 .params = &.{2615 .params = &.{
2599 .{ .kind = .overloaded },2616 .{ .kind = .overloaded },
2600 .{ .kind = .{ .matches = 0 } },2617 .{ .kind = .{ .matches = 0 } },
...@@ -2603,6 +2620,7 @@ pub const Intrinsic = enum {...@@ -2603,6 +2620,7 @@ pub const Intrinsic = enum {
2603 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2620 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2604 },2621 },
2605 .sin = .{2622 .sin = .{
2623 .ret_len = 1,
2606 .params = &.{2624 .params = &.{
2607 .{ .kind = .overloaded },2625 .{ .kind = .overloaded },
2608 .{ .kind = .{ .matches = 0 } },2626 .{ .kind = .{ .matches = 0 } },
...@@ -2610,6 +2628,7 @@ pub const Intrinsic = enum {...@@ -2610,6 +2628,7 @@ pub const Intrinsic = enum {
2610 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2628 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2611 },2629 },
2612 .cos = .{2630 .cos = .{
2631 .ret_len = 1,
2613 .params = &.{2632 .params = &.{
2614 .{ .kind = .overloaded },2633 .{ .kind = .overloaded },
2615 .{ .kind = .{ .matches = 0 } },2634 .{ .kind = .{ .matches = 0 } },
...@@ -2617,6 +2636,7 @@ pub const Intrinsic = enum {...@@ -2617,6 +2636,7 @@ pub const Intrinsic = enum {
2617 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2636 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2618 },2637 },
2619 .pow = .{2638 .pow = .{
2639 .ret_len = 1,
2620 .params = &.{2640 .params = &.{
2621 .{ .kind = .overloaded },2641 .{ .kind = .overloaded },
2622 .{ .kind = .{ .matches = 0 } },2642 .{ .kind = .{ .matches = 0 } },
...@@ -2625,6 +2645,7 @@ pub const Intrinsic = enum {...@@ -2625,6 +2645,7 @@ pub const Intrinsic = enum {
2625 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2645 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2626 },2646 },
2627 .exp = .{2647 .exp = .{
2648 .ret_len = 1,
2628 .params = &.{2649 .params = &.{
2629 .{ .kind = .overloaded },2650 .{ .kind = .overloaded },
2630 .{ .kind = .{ .matches = 0 } },2651 .{ .kind = .{ .matches = 0 } },
...@@ -2632,6 +2653,7 @@ pub const Intrinsic = enum {...@@ -2632,6 +2653,7 @@ pub const Intrinsic = enum {
2632 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2653 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2633 },2654 },
2634 .exp2 = .{2655 .exp2 = .{
2656 .ret_len = 1,
2635 .params = &.{2657 .params = &.{
2636 .{ .kind = .overloaded },2658 .{ .kind = .overloaded },
2637 .{ .kind = .{ .matches = 0 } },2659 .{ .kind = .{ .matches = 0 } },
...@@ -2639,6 +2661,7 @@ pub const Intrinsic = enum {...@@ -2639,6 +2661,7 @@ pub const Intrinsic = enum {
2639 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2661 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2640 },2662 },
2641 .ldexp = .{2663 .ldexp = .{
2664 .ret_len = 1,
2642 .params = &.{2665 .params = &.{
2643 .{ .kind = .overloaded },2666 .{ .kind = .overloaded },
2644 .{ .kind = .{ .matches = 0 } },2667 .{ .kind = .{ .matches = 0 } },
...@@ -2647,13 +2670,16 @@ pub const Intrinsic = enum {...@@ -2647,13 +2670,16 @@ pub const Intrinsic = enum {
2647 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2670 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2648 },2671 },
2649 .frexp = .{2672 .frexp = .{
2673 .ret_len = 2,
2650 .params = &.{2674 .params = &.{
2651 .{ .kind = .{ .overloaded_tuple = 2 } },2675 .{ .kind = .overloaded },
2652 .{ .kind = .{ .matches_tuple = .{ .param = 0, .field = 0 } } },2676 .{ .kind = .overloaded },
2677 .{ .kind = .{ .matches = 0 } },
2653 },2678 },
2654 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2679 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2655 },2680 },
2656 .log = .{2681 .log = .{
2682 .ret_len = 1,
2657 .params = &.{2683 .params = &.{
2658 .{ .kind = .overloaded },2684 .{ .kind = .overloaded },
2659 .{ .kind = .{ .matches = 0 } },2685 .{ .kind = .{ .matches = 0 } },
...@@ -2661,6 +2687,7 @@ pub const Intrinsic = enum {...@@ -2661,6 +2687,7 @@ pub const Intrinsic = enum {
2661 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2687 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2662 },2688 },
2663 .log10 = .{2689 .log10 = .{
2690 .ret_len = 1,
2664 .params = &.{2691 .params = &.{
2665 .{ .kind = .overloaded },2692 .{ .kind = .overloaded },
2666 .{ .kind = .{ .matches = 0 } },2693 .{ .kind = .{ .matches = 0 } },
...@@ -2668,6 +2695,7 @@ pub const Intrinsic = enum {...@@ -2668,6 +2695,7 @@ pub const Intrinsic = enum {
2668 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2695 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2669 },2696 },
2670 .log2 = .{2697 .log2 = .{
2698 .ret_len = 1,
2671 .params = &.{2699 .params = &.{
2672 .{ .kind = .overloaded },2700 .{ .kind = .overloaded },
2673 .{ .kind = .{ .matches = 0 } },2701 .{ .kind = .{ .matches = 0 } },
...@@ -2675,6 +2703,7 @@ pub const Intrinsic = enum {...@@ -2675,6 +2703,7 @@ pub const Intrinsic = enum {
2675 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2703 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2676 },2704 },
2677 .fma = .{2705 .fma = .{
2706 .ret_len = 1,
2678 .params = &.{2707 .params = &.{
2679 .{ .kind = .overloaded },2708 .{ .kind = .overloaded },
2680 .{ .kind = .{ .matches = 0 } },2709 .{ .kind = .{ .matches = 0 } },
...@@ -2684,6 +2713,7 @@ pub const Intrinsic = enum {...@@ -2684,6 +2713,7 @@ pub const Intrinsic = enum {
2684 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2713 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2685 },2714 },
2686 .fabs = .{2715 .fabs = .{
2716 .ret_len = 1,
2687 .params = &.{2717 .params = &.{
2688 .{ .kind = .overloaded },2718 .{ .kind = .overloaded },
2689 .{ .kind = .{ .matches = 0 } },2719 .{ .kind = .{ .matches = 0 } },
...@@ -2691,6 +2721,7 @@ pub const Intrinsic = enum {...@@ -2691,6 +2721,7 @@ pub const Intrinsic = enum {
2691 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2721 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2692 },2722 },
2693 .minnum = .{2723 .minnum = .{
2724 .ret_len = 1,
2694 .params = &.{2725 .params = &.{
2695 .{ .kind = .overloaded },2726 .{ .kind = .overloaded },
2696 .{ .kind = .{ .matches = 0 } },2727 .{ .kind = .{ .matches = 0 } },
...@@ -2699,6 +2730,7 @@ pub const Intrinsic = enum {...@@ -2699,6 +2730,7 @@ pub const Intrinsic = enum {
2699 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2730 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2700 },2731 },
2701 .maxnum = .{2732 .maxnum = .{
2733 .ret_len = 1,
2702 .params = &.{2734 .params = &.{
2703 .{ .kind = .overloaded },2735 .{ .kind = .overloaded },
2704 .{ .kind = .{ .matches = 0 } },2736 .{ .kind = .{ .matches = 0 } },
...@@ -2707,6 +2739,7 @@ pub const Intrinsic = enum {...@@ -2707,6 +2739,7 @@ pub const Intrinsic = enum {
2707 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2739 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2708 },2740 },
2709 .minimum = .{2741 .minimum = .{
2742 .ret_len = 1,
2710 .params = &.{2743 .params = &.{
2711 .{ .kind = .overloaded },2744 .{ .kind = .overloaded },
2712 .{ .kind = .{ .matches = 0 } },2745 .{ .kind = .{ .matches = 0 } },
...@@ -2715,6 +2748,7 @@ pub const Intrinsic = enum {...@@ -2715,6 +2748,7 @@ pub const Intrinsic = enum {
2715 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2748 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2716 },2749 },
2717 .maximum = .{2750 .maximum = .{
2751 .ret_len = 1,
2718 .params = &.{2752 .params = &.{
2719 .{ .kind = .overloaded },2753 .{ .kind = .overloaded },
2720 .{ .kind = .{ .matches = 0 } },2754 .{ .kind = .{ .matches = 0 } },
...@@ -2723,6 +2757,7 @@ pub const Intrinsic = enum {...@@ -2723,6 +2757,7 @@ pub const Intrinsic = enum {
2723 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2757 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2724 },2758 },
2725 .copysign = .{2759 .copysign = .{
2760 .ret_len = 1,
2726 .params = &.{2761 .params = &.{
2727 .{ .kind = .overloaded },2762 .{ .kind = .overloaded },
2728 .{ .kind = .{ .matches = 0 } },2763 .{ .kind = .{ .matches = 0 } },
...@@ -2731,6 +2766,7 @@ pub const Intrinsic = enum {...@@ -2731,6 +2766,7 @@ pub const Intrinsic = enum {
2731 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2766 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2732 },2767 },
2733 .floor = .{2768 .floor = .{
2769 .ret_len = 1,
2734 .params = &.{2770 .params = &.{
2735 .{ .kind = .overloaded },2771 .{ .kind = .overloaded },
2736 .{ .kind = .{ .matches = 0 } },2772 .{ .kind = .{ .matches = 0 } },
...@@ -2738,6 +2774,7 @@ pub const Intrinsic = enum {...@@ -2738,6 +2774,7 @@ pub const Intrinsic = enum {
2738 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2774 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2739 },2775 },
2740 .ceil = .{2776 .ceil = .{
2777 .ret_len = 1,
2741 .params = &.{2778 .params = &.{
2742 .{ .kind = .overloaded },2779 .{ .kind = .overloaded },
2743 .{ .kind = .{ .matches = 0 } },2780 .{ .kind = .{ .matches = 0 } },
...@@ -2745,6 +2782,7 @@ pub const Intrinsic = enum {...@@ -2745,6 +2782,7 @@ pub const Intrinsic = enum {
2745 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2782 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2746 },2783 },
2747 .trunc = .{2784 .trunc = .{
2785 .ret_len = 1,
2748 .params = &.{2786 .params = &.{
2749 .{ .kind = .overloaded },2787 .{ .kind = .overloaded },
2750 .{ .kind = .{ .matches = 0 } },2788 .{ .kind = .{ .matches = 0 } },
...@@ -2752,6 +2790,7 @@ pub const Intrinsic = enum {...@@ -2752,6 +2790,7 @@ pub const Intrinsic = enum {
2752 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2790 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2753 },2791 },
2754 .rint = .{2792 .rint = .{
2793 .ret_len = 1,
2755 .params = &.{2794 .params = &.{
2756 .{ .kind = .overloaded },2795 .{ .kind = .overloaded },
2757 .{ .kind = .{ .matches = 0 } },2796 .{ .kind = .{ .matches = 0 } },
...@@ -2759,6 +2798,7 @@ pub const Intrinsic = enum {...@@ -2759,6 +2798,7 @@ pub const Intrinsic = enum {
2759 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2798 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2760 },2799 },
2761 .nearbyint = .{2800 .nearbyint = .{
2801 .ret_len = 1,
2762 .params = &.{2802 .params = &.{
2763 .{ .kind = .overloaded },2803 .{ .kind = .overloaded },
2764 .{ .kind = .{ .matches = 0 } },2804 .{ .kind = .{ .matches = 0 } },
...@@ -2766,6 +2806,7 @@ pub const Intrinsic = enum {...@@ -2766,6 +2806,7 @@ pub const Intrinsic = enum {
2766 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2806 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2767 },2807 },
2768 .round = .{2808 .round = .{
2809 .ret_len = 1,
2769 .params = &.{2810 .params = &.{
2770 .{ .kind = .overloaded },2811 .{ .kind = .overloaded },
2771 .{ .kind = .{ .matches = 0 } },2812 .{ .kind = .{ .matches = 0 } },
...@@ -2773,6 +2814,7 @@ pub const Intrinsic = enum {...@@ -2773,6 +2814,7 @@ pub const Intrinsic = enum {
2773 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2814 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2774 },2815 },
2775 .roundeven = .{2816 .roundeven = .{
2817 .ret_len = 1,
2776 .params = &.{2818 .params = &.{
2777 .{ .kind = .overloaded },2819 .{ .kind = .overloaded },
2778 .{ .kind = .{ .matches = 0 } },2820 .{ .kind = .{ .matches = 0 } },
...@@ -2780,6 +2822,7 @@ pub const Intrinsic = enum {...@@ -2780,6 +2822,7 @@ pub const Intrinsic = enum {
2780 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2822 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2781 },2823 },
2782 .lround = .{2824 .lround = .{
2825 .ret_len = 1,
2783 .params = &.{2826 .params = &.{
2784 .{ .kind = .overloaded },2827 .{ .kind = .overloaded },
2785 .{ .kind = .overloaded },2828 .{ .kind = .overloaded },
...@@ -2787,6 +2830,7 @@ pub const Intrinsic = enum {...@@ -2787,6 +2830,7 @@ pub const Intrinsic = enum {
2787 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2830 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2788 },2831 },
2789 .llround = .{2832 .llround = .{
2833 .ret_len = 1,
2790 .params = &.{2834 .params = &.{
2791 .{ .kind = .overloaded },2835 .{ .kind = .overloaded },
2792 .{ .kind = .overloaded },2836 .{ .kind = .overloaded },
...@@ -2794,6 +2838,7 @@ pub const Intrinsic = enum {...@@ -2794,6 +2838,7 @@ pub const Intrinsic = enum {
2794 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2838 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2795 },2839 },
2796 .lrint = .{2840 .lrint = .{
2841 .ret_len = 1,
2797 .params = &.{2842 .params = &.{
2798 .{ .kind = .overloaded },2843 .{ .kind = .overloaded },
2799 .{ .kind = .overloaded },2844 .{ .kind = .overloaded },
...@@ -2801,6 +2846,7 @@ pub const Intrinsic = enum {...@@ -2801,6 +2846,7 @@ pub const Intrinsic = enum {
2801 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2846 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2802 },2847 },
2803 .llrint = .{2848 .llrint = .{
2849 .ret_len = 1,
2804 .params = &.{2850 .params = &.{
2805 .{ .kind = .overloaded },2851 .{ .kind = .overloaded },
2806 .{ .kind = .overloaded },2852 .{ .kind = .overloaded },
...@@ -2809,6 +2855,7 @@ pub const Intrinsic = enum {...@@ -2809,6 +2855,7 @@ pub const Intrinsic = enum {
2809 },2855 },
28102856
2811 .bitreverse = .{2857 .bitreverse = .{
2858 .ret_len = 1,
2812 .params = &.{2859 .params = &.{
2813 .{ .kind = .overloaded },2860 .{ .kind = .overloaded },
2814 .{ .kind = .{ .matches = 0 } },2861 .{ .kind = .{ .matches = 0 } },
...@@ -2816,6 +2863,7 @@ pub const Intrinsic = enum {...@@ -2816,6 +2863,7 @@ pub const Intrinsic = enum {
2816 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2863 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2817 },2864 },
2818 .bswap = .{2865 .bswap = .{
2866 .ret_len = 1,
2819 .params = &.{2867 .params = &.{
2820 .{ .kind = .overloaded },2868 .{ .kind = .overloaded },
2821 .{ .kind = .{ .matches = 0 } },2869 .{ .kind = .{ .matches = 0 } },
...@@ -2823,6 +2871,7 @@ pub const Intrinsic = enum {...@@ -2823,6 +2871,7 @@ pub const Intrinsic = enum {
2823 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2871 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2824 },2872 },
2825 .ctpop = .{2873 .ctpop = .{
2874 .ret_len = 1,
2826 .params = &.{2875 .params = &.{
2827 .{ .kind = .overloaded },2876 .{ .kind = .overloaded },
2828 .{ .kind = .{ .matches = 0 } },2877 .{ .kind = .{ .matches = 0 } },
...@@ -2830,6 +2879,7 @@ pub const Intrinsic = enum {...@@ -2830,6 +2879,7 @@ pub const Intrinsic = enum {
2830 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2879 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2831 },2880 },
2832 .ctlz = .{2881 .ctlz = .{
2882 .ret_len = 1,
2833 .params = &.{2883 .params = &.{
2834 .{ .kind = .overloaded },2884 .{ .kind = .overloaded },
2835 .{ .kind = .{ .matches = 0 } },2885 .{ .kind = .{ .matches = 0 } },
...@@ -2838,6 +2888,7 @@ pub const Intrinsic = enum {...@@ -2838,6 +2888,7 @@ pub const Intrinsic = enum {
2838 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2888 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2839 },2889 },
2840 .cttz = .{2890 .cttz = .{
2891 .ret_len = 1,
2841 .params = &.{2892 .params = &.{
2842 .{ .kind = .overloaded },2893 .{ .kind = .overloaded },
2843 .{ .kind = .{ .matches = 0 } },2894 .{ .kind = .{ .matches = 0 } },
...@@ -2846,6 +2897,7 @@ pub const Intrinsic = enum {...@@ -2846,6 +2897,7 @@ pub const Intrinsic = enum {
2846 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2897 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2847 },2898 },
2848 .fshl = .{2899 .fshl = .{
2900 .ret_len = 1,
2849 .params = &.{2901 .params = &.{
2850 .{ .kind = .overloaded },2902 .{ .kind = .overloaded },
2851 .{ .kind = .{ .matches = 0 } },2903 .{ .kind = .{ .matches = 0 } },
...@@ -2855,6 +2907,7 @@ pub const Intrinsic = enum {...@@ -2855,6 +2907,7 @@ pub const Intrinsic = enum {
2855 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2907 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2856 },2908 },
2857 .fshr = .{2909 .fshr = .{
2910 .ret_len = 1,
2858 .params = &.{2911 .params = &.{
2859 .{ .kind = .overloaded },2912 .{ .kind = .overloaded },
2860 .{ .kind = .{ .matches = 0 } },2913 .{ .kind = .{ .matches = 0 } },
...@@ -2865,55 +2918,68 @@ pub const Intrinsic = enum {...@@ -2865,55 +2918,68 @@ pub const Intrinsic = enum {
2865 },2918 },
28662919
2867 .@"sadd.with.overflow" = .{2920 .@"sadd.with.overflow" = .{
2921 .ret_len = 2,
2868 .params = &.{2922 .params = &.{
2869 .{ .kind = .{ .matches_with_overflow = 1 } },
2870 .{ .kind = .overloaded },2923 .{ .kind = .overloaded },
2871 .{ .kind = .{ .matches = 1 } },2924 .{ .kind = .{ .change_scalar = .{ .index = 0, .scalar = .i1 } } },
2925 .{ .kind = .{ .matches = 0 } },
2926 .{ .kind = .{ .matches = 0 } },
2872 },2927 },
2873 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2928 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2874 },2929 },
2875 .@"uadd.with.overflow" = .{2930 .@"uadd.with.overflow" = .{
2931 .ret_len = 2,
2876 .params = &.{2932 .params = &.{
2877 .{ .kind = .{ .matches_with_overflow = 1 } },
2878 .{ .kind = .overloaded },2933 .{ .kind = .overloaded },
2879 .{ .kind = .{ .matches = 1 } },2934 .{ .kind = .{ .change_scalar = .{ .index = 0, .scalar = .i1 } } },
2935 .{ .kind = .{ .matches = 0 } },
2936 .{ .kind = .{ .matches = 0 } },
2880 },2937 },
2881 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2938 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2882 },2939 },
2883 .@"ssub.with.overflow" = .{2940 .@"ssub.with.overflow" = .{
2941 .ret_len = 2,
2884 .params = &.{2942 .params = &.{
2885 .{ .kind = .{ .matches_with_overflow = 1 } },
2886 .{ .kind = .overloaded },2943 .{ .kind = .overloaded },
2887 .{ .kind = .{ .matches = 1 } },2944 .{ .kind = .{ .change_scalar = .{ .index = 0, .scalar = .i1 } } },
2945 .{ .kind = .{ .matches = 0 } },
2946 .{ .kind = .{ .matches = 0 } },
2888 },2947 },
2889 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2948 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2890 },2949 },
2891 .@"usub.with.overflow" = .{2950 .@"usub.with.overflow" = .{
2951 .ret_len = 2,
2892 .params = &.{2952 .params = &.{
2893 .{ .kind = .{ .matches_with_overflow = 1 } },
2894 .{ .kind = .overloaded },2953 .{ .kind = .overloaded },
2895 .{ .kind = .{ .matches = 1 } },2954 .{ .kind = .{ .change_scalar = .{ .index = 0, .scalar = .i1 } } },
2955 .{ .kind = .{ .matches = 0 } },
2956 .{ .kind = .{ .matches = 0 } },
2896 },2957 },
2897 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2958 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2898 },2959 },
2899 .@"smul.with.overflow" = .{2960 .@"smul.with.overflow" = .{
2961 .ret_len = 2,
2900 .params = &.{2962 .params = &.{
2901 .{ .kind = .{ .matches_with_overflow = 1 } },
2902 .{ .kind = .overloaded },2963 .{ .kind = .overloaded },
2903 .{ .kind = .{ .matches = 1 } },2964 .{ .kind = .{ .change_scalar = .{ .index = 0, .scalar = .i1 } } },
2965 .{ .kind = .{ .matches = 0 } },
2966 .{ .kind = .{ .matches = 0 } },
2904 },2967 },
2905 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2968 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2906 },2969 },
2907 .@"umul.with.overflow" = .{2970 .@"umul.with.overflow" = .{
2971 .ret_len = 2,
2908 .params = &.{2972 .params = &.{
2909 .{ .kind = .{ .matches_with_overflow = 1 } },
2910 .{ .kind = .overloaded },2973 .{ .kind = .overloaded },
2911 .{ .kind = .{ .matches = 1 } },2974 .{ .kind = .{ .change_scalar = .{ .index = 0, .scalar = .i1 } } },
2975 .{ .kind = .{ .matches = 0 } },
2976 .{ .kind = .{ .matches = 0 } },
2912 },2977 },
2913 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2978 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2914 },2979 },
29152980
2916 .@"sadd.sat" = .{2981 .@"sadd.sat" = .{
2982 .ret_len = 1,
2917 .params = &.{2983 .params = &.{
2918 .{ .kind = .overloaded },2984 .{ .kind = .overloaded },
2919 .{ .kind = .{ .matches = 0 } },2985 .{ .kind = .{ .matches = 0 } },
...@@ -2922,6 +2988,7 @@ pub const Intrinsic = enum {...@@ -2922,6 +2988,7 @@ pub const Intrinsic = enum {
2922 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2988 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2923 },2989 },
2924 .@"uadd.sat" = .{2990 .@"uadd.sat" = .{
2991 .ret_len = 1,
2925 .params = &.{2992 .params = &.{
2926 .{ .kind = .overloaded },2993 .{ .kind = .overloaded },
2927 .{ .kind = .{ .matches = 0 } },2994 .{ .kind = .{ .matches = 0 } },
...@@ -2930,6 +2997,7 @@ pub const Intrinsic = enum {...@@ -2930,6 +2997,7 @@ pub const Intrinsic = enum {
2930 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },2997 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2931 },2998 },
2932 .@"ssub.sat" = .{2999 .@"ssub.sat" = .{
3000 .ret_len = 1,
2933 .params = &.{3001 .params = &.{
2934 .{ .kind = .overloaded },3002 .{ .kind = .overloaded },
2935 .{ .kind = .{ .matches = 0 } },3003 .{ .kind = .{ .matches = 0 } },
...@@ -2938,6 +3006,7 @@ pub const Intrinsic = enum {...@@ -2938,6 +3006,7 @@ pub const Intrinsic = enum {
2938 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3006 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2939 },3007 },
2940 .@"usub.sat" = .{3008 .@"usub.sat" = .{
3009 .ret_len = 1,
2941 .params = &.{3010 .params = &.{
2942 .{ .kind = .overloaded },3011 .{ .kind = .overloaded },
2943 .{ .kind = .{ .matches = 0 } },3012 .{ .kind = .{ .matches = 0 } },
...@@ -2946,6 +3015,7 @@ pub const Intrinsic = enum {...@@ -2946,6 +3015,7 @@ pub const Intrinsic = enum {
2946 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3015 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2947 },3016 },
2948 .@"sshl.sat" = .{3017 .@"sshl.sat" = .{
3018 .ret_len = 1,
2949 .params = &.{3019 .params = &.{
2950 .{ .kind = .overloaded },3020 .{ .kind = .overloaded },
2951 .{ .kind = .{ .matches = 0 } },3021 .{ .kind = .{ .matches = 0 } },
...@@ -2954,6 +3024,7 @@ pub const Intrinsic = enum {...@@ -2954,6 +3024,7 @@ pub const Intrinsic = enum {
2954 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3024 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2955 },3025 },
2956 .@"ushl.sat" = .{3026 .@"ushl.sat" = .{
3027 .ret_len = 1,
2957 .params = &.{3028 .params = &.{
2958 .{ .kind = .overloaded },3029 .{ .kind = .overloaded },
2959 .{ .kind = .{ .matches = 0 } },3030 .{ .kind = .{ .matches = 0 } },
...@@ -2963,6 +3034,7 @@ pub const Intrinsic = enum {...@@ -2963,6 +3034,7 @@ pub const Intrinsic = enum {
2963 },3034 },
29643035
2965 .@"smul.fix" = .{3036 .@"smul.fix" = .{
3037 .ret_len = 1,
2966 .params = &.{3038 .params = &.{
2967 .{ .kind = .overloaded },3039 .{ .kind = .overloaded },
2968 .{ .kind = .{ .matches = 0 } },3040 .{ .kind = .{ .matches = 0 } },
...@@ -2972,6 +3044,7 @@ pub const Intrinsic = enum {...@@ -2972,6 +3044,7 @@ pub const Intrinsic = enum {
2972 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3044 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2973 },3045 },
2974 .@"umul.fix" = .{3046 .@"umul.fix" = .{
3047 .ret_len = 1,
2975 .params = &.{3048 .params = &.{
2976 .{ .kind = .overloaded },3049 .{ .kind = .overloaded },
2977 .{ .kind = .{ .matches = 0 } },3050 .{ .kind = .{ .matches = 0 } },
...@@ -2981,6 +3054,7 @@ pub const Intrinsic = enum {...@@ -2981,6 +3054,7 @@ pub const Intrinsic = enum {
2981 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3054 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2982 },3055 },
2983 .@"smul.fix.sat" = .{3056 .@"smul.fix.sat" = .{
3057 .ret_len = 1,
2984 .params = &.{3058 .params = &.{
2985 .{ .kind = .overloaded },3059 .{ .kind = .overloaded },
2986 .{ .kind = .{ .matches = 0 } },3060 .{ .kind = .{ .matches = 0 } },
...@@ -2990,6 +3064,7 @@ pub const Intrinsic = enum {...@@ -2990,6 +3064,7 @@ pub const Intrinsic = enum {
2990 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3064 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
2991 },3065 },
2992 .@"umul.fix.sat" = .{3066 .@"umul.fix.sat" = .{
3067 .ret_len = 1,
2993 .params = &.{3068 .params = &.{
2994 .{ .kind = .overloaded },3069 .{ .kind = .overloaded },
2995 .{ .kind = .{ .matches = 0 } },3070 .{ .kind = .{ .matches = 0 } },
...@@ -2999,6 +3074,7 @@ pub const Intrinsic = enum {...@@ -2999,6 +3074,7 @@ pub const Intrinsic = enum {
2999 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3074 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3000 },3075 },
3001 .@"sdiv.fix" = .{3076 .@"sdiv.fix" = .{
3077 .ret_len = 1,
3002 .params = &.{3078 .params = &.{
3003 .{ .kind = .overloaded },3079 .{ .kind = .overloaded },
3004 .{ .kind = .{ .matches = 0 } },3080 .{ .kind = .{ .matches = 0 } },
...@@ -3008,6 +3084,7 @@ pub const Intrinsic = enum {...@@ -3008,6 +3084,7 @@ pub const Intrinsic = enum {
3008 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3084 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3009 },3085 },
3010 .@"udiv.fix" = .{3086 .@"udiv.fix" = .{
3087 .ret_len = 1,
3011 .params = &.{3088 .params = &.{
3012 .{ .kind = .overloaded },3089 .{ .kind = .overloaded },
3013 .{ .kind = .{ .matches = 0 } },3090 .{ .kind = .{ .matches = 0 } },
...@@ -3017,6 +3094,7 @@ pub const Intrinsic = enum {...@@ -3017,6 +3094,7 @@ pub const Intrinsic = enum {
3017 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3094 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3018 },3095 },
3019 .@"sdiv.fix.sat" = .{3096 .@"sdiv.fix.sat" = .{
3097 .ret_len = 1,
3020 .params = &.{3098 .params = &.{
3021 .{ .kind = .overloaded },3099 .{ .kind = .overloaded },
3022 .{ .kind = .{ .matches = 0 } },3100 .{ .kind = .{ .matches = 0 } },
...@@ -3026,6 +3104,7 @@ pub const Intrinsic = enum {...@@ -3026,6 +3104,7 @@ pub const Intrinsic = enum {
3026 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3104 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3027 },3105 },
3028 .@"udiv.fix.sat" = .{3106 .@"udiv.fix.sat" = .{
3107 .ret_len = 1,
3029 .params = &.{3108 .params = &.{
3030 .{ .kind = .overloaded },3109 .{ .kind = .overloaded },
3031 .{ .kind = .{ .matches = 0 } },3110 .{ .kind = .{ .matches = 0 } },
...@@ -3036,62 +3115,67 @@ pub const Intrinsic = enum {...@@ -3036,62 +3115,67 @@ pub const Intrinsic = enum {
3036 },3115 },
30373116
3038 .trap = .{3117 .trap = .{
3039 .params = &.{3118 .ret_len = 0,
3040 .{ .kind = .{ .type = .void } },3119 .params = &.{},
3041 },
3042 .attrs = &.{ .cold, .noreturn, .nounwind, .{ .memory = .{ .inaccessiblemem = .write } } },3120 .attrs = &.{ .cold, .noreturn, .nounwind, .{ .memory = .{ .inaccessiblemem = .write } } },
3043 },3121 },
3044 .debugtrap = .{3122 .debugtrap = .{
3045 .params = &.{3123 .ret_len = 0,
3046 .{ .kind = .{ .type = .void } },3124 .params = &.{},
3047 },
3048 .attrs = &.{.nounwind},3125 .attrs = &.{.nounwind},
3049 },3126 },
3050 .ubsantrap = .{3127 .ubsantrap = .{
3128 .ret_len = 0,
3051 .params = &.{3129 .params = &.{
3052 .{ .kind = .{ .type = .void } },
3053 .{ .kind = .{ .type = .i8 }, .attrs = &.{.immarg} },3130 .{ .kind = .{ .type = .i8 }, .attrs = &.{.immarg} },
3054 },3131 },
3055 .attrs = &.{ .cold, .noreturn, .nounwind },3132 .attrs = &.{ .cold, .noreturn, .nounwind },
3056 },3133 },
30573134
3058 .@"amdgcn.workitem.id.x" = .{3135 .@"amdgcn.workitem.id.x" = .{
3136 .ret_len = 1,
3059 .params = &.{3137 .params = &.{
3060 .{ .kind = .{ .type = .i32 } },3138 .{ .kind = .{ .type = .i32 } },
3061 },3139 },
3062 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3140 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3063 },3141 },
3064 .@"amdgcn.workitem.id.y" = .{3142 .@"amdgcn.workitem.id.y" = .{
3143 .ret_len = 1,
3065 .params = &.{3144 .params = &.{
3066 .{ .kind = .{ .type = .i32 } },3145 .{ .kind = .{ .type = .i32 } },
3067 },3146 },
3068 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3147 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3069 },3148 },
3070 .@"amdgcn.workitem.id.z" = .{3149 .@"amdgcn.workitem.id.z" = .{
3150 .ret_len = 1,
3071 .params = &.{3151 .params = &.{
3072 .{ .kind = .{ .type = .i32 } },3152 .{ .kind = .{ .type = .i32 } },
3073 },3153 },
3074 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3154 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3075 },3155 },
3076 .@"amdgcn.workgroup.id.x" = .{3156 .@"amdgcn.workgroup.id.x" = .{
3157 .ret_len = 1,
3077 .params = &.{3158 .params = &.{
3078 .{ .kind = .{ .type = .i32 } },3159 .{ .kind = .{ .type = .i32 } },
3079 },3160 },
3080 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3161 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3081 },3162 },
3082 .@"amdgcn.workgroup.id.y" = .{3163 .@"amdgcn.workgroup.id.y" = .{
3164 .ret_len = 1,
3083 .params = &.{3165 .params = &.{
3084 .{ .kind = .{ .type = .i32 } },3166 .{ .kind = .{ .type = .i32 } },
3085 },3167 },
3086 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3168 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3087 },3169 },
3088 .@"amdgcn.workgroup.id.z" = .{3170 .@"amdgcn.workgroup.id.z" = .{
3171 .ret_len = 1,
3089 .params = &.{3172 .params = &.{
3090 .{ .kind = .{ .type = .i32 } },3173 .{ .kind = .{ .type = .i32 } },
3091 },3174 },
3092 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3175 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3093 },3176 },
3094 .@"amdgcn.dispatch.ptr" = .{3177 .@"amdgcn.dispatch.ptr" = .{
3178 .ret_len = 1,
3095 .params = &.{3179 .params = &.{
3096 .{3180 .{
3097 .kind = .{ .type = Type.ptr_amdgpu_constant },3181 .kind = .{ .type = Type.ptr_amdgpu_constant },
...@@ -3102,6 +3186,7 @@ pub const Intrinsic = enum {...@@ -3102,6 +3186,7 @@ pub const Intrinsic = enum {
3102 },3186 },
31033187
3104 .@"wasm.memory.size" = .{3188 .@"wasm.memory.size" = .{
3189 .ret_len = 1,
3105 .params = &.{3190 .params = &.{
3106 .{ .kind = .overloaded },3191 .{ .kind = .overloaded },
3107 .{ .kind = .{ .type = .i32 } },3192 .{ .kind = .{ .type = .i32 } },
...@@ -3109,6 +3194,7 @@ pub const Intrinsic = enum {...@@ -3109,6 +3194,7 @@ pub const Intrinsic = enum {
3109 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },3194 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3110 },3195 },
3111 .@"wasm.memory.grow" = .{3196 .@"wasm.memory.grow" = .{
3197 .ret_len = 1,
3112 .params = &.{3198 .params = &.{
3113 .{ .kind = .overloaded },3199 .{ .kind = .overloaded },
3114 .{ .kind = .{ .type = .i32 } },3200 .{ .kind = .{ .type = .i32 } },
...@@ -7627,8 +7713,10 @@ pub fn getIntrinsic(...@@ -7627,8 +7713,10 @@ pub fn getIntrinsic(
7627 const signature = Intrinsic.signatures.get(id);7713 const signature = Intrinsic.signatures.get(id);
7628 const param_types = try allocator.alloc(Type, signature.params.len);7714 const param_types = try allocator.alloc(Type, signature.params.len);
7629 defer allocator.free(param_types);7715 defer allocator.free(param_types);
7630 const function_attributes =7716 const function_attributes = try allocator.alloc(
7631 try allocator.alloc(Attributes, FunctionAttributes.return_index + signature.params.len);7717 Attributes,
7718 FunctionAttributes.params_index + (signature.params.len - signature.ret_len),
7719 );
7632 defer allocator.free(function_attributes);7720 defer allocator.free(function_attributes);
76337721
7634 var attributes: struct {7722 var attributes: struct {
...@@ -7651,42 +7739,37 @@ pub fn getIntrinsic(...@@ -7651,42 +7739,37 @@ pub fn getIntrinsic(
76517739
7652 var overload_index: usize = 0;7740 var overload_index: usize = 0;
7653 function_attributes[FunctionAttributes.function_index] = try attributes.get(signature.attrs);7741 function_attributes[FunctionAttributes.function_index] = try attributes.get(signature.attrs);
7654 for (7742 for (0.., param_types, signature.params) |param_index, *param_type, signature_param| {
7655 param_types,
7656 function_attributes[FunctionAttributes.return_index..],
7657 signature.params,
7658 ) |*param_type, *param_attributes, signature_param| {
7659 switch (signature_param.kind) {7743 switch (signature_param.kind) {
7660 .type => |ty| param_type.* = ty,7744 .type => |ty| param_type.* = ty,
7745 .change_scalar => |info| {
7746 assert(info.index < param_index);
7747 param_type.* = try param_types[info.index].changeScalar(info.scalar, self);
7748 },
7661 .overloaded => {7749 .overloaded => {
7662 param_type.* = overload[overload_index];7750 param_type.* = overload[overload_index];
7663 overload_index += 1;7751 overload_index += 1;
7664 },7752 },
7665 .overloaded_tuple => |len| {7753 .matches => |index| {
7666 const fields = try allocator.alloc(Type, len);7754 assert(index < param_index);
7667 defer allocator.free(fields);7755 param_type.* = param_types[index];
7668 for (fields, overload[overload_index..][0..len]) |*field, ty| field.* = ty;
7669 param_type.* = try self.structType(.normal, fields);
7670 overload_index += len;
7671 },7756 },
7672 .matches, .matches_tuple, .matches_with_overflow => {},
7673 }7757 }
7674 param_attributes.* = try attributes.get(signature_param.attrs);7758 function_attributes[
7759 if (param_index < signature.ret_len)
7760 FunctionAttributes.return_index
7761 else
7762 FunctionAttributes.params_index + (param_index - signature.ret_len)
7763 ] = try attributes.get(signature_param.attrs);
7675 }7764 }
7676 assert(overload_index == overload.len);7765 assert(overload_index == overload.len);
7677 for (param_types, signature.params) |*param_type, signature_param| switch (signature_param.kind) {
7678 .type, .overloaded, .overloaded_tuple => {},
7679 .matches => |param_index| param_type.* = param_types[param_index],
7680 .matches_tuple => |tuple| param_type.* =
7681 param_types[tuple.param].structFields(self)[tuple.field],
7682 .matches_with_overflow => |param_index| {
7683 const ty = param_types[param_index];
7684 param_type.* = try self.structType(.normal, &.{ ty, try ty.changeScalar(.i1, self) });
7685 },
7686 };
76877766
7688 const function_index =7767 const function_index =
7689 try self.addFunction(try self.fnType(param_types[0], param_types[1..], .normal), name);7768 try self.addFunction(try self.fnType(switch (signature.ret_len) {
7769 0 => .void,
7770 1 => param_types[0],
7771 else => try self.structType(.normal, param_types[0..signature.ret_len]),
7772 }, param_types[signature.ret_len..], .normal), name);
7690 function_index.ptr(self).attributes = try self.fnAttrs(function_attributes);7773 function_index.ptr(self).attributes = try self.fnAttrs(function_attributes);
7691 return function_index;7774 return function_index;
7692}7775}