https://gcc.gnu.org/g:99ce99f38e420591311c55807d443d6847bb3b54
commit 99ce99f38e420591311c55807d443d6847bb3b54 Author: Michael Meissner <[email protected]> Date: Thu Oct 2 23:51:18 2025 -0400 If -Ofast remove truncate and re-expand of 16-bit floating point 2025-10-02 Michael Meissner <[email protected]> gcc/ * config/rs6000/rs6000.md (<BF_OPS_NAME>bf3): Remove debug printf. (no_extend_trunc_<SFDF:mode>_<FP16_HW:mode>): If -Ofast, optimize multiple 16-bit floating point truncate and extend operations. Diff: --- gcc/config/rs6000/rs6000.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 774b058a8e18..4ac162c963ac 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -5917,8 +5917,6 @@ if (GET_CODE (tmp2) == SCRATCH) tmp2 = gen_reg_rtx (V4SFmode); - printf ("--- %s\n", "<CODE>_bf"); - /* Convert operand1 to V4SFmode format. */ emit_insn (gen_xxspltw_bf (tmp1, op1)); emit_insn (gen_xvcvbf16spn_bf (tmp1, tmp1)); @@ -6198,6 +6196,18 @@ DONE; }) +;; In -Ofast, eliminate back to back extend/trunc operations + +(define_insn_and_split "*no_extend_trunc_<SFDF:mode>_<FP16_HW:mode>" + [(set (match_operand:FP16_HW 0 "vsx_register_operand" "=wa") + (float_truncate:FP16_HW + (float_extend:SFDF + (match_operand:FP16_HW 1 "vsx_register_operand" "wa"))))] + "optimize_fast" + "#" + "&& 1" + [(set (match_dup 0) (match_dup 1))]) + ;; Conversions to and from floating-point.
