rs6000: Simplify some code with rs6000_builtin_is_supported
In function rs6000_init_builtins, there is a oversight that in one target debugging hunk with TARGET_DEBUG_BUILTIN we missed to handle enum bif_enable ENB_CELL. It's easy to fix it by adding another if case. But considering the long term maintainability, this patch updates it with the existing function rs6000_builtin_is_supported, which centralizes the related conditions for different enum bif_enable, we only need to update that function once some condition needs to be changed later. This also simplifies another usage in function rs6000_expand_builtin. gcc/ChangeLog: * config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Fix the oversight on ENB_CELL by simplifying with rs6000_builtin_is_supported. (rs6000_expand_builtin): Simplify with rs6000_builtin_is_supported.
This commit is contained in:
parent
7a0e252080
commit
b22086c261
|
@ -830,44 +830,8 @@ rs6000_init_builtins (void)
|
|||
fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
|
||||
for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
|
||||
{
|
||||
bif_enable e = rs6000_builtin_info[i].enable;
|
||||
if (e == ENB_P5 && !TARGET_POPCNTB)
|
||||
continue;
|
||||
if (e == ENB_P6 && !TARGET_CMPB)
|
||||
continue;
|
||||
if (e == ENB_P6_64 && !(TARGET_CMPB && TARGET_POWERPC64))
|
||||
continue;
|
||||
if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
|
||||
continue;
|
||||
if (e == ENB_VSX && !TARGET_VSX)
|
||||
continue;
|
||||
if (e == ENB_P7 && !TARGET_POPCNTD)
|
||||
continue;
|
||||
if (e == ENB_P7_64 && !(TARGET_POPCNTD && TARGET_POWERPC64))
|
||||
continue;
|
||||
if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
|
||||
continue;
|
||||
if (e == ENB_P8V && !TARGET_P8_VECTOR)
|
||||
continue;
|
||||
if (e == ENB_P9 && !TARGET_MODULO)
|
||||
continue;
|
||||
if (e == ENB_P9_64 && !(TARGET_MODULO && TARGET_POWERPC64))
|
||||
continue;
|
||||
if (e == ENB_P9V && !TARGET_P9_VECTOR)
|
||||
continue;
|
||||
if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
|
||||
continue;
|
||||
if (e == ENB_DFP && !TARGET_DFP)
|
||||
continue;
|
||||
if (e == ENB_CRYPTO && !TARGET_CRYPTO)
|
||||
continue;
|
||||
if (e == ENB_HTM && !TARGET_HTM)
|
||||
continue;
|
||||
if (e == ENB_P10 && !TARGET_POWER10)
|
||||
continue;
|
||||
if (e == ENB_P10_64 && !(TARGET_POWER10 && TARGET_POWERPC64))
|
||||
continue;
|
||||
if (e == ENB_MMA && !TARGET_MMA)
|
||||
enum rs6000_gen_builtins fn_code = (enum rs6000_gen_builtins) i;
|
||||
if (!rs6000_builtin_is_supported (fn_code))
|
||||
continue;
|
||||
tree fntype = rs6000_builtin_info[i].fntype;
|
||||
tree t = TREE_TYPE (fntype);
|
||||
|
@ -3370,29 +3334,8 @@ rs6000_expand_builtin (tree exp, rtx target, rtx /* subtarget */,
|
|||
but check for actual availability now, during expand time. For
|
||||
invalid builtins, generate a normal call. */
|
||||
bifdata *bifaddr = &rs6000_builtin_info[uns_fcode];
|
||||
bif_enable e = bifaddr->enable;
|
||||
|
||||
if (!(e == ENB_ALWAYS
|
||||
|| (e == ENB_P5 && TARGET_POPCNTB)
|
||||
|| (e == ENB_P6 && TARGET_CMPB)
|
||||
|| (e == ENB_P6_64 && TARGET_CMPB && TARGET_POWERPC64)
|
||||
|| (e == ENB_ALTIVEC && TARGET_ALTIVEC)
|
||||
|| (e == ENB_CELL && TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL)
|
||||
|| (e == ENB_VSX && TARGET_VSX)
|
||||
|| (e == ENB_P7 && TARGET_POPCNTD)
|
||||
|| (e == ENB_P7_64 && TARGET_POPCNTD && TARGET_POWERPC64)
|
||||
|| (e == ENB_P8 && TARGET_DIRECT_MOVE)
|
||||
|| (e == ENB_P8V && TARGET_P8_VECTOR)
|
||||
|| (e == ENB_P9 && TARGET_MODULO)
|
||||
|| (e == ENB_P9_64 && TARGET_MODULO && TARGET_POWERPC64)
|
||||
|| (e == ENB_P9V && TARGET_P9_VECTOR)
|
||||
|| (e == ENB_IEEE128_HW && TARGET_FLOAT128_HW)
|
||||
|| (e == ENB_DFP && TARGET_DFP)
|
||||
|| (e == ENB_CRYPTO && TARGET_CRYPTO)
|
||||
|| (e == ENB_HTM && TARGET_HTM)
|
||||
|| (e == ENB_P10 && TARGET_POWER10)
|
||||
|| (e == ENB_P10_64 && TARGET_POWER10 && TARGET_POWERPC64)
|
||||
|| (e == ENB_MMA && TARGET_MMA)))
|
||||
if (!rs6000_builtin_is_supported (fcode))
|
||||
{
|
||||
rs6000_invalid_builtin (fcode);
|
||||
return expand_call (exp, target, ignore);
|
||||
|
|
Loading…
Reference in New Issue