From 5222e47075dd80a3ada4a34c2231aef6f7a3231f Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 9 Jul 2001 21:38:19 +0200 Subject: [PATCH] emit-rtl.c (gen_highpart_mode): New. * emit-rtl.c (gen_highpart_mode): New. * rtl.h (gen_highpart_mode): Declare. * sparc.md (insn splitters): Use gen_highpart_mode, whenever the operand can be VOIDmode constant. From-SVN: r43869 --- gcc/ChangeLog | 7 +++++++ gcc/config/sparc/sparc.md | 17 +++++++++-------- gcc/emit-rtl.c | 17 +++++++++++++++++ gcc/rtl.h | 2 ++ 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 807f1096d4d..3dbc4517763 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Mon Jul 9 21:36:00 CEST 2001 Jan Hubicka + + * emit-rtl.c (gen_highpart_mode): New. + * rtl.h (gen_highpart_mode): Declare. + * sparc.md (insn splitters): Use gen_highpart_mode, whenever the + operand can be VOIDmode constant. + Mon Jul 9 17:23:10 CEST 2001 Jan Hubicka * flow.c (redirect_edge_and_branch_force): New. diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index 61c2b9baf12..5a1cb92861e 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -5633,7 +5633,7 @@ operands[4] = gen_lowpart (SImode, operands[1]); operands[5] = gen_lowpart (SImode, operands[2]); operands[6] = gen_highpart (SImode, operands[0]); - operands[7] = gen_highpart (SImode, operands[1]); + operands[7] = gen_highpart_mode (SImode, DImode, operands[1]); #if HOST_BITS_PER_WIDE_INT == 32 if (GET_CODE (operands[2]) == CONST_INT) { @@ -5644,7 +5644,7 @@ } else #endif - operands[8] = gen_highpart (SImode, operands[2]); + operands[8] = gen_highpart_mode (SImode, DImode, operands[2]); }") (define_split @@ -5680,7 +5680,7 @@ } else #endif - operands[8] = gen_highpart (SImode, operands[2]); + operands[8] = gen_highpart_mode (SImode, DImode, operands[2]); }") ;; LTU here means "carry set" @@ -5714,7 +5714,7 @@ (ltu:SI (reg:CC_NOOV 100) (const_int 0)))) (set (match_dup 4) (const_int 0))] "operands[3] = gen_lowpart (SImode, operands[0]); - operands[4] = gen_highpart (SImode, operands[1]);") + operands[4] = gen_highpart_mode (SImode, DImode, operands[1]);") (define_insn "*addx_extend_sp64" [(set (match_operand:DI 0 "register_operand" "=r") @@ -5929,7 +5929,7 @@ { rtx highp, lowp; - highp = gen_highpart (SImode, operands[2]); + highp = gen_highpart_mode (SImode, DImode, operands[2]); lowp = gen_lowpart (SImode, operands[2]); if ((lowp == const0_rtx) && (operands[0] == operands[1])) @@ -5937,7 +5937,8 @@ emit_insn (gen_rtx_SET (VOIDmode, gen_highpart (SImode, operands[0]), gen_rtx_MINUS (SImode, - gen_highpart (SImode, operands[1]), + gen_highpart_mode (SImode, DImode, + operands[1]), highp))); } else @@ -5946,7 +5947,7 @@ gen_lowpart (SImode, operands[1]), lowp)); emit_insn (gen_subx (gen_highpart (SImode, operands[0]), - gen_highpart (SImode, operands[1]), + gen_highpart_mode (SImode, DImode, operands[1]), highp)); } DONE; @@ -6800,7 +6801,7 @@ } else #endif - operands[8] = gen_highpart (SImode, operands[3]); + operands[8] = gen_highpart_mode (SImode, DImode, operands[3]); operands[9] = gen_lowpart (SImode, operands[3]); }") diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 4187468538d..42137bf776d 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1146,6 +1146,23 @@ gen_highpart (mode, x) abort (); return result; } + +/* Like gen_highpart_mode, but accept mode of EXP operand in case EXP can + be VOIDmode constant. */ +rtx +gen_highpart_mode (outermode, innermode, exp) + enum machine_mode outermode, innermode; + rtx exp; +{ + if (GET_MODE (exp) != VOIDmode) + { + if (GET_MODE (exp) != innermode) + abort (); + return gen_highpart (outermode, exp); + } + return simplify_gen_subreg (outermode, exp, innermode, + subreg_highpart_offset (outermode, innermode)); +} /* Return offset in bytes to get OUTERMODE low part of the value in mode INNERMODE stored in memory in target format. */ diff --git a/gcc/rtl.h b/gcc/rtl.h index 13edabdd8ac..64d9f202e68 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1190,6 +1190,8 @@ extern rtx gen_lowpart_if_possible PARAMS ((enum machine_mode, rtx)); /* In emit-rtl.c */ extern rtx gen_highpart PARAMS ((enum machine_mode, rtx)); +extern rtx gen_highpart_mode PARAMS ((enum machine_mode, + enum machine_mode, rtx)); extern rtx gen_realpart PARAMS ((enum machine_mode, rtx)); extern rtx gen_imagpart PARAMS ((enum machine_mode, rtx)); extern rtx operand_subword PARAMS ((rtx, unsigned int, int, -- 2.30.2