diff options
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/cygwin.h | 1 | ||||
-rw-r--r-- | gcc/config/i386/i386-builtin-types.def | 2 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 71 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 30 |
4 files changed, 65 insertions, 39 deletions
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 182e4d62658..1d95cd70ad8 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -39,7 +39,6 @@ along with GCC; see the file COPYING3. If not see #undef STARTFILE_SPEC #define STARTFILE_SPEC "\ - -L%R/usr/lib/w32api \ %{!shared: %{!mdll: crt0%O%s \ %{pg:gcrt0%O%s}}}\ %{shared:crtbeginS.o%s;:crtbegin.o%s} \ diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def index c66f65108f8..7eb6fc96e66 100644 --- a/gcc/config/i386/i386-builtin-types.def +++ b/gcc/config/i386/i386-builtin-types.def @@ -73,6 +73,7 @@ DEF_PRIMITIVE_TYPE (FLOAT, float_type_node) DEF_PRIMITIVE_TYPE (DOUBLE, double_type_node) DEF_PRIMITIVE_TYPE (FLOAT80, float80_type_node) DEF_PRIMITIVE_TYPE (FLOAT128, float128_type_node) +DEF_PRIMITIVE_TYPE (CONST_STRING, const_string_type_node) # MMX vectors DEF_VECTOR_TYPE (V2SF, FLOAT) @@ -191,6 +192,7 @@ DEF_FUNCTION_TYPE (PVOID) DEF_FUNCTION_TYPE (FLOAT, FLOAT) DEF_FUNCTION_TYPE (FLOAT128, FLOAT128) +DEF_FUNCTION_TYPE (FLOAT128, CONST_STRING) DEF_FUNCTION_TYPE (INT, INT) DEF_FUNCTION_TYPE (INT, V16QI) DEF_FUNCTION_TYPE (INT, V2DF) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b807a9a0004..c5e5e1238a5 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -32718,6 +32718,8 @@ enum ix86_builtins /* TFmode support builtins. */ IX86_BUILTIN_INFQ, IX86_BUILTIN_HUGE_VALQ, + IX86_BUILTIN_NANQ, + IX86_BUILTIN_NANSQ, IX86_BUILTIN_FABSQ, IX86_BUILTIN_COPYSIGNQ, @@ -38105,11 +38107,28 @@ ix86_fold_builtin (tree fndecl, int n_args, { enum ix86_builtins fn_code = (enum ix86_builtins) DECL_FUNCTION_CODE (fndecl); - if (fn_code == IX86_BUILTIN_CPU_IS - || fn_code == IX86_BUILTIN_CPU_SUPPORTS) + switch (fn_code) { + case IX86_BUILTIN_CPU_IS: + case IX86_BUILTIN_CPU_SUPPORTS: gcc_assert (n_args == 1); - return fold_builtin_cpu (fndecl, args); + return fold_builtin_cpu (fndecl, args); + + case IX86_BUILTIN_NANQ: + case IX86_BUILTIN_NANSQ: + { + tree type = TREE_TYPE (TREE_TYPE (fndecl)); + const char *str = c_getstr (*args); + int quiet = fn_code == IX86_BUILTIN_NANQ; + REAL_VALUE_TYPE real; + + if (str && real_nan (&real, str, quiet, TYPE_MODE (type))) + return build_real (type, real); + return NULL_TREE; + } + + default: + break; } } @@ -38210,7 +38229,7 @@ ix86_init_builtins_va_builtins_abi (void) static void ix86_init_builtin_types (void) { - tree float128_type_node, float80_type_node; + tree float128_type_node, float80_type_node, const_string_type_node; /* The __float80 type. */ float80_type_node = long_double_type_node; @@ -38230,6 +38249,10 @@ ix86_init_builtin_types (void) layout_type (float128_type_node); lang_hooks.types.register_builtin_type (float128_type_node, "__float128"); + const_string_type_node + = build_pointer_type (build_qualified_type + (char_type_node, TYPE_QUAL_CONST)); + /* This macro is built by i386-builtin-types.awk. */ DEFINE_BUILTIN_PRIMITIVE_TYPES; } @@ -38237,7 +38260,7 @@ ix86_init_builtin_types (void) static void ix86_init_builtins (void) { - tree t; + tree ftype, decl; ix86_init_builtin_types (); @@ -38250,19 +38273,31 @@ ix86_init_builtins (void) def_builtin_const (0, "__builtin_huge_valq", FLOAT128_FTYPE_VOID, IX86_BUILTIN_HUGE_VALQ); + ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_CONST_STRING); + decl = add_builtin_function ("__builtin_nanq", ftype, IX86_BUILTIN_NANQ, + BUILT_IN_MD, "nanq", NULL_TREE); + TREE_READONLY (decl) = 1; + ix86_builtins[(int) IX86_BUILTIN_NANQ] = decl; + + decl = add_builtin_function ("__builtin_nansq", ftype, IX86_BUILTIN_NANSQ, + BUILT_IN_MD, "nansq", NULL_TREE); + TREE_READONLY (decl) = 1; + ix86_builtins[(int) IX86_BUILTIN_NANSQ] = decl; + /* We will expand them to normal call if SSE isn't available since they are used by libgcc. */ - t = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128); - t = add_builtin_function ("__builtin_fabsq", t, IX86_BUILTIN_FABSQ, - BUILT_IN_MD, "__fabstf2", NULL_TREE); - TREE_READONLY (t) = 1; - ix86_builtins[(int) IX86_BUILTIN_FABSQ] = t; - - t = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128_FLOAT128); - t = add_builtin_function ("__builtin_copysignq", t, IX86_BUILTIN_COPYSIGNQ, - BUILT_IN_MD, "__copysigntf3", NULL_TREE); - TREE_READONLY (t) = 1; - ix86_builtins[(int) IX86_BUILTIN_COPYSIGNQ] = t; + ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128); + decl = add_builtin_function ("__builtin_fabsq", ftype, IX86_BUILTIN_FABSQ, + BUILT_IN_MD, "__fabstf2", NULL_TREE); + TREE_READONLY (decl) = 1; + ix86_builtins[(int) IX86_BUILTIN_FABSQ] = decl; + + ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128_FLOAT128); + decl = add_builtin_function ("__builtin_copysignq", ftype, + IX86_BUILTIN_COPYSIGNQ, BUILT_IN_MD, + "__copysigntf3", NULL_TREE); + TREE_READONLY (decl) = 1; + ix86_builtins[(int) IX86_BUILTIN_COPYSIGNQ] = decl; ix86_init_tm_builtins (); ix86_init_mmx_sse_builtins (); @@ -41463,6 +41498,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, return target; } + case IX86_BUILTIN_NANQ: + case IX86_BUILTIN_NANSQ: + return expand_call (exp, target, ignore); + case IX86_BUILTIN_RDPMC: case IX86_BUILTIN_RDTSC: case IX86_BUILTIN_RDTSCP: diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 416cdcd9129..86837525628 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -13458,15 +13458,12 @@ "! TARGET_POPCNT" { rtx scratch = gen_reg_rtx (QImode); - rtx cond; emit_insn (gen_paritydi2_cmp (NULL_RTX, NULL_RTX, NULL_RTX, operands[1])); - cond = gen_rtx_fmt_ee (ORDERED, QImode, - gen_rtx_REG (CCmode, FLAGS_REG), - const0_rtx); - emit_insn (gen_rtx_SET (scratch, cond)); + ix86_expand_setcc (scratch, ORDERED, + gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); if (TARGET_64BIT) emit_insn (gen_zero_extendqidi2 (operands[0], scratch)); @@ -13486,14 +13483,11 @@ "! TARGET_POPCNT" { rtx scratch = gen_reg_rtx (QImode); - rtx cond; emit_insn (gen_paritysi2_cmp (NULL_RTX, NULL_RTX, operands[1])); - cond = gen_rtx_fmt_ee (ORDERED, QImode, - gen_rtx_REG (CCmode, FLAGS_REG), - const0_rtx); - emit_insn (gen_rtx_SET (scratch, cond)); + ix86_expand_setcc (scratch, ORDERED, + gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); emit_insn (gen_zero_extendqisi2 (operands[0], scratch)); DONE; @@ -16159,8 +16153,6 @@ rtx mask = GEN_INT (0x45); rtx val = GEN_INT (0x05); - rtx cond; - rtx scratch = gen_reg_rtx (HImode); rtx res = gen_reg_rtx (QImode); @@ -16168,10 +16160,8 @@ emit_insn (gen_andqi_ext_0 (scratch, scratch, mask)); emit_insn (gen_cmpqi_ext_3 (scratch, val)); - cond = gen_rtx_fmt_ee (EQ, QImode, - gen_rtx_REG (CCmode, FLAGS_REG), - const0_rtx); - emit_insn (gen_rtx_SET (res, cond)); + ix86_expand_setcc (res, EQ, + gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); emit_insn (gen_zero_extendqisi2 (operands[0], res)); DONE; }) @@ -16186,8 +16176,6 @@ rtx mask = GEN_INT (0x45); rtx val = GEN_INT (0x05); - rtx cond; - rtx scratch = gen_reg_rtx (HImode); rtx res = gen_reg_rtx (QImode); @@ -16204,10 +16192,8 @@ emit_insn (gen_andqi_ext_0 (scratch, scratch, mask)); emit_insn (gen_cmpqi_ext_3 (scratch, val)); - cond = gen_rtx_fmt_ee (EQ, QImode, - gen_rtx_REG (CCmode, FLAGS_REG), - const0_rtx); - emit_insn (gen_rtx_SET (res, cond)); + ix86_expand_setcc (res, EQ, + gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); emit_insn (gen_zero_extendqisi2 (operands[0], res)); DONE; }) |