Commit 4fda2521 by Herman A.J. ten Brugge Committed by Michael Hayes

c4x.h (INIT_TARGET_OPTABS): Add all missing local optab entries.

2000-01-29 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>

        * c4x.h (INIT_TARGET_OPTABS): Add all missing local optab entries.
	* c4x.c: Define the optab rtx values.
	(c4x_add_gc_roots): Add the ggc roots for these optab rtx values.
	(c4x_emit_libcall): Use new optab rtx values.
	(c4x_emit_libcall3): Likewise.
	(c4x_emit_libcall_mulhi): Likewise.
	* c4x-protos.h: Add prototypes for optab rtx values and change
	prototypes for above c4x_emit_libcall functions.

From-SVN: r31683
parent dfafcb4d
2000-01-29 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl> 2000-01-29 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
* c4x.h (INIT_TARGET_OPTABS): Add all missing local optab entries.
* c4x.c: Define the optab rtx values.
(c4x_add_gc_roots): Add the ggc roots for these optab rtx values.
(c4x_emit_libcall): Use new optab rtx values.
(c4x_emit_libcall3): Likewise.
(c4x_emit_libcall_mulhi): Likewise.
* c4x-protos.h: Add prototypes for optab rtx values and change
prototypes for above c4x_emit_libcall functions.
2000-01-29 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
* c4x.c (c4x_output_ascii): Restrict line length of output when TI * c4x.c (c4x_output_ascii): Restrict line length of output when TI
syntax is used. syntax is used.
(c4x_function_prologue): Use regnames intead of float_reg_names when (c4x_function_prologue): Use regnames intead of float_reg_names when
......
...@@ -226,14 +226,14 @@ extern int c4x_T_constraint PARAMS ((rtx)); ...@@ -226,14 +226,14 @@ extern int c4x_T_constraint PARAMS ((rtx));
extern int c4x_U_constraint PARAMS ((rtx)); extern int c4x_U_constraint PARAMS ((rtx));
extern void c4x_emit_libcall PARAMS ((const char *, enum rtx_code, extern void c4x_emit_libcall PARAMS ((rtx, enum rtx_code,
enum machine_mode, enum machine_mode,
enum machine_mode, int, rtx *)); enum machine_mode, int, rtx *));
extern void c4x_emit_libcall3 PARAMS ((const char *, enum rtx_code, extern void c4x_emit_libcall3 PARAMS ((rtx, enum rtx_code,
enum machine_mode, rtx *)); enum machine_mode, rtx *));
extern void c4x_emit_libcall_mulhi PARAMS ((char *, enum rtx_code, extern void c4x_emit_libcall_mulhi PARAMS ((rtx, enum rtx_code,
enum machine_mode, rtx *)); enum machine_mode, rtx *));
extern int c4x_emit_move_sequence PARAMS ((rtx *, enum machine_mode)); extern int c4x_emit_move_sequence PARAMS ((rtx *, enum machine_mode));
...@@ -251,5 +251,16 @@ extern int valid_parallel_operands_5 PARAMS ((rtx *, enum machine_mode)); ...@@ -251,5 +251,16 @@ extern int valid_parallel_operands_5 PARAMS ((rtx *, enum machine_mode));
extern int valid_parallel_operands_6 PARAMS ((rtx *, enum machine_mode)); extern int valid_parallel_operands_6 PARAMS ((rtx *, enum machine_mode));
extern rtx smulhi3_libfunc;
extern rtx umulhi3_libfunc;
extern rtx fix_truncqfhi2_libfunc;
extern rtx fixuns_truncqfhi2_libfunc;
extern rtx fix_trunchfhi2_libfunc;
extern rtx fixuns_trunchfhi2_libfunc;
extern rtx floathiqf2_libfunc;
extern rtx floatunshiqf2_libfunc;
extern rtx floathihf2_libfunc;
extern rtx floatunshihf2_libfunc;
#endif /* RTX_CODE */ #endif /* RTX_CODE */
...@@ -46,6 +46,17 @@ ...@@ -46,6 +46,17 @@
#include "ggc.h" #include "ggc.h"
#include "c4x-protos.h" #include "c4x-protos.h"
rtx smulhi3_libfunc;
rtx umulhi3_libfunc;
rtx fix_truncqfhi2_libfunc;
rtx fixuns_truncqfhi2_libfunc;
rtx fix_trunchfhi2_libfunc;
rtx fixuns_trunchfhi2_libfunc;
rtx floathiqf2_libfunc;
rtx floatunshiqf2_libfunc;
rtx floathihf2_libfunc;
rtx floatunshihf2_libfunc;
static int c4x_leaf_function; static int c4x_leaf_function;
static char *float_reg_names[] = FLOAT_REGISTER_NAMES; static char *float_reg_names[] = FLOAT_REGISTER_NAMES;
...@@ -163,6 +174,16 @@ c4x_add_gc_roots () ...@@ -163,6 +174,16 @@ c4x_add_gc_roots ()
ggc_add_tree_root (&pure_tree, 1); ggc_add_tree_root (&pure_tree, 1);
ggc_add_tree_root (&noreturn_tree, 1); ggc_add_tree_root (&noreturn_tree, 1);
ggc_add_tree_root (&interrupt_tree, 1); ggc_add_tree_root (&interrupt_tree, 1);
ggc_add_rtx_root (&smulhi3_libfunc, 1);
ggc_add_rtx_root (&umulhi3_libfunc, 1);
ggc_add_rtx_root (&fix_truncqfhi2_libfunc, 1);
ggc_add_rtx_root (&fixuns_truncqfhi2_libfunc, 1);
ggc_add_rtx_root (&fix_trunchfhi2_libfunc, 1);
ggc_add_rtx_root (&fixuns_trunchfhi2_libfunc, 1);
ggc_add_rtx_root (&floathiqf2_libfunc, 1);
ggc_add_rtx_root (&floatunshiqf2_libfunc, 1);
ggc_add_rtx_root (&floathihf2_libfunc, 1);
ggc_add_rtx_root (&floatunshihf2_libfunc, 1);
} }
...@@ -1237,8 +1258,8 @@ c4x_emit_move_sequence (operands, mode) ...@@ -1237,8 +1258,8 @@ c4x_emit_move_sequence (operands, mode)
void void
c4x_emit_libcall (name, code, dmode, smode, noperands, operands) c4x_emit_libcall (libcall, code, dmode, smode, noperands, operands)
const char *name; rtx libcall;
enum rtx_code code; enum rtx_code code;
enum machine_mode dmode; enum machine_mode dmode;
enum machine_mode smode; enum machine_mode smode;
...@@ -1247,13 +1268,9 @@ c4x_emit_libcall (name, code, dmode, smode, noperands, operands) ...@@ -1247,13 +1268,9 @@ c4x_emit_libcall (name, code, dmode, smode, noperands, operands)
{ {
rtx ret; rtx ret;
rtx insns; rtx insns;
rtx libcall;
rtx equiv; rtx equiv;
start_sequence (); start_sequence ();
if (ggc_p)
name = ggc_alloc_string (name, -1);
libcall = gen_rtx_SYMBOL_REF (Pmode, name);
switch (noperands) switch (noperands)
{ {
case 2: case 2:
...@@ -1279,30 +1296,28 @@ c4x_emit_libcall (name, code, dmode, smode, noperands, operands) ...@@ -1279,30 +1296,28 @@ c4x_emit_libcall (name, code, dmode, smode, noperands, operands)
void void
c4x_emit_libcall3 (name, code, mode, operands) c4x_emit_libcall3 (libcall, code, mode, operands)
const char *name; rtx libcall;
enum rtx_code code; enum rtx_code code;
enum machine_mode mode; enum machine_mode mode;
rtx *operands; rtx *operands;
{ {
return c4x_emit_libcall (name, code, mode, mode, 3, operands); return c4x_emit_libcall (libcall, code, mode, mode, 3, operands);
} }
void void
c4x_emit_libcall_mulhi (name, code, mode, operands) c4x_emit_libcall_mulhi (libcall, code, mode, operands)
char *name; rtx libcall;
enum rtx_code code; enum rtx_code code;
enum machine_mode mode; enum machine_mode mode;
rtx *operands; rtx *operands;
{ {
rtx ret; rtx ret;
rtx insns; rtx insns;
rtx libcall;
rtx equiv; rtx equiv;
start_sequence (); start_sequence ();
libcall = gen_rtx_SYMBOL_REF (Pmode, name);
ret = emit_library_call_value (libcall, NULL_RTX, 1, mode, 2, ret = emit_library_call_value (libcall, NULL_RTX, 1, mode, 2,
operands[1], mode, operands[2], mode); operands[1], mode, operands[2], mode);
equiv = gen_rtx_TRUNCATE (mode, equiv = gen_rtx_TRUNCATE (mode,
...@@ -2329,8 +2344,8 @@ c4x_shiftable_constant (op) ...@@ -2329,8 +2344,8 @@ c4x_shiftable_constant (op)
break; break;
} }
mask = ((0xffff >> i) << 16) | 0xffff; mask = ((0xffff >> i) << 16) | 0xffff;
if (IS_INT16_CONST (val & 0x80000000 ? (val >> i) | ~mask if (IS_INT16_CONST (val & (1 << 31) ? (val >> i) | ~mask
: (val >> i) & mask)) : (val >> i) & mask))
return i; return i;
return -1; return -1;
} }
...@@ -3000,7 +3015,6 @@ std_reg_operand (op, mode) ...@@ -3000,7 +3015,6 @@ std_reg_operand (op, mode)
return REG_P (op) && IS_STD_OR_PSEUDO_REG (op); return REG_P (op) && IS_STD_OR_PSEUDO_REG (op);
} }
/* Standard precision or normal register. */ /* Standard precision or normal register. */
int int
......
...@@ -1462,7 +1462,6 @@ CUMULATIVE_ARGS; ...@@ -1462,7 +1462,6 @@ CUMULATIVE_ARGS;
#define FFS_LIBCALL "__ffs" #define FFS_LIBCALL "__ffs"
#define INIT_TARGET_OPTABS \ #define INIT_TARGET_OPTABS \
do { \ do { \
smul_optab->handlers[(int) QImode].libfunc \ smul_optab->handlers[(int) QImode].libfunc \
...@@ -1493,6 +1492,26 @@ CUMULATIVE_ARGS; ...@@ -1493,6 +1492,26 @@ CUMULATIVE_ARGS;
= init_one_libfunc (UMODHI3_LIBCALL); \ = init_one_libfunc (UMODHI3_LIBCALL); \
ffs_optab->handlers[(int) QImode].libfunc \ ffs_optab->handlers[(int) QImode].libfunc \
= init_one_libfunc (FFS_LIBCALL); \ = init_one_libfunc (FFS_LIBCALL); \
smulhi3_libfunc \
= init_one_libfunc(SMULHI3_LIBCALL); \
umulhi3_libfunc \
= init_one_libfunc(UMULHI3_LIBCALL); \
fix_truncqfhi2_libfunc \
= init_one_libfunc(FIX_TRUNCQFHI2_LIBCALL); \
fixuns_truncqfhi2_libfunc \
= init_one_libfunc(FIXUNS_TRUNCQFHI2_LIBCALL); \
fix_trunchfhi2_libfunc \
= init_one_libfunc(FIX_TRUNCHFHI2_LIBCALL); \
fixuns_trunchfhi2_libfunc \
= init_one_libfunc(FIXUNS_TRUNCHFHI2_LIBCALL); \
floathiqf2_libfunc \
= init_one_libfunc(FLOATHIQF2_LIBCALL); \
floatunshiqf2_libfunc \
= init_one_libfunc(FLOATUNSHIQF2_LIBCALL); \
floathihf2_libfunc \
= init_one_libfunc(FLOATHIHF2_LIBCALL); \
floatunshihf2_libfunc \
= init_one_libfunc(FLOATUNSHIHF2_LIBCALL); \
} while (0) } while (0)
#define TARGET_MEM_FUNCTIONS #define TARGET_MEM_FUNCTIONS
......
...@@ -2084,7 +2084,8 @@ ...@@ -2084,7 +2084,8 @@
operands[2])); operands[2]));
DONE; DONE;
} }
c4x_emit_libcall3 (MULQI3_LIBCALL, MULT, QImode, operands); c4x_emit_libcall3 (smul_optab->handlers[(int) QImode].libfunc,
MULT, QImode, operands);
DONE; DONE;
} }
") ")
...@@ -2295,7 +2296,7 @@ ...@@ -2295,7 +2296,7 @@
"legitimize_operands (MULT, operands, QImode); "legitimize_operands (MULT, operands, QImode);
if (TARGET_C3X) if (TARGET_C3X)
{ {
c4x_emit_libcall_mulhi (SMULHI3_LIBCALL, SIGN_EXTEND, QImode, operands); c4x_emit_libcall_mulhi (smulhi3_libfunc, SIGN_EXTEND, QImode, operands);
DONE; DONE;
} }
") ")
...@@ -2352,7 +2353,7 @@ ...@@ -2352,7 +2353,7 @@
"legitimize_operands (MULT, operands, QImode); "legitimize_operands (MULT, operands, QImode);
if (TARGET_C3X) if (TARGET_C3X)
{ {
c4x_emit_libcall_mulhi (UMULHI3_LIBCALL, ZERO_EXTEND, QImode, operands); c4x_emit_libcall_mulhi (umulhi3_libfunc, ZERO_EXTEND, QImode, operands);
DONE; DONE;
} }
") ")
...@@ -3747,7 +3748,7 @@ ...@@ -3747,7 +3748,7 @@
(fix:HI (match_operand:QF 1 "src_operand" ""))) (fix:HI (match_operand:QF 1 "src_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall (FIX_TRUNCQFHI2_LIBCALL, FIX, HImode, QFmode, 2, operands); "c4x_emit_libcall (fix_truncqfhi2_libfunc, FIX, HImode, QFmode, 2, operands);
DONE;") DONE;")
; Is this allowed to be implementation dependent? If so, we can ; Is this allowed to be implementation dependent? If so, we can
...@@ -3770,7 +3771,7 @@ ...@@ -3770,7 +3771,7 @@
(unsigned_fix:HI (match_operand:QF 1 "src_operand" ""))) (unsigned_fix:HI (match_operand:QF 1 "src_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall (FIXUNS_TRUNCQFHI2_LIBCALL, UNSIGNED_FIX, "c4x_emit_libcall (fixuns_truncqfhi2_libfunc, UNSIGNED_FIX,
HImode, QFmode, 2, operands); HImode, QFmode, 2, operands);
DONE;") DONE;")
...@@ -5905,7 +5906,7 @@ ...@@ -5905,7 +5906,7 @@
(fix:HI (match_operand:HF 1 "reg_operand" ""))) (fix:HI (match_operand:HF 1 "reg_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall (FIX_TRUNCHFHI2_LIBCALL, FIX, HImode, HFmode, 2, operands); "c4x_emit_libcall (fix_trunchfhi2_libfunc, FIX, HImode, HFmode, 2, operands);
DONE;") DONE;")
(define_expand "fixuns_trunchfhi2" (define_expand "fixuns_trunchfhi2"
...@@ -5913,7 +5914,7 @@ ...@@ -5913,7 +5914,7 @@
(unsigned_fix:HI (match_operand:HF 1 "reg_operand" ""))) (unsigned_fix:HI (match_operand:HF 1 "reg_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall (FIXUNS_TRUNCHFHI2_LIBCALL, UNSIGNED_FIX, "c4x_emit_libcall (fixuns_trunchfhi2_libfunc, UNSIGNED_FIX,
HImode, HFmode, 2, operands); HImode, HFmode, 2, operands);
DONE;") DONE;")
...@@ -6254,7 +6255,7 @@ ...@@ -6254,7 +6255,7 @@
(float:QF (match_operand:HI 1 "src_operand" ""))) (float:QF (match_operand:HI 1 "src_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall (FLOATHIQF2_LIBCALL, FLOAT, QFmode, HImode, 2, operands); "c4x_emit_libcall (floathiqf2_libfunc, FLOAT, QFmode, HImode, 2, operands);
DONE;") DONE;")
(define_expand "floatunshiqf2" (define_expand "floatunshiqf2"
...@@ -6262,7 +6263,7 @@ ...@@ -6262,7 +6263,7 @@
(unsigned_float:QF (match_operand:HI 1 "src_operand" ""))) (unsigned_float:QF (match_operand:HI 1 "src_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall (FLOATUNSHIQF2_LIBCALL, UNSIGNED_FLOAT, "c4x_emit_libcall (floatunshiqf2_libfunc, UNSIGNED_FLOAT,
QFmode, HImode, 2, operands); QFmode, HImode, 2, operands);
DONE;") DONE;")
...@@ -6271,7 +6272,7 @@ ...@@ -6271,7 +6272,7 @@
(float:HF (match_operand:HI 1 "src_operand" ""))) (float:HF (match_operand:HI 1 "src_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall (FLOATHIHF2_LIBCALL, FLOAT, HFmode, HImode, 2, operands); "c4x_emit_libcall (floathihf2_libfunc, FLOAT, HFmode, HImode, 2, operands);
DONE;") DONE;")
(define_expand "floatunshihf2" (define_expand "floatunshihf2"
...@@ -6279,7 +6280,7 @@ ...@@ -6279,7 +6280,7 @@
(unsigned_float:HF (match_operand:HI 1 "src_operand" ""))) (unsigned_float:HF (match_operand:HI 1 "src_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall (FLOATUNSHIHF2_LIBCALL, UNSIGNED_FLOAT, "c4x_emit_libcall (floatunshihf2_libfunc, UNSIGNED_FLOAT,
HFmode, HImode, 2, operands); HFmode, HImode, 2, operands);
DONE;") DONE;")
...@@ -6846,7 +6847,8 @@ ...@@ -6846,7 +6847,8 @@
(match_operand:HI 2 "src_operand" ""))) (match_operand:HI 2 "src_operand" "")))
(clobber (reg:CC 21))])] (clobber (reg:CC 21))])]
"" ""
"c4x_emit_libcall3 (MULHI3_LIBCALL, MULT, HImode, operands); "c4x_emit_libcall3 (smul_optab->handlers[(int) HImode].libfunc,
MULT, HImode, operands);
DONE;") DONE;")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment