gcc_unreachable ();
}
+/* This returns the target-specific builtin with code CODE if
+ current_function_decl has visibility on this builtin, which is checked
+ using isa flags. Returns NULL_TREE otherwise. */
+
+static tree ix86_get_builtin (enum ix86_builtins code)
+{
+ struct cl_target_option *opts;
+ tree target_tree = NULL_TREE;
+
+ /* Determine the isa flags of current_function_decl. */
+
+ if (current_function_decl)
+ target_tree = DECL_FUNCTION_SPECIFIC_TARGET (current_function_decl);
+
+ if (target_tree == NULL)
+ target_tree = target_option_default_node;
+
+ opts = TREE_TARGET_OPTION (target_tree);
+
+ if (ix86_builtins_isa[(int) code].isa & opts->x_ix86_isa_flags)
+ return ix86_builtin_decl (code, true);
+ else
+ return NULL_TREE;
+}
+
/* Returns a function decl for a vectorized version of the builtin function
with builtin function code FN and the result vector type TYPE, or NULL_TREE
if it is not available. */
if (out_mode == DFmode && in_mode == DFmode)
{
if (out_n == 2 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_SQRTPD];
+ return ix86_get_builtin (IX86_BUILTIN_SQRTPD);
else if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_SQRTPD256];
+ return ix86_get_builtin (IX86_BUILTIN_SQRTPD256);
}
break;
if (out_mode == SFmode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_SQRTPS_NR];
+ return ix86_get_builtin (IX86_BUILTIN_SQRTPS_NR);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_SQRTPS_NR256];
+ return ix86_get_builtin (IX86_BUILTIN_SQRTPS_NR256);
}
break;
if (out_mode == SImode && in_mode == DFmode)
{
if (out_n == 4 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_FLOORPD_VEC_PACK_SFIX];
+ return ix86_get_builtin (IX86_BUILTIN_FLOORPD_VEC_PACK_SFIX);
else if (out_n == 8 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_FLOORPD_VEC_PACK_SFIX256];
+ return ix86_get_builtin (IX86_BUILTIN_FLOORPD_VEC_PACK_SFIX256);
}
break;
if (out_mode == SImode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_FLOORPS_SFIX];
+ return ix86_get_builtin (IX86_BUILTIN_FLOORPS_SFIX);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_FLOORPS_SFIX256];
+ return ix86_get_builtin (IX86_BUILTIN_FLOORPS_SFIX256);
}
break;
if (out_mode == SImode && in_mode == DFmode)
{
if (out_n == 4 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_CEILPD_VEC_PACK_SFIX];
+ return ix86_get_builtin (IX86_BUILTIN_CEILPD_VEC_PACK_SFIX);
else if (out_n == 8 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_CEILPD_VEC_PACK_SFIX256];
+ return ix86_get_builtin (IX86_BUILTIN_CEILPD_VEC_PACK_SFIX256);
}
break;
if (out_mode == SImode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_CEILPS_SFIX];
+ return ix86_get_builtin (IX86_BUILTIN_CEILPS_SFIX);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_CEILPS_SFIX256];
+ return ix86_get_builtin (IX86_BUILTIN_CEILPS_SFIX256);
}
break;
if (out_mode == SImode && in_mode == DFmode)
{
if (out_n == 4 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_VEC_PACK_SFIX];
+ return ix86_get_builtin (IX86_BUILTIN_VEC_PACK_SFIX);
else if (out_n == 8 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_VEC_PACK_SFIX256];
+ return ix86_get_builtin (IX86_BUILTIN_VEC_PACK_SFIX256);
}
break;
if (out_mode == SImode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_CVTPS2DQ];
+ return ix86_get_builtin (IX86_BUILTIN_CVTPS2DQ);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_CVTPS2DQ256];
+ return ix86_get_builtin (IX86_BUILTIN_CVTPS2DQ256);
}
break;
if (out_mode == SImode && in_mode == DFmode)
{
if (out_n == 4 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_ROUNDPD_AZ_VEC_PACK_SFIX];
+ return ix86_get_builtin (IX86_BUILTIN_ROUNDPD_AZ_VEC_PACK_SFIX);
else if (out_n == 8 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_ROUNDPD_AZ_VEC_PACK_SFIX256];
+ return ix86_get_builtin (IX86_BUILTIN_ROUNDPD_AZ_VEC_PACK_SFIX256);
}
break;
if (out_mode == SImode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_ROUNDPS_AZ_SFIX];
+ return ix86_get_builtin (IX86_BUILTIN_ROUNDPS_AZ_SFIX);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_ROUNDPS_AZ_SFIX256];
+ return ix86_get_builtin (IX86_BUILTIN_ROUNDPS_AZ_SFIX256);
}
break;
if (out_mode == DFmode && in_mode == DFmode)
{
if (out_n == 2 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_CPYSGNPD];
+ return ix86_get_builtin (IX86_BUILTIN_CPYSGNPD);
else if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_CPYSGNPD256];
+ return ix86_get_builtin (IX86_BUILTIN_CPYSGNPD256);
}
break;
if (out_mode == SFmode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_CPYSGNPS];
+ return ix86_get_builtin (IX86_BUILTIN_CPYSGNPS);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_CPYSGNPS256];
+ return ix86_get_builtin (IX86_BUILTIN_CPYSGNPS256);
}
break;
if (out_mode == DFmode && in_mode == DFmode)
{
if (out_n == 2 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_FLOORPD];
+ return ix86_get_builtin (IX86_BUILTIN_FLOORPD);
else if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_FLOORPD256];
+ return ix86_get_builtin (IX86_BUILTIN_FLOORPD256);
}
break;
if (out_mode == SFmode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_FLOORPS];
+ return ix86_get_builtin (IX86_BUILTIN_FLOORPS);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_FLOORPS256];
+ return ix86_get_builtin (IX86_BUILTIN_FLOORPS256);
}
break;
if (out_mode == DFmode && in_mode == DFmode)
{
if (out_n == 2 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_CEILPD];
+ return ix86_get_builtin (IX86_BUILTIN_CEILPD);
else if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_CEILPD256];
+ return ix86_get_builtin (IX86_BUILTIN_CEILPD256);
}
break;
if (out_mode == SFmode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_CEILPS];
+ return ix86_get_builtin (IX86_BUILTIN_CEILPS);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_CEILPS256];
+ return ix86_get_builtin (IX86_BUILTIN_CEILPS256);
}
break;
if (out_mode == DFmode && in_mode == DFmode)
{
if (out_n == 2 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_TRUNCPD];
+ return ix86_get_builtin (IX86_BUILTIN_TRUNCPD);
else if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_TRUNCPD256];
+ return ix86_get_builtin (IX86_BUILTIN_TRUNCPD256);
}
break;
if (out_mode == SFmode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_TRUNCPS];
+ return ix86_get_builtin (IX86_BUILTIN_TRUNCPS);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_TRUNCPS256];
+ return ix86_get_builtin (IX86_BUILTIN_TRUNCPS256);
}
break;
if (out_mode == DFmode && in_mode == DFmode)
{
if (out_n == 2 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_RINTPD];
+ return ix86_get_builtin (IX86_BUILTIN_RINTPD);
else if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_RINTPD256];
+ return ix86_get_builtin (IX86_BUILTIN_RINTPD256);
}
break;
if (out_mode == SFmode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_RINTPS];
+ return ix86_get_builtin (IX86_BUILTIN_RINTPS);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_RINTPS256];
+ return ix86_get_builtin (IX86_BUILTIN_RINTPS256);
}
break;
if (out_mode == DFmode && in_mode == DFmode)
{
if (out_n == 2 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_ROUNDPD_AZ];
+ return ix86_get_builtin (IX86_BUILTIN_ROUNDPD_AZ);
else if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_ROUNDPD_AZ256];
+ return ix86_get_builtin (IX86_BUILTIN_ROUNDPD_AZ256);
}
break;
if (out_mode == SFmode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_ROUNDPS_AZ];
+ return ix86_get_builtin (IX86_BUILTIN_ROUNDPS_AZ);
else if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_ROUNDPS_AZ256];
+ return ix86_get_builtin (IX86_BUILTIN_ROUNDPS_AZ256);
}
break;
if (out_mode == DFmode && in_mode == DFmode)
{
if (out_n == 2 && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_VFMADDPD];
+ return ix86_get_builtin (IX86_BUILTIN_VFMADDPD);
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_VFMADDPD256];
+ return ix86_get_builtin (IX86_BUILTIN_VFMADDPD256);
}
break;
if (out_mode == SFmode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
- return ix86_builtins[IX86_BUILTIN_VFMADDPS];
+ return ix86_get_builtin (IX86_BUILTIN_VFMADDPS);
if (out_n == 8 && in_n == 8)
- return ix86_builtins[IX86_BUILTIN_VFMADDPS256];
+ return ix86_get_builtin (IX86_BUILTIN_VFMADDPS256);
}
break;
return NULL_TREE;
}
- return ix86_builtins[code];
+ return ix86_get_builtin (code);
}
/* Returns a code for a target-specific builtin that implements
{
/* Vectorized version of sqrt to rsqrt conversion. */
case IX86_BUILTIN_SQRTPS_NR:
- return ix86_builtins[IX86_BUILTIN_RSQRTPS_NR];
+ return ix86_get_builtin (IX86_BUILTIN_RSQRTPS_NR);
case IX86_BUILTIN_SQRTPS_NR256:
- return ix86_builtins[IX86_BUILTIN_RSQRTPS_NR256];
+ return ix86_get_builtin (IX86_BUILTIN_RSQRTPS_NR256);
default:
return NULL_TREE;
{
/* Sqrt to rsqrt conversion. */
case BUILT_IN_SQRTF:
- return ix86_builtins[IX86_BUILTIN_RSQRTF];
+ return ix86_get_builtin (IX86_BUILTIN_RSQRTF);
default:
return NULL_TREE;