aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-12-13 15:34:30 +0100
committerMartin Liska <mliska@suse.cz>2021-12-15 10:30:45 +0100
commit127c7178d5ec502d95862fd823537cbca1a0cb99 (patch)
tree48360fca4e5e5a5425a756acfec547374c86ff3a /gcc
parentc0e34451ae582c901a2df08498b36f68ae401f0a (diff)
downloadgcc-127c7178d5ec502d95862fd823537cbca1a0cb99.zip
gcc-127c7178d5ec502d95862fd823537cbca1a0cb99.tar.gz
gcc-127c7178d5ec502d95862fd823537cbca1a0cb99.tar.bz2
i386: Fix emissing of __builtin_cpu_supports.
PR target/103661 gcc/ChangeLog: * config/i386/i386-builtins.c (fold_builtin_cpu): Compare to 0 as API expects that non-zero values are returned (do that it mask == 31). For "avx512vbmi2" argument, we return now 1 << 31, which is a negative integer value.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/i386/i386-builtins.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/config/i386/i386-builtins.c b/gcc/config/i386/i386-builtins.c
index 0fb14b5..4b30cf7 100644
--- a/gcc/config/i386/i386-builtins.c
+++ b/gcc/config/i386/i386-builtins.c
@@ -2353,7 +2353,11 @@ fold_builtin_cpu (tree fndecl, tree *args)
/* Return __cpu_model.__cpu_features[0] & field_val */
final = build2 (BIT_AND_EXPR, unsigned_type_node, array_elt,
build_int_cstu (unsigned_type_node, field_val));
- return build1 (CONVERT_EXPR, integer_type_node, final);
+ if (isa_names_table[i].feature == (INT_TYPE_SIZE - 1))
+ return build2 (NE_EXPR, integer_type_node, final,
+ build_int_cst (unsigned_type_node, 0));
+ else
+ return build1 (CONVERT_EXPR, integer_type_node, final);
}
gcc_unreachable ();
}