diff options
author | Martin Liska <mliska@suse.cz> | 2022-10-15 15:32:39 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-10-15 15:32:39 +0200 |
commit | 2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9 (patch) | |
tree | b118381a0a883a762ddd56c0e91608d937ee8bdf /gcc/config | |
parent | bd21c04269deded2c7476ceca1100a26f28ea526 (diff) | |
parent | baeec7cc83b19b46d1c73523f06efa7ea2b30390 (diff) | |
download | gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.zip gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.tar.gz gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/aarch64/aarch64-modes.def | 1 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.cc | 39 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.md | 76 | ||||
-rw-r--r-- | gcc/config/i386/i386-builtin-types.def | 2 | ||||
-rw-r--r-- | gcc/config/i386/i386-builtins.cc | 17 | ||||
-rw-r--r-- | gcc/config/i386/i386-expand.cc | 2 | ||||
-rw-r--r-- | gcc/config/i386/i386.cc | 63 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 81 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.cc | 24 |
9 files changed, 179 insertions, 126 deletions
diff --git a/gcc/config/aarch64/aarch64-modes.def b/gcc/config/aarch64/aarch64-modes.def index d3c9b74..0fd4c32 100644 --- a/gcc/config/aarch64/aarch64-modes.def +++ b/gcc/config/aarch64/aarch64-modes.def @@ -35,6 +35,7 @@ CC_MODE (CCFPE); CC_MODE (CC_SWP); CC_MODE (CC_NZC); /* Only N, Z and C bits of condition flags are valid. (Used with SVE predicate tests.) */ +CC_MODE (CC_NZV); /* Only N, Z and V bits of condition flags are valid. */ CC_MODE (CC_NZ); /* Only N and Z bits of condition flags are valid. */ CC_MODE (CC_Z); /* Only Z bit of condition flags is valid. */ CC_MODE (CC_C); /* C represents unsigned overflow of a simple addition. */ diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index a8845a5..1d0f994 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -11274,7 +11274,7 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y) if (y == const0_rtx && (REG_P (x) || SUBREG_P (x)) && (code == EQ || code == NE) && (mode_x == HImode || mode_x == QImode)) - return CC_NZmode; + return CC_Zmode; /* Similarly, comparisons of zero_extends from shorter modes can be performed using an ANDS with an immediate mask. */ @@ -11282,15 +11282,29 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y) && (mode_x == SImode || mode_x == DImode) && (GET_MODE (XEXP (x, 0)) == HImode || GET_MODE (XEXP (x, 0)) == QImode) && (code == EQ || code == NE)) - return CC_NZmode; + return CC_Zmode; + + /* Zero extracts support equality comparisons. */ + if ((mode_x == SImode || mode_x == DImode) + && y == const0_rtx + && (code_x == ZERO_EXTRACT && CONST_INT_P (XEXP (x, 1)) + && CONST_INT_P (XEXP (x, 2))) + && (code == EQ || code == NE)) + return CC_Zmode; + + /* ANDS/BICS/TST support equality and all signed comparisons. */ + if ((mode_x == SImode || mode_x == DImode) + && y == const0_rtx + && (code_x == AND) + && (code == EQ || code == NE || code == LT || code == GE + || code == GT || code == LE)) + return CC_NZVmode; + /* ADDS/SUBS correctly set N and Z flags. */ if ((mode_x == SImode || mode_x == DImode) && y == const0_rtx && (code == EQ || code == NE || code == LT || code == GE) - && (code_x == PLUS || code_x == MINUS || code_x == AND - || code_x == NEG - || (code_x == ZERO_EXTRACT && CONST_INT_P (XEXP (x, 1)) - && CONST_INT_P (XEXP (x, 2))))) + && (code_x == PLUS || code_x == MINUS || code_x == NEG)) return CC_NZmode; /* A compare with a shifted operand. Because of canonicalization, @@ -11427,6 +11441,19 @@ aarch64_get_condition_code_1 (machine_mode mode, enum rtx_code comp_code) } break; + case E_CC_NZVmode: + switch (comp_code) + { + case NE: return AARCH64_NE; + case EQ: return AARCH64_EQ; + case GE: return AARCH64_PL; + case LT: return AARCH64_MI; + case GT: return AARCH64_GT; + case LE: return AARCH64_LE; + default: return -1; + } + break; + case E_CC_NZmode: switch (comp_code) { diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 0a7633e..f2e3d90 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -4514,8 +4514,8 @@ ) (define_insn "*and<mode>3_compare0" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (match_operand:GPI 1 "register_operand" "%r,r") (match_operand:GPI 2 "aarch64_logical_operand" "r,<lconst>")) (const_int 0))) @@ -4530,8 +4530,8 @@ ;; zero_extend version of above (define_insn "*andsi3_compare0_uxtw" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:SI (match_operand:SI 1 "register_operand" "%r,r") (match_operand:SI 2 "aarch64_logical_operand" "r,K")) (const_int 0))) @@ -4545,8 +4545,8 @@ ) (define_insn "*and_<SHIFT:optab><mode>3_compare0" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (SHIFT:GPI (match_operand:GPI 1 "register_operand" "r") (match_operand:QI 2 "aarch64_shift_imm_<mode>" "n")) @@ -4565,8 +4565,8 @@ ;; zero_extend version of above (define_insn "*and_<SHIFT:optab>si3_compare0_uxtw" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:SI (SHIFT:SI (match_operand:SI 1 "register_operand" "r") (match_operand:QI 2 "aarch64_shift_imm_si" "n")) @@ -4770,8 +4770,8 @@ ) (define_insn "*and_one_cmpl<mode>3_compare0" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (not:GPI (match_operand:GPI 1 "register_operand" "r")) (match_operand:GPI 2 "register_operand" "r")) @@ -4785,8 +4785,8 @@ ;; zero_extend version of above (define_insn "*and_one_cmplsi3_compare0_uxtw" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:SI (not:SI (match_operand:SI 1 "register_operand" "r")) (match_operand:SI 2 "register_operand" "r")) @@ -4799,8 +4799,8 @@ ) (define_insn "*and_one_cmpl<mode>3_compare0_no_reuse" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (not:GPI (match_operand:GPI 0 "register_operand" "r")) (match_operand:GPI 1 "register_operand" "r")) @@ -4878,8 +4878,8 @@ ) (define_insn "*and_one_cmpl_<SHIFT:optab><mode>3_compare0" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (not:GPI (SHIFT:GPI (match_operand:GPI 1 "register_operand" "r") @@ -4901,8 +4901,8 @@ ;; zero_extend version of above (define_insn "*and_one_cmpl_<SHIFT:optab>si3_compare0_uxtw" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:SI (not:SI (SHIFT:SI (match_operand:SI 1 "register_operand" "r") @@ -4923,8 +4923,8 @@ ) (define_insn "*and_one_cmpl_<SHIFT:optab><mode>3_compare0_no_reuse" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (not:GPI (SHIFT:GPI (match_operand:GPI 0 "register_operand" "r") @@ -5029,8 +5029,8 @@ ") (define_insn "*and<mode>_compare0" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_Z CC_REGNUM) + (compare:CC_Z (match_operand:SHORT 0 "register_operand" "r") (const_int 0)))] "" @@ -5039,8 +5039,8 @@ ) (define_insn "*ands<GPI:mode>_compare0" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_Z CC_REGNUM) + (compare:CC_Z (zero_extend:GPI (match_operand:SHORT 1 "register_operand" "r")) (const_int 0))) (set (match_operand:GPI 0 "register_operand" "=r") @@ -5051,8 +5051,8 @@ ) (define_insn "*and<mode>3nr_compare0" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (match_operand:GPI 0 "register_operand" "%r,r") (match_operand:GPI 1 "aarch64_logical_operand" "r,<lconst>")) (const_int 0)))] @@ -5064,24 +5064,24 @@ ) (define_split - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (match_operand:GPI 0 "register_operand") (match_operand:GPI 1 "aarch64_mov_imm_operand")) (const_int 0))) (clobber (match_operand:SI 2 "register_operand"))] "" [(set (match_dup 2) (match_dup 1)) - (set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + (set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (match_dup 0) (match_dup 2)) (const_int 0)))] ) (define_insn "*and<mode>3nr_compare0_zextract" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_Z CC_REGNUM) + (compare:CC_Z (zero_extract:GPI (match_operand:GPI 0 "register_operand" "r") (match_operand:GPI 1 "const_int_operand" "n") (match_operand:GPI 2 "const_int_operand" "n")) @@ -5102,8 +5102,8 @@ ) (define_insn "*and_<SHIFT:optab><mode>3nr_compare0" - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (SHIFT:GPI (match_operand:GPI 0 "register_operand" "r") (match_operand:QI 1 "aarch64_shift_imm_<mode>" "n")) @@ -5119,8 +5119,8 @@ ) (define_split - [(set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + [(set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (SHIFT:GPI (match_operand:GPI 0 "register_operand") (match_operand:QI 1 "aarch64_shift_imm_<mode>")) @@ -5129,8 +5129,8 @@ (clobber (match_operand:SI 3 "register_operand"))] "" [(set (match_dup 3) (match_dup 2)) - (set (reg:CC_NZ CC_REGNUM) - (compare:CC_NZ + (set (reg:CC_NZV CC_REGNUM) + (compare:CC_NZV (and:GPI (SHIFT:GPI (match_dup 0) (match_dup 1)) diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def index 63a360b..2c27a4e 100644 --- a/gcc/config/i386/i386-builtin-types.def +++ b/gcc/config/i386/i386-builtin-types.def @@ -69,7 +69,7 @@ DEF_PRIMITIVE_TYPE (UINT16, short_unsigned_type_node) DEF_PRIMITIVE_TYPE (INT64, long_long_integer_type_node) DEF_PRIMITIVE_TYPE (UINT64, long_long_unsigned_type_node) DEF_PRIMITIVE_TYPE (FLOAT16, ix86_float16_type_node) -DEF_PRIMITIVE_TYPE (BFLOAT16, ix86_bf16_type_node) +DEF_PRIMITIVE_TYPE (BFLOAT16, bfloat16_type_node) DEF_PRIMITIVE_TYPE (FLOAT, float_type_node) DEF_PRIMITIVE_TYPE (DOUBLE, double_type_node) DEF_PRIMITIVE_TYPE (FLOAT80, float80_type_node) diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc index b91aba1..b5c651a 100644 --- a/gcc/config/i386/i386-builtins.cc +++ b/gcc/config/i386/i386-builtins.cc @@ -126,7 +126,6 @@ BDESC_VERIFYS (IX86_BUILTIN_MAX, static GTY(()) tree ix86_builtin_type_tab[(int) IX86_BT_LAST_CPTR + 1]; tree ix86_float16_type_node = NULL_TREE; -tree ix86_bf16_type_node = NULL_TREE; tree ix86_bf16_ptr_type_node = NULL_TREE; /* Retrieve an element from the above table, building some of @@ -1372,16 +1371,18 @@ ix86_register_float16_builtin_type (void) static void ix86_register_bf16_builtin_type (void) { - ix86_bf16_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (ix86_bf16_type_node) = 16; - SET_TYPE_MODE (ix86_bf16_type_node, BFmode); - layout_type (ix86_bf16_type_node); + if (bfloat16_type_node == NULL_TREE) + { + bfloat16_type_node = make_node (REAL_TYPE); + TYPE_PRECISION (bfloat16_type_node) = 16; + SET_TYPE_MODE (bfloat16_type_node, BFmode); + layout_type (bfloat16_type_node); + } if (!maybe_get_identifier ("__bf16") && TARGET_SSE2) { - lang_hooks.types.register_builtin_type (ix86_bf16_type_node, - "__bf16"); - ix86_bf16_ptr_type_node = build_pointer_type (ix86_bf16_type_node); + lang_hooks.types.register_builtin_type (bfloat16_type_node, "__bf16"); + ix86_bf16_ptr_type_node = build_pointer_type (bfloat16_type_node); } } diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 6baff6d..a0f8a98 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -14941,7 +14941,7 @@ static machine_mode get_mode_wider_vector (machine_mode o) { /* ??? Rely on the ordering that genmodes.cc gives to vectors. */ - machine_mode n = GET_MODE_WIDER_MODE (o).require (); + machine_mode n = GET_MODE_NEXT_MODE (o).require (); gcc_assert (GET_MODE_NUNITS (o) == GET_MODE_NUNITS (n) * 2); gcc_assert (GET_MODE_SIZE (o) == GET_MODE_SIZE (n)); return n; diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index ff4de2d..480db35 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -2423,6 +2423,7 @@ classify_argument (machine_mode mode, const_tree type, classes[1] = X86_64_SSEUP_CLASS; return 2; case E_HCmode: + case E_BCmode: classes[0] = X86_64_SSE_CLASS; if (!(bit_offset % 64)) return 1; @@ -22428,7 +22429,7 @@ ix86_libgcc_floating_mode_supported_p (scalar_float_mode mode) be defined by the C front-end for AVX512FP16 intrinsics. We will issue an error in ix86_expand_move for HFmode if AVX512FP16 isn't enabled. */ - return ((mode == HFmode && TARGET_SSE2) + return (((mode == HFmode || mode == BFmode) && TARGET_SSE2) ? true : default_libgcc_floating_mode_supported_p (mode)); } @@ -22731,7 +22732,7 @@ ix86_mangle_type (const_tree type) switch (TYPE_MODE (type)) { case E_BFmode: - return "u6__bf16"; + return "DF16b"; case E_HFmode: /* _Float16 is "DF16_". Align with clang's decision in https://reviews.llvm.org/D33719. */ @@ -22747,55 +22748,6 @@ ix86_mangle_type (const_tree type) } } -/* Return the diagnostic message string if conversion from FROMTYPE to - TOTYPE is not allowed, NULL otherwise. */ - -static const char * -ix86_invalid_conversion (const_tree fromtype, const_tree totype) -{ - if (element_mode (fromtype) != element_mode (totype)) - { - /* Do no allow conversions to/from BFmode scalar types. */ - if (TYPE_MODE (fromtype) == BFmode) - return N_("invalid conversion from type %<__bf16%>"); - if (TYPE_MODE (totype) == BFmode) - return N_("invalid conversion to type %<__bf16%>"); - } - - /* Conversion allowed. */ - return NULL; -} - -/* Return the diagnostic message string if the unary operation OP is - not permitted on TYPE, NULL otherwise. */ - -static const char * -ix86_invalid_unary_op (int op, const_tree type) -{ - /* Reject all single-operand operations on BFmode except for &. */ - if (element_mode (type) == BFmode && op != ADDR_EXPR) - return N_("operation not permitted on type %<__bf16%>"); - - /* Operation allowed. */ - return NULL; -} - -/* Return the diagnostic message string if the binary operation OP is - not permitted on TYPE1 and TYPE2, NULL otherwise. */ - -static const char * -ix86_invalid_binary_op (int op ATTRIBUTE_UNUSED, const_tree type1, - const_tree type2) -{ - /* Reject all 2-operand operations on BFmode. */ - if (element_mode (type1) == BFmode - || element_mode (type2) == BFmode) - return N_("operation not permitted on type %<__bf16%>"); - - /* Operation allowed. */ - return NULL; -} - static GTY(()) tree ix86_tls_stack_chk_guard_decl; static tree @@ -24853,15 +24805,6 @@ ix86_libgcc_floating_mode_supported_p #undef TARGET_MANGLE_TYPE #define TARGET_MANGLE_TYPE ix86_mangle_type -#undef TARGET_INVALID_CONVERSION -#define TARGET_INVALID_CONVERSION ix86_invalid_conversion - -#undef TARGET_INVALID_UNARY_OP -#define TARGET_INVALID_UNARY_OP ix86_invalid_unary_op - -#undef TARGET_INVALID_BINARY_OP -#define TARGET_INVALID_BINARY_OP ix86_invalid_binary_op - #undef TARGET_STACK_PROTECT_GUARD #define TARGET_STACK_PROTECT_GUARD ix86_stack_protect_guard diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 8e84752..6688d92 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -1644,6 +1644,48 @@ DONE; }) +(define_expand "cbranchbf4" + [(set (reg:CC FLAGS_REG) + (compare:CC (match_operand:BF 1 "cmp_fp_expander_operand") + (match_operand:BF 2 "cmp_fp_expander_operand"))) + (set (pc) (if_then_else + (match_operator 0 "comparison_operator" + [(reg:CC FLAGS_REG) + (const_int 0)]) + (label_ref (match_operand 3)) + (pc)))] + "" +{ + rtx op1 = gen_lowpart (HImode, operands[1]); + if (CONST_INT_P (op1)) + op1 = simplify_const_unary_operation (FLOAT_EXTEND, SFmode, + operands[1], BFmode); + else + { + rtx t1 = gen_reg_rtx (SImode); + emit_insn (gen_zero_extendhisi2 (t1, op1)); + emit_insn (gen_ashlsi3 (t1, t1, GEN_INT (16))); + op1 = gen_lowpart (SFmode, t1); + } + rtx op2 = gen_lowpart (HImode, operands[2]); + if (CONST_INT_P (op2)) + op2 = simplify_const_unary_operation (FLOAT_EXTEND, SFmode, + operands[2], BFmode); + else + { + rtx t2 = gen_reg_rtx (SImode); + emit_insn (gen_zero_extendhisi2 (t2, op2)); + emit_insn (gen_ashlsi3 (t2, t2, GEN_INT (16))); + op2 = gen_lowpart (SFmode, t2); + } + do_compare_rtx_and_jump (op1, op2, GET_CODE (operands[0]), 0, + SFmode, NULL_RTX, NULL, + as_a <rtx_code_label *> (operands[3]), + /* Unfortunately this isn't propagated. */ + profile_probability::even ()); + DONE; +}) + (define_expand "cstorehf4" [(set (reg:CC FLAGS_REG) (compare:CC (match_operand:HF 2 "cmp_fp_expander_operand") @@ -1659,6 +1701,45 @@ DONE; }) +(define_expand "cstorebf4" + [(set (reg:CC FLAGS_REG) + (compare:CC (match_operand:BF 2 "cmp_fp_expander_operand") + (match_operand:BF 3 "cmp_fp_expander_operand"))) + (set (match_operand:QI 0 "register_operand") + (match_operator 1 "comparison_operator" + [(reg:CC FLAGS_REG) + (const_int 0)]))] + "" +{ + rtx op1 = gen_lowpart (HImode, operands[2]); + if (CONST_INT_P (op1)) + op1 = simplify_const_unary_operation (FLOAT_EXTEND, SFmode, + operands[2], BFmode); + else + { + rtx t1 = gen_reg_rtx (SImode); + emit_insn (gen_zero_extendhisi2 (t1, op1)); + emit_insn (gen_ashlsi3 (t1, t1, GEN_INT (16))); + op1 = gen_lowpart (SFmode, t1); + } + rtx op2 = gen_lowpart (HImode, operands[3]); + if (CONST_INT_P (op2)) + op2 = simplify_const_unary_operation (FLOAT_EXTEND, SFmode, + operands[3], BFmode); + else + { + rtx t2 = gen_reg_rtx (SImode); + emit_insn (gen_zero_extendhisi2 (t2, op2)); + emit_insn (gen_ashlsi3 (t2, t2, GEN_INT (16))); + op2 = gen_lowpart (SFmode, t2); + } + rtx res = emit_store_flag_force (operands[0], GET_CODE (operands[1]), + op1, op2, SFmode, 0, 1); + if (!rtx_equal_p (res, operands[0])) + emit_move_insn (operands[0], res); + DONE; +}) + (define_expand "cstore<mode>4" [(set (reg:CC FLAGS_REG) (compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand") diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc index c72c38e..10c0f52 100644 --- a/gcc/config/sparc/sparc.cc +++ b/gcc/config/sparc/sparc.cc @@ -6051,6 +6051,9 @@ sparc_expand_prologue (void) } RTX_FRAME_RELATED_P (insn) = 1; + + /* Ensure no memory access is done before the frame is established. */ + emit_insn (gen_frame_blockage ()); } else { @@ -6065,13 +6068,7 @@ sparc_expand_prologue (void) /* %sp is not the CFA register anymore. */ emit_insn (gen_stack_pointer_inc (GEN_INT (4096 - size))); - /* Make sure no %fp-based store is issued until after the frame is - established. The offset between the frame pointer and the stack - pointer is calculated relative to the value of the stack pointer - at the end of the function prologue, and moving instructions that - access the stack via the frame pointer between the instructions - that decrement the stack pointer could result in accessing the - register window save area, which is volatile. */ + /* Likewise. */ emit_insn (gen_frame_blockage ()); } else @@ -6167,8 +6164,8 @@ sparc_flat_expand_prologue (void) } RTX_FRAME_RELATED_P (insn) = 1; - /* Ensure nothing is scheduled until after the frame is established. */ - emit_insn (gen_blockage ()); + /* Ensure no memory access is done before the frame is established. */ + emit_insn (gen_frame_blockage ()); if (frame_pointer_needed) { @@ -6255,6 +6252,9 @@ sparc_expand_epilogue (bool for_eh) ; /* do nothing. */ else if (sparc_leaf_function_p) { + /* Ensure no memory access is done after the frame is destroyed. */ + emit_insn (gen_frame_blockage ()); + if (size <= 4096) emit_insn (gen_stack_pointer_inc (GEN_INT (size))); else if (size <= 8192) @@ -6305,15 +6305,15 @@ sparc_flat_expand_epilogue (bool for_eh) ; /* do nothing. */ else if (frame_pointer_needed) { - /* Make sure the frame is destroyed after everything else is done. */ - emit_insn (gen_blockage ()); + /* Ensure no memory access is done after the frame is destroyed. */ + emit_insn (gen_frame_blockage ()); emit_move_insn (stack_pointer_rtx, gen_rtx_REG (Pmode, 1)); } else { /* Likewise. */ - emit_insn (gen_blockage ()); + emit_insn (gen_frame_blockage ()); if (size <= 4096) emit_insn (gen_stack_pointer_inc (GEN_INT (size))); |