authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-11-24 22:25:32-08:00
committergravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-11-25 01:11:15-08:00
log9e17e097e59adfc31d746634cfe576f6420ec070
tree8ec3613438b3b6f356abdc6839ae5ba69f04619c
parentbc3ed51b7f750e0471a97ec2f7724326885ba71a
signaturelock-open Commit is signed but in an unrecognized format.

make `crc32` a featdep of `sse4.2`

To my knowledge there isn't an implementation of `sse4.2` that doesn't have `crc32`. The Clang driver also sets `crc32` to be implicitly enabled when an explicit `-crc32` wasn't provided. This matches that behaviour. We need this behaviour to compile libraries like `rocksdb` which currently guard against `crc32` intrinsics by checking for `sse4.2`.

2 files changed, 5 insertions(+), 53 deletions(-)

lib/std/Target/x86.zig+1-53
......@@ -1162,6 +1162,7 @@ pub const all_features = blk: {
11621162 .llvm_name = "sse4.2",
11631163 .description = "Enable SSE 4.2 instructions",
11641164 .dependencies = featureSet(&[_]Feature{
1165 .crc32,
11651166 .sse4_1,
11661167 }),
11671168 };
......@@ -1328,7 +1329,6 @@ pub const cpu = struct {
13281329 .clflushopt,
13291330 .clwb,
13301331 .cmov,
1331 .crc32,
13321332 .cx16,
13331333 .f16c,
13341334 .false_deps_perm,
......@@ -1424,7 +1424,6 @@ pub const cpu = struct {
14241424 .clwb,
14251425 .cmov,
14261426 .cmpccxadd,
1427 .crc32,
14281427 .cx16,
14291428 .enqcmd,
14301429 .f16c,
......@@ -1500,7 +1499,6 @@ pub const cpu = struct {
15001499 .clwb,
15011500 .cmov,
15021501 .cmpccxadd,
1503 .crc32,
15041502 .cx16,
15051503 .enqcmd,
15061504 .f16c,
......@@ -1735,7 +1733,6 @@ pub const cpu = struct {
17351733 .aes,
17361734 .clflushopt,
17371735 .cmov,
1738 .crc32,
17391736 .cx16,
17401737 .false_deps_popcnt,
17411738 .fast_7bytenop,
......@@ -1799,7 +1796,6 @@ pub const cpu = struct {
17991796 .aes,
18001797 .branchfusion,
18011798 .cmov,
1802 .crc32,
18031799 .cx16,
18041800 .fast_11bytenop,
18051801 .fast_scalar_shift_masks,
......@@ -1830,7 +1826,6 @@ pub const cpu = struct {
18301826 .bmi,
18311827 .branchfusion,
18321828 .cmov,
1833 .crc32,
18341829 .cx16,
18351830 .f16c,
18361831 .fast_11bytenop,
......@@ -1866,7 +1861,6 @@ pub const cpu = struct {
18661861 .bmi,
18671862 .branchfusion,
18681863 .cmov,
1869 .crc32,
18701864 .cx16,
18711865 .f16c,
18721866 .fast_11bytenop,
......@@ -1905,7 +1899,6 @@ pub const cpu = struct {
19051899 .bmi2,
19061900 .branchfusion,
19071901 .cmov,
1908 .crc32,
19091902 .cx16,
19101903 .f16c,
19111904 .fast_11bytenop,
......@@ -1973,7 +1966,6 @@ pub const cpu = struct {
19731966 .bmi,
19741967 .bmi2,
19751968 .cmov,
1976 .crc32,
19771969 .cx16,
19781970 .ermsb,
19791971 .f16c,
......@@ -2043,7 +2035,6 @@ pub const cpu = struct {
20432035 .aes,
20442036 .bmi,
20452037 .cmov,
2046 .crc32,
20472038 .cx16,
20482039 .f16c,
20492040 .fast_15bytenop,
......@@ -2113,7 +2104,6 @@ pub const cpu = struct {
21132104 .bmi2,
21142105 .clflushopt,
21152106 .cmov,
2116 .crc32,
21172107 .cx16,
21182108 .ermsb,
21192109 .evex512,
......@@ -2172,7 +2162,6 @@ pub const cpu = struct {
21722162 .clflushopt,
21732163 .clwb,
21742164 .cmov,
2175 .crc32,
21762165 .cx16,
21772166 .ermsb,
21782167 .evex512,
......@@ -2233,7 +2222,6 @@ pub const cpu = struct {
22332222 .clwb,
22342223 .cmov,
22352224 .cmpccxadd,
2236 .crc32,
22372225 .cx16,
22382226 .enqcmd,
22392227 .f16c,
......@@ -2313,7 +2301,6 @@ pub const cpu = struct {
23132301 .clflushopt,
23142302 .clwb,
23152303 .cmov,
2316 .crc32,
23172304 .cx16,
23182305 .ermsb,
23192306 .evex512,
......@@ -2379,7 +2366,6 @@ pub const cpu = struct {
23792366 .features = featureSet(&[_]Feature{
23802367 .@"64bit",
23812368 .cmov,
2382 .crc32,
23832369 .cx16,
23842370 .fxsr,
23852371 .idivq_to_divl,
......@@ -2419,7 +2405,6 @@ pub const cpu = struct {
24192405 .clflushopt,
24202406 .clwb,
24212407 .cmov,
2422 .crc32,
24232408 .cx16,
24242409 .enqcmd,
24252410 .ermsb,
......@@ -2514,7 +2499,6 @@ pub const cpu = struct {
25142499 .aes,
25152500 .clflushopt,
25162501 .cmov,
2517 .crc32,
25182502 .cx16,
25192503 .false_deps_popcnt,
25202504 .fast_imm16,
......@@ -2552,7 +2536,6 @@ pub const cpu = struct {
25522536 .aes,
25532537 .clflushopt,
25542538 .cmov,
2555 .crc32,
25562539 .cx16,
25572540 .fast_imm16,
25582541 .fast_movbe,
......@@ -2596,7 +2579,6 @@ pub const cpu = struct {
25962579 .clflushopt,
25972580 .clwb,
25982581 .cmov,
2599 .crc32,
26002582 .cx16,
26012583 .f16c,
26022584 .false_deps_popcnt,
......@@ -2658,7 +2640,6 @@ pub const cpu = struct {
26582640 .clwb,
26592641 .cmov,
26602642 .cmpccxadd,
2661 .crc32,
26622643 .cx16,
26632644 .enqcmd,
26642645 .f16c,
......@@ -2732,7 +2713,6 @@ pub const cpu = struct {
27322713 .clflushopt,
27332714 .clwb,
27342715 .cmov,
2735 .crc32,
27362716 .cx16,
27372717 .enqcmd,
27382718 .ermsb,
......@@ -2821,7 +2801,6 @@ pub const cpu = struct {
28212801 .clflushopt,
28222802 .clwb,
28232803 .cmov,
2824 .crc32,
28252804 .cx16,
28262805 .enqcmd,
28272806 .ermsb,
......@@ -2892,7 +2871,6 @@ pub const cpu = struct {
28922871 .bmi,
28932872 .bmi2,
28942873 .cmov,
2895 .crc32,
28962874 .cx16,
28972875 .ermsb,
28982876 .f16c,
......@@ -2984,7 +2962,6 @@ pub const cpu = struct {
29842962 .bmi2,
29852963 .clflushopt,
29862964 .cmov,
2987 .crc32,
29882965 .cx16,
29892966 .ermsb,
29902967 .evex512,
......@@ -3049,7 +3026,6 @@ pub const cpu = struct {
30493026 .clflushopt,
30503027 .clwb,
30513028 .cmov,
3052 .crc32,
30533029 .cx16,
30543030 .ermsb,
30553031 .evex512,
......@@ -3101,7 +3077,6 @@ pub const cpu = struct {
31013077 .features = featureSet(&[_]Feature{
31023078 .@"64bit",
31033079 .cmov,
3104 .crc32,
31053080 .cx16,
31063081 .f16c,
31073082 .false_deps_popcnt,
......@@ -3214,7 +3189,6 @@ pub const cpu = struct {
32143189 .bmi,
32153190 .bmi2,
32163191 .cmov,
3217 .crc32,
32183192 .cx16,
32193193 .evex512,
32203194 .fast_gather,
......@@ -3257,7 +3231,6 @@ pub const cpu = struct {
32573231 .bmi,
32583232 .bmi2,
32593233 .cmov,
3260 .crc32,
32613234 .cx16,
32623235 .evex512,
32633236 .fast_gather,
......@@ -3315,7 +3288,6 @@ pub const cpu = struct {
33153288 .clwb,
33163289 .cmov,
33173290 .cmpccxadd,
3318 .crc32,
33193291 .cx16,
33203292 .enqcmd,
33213293 .f16c,
......@@ -3389,7 +3361,6 @@ pub const cpu = struct {
33893361 .clflushopt,
33903362 .clwb,
33913363 .cmov,
3392 .crc32,
33933364 .cx16,
33943365 .f16c,
33953366 .false_deps_perm,
......@@ -3450,7 +3421,6 @@ pub const cpu = struct {
34503421 .features = featureSet(&[_]Feature{
34513422 .@"64bit",
34523423 .cmov,
3453 .crc32,
34543424 .cx16,
34553425 .fxsr,
34563426 .idivq_to_divl,
......@@ -3540,7 +3510,6 @@ pub const cpu = struct {
35403510 .clwb,
35413511 .cmov,
35423512 .cmpccxadd,
3543 .crc32,
35443513 .cx16,
35453514 .enqcmd,
35463515 .f16c,
......@@ -3755,7 +3724,6 @@ pub const cpu = struct {
37553724 .clflushopt,
37563725 .clwb,
37573726 .cmov,
3758 .crc32,
37593727 .cx16,
37603728 .f16c,
37613729 .false_deps_perm,
......@@ -3830,7 +3798,6 @@ pub const cpu = struct {
38303798 .bmi2,
38313799 .clflushopt,
38323800 .cmov,
3833 .crc32,
38343801 .cx16,
38353802 .ermsb,
38363803 .evex512,
......@@ -3881,7 +3848,6 @@ pub const cpu = struct {
38813848 .@"64bit",
38823849 .avx,
38833850 .cmov,
3884 .crc32,
38853851 .cx16,
38863852 .false_deps_popcnt,
38873853 .fast_15bytenop,
......@@ -3928,7 +3894,6 @@ pub const cpu = struct {
39283894 .clflushopt,
39293895 .clwb,
39303896 .cmov,
3931 .crc32,
39323897 .cx16,
39333898 .enqcmd,
39343899 .ermsb,
......@@ -4005,7 +3970,6 @@ pub const cpu = struct {
40053970 .clwb,
40063971 .cmov,
40073972 .cmpccxadd,
4008 .crc32,
40093973 .cx16,
40103974 .enqcmd,
40113975 .f16c,
......@@ -4058,7 +4022,6 @@ pub const cpu = struct {
40584022 .features = featureSet(&[_]Feature{
40594023 .@"64bit",
40604024 .cmov,
4061 .crc32,
40624025 .cx16,
40634026 .false_deps_popcnt,
40644027 .fast_7bytenop,
......@@ -4102,7 +4065,6 @@ pub const cpu = struct {
41024065 .clflushopt,
41034066 .clwb,
41044067 .cmov,
4105 .crc32,
41064068 .cx16,
41074069 .ermsb,
41084070 .evex512,
......@@ -4157,7 +4119,6 @@ pub const cpu = struct {
41574119 .bmi2,
41584120 .clflushopt,
41594121 .cmov,
4160 .crc32,
41614122 .cx16,
41624123 .ermsb,
41634124 .f16c,
......@@ -4213,7 +4174,6 @@ pub const cpu = struct {
42134174 .clflushopt,
42144175 .clwb,
42154176 .cmov,
4216 .crc32,
42174177 .cx16,
42184178 .ermsb,
42194179 .evex512,
......@@ -4261,7 +4221,6 @@ pub const cpu = struct {
42614221 .features = featureSet(&[_]Feature{
42624222 .@"64bit",
42634223 .cmov,
4264 .crc32,
42654224 .cx16,
42664225 .false_deps_popcnt,
42674226 .fast_7bytenop,
......@@ -4310,7 +4269,6 @@ pub const cpu = struct {
43104269 .clflushopt,
43114270 .clwb,
43124271 .cmov,
4313 .crc32,
43144272 .cx16,
43154273 .ermsb,
43164274 .evex512,
......@@ -4366,7 +4324,6 @@ pub const cpu = struct {
43664324 .clflushopt,
43674325 .clwb,
43684326 .cmov,
4369 .crc32,
43704327 .cx16,
43714328 .fast_imm16,
43724329 .fast_movbe,
......@@ -4404,7 +4361,6 @@ pub const cpu = struct {
44044361 .features = featureSet(&[_]Feature{
44054362 .@"64bit",
44064363 .cmov,
4407 .crc32,
44084364 .cx16,
44094365 .fxsr,
44104366 .idivq_to_divl,
......@@ -4466,7 +4422,6 @@ pub const cpu = struct {
44664422 .features = featureSet(&[_]Feature{
44674423 .@"64bit",
44684424 .cmov,
4469 .crc32,
44704425 .cx16,
44714426 .false_deps_popcnt,
44724427 .fast_15bytenop,
......@@ -4496,7 +4451,6 @@ pub const cpu = struct {
44964451 .bmi,
44974452 .bmi2,
44984453 .cmov,
4499 .crc32,
45004454 .cx16,
45014455 .f16c,
45024456 .false_deps_lzcnt_tzcnt,
......@@ -4535,7 +4489,6 @@ pub const cpu = struct {
45354489 .bmi,
45364490 .bmi2,
45374491 .cmov,
4538 .crc32,
45394492 .cx16,
45404493 .evex512,
45414494 .false_deps_popcnt,
......@@ -4592,7 +4545,6 @@ pub const cpu = struct {
45924545 .clflushopt,
45934546 .clzero,
45944547 .cmov,
4595 .crc32,
45964548 .cx16,
45974549 .f16c,
45984550 .fast_15bytenop,
......@@ -4646,7 +4598,6 @@ pub const cpu = struct {
46464598 .clwb,
46474599 .clzero,
46484600 .cmov,
4649 .crc32,
46504601 .cx16,
46514602 .f16c,
46524603 .fast_15bytenop,
......@@ -4701,7 +4652,6 @@ pub const cpu = struct {
47014652 .clwb,
47024653 .clzero,
47034654 .cmov,
4704 .crc32,
47054655 .cx16,
47064656 .f16c,
47074657 .fast_15bytenop,
......@@ -4771,7 +4721,6 @@ pub const cpu = struct {
47714721 .clwb,
47724722 .clzero,
47734723 .cmov,
4774 .crc32,
47754724 .cx16,
47764725 .evex512,
47774726 .fast_15bytenop,
......@@ -4845,7 +4794,6 @@ pub const cpu = struct {
48454794 .clwb,
48464795 .clzero,
48474796 .cmov,
4848 .crc32,
48494797 .cx16,
48504798 .evex512,
48514799 .fast_15bytenop,
tools/update_cpu_features.zig+4
......@@ -1139,6 +1139,10 @@ const llvm_targets = [_]LlvmTarget{
11391139 .llvm_name = "winchip2",
11401140 .extra_deps = &.{"3dnow"},
11411141 },
1142 .{
1143 .llvm_name = "sse4.2",
1144 .extra_deps = &.{"crc32"},
1145 },
11421146 },
11431147 // Features removed from LLVM
11441148 .extra_features = &.{