cranelift_codegen_meta/isa/
s390x.rs

1use crate::cdsl::isa::TargetIsa;
2use crate::cdsl::settings::SettingGroupBuilder;
3
4pub(crate) fn define() -> TargetIsa {
5    let mut settings = SettingGroupBuilder::new("s390x");
6
7    // The baseline architecture for cranelift is z14 (arch12),
8    // so we list only facilities of later processors here.
9
10    // z15 (arch13) facilities
11    let has_mie3 = settings.add_bool(
12        "has_mie3",
13        "Has Miscellaneous-Instruction-Extensions Facility 3 support.",
14        "",
15        false,
16    );
17    let has_vxrs_ext2 = settings.add_bool(
18        "has_vxrs_ext2",
19        "Has Vector-Enhancements Facility 2 support.",
20        "",
21        false,
22    );
23
24    // z16 (arch14) has no new facilities that can be exploited by cranelift
25
26    // z17 (arch15) facilities
27    let has_mie4 = settings.add_bool(
28        "has_mie4",
29        "Has Miscellaneous-Instruction-Extensions Facility 4 support.",
30        "",
31        false,
32    );
33    let has_vxrs_ext3 = settings.add_bool(
34        "has_vxrs_ext3",
35        "Has Vector-Enhancements Facility 3 support.",
36        "",
37        false,
38    );
39
40    // Architecture level presets
41    settings.add_preset(
42        "arch13",
43        "Thirteenth Edition of the z/Architecture.",
44        preset!(has_mie3 && has_vxrs_ext2),
45    );
46    settings.add_preset(
47        "arch14",
48        "Fourteenth Edition of the z/Architecture.",
49        preset!(has_mie3 && has_vxrs_ext2),
50    );
51    settings.add_preset(
52        "arch15",
53        "Fifteenth Edition of the z/Architecture.",
54        preset!(has_mie3 && has_mie4 && has_vxrs_ext2 && has_vxrs_ext3),
55    );
56
57    // Processor presets
58    settings.add_preset(
59        "z15",
60        "IBM z15 processor.",
61        preset!(has_mie3 && has_vxrs_ext2),
62    );
63    settings.add_preset(
64        "z16",
65        "IBM z16 processor.",
66        preset!(has_mie3 && has_vxrs_ext2),
67    );
68    settings.add_preset(
69        "z17",
70        "IBM z17 processor.",
71        preset!(has_mie3 && has_mie4 && has_vxrs_ext2 && has_vxrs_ext3),
72    );
73
74    TargetIsa::new("s390x", settings.build())
75}