Commit 0744333e by Jozef Lawrynowicz Committed by Jozef Lawrynowicz

msp430-protos.h (msp430_has_hwmult): New.

2019-10-23  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/msp430/msp430-protos.h (msp430_has_hwmult): New.
	* config/msp430/msp430.c (msp430_no_hwmult): Remove.
	(msp430_has_hwmult): New.
	(msp430_output_labelref):
	s/msp430_hwmult_type != MSP430_HWMULT_NONE/msp430_has_hwmult ()/
	* config/msp430/msp430.md (mulhisi3): Likewise.
	(umulhisi3): Likewise.
	(mulsidi3): Likewise.
	(umulsidi3): Likewise.

From-SVN: r277341
parent 91c64455
2019-10-23 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/msp430/msp430-protos.h (msp430_has_hwmult): New.
* config/msp430/msp430.c (msp430_no_hwmult): Remove.
(msp430_has_hwmult): New.
(msp430_output_labelref):
s/msp430_hwmult_type != MSP430_HWMULT_NONE/msp430_has_hwmult ()/
* config/msp430/msp430.md (mulhisi3): Likewise.
(umulhisi3): Likewise.
(mulsidi3): Likewise.
(umulsidi3): Likewise.
2019-10-23 Jan Hubicka <hubicka@ucw.cz> 2019-10-23 Jan Hubicka <hubicka@ucw.cz>
PR ipa/92074 PR ipa/92074
...@@ -48,6 +48,7 @@ int msp430_split_addsi (rtx *); ...@@ -48,6 +48,7 @@ int msp430_split_addsi (rtx *);
void msp430_start_function (FILE *, const char *, tree); void msp430_start_function (FILE *, const char *, tree);
rtx msp430_subreg (machine_mode, rtx, machine_mode, int); rtx msp430_subreg (machine_mode, rtx, machine_mode, int);
bool msp430_use_f5_series_hwmult (void); bool msp430_use_f5_series_hwmult (void);
bool msp430_has_hwmult (void);
bool msp430_op_not_in_high_mem (rtx op); bool msp430_op_not_in_high_mem (rtx op);
#endif /* GCC_MSP430_PROTOS_H */ #endif /* GCC_MSP430_PROTOS_H */
...@@ -3097,20 +3097,22 @@ use_32bit_hwmult (void) ...@@ -3097,20 +3097,22 @@ use_32bit_hwmult (void)
/* Returns true if the current MCU does not have a /* Returns true if the current MCU does not have a
hardware multiplier of any kind. */ hardware multiplier of any kind. */
static bool bool
msp430_no_hwmult (void) msp430_has_hwmult (void)
{ {
static const char * cached_match = NULL; static const char * cached_match = NULL;
static bool cached_result; static bool cached_result;
if (msp430_hwmult_type == MSP430_HWMULT_NONE) if (msp430_hwmult_type == MSP430_HWMULT_NONE)
return true; return false;
/* TRUE for any other explicit hwmult specified. */
if (msp430_hwmult_type != MSP430_HWMULT_AUTO) if (msp430_hwmult_type != MSP430_HWMULT_AUTO)
return false; return true;
/* Now handle -mhwmult=auto. */
if (target_mcu == NULL) if (target_mcu == NULL)
return true; return false;
if (target_mcu == cached_match) if (target_mcu == cached_match)
return cached_result; return cached_result;
...@@ -3119,11 +3121,11 @@ msp430_no_hwmult (void) ...@@ -3119,11 +3121,11 @@ msp430_no_hwmult (void)
msp430_extract_mcu_data (target_mcu); msp430_extract_mcu_data (target_mcu);
if (extracted_mcu_data.name != NULL) if (extracted_mcu_data.name != NULL)
return cached_result = extracted_mcu_data.hwmpy == 0; return cached_result = extracted_mcu_data.hwmpy != 0;
/* If we do not recognise the MCU name, we assume that it does not support /* If we do not recognise the MCU name, we assume that it does not support
any kind of hardware multiply - this is the safest assumption to make. */ any kind of hardware multiply - this is the safest assumption to make. */
return cached_result = true; return cached_result = false;
} }
/* This function does the same as the default, but it will replace GCC /* This function does the same as the default, but it will replace GCC
...@@ -3143,13 +3145,13 @@ msp430_output_labelref (FILE *file, const char *name) ...@@ -3143,13 +3145,13 @@ msp430_output_labelref (FILE *file, const char *name)
/* If we have been given a specific MCU name then we may be /* If we have been given a specific MCU name then we may be
able to make use of its hardware multiply capabilities. */ able to make use of its hardware multiply capabilities. */
if (msp430_hwmult_type != MSP430_HWMULT_NONE) if (msp430_has_hwmult ())
{ {
if (strcmp ("__mspabi_mpyi", name) == 0) if (strcmp ("__mspabi_mpyi", name) == 0)
{ {
if (msp430_use_f5_series_hwmult ()) if (msp430_use_f5_series_hwmult ())
name = "__mulhi2_f5"; name = "__mulhi2_f5";
else if (! msp430_no_hwmult ()) else
name = "__mulhi2"; name = "__mulhi2";
} }
else if (strcmp ("__mspabi_mpyl", name) == 0) else if (strcmp ("__mspabi_mpyl", name) == 0)
...@@ -3158,7 +3160,7 @@ msp430_output_labelref (FILE *file, const char *name) ...@@ -3158,7 +3160,7 @@ msp430_output_labelref (FILE *file, const char *name)
name = "__mulsi2_f5"; name = "__mulsi2_f5";
else if (use_32bit_hwmult ()) else if (use_32bit_hwmult ())
name = "__mulsi2_hw32"; name = "__mulsi2_hw32";
else if (! msp430_no_hwmult ()) else
name = "__mulsi2"; name = "__mulsi2";
} }
} }
......
...@@ -1642,7 +1642,7 @@ ...@@ -1642,7 +1642,7 @@
[(set (match_operand:SI 0 "register_operand" "=r") [(set (match_operand:SI 0 "register_operand" "=r")
(mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%0")) (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%0"))
(sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))] (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
"optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE" "optimize > 2 && msp430_has_hwmult ()"
"* "*
if (msp430_use_f5_series_hwmult ()) if (msp430_use_f5_series_hwmult ())
return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x04C2 { MOV.W %2, &0x04C8 { MOV.W &0x04CA, %L0 { MOV.W &0x04CC, %H0 { POP.W sr\"; return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x04C2 { MOV.W %2, &0x04C8 { MOV.W &0x04CA, %L0 { MOV.W &0x04CC, %H0 { POP.W sr\";
...@@ -1655,7 +1655,7 @@ ...@@ -1655,7 +1655,7 @@
[(set (match_operand:SI 0 "register_operand" "=r") [(set (match_operand:SI 0 "register_operand" "=r")
(mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "%0")) (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "%0"))
(zero_extend:SI (match_operand:HI 2 "register_operand" "r"))))] (zero_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
"optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE" "optimize > 2 && msp430_has_hwmult ()"
"* "*
if (msp430_use_f5_series_hwmult ()) if (msp430_use_f5_series_hwmult ())
return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x04C0 { MOV.W %2, &0x04C8 { MOV.W &0x04CA, %L0 { MOV.W &0x04CC, %H0 { POP.W sr\"; return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x04C0 { MOV.W %2, &0x04C8 { MOV.W &0x04CA, %L0 { MOV.W &0x04CC, %H0 { POP.W sr\";
...@@ -1668,7 +1668,7 @@ ...@@ -1668,7 +1668,7 @@
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%0")) (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%0"))
(sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))] (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
"optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE" "optimize > 2 && msp430_has_hwmult ()"
"* "*
if (msp430_use_f5_series_hwmult ()) if (msp430_use_f5_series_hwmult ())
return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x04D4 { MOV.W %H1, &0x04D6 { MOV.W %L2, &0x04E0 { MOV.W %H2, &0x04E2 { MOV.W &0x04E4, %A0 { MOV.W &0x04E6, %B0 { MOV.W &0x04E8, %C0 { MOV.W &0x04EA, %D0 { POP.W sr\"; return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x04D4 { MOV.W %H1, &0x04D6 { MOV.W %L2, &0x04E0 { MOV.W %H2, &0x04E2 { MOV.W &0x04E4, %A0 { MOV.W &0x04E6, %B0 { MOV.W &0x04E8, %C0 { MOV.W &0x04EA, %D0 { POP.W sr\";
...@@ -1681,7 +1681,7 @@ ...@@ -1681,7 +1681,7 @@
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0")) (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
(zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))] (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
"optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE" "optimize > 2 && msp430_has_hwmult ()"
"* "*
if (msp430_use_f5_series_hwmult ()) if (msp430_use_f5_series_hwmult ())
return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x04D0 { MOV.W %H1, &0x04D2 { MOV.W %L2, &0x04E0 { MOV.W %H2, &0x04E2 { MOV.W &0x04E4, %A0 { MOV.W &0x04E6, %B0 { MOV.W &0x04E8, %C0 { MOV.W &0x04EA, %D0 { POP.W sr\"; return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x04D0 { MOV.W %H1, &0x04D2 { MOV.W %L2, &0x04E0 { MOV.W %H2, &0x04E2 { MOV.W &0x04E4, %A0 { MOV.W &0x04E6, %B0 { MOV.W &0x04E8, %C0 { MOV.W &0x04EA, %D0 { POP.W sr\";
......
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