comparison gcc/config/spu/spu.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* Copyright (C) 2006-2017 Free Software Foundation, Inc. 1 /* Copyright (C) 2006-2018 Free Software Foundation, Inc.
2 2
3 This file is free software; you can redistribute it and/or modify it under 3 This file is free software; you can redistribute it and/or modify it under
4 the terms of the GNU General Public License as published by the Free 4 the terms of the GNU General Public License as published by the Free
5 Software Foundation; either version 3 of the License, or (at your option) 5 Software Foundation; either version 3 of the License, or (at your option)
6 any later version. 6 any later version.
11 for more details. 11 for more details.
12 12
13 You should have received a copy of the GNU General Public License 13 You should have received a copy of the GNU General Public License
14 along with GCC; see the file COPYING3. If not see 14 along with GCC; see the file COPYING3. If not see
15 <http://www.gnu.org/licenses/>. */ 15 <http://www.gnu.org/licenses/>. */
16
17 #define IN_TARGET_CODE 1
16 18
17 #include "config.h" 19 #include "config.h"
18 #include "system.h" 20 #include "system.h"
19 #include "coretypes.h" 21 #include "coretypes.h"
20 #include "backend.h" 22 #include "backend.h"
54 #include "tm-constrs.h" 56 #include "tm-constrs.h"
55 #include "ddg.h" 57 #include "ddg.h"
56 #include "dumpfile.h" 58 #include "dumpfile.h"
57 #include "builtins.h" 59 #include "builtins.h"
58 #include "rtl-iter.h" 60 #include "rtl-iter.h"
61 #include "flags.h"
62 #include "toplev.h"
59 63
60 /* This file should be included last. */ 64 /* This file should be included last. */
61 #include "target-def.h" 65 #include "target-def.h"
62 66
63 /* Builtin types, data and prototypes. */ 67 /* Builtin types, data and prototypes. */
234 global_options_set.x_param_values); 238 global_options_set.x_param_values);
235 239
236 flag_omit_frame_pointer = 1; 240 flag_omit_frame_pointer = 1;
237 241
238 /* Functions must be 8 byte aligned so we correctly handle dual issue */ 242 /* Functions must be 8 byte aligned so we correctly handle dual issue */
239 if (align_functions < 8) 243 parse_alignment_opts ();
240 align_functions = 8; 244 if (align_functions.levels[0].get_value () < 8)
245 str_align_functions = "8";
241 246
242 spu_hint_dist = 8*4 - spu_max_nops*4; 247 spu_hint_dist = 8*4 - spu_max_nops*4;
243 if (spu_hint_dist < 0) 248 if (spu_hint_dist < 0)
244 spu_hint_dist = 0; 249 spu_hint_dist = 0;
245 250
1901 For TImode, VAL will be zero extended to 128 bits. */ 1906 For TImode, VAL will be zero extended to 128 bits. */
1902 rtx 1907 rtx
1903 spu_const (machine_mode mode, HOST_WIDE_INT val) 1908 spu_const (machine_mode mode, HOST_WIDE_INT val)
1904 { 1909 {
1905 rtx inner; 1910 rtx inner;
1906 rtvec v;
1907 int units, i;
1908 1911
1909 gcc_assert (GET_MODE_CLASS (mode) == MODE_INT 1912 gcc_assert (GET_MODE_CLASS (mode) == MODE_INT
1910 || GET_MODE_CLASS (mode) == MODE_FLOAT 1913 || GET_MODE_CLASS (mode) == MODE_FLOAT
1911 || GET_MODE_CLASS (mode) == MODE_VECTOR_INT 1914 || GET_MODE_CLASS (mode) == MODE_VECTOR_INT
1912 || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT); 1915 || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT);
1921 if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT) 1924 if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
1922 inner = immed_double_const (val, 0, GET_MODE_INNER (mode)); 1925 inner = immed_double_const (val, 0, GET_MODE_INNER (mode));
1923 else 1926 else
1924 inner = hwint_to_const_double (GET_MODE_INNER (mode), val); 1927 inner = hwint_to_const_double (GET_MODE_INNER (mode), val);
1925 1928
1926 units = GET_MODE_NUNITS (mode); 1929 return gen_const_vec_duplicate (mode, inner);
1927
1928 v = rtvec_alloc (units);
1929
1930 for (i = 0; i < units; ++i)
1931 RTVEC_ELT (v, i) = inner;
1932
1933 return gen_rtx_CONST_VECTOR (mode, v);
1934 } 1930 }
1935 1931
1936 /* Create a MODE vector constant from 4 ints. */ 1932 /* Create a MODE vector constant from 4 ints. */
1937 rtx 1933 rtx
1938 spu_const_from_ints(machine_mode mode, int a, int b, int c, int d) 1934 spu_const_from_ints(machine_mode mode, int a, int b, int c, int d)
2036 if (!active_insn_p (insn)) 2032 if (!active_insn_p (insn))
2037 insn = next_active_insn (insn); 2033 insn = next_active_insn (insn);
2038 for (; insn; insn = next_insn) 2034 for (; insn; insn = next_insn)
2039 { 2035 {
2040 next_insn = next_active_insn (insn); 2036 next_insn = next_active_insn (insn);
2041 if (INSN_CODE (insn) == CODE_FOR_iprefetch 2037 if (INSN_P (insn)
2042 || INSN_CODE (insn) == CODE_FOR_hbr) 2038 && (INSN_CODE (insn) == CODE_FOR_iprefetch
2039 || INSN_CODE (insn) == CODE_FOR_hbr))
2043 { 2040 {
2044 if (hbr_insn) 2041 if (hbr_insn)
2045 { 2042 {
2046 int a0 = INSN_ADDRESSES (INSN_UID (hbr_insn)); 2043 int a0 = INSN_ADDRESSES (INSN_UID (hbr_insn));
2047 int a1 = INSN_ADDRESSES (INSN_UID (insn)); 2044 int a1 = INSN_ADDRESSES (INSN_UID (insn));
2055 length += 4; 2052 length += 4;
2056 } 2053 }
2057 } 2054 }
2058 hbr_insn = insn; 2055 hbr_insn = insn;
2059 } 2056 }
2060 if (INSN_CODE (insn) == CODE_FOR_blockage && next_insn) 2057 if (INSN_P (insn) && INSN_CODE (insn) == CODE_FOR_blockage && next_insn)
2061 { 2058 {
2062 if (GET_MODE (insn) == TImode) 2059 if (GET_MODE (insn) == TImode)
2063 PUT_MODE (next_insn, TImode); 2060 PUT_MODE (next_insn, TImode);
2064 insn = next_insn; 2061 insn = next_insn;
2065 next_insn = next_active_insn (insn); 2062 next_insn = next_active_insn (insn);
2773 2770
2774 static void 2771 static void
2775 spu_sched_init (FILE *file ATTRIBUTE_UNUSED, int verbose ATTRIBUTE_UNUSED, 2772 spu_sched_init (FILE *file ATTRIBUTE_UNUSED, int verbose ATTRIBUTE_UNUSED,
2776 int max_ready ATTRIBUTE_UNUSED) 2773 int max_ready ATTRIBUTE_UNUSED)
2777 { 2774 {
2778 if (align_labels > 4 || align_loops > 4 || align_jumps > 4) 2775 if (align_labels.levels[0].get_value () > 4
2776 || align_loops.levels[0].get_value () > 4
2777 || align_jumps.levels[0].get_value () > 4)
2779 { 2778 {
2780 /* When any block might be at least 8-byte aligned, assume they 2779 /* When any block might be at least 8-byte aligned, assume they
2781 will all be at least 8-byte aligned to make sure dual issue 2780 will all be at least 8-byte aligned to make sure dual issue
2782 works out correctly. */ 2781 works out correctly. */
2783 spu_sched_length = 0; 2782 spu_sched_length = 0;
7189 } 7188 }
7190 7189
7191 /* Implement TARGET_TRULY_NOOP_TRUNCATION. */ 7190 /* Implement TARGET_TRULY_NOOP_TRUNCATION. */
7192 7191
7193 static bool 7192 static bool
7194 spu_truly_noop_truncation (unsigned int outprec, unsigned int inprec) 7193 spu_truly_noop_truncation (poly_uint64 outprec, poly_uint64 inprec)
7195 { 7194 {
7196 return inprec <= 32 && outprec <= inprec; 7195 return inprec <= 32 && outprec <= inprec;
7197 } 7196 }
7198 7197
7199 /* Implement TARGET_STATIC_RTX_ALIGNMENT. 7198 /* Implement TARGET_STATIC_RTX_ALIGNMENT.
7221 } 7220 }
7222 7221
7223 /* Table of machine attributes. */ 7222 /* Table of machine attributes. */
7224 static const struct attribute_spec spu_attribute_table[] = 7223 static const struct attribute_spec spu_attribute_table[] =
7225 { 7224 {
7226 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler, 7225 /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
7227 affects_type_identity } */ 7226 affects_type_identity, handler, exclude } */
7228 { "naked", 0, 0, true, false, false, spu_handle_fndecl_attribute, 7227 { "naked", 0, 0, true, false, false, false,
7229 false }, 7228 spu_handle_fndecl_attribute, NULL },
7230 { "spu_vector", 0, 0, false, true, false, spu_handle_vector_attribute, 7229 { "spu_vector", 0, 0, false, true, false, false,
7231 false }, 7230 spu_handle_vector_attribute, NULL },
7232 { NULL, 0, 0, false, false, false, NULL, false } 7231 { NULL, 0, 0, false, false, false, false, NULL, NULL }
7233 }; 7232 };
7234 7233
7235 /* TARGET overrides. */ 7234 /* TARGET overrides. */
7236 7235
7237 #undef TARGET_LRA_P 7236 #undef TARGET_LRA_P
7462 #undef TARGET_STATIC_RTX_ALIGNMENT 7461 #undef TARGET_STATIC_RTX_ALIGNMENT
7463 #define TARGET_STATIC_RTX_ALIGNMENT spu_static_rtx_alignment 7462 #define TARGET_STATIC_RTX_ALIGNMENT spu_static_rtx_alignment
7464 #undef TARGET_CONSTANT_ALIGNMENT 7463 #undef TARGET_CONSTANT_ALIGNMENT
7465 #define TARGET_CONSTANT_ALIGNMENT spu_constant_alignment 7464 #define TARGET_CONSTANT_ALIGNMENT spu_constant_alignment
7466 7465
7466 #undef TARGET_HAVE_SPECULATION_SAFE_VALUE
7467 #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
7468
7467 struct gcc_target targetm = TARGET_INITIALIZER; 7469 struct gcc_target targetm = TARGET_INITIALIZER;
7468 7470
7469 #include "gt-spu.h" 7471 #include "gt-spu.h"