* [PATCH 1/6] [MIPS] Split Loongson EXTensions (EXT) instructions from loongson3a
@ 2018-09-03 12:38 Paul Hua
2018-09-03 12:38 ` [PATCH 2/6] " Paul Hua
0 siblings, 1 reply; 3+ messages in thread
From: Paul Hua @ 2018-09-03 12:38 UTC (permalink / raw)
To: gcc-patches; +Cc: Matthew Fortune
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0002-MIPS-Add-support-for-Loongson-EXT-istructions.patch --]
[-- Type: text/x-patch, Size: 6137 bytes --]
From fbe1d77d63f6224126ff4cdfef439182265b1682 Mon Sep 17 00:00:00 2001
From: Chenghua Xu <paul.hua.gm@gmail.com>
Date: Fri, 31 Aug 2018 11:52:33 +0800
Subject: [PATCH 2/6] [MIPS] Add support for Loongson EXT istructions.
gcc/
* config/mips/mips.c (mips_option_override): Default enable
Loongson EXT on Loongson 3a target.
* config/mips/mips.h (TARGET_CPU_CPP_BUILTINS): Add
__mips_loongson_ext.
(ASM_SPEC): Add mloongson-ext and mno-loongson-ext.
* config/mips/mips.md (mul<mode>3, mul<mode>3_mul3_nohilo,
<u>div<mode>3, <u>mod<mode>3, prefetch): Use TARGET_LOONGSON_EXT
instead of TARGET_LOONGSON_3A.
* config/mips/mips.opt: Add -mloongson-ext option.
gcc/testsuite/
* gcc.target/mips/mips.exp (mips_option_groups): Add
-mloongson-ext option.
---
gcc/config/mips/mips.c | 5 +++++
gcc/config/mips/mips.h | 7 +++++++
gcc/config/mips/mips.md | 16 ++++++++--------
gcc/config/mips/mips.opt | 4 ++++
gcc/testsuite/gcc.target/mips/mips.exp | 1 +
5 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index a804f70..019a6dc 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -20178,6 +20178,11 @@ mips_option_override (void)
|| (strcmp (mips_arch_info->name, "loongson3a") == 0)))
target_flags |= MASK_LOONGSON_MMI;
+ /* Default to enable Loongson EXT on Longson 3a target. */
+ if ((target_flags_explicit & MASK_LOONGSON_EXT) == 0
+ && (strcmp (mips_arch_info->name, "loongson3a") == 0))
+ target_flags |= MASK_LOONGSON_EXT;
+
/* .eh_frame addresses should be the same width as a C pointer.
Most MIPS ABIs support only one pointer size, so the assembler
will usually know exactly how big an .eh_frame address is.
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 3563c1d..e0e78ba 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -596,6 +596,12 @@ struct mips_cpu_info {
builtin_define ("__mips_loongson_mmi"); \
} \
\
+ /* Whether Loongson EXT modes are enabled. */ \
+ if (TARGET_LOONGSON_EXT) \
+ { \
+ builtin_define ("__mips_loongson_ext"); \
+ } \
+ \
/* Historical Octeon macro. */ \
if (TARGET_OCTEON) \
builtin_define ("__OCTEON__"); \
@@ -1355,6 +1361,7 @@ struct mips_cpu_info {
%{mginv} %{mno-ginv} \
%{mmsa} %{mno-msa} \
%{mloongson-mmi} %{mno-loongson-mmi} \
+%{mloongson-ext} %{mno-loongson-ext} \
%{msmartmips} %{mno-smartmips} \
%{mmt} %{mno-mt} \
%{mfix-rm7000} %{mno-fix-rm7000} \
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index a88c1c5..4b7a627 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -1599,7 +1599,7 @@
{
rtx lo;
- if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6<D>MUL)
+ if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT || ISA_HAS_R6<D>MUL)
emit_insn (gen_mul<mode>3_mul3_nohilo (operands[0], operands[1],
operands[2]));
else if (ISA_HAS_<D>MUL3)
@@ -1622,11 +1622,11 @@
[(set (match_operand:GPR 0 "register_operand" "=d")
(mult:GPR (match_operand:GPR 1 "register_operand" "d")
(match_operand:GPR 2 "register_operand" "d")))]
- "TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6<D>MUL"
+ "TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT || ISA_HAS_R6<D>MUL"
{
if (TARGET_LOONGSON_2EF)
return "<d>multu.g\t%0,%1,%2";
- else if (TARGET_LOONGSON_3A)
+ else if (TARGET_LOONGSON_EXT)
return "gs<d>multu\t%0,%1,%2";
else
return "<d>mul\t%0,%1,%2";
@@ -3016,11 +3016,11 @@
[(set (match_operand:GPR 0 "register_operand" "=&d")
(any_div:GPR (match_operand:GPR 1 "register_operand" "d")
(match_operand:GPR 2 "register_operand" "d")))]
- "TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6<D>DIV"
+ "TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT || ISA_HAS_R6<D>DIV"
{
if (TARGET_LOONGSON_2EF)
return mips_output_division ("<d>div<u>.g\t%0,%1,%2", operands);
- else if (TARGET_LOONGSON_3A)
+ else if (TARGET_LOONGSON_EXT)
return mips_output_division ("gs<d>div<u>\t%0,%1,%2", operands);
else
return mips_output_division ("<d>div<u>\t%0,%1,%2", operands);
@@ -3032,11 +3032,11 @@
[(set (match_operand:GPR 0 "register_operand" "=&d")
(any_mod:GPR (match_operand:GPR 1 "register_operand" "d")
(match_operand:GPR 2 "register_operand" "d")))]
- "TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6<D>DIV"
+ "TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT || ISA_HAS_R6<D>DIV"
{
if (TARGET_LOONGSON_2EF)
return mips_output_division ("<d>mod<u>.g\t%0,%1,%2", operands);
- else if (TARGET_LOONGSON_3A)
+ else if (TARGET_LOONGSON_EXT)
return mips_output_division ("gs<d>mod<u>\t%0,%1,%2", operands);
else
return mips_output_division ("<d>mod<u>\t%0,%1,%2", operands);
@@ -7136,7 +7136,7 @@
(match_operand 2 "const_int_operand" "n"))]
"ISA_HAS_PREFETCH && TARGET_EXPLICIT_RELOCS"
{
- if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A)
+ if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT)
{
/* Loongson 2[ef] and Loongson 3a use load to $0 for prefetching. */
if (TARGET_64BIT)
diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
index 6767c47..a8fe8db 100644
--- a/gcc/config/mips/mips.opt
+++ b/gcc/config/mips/mips.opt
@@ -463,3 +463,7 @@ Enum(mips_cb_setting) String(always) Value(MIPS_CB_ALWAYS)
mloongson-mmi
Target Report Mask(LOONGSON_MMI)
Use Loongson MultiMedia extensions Instructions (MMI) instructions.
+
+mloongson-ext
+Target Report Mask(LOONGSON_EXT)
+Use Loongson EXTension (EXT) instructions.
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index 4045c59..70f7a99 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -297,6 +297,7 @@ foreach option {
odd-spreg
msa
loongson-mmi
+ loongson-ext
} {
lappend mips_option_groups $option "-m(no-|)$option"
}
--
1.7.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/6] [MIPS] Split Loongson EXTensions (EXT) instructions from loongson3a
2018-09-03 12:38 [PATCH 1/6] [MIPS] Split Loongson EXTensions (EXT) instructions from loongson3a Paul Hua
@ 2018-09-03 12:38 ` Paul Hua
2018-09-04 3:54 ` [PATCH v2 " Paul Hua
0 siblings, 1 reply; 3+ messages in thread
From: Paul Hua @ 2018-09-03 12:38 UTC (permalink / raw)
To: gcc-patches; +Cc: Matthew Fortune
sorry, it's should be [PATCH 2/6] not [PATCH 1/6] .
On Mon, Sep 3, 2018 at 8:30 PM Paul Hua <paul.hua.gm@gmail.com> wrote:
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 2/6] [MIPS] Split Loongson EXTensions (EXT) instructions from loongson3a
2018-09-03 12:38 ` [PATCH 2/6] " Paul Hua
@ 2018-09-04 3:54 ` Paul Hua
0 siblings, 0 replies; 3+ messages in thread
From: Paul Hua @ 2018-09-04 3:54 UTC (permalink / raw)
To: gcc-patches; +Cc: Matthew Fortune
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
On Mon, Sep 3, 2018 at 8:37 PM Paul Hua <paul.hua.gm@gmail.com> wrote:
>
> sorry, it's should be [PATCH 2/6] not [PATCH 1/6] .
>
> On Mon, Sep 3, 2018 at 8:30 PM Paul Hua <paul.hua.gm@gmail.com> wrote:
> >
> >
Hi:
The v2 patch add:
* gcc/doc/invoke.texi (-mloongson-ext): Document.
Thanks
Paul Hua
[-- Attachment #2: 0002-MIPS-Add-support-for-Loongson-EXT-istructions.patch --]
[-- Type: text/x-patch, Size: 7171 bytes --]
From e71973c5446ba529171f5934b92c3dc33842c612 Mon Sep 17 00:00:00 2001
From: Chenghua Xu <paul.hua.gm@gmail.com>
Date: Fri, 31 Aug 2018 11:52:33 +0800
Subject: [PATCH 2/6] [MIPS] Add support for Loongson EXT istructions.
gcc/
* config/mips/mips.c (mips_option_override): Default enable
Loongson EXT on Loongson 3a target.
* config/mips/mips.h (TARGET_CPU_CPP_BUILTINS): Add
__mips_loongson_ext.
(ASM_SPEC): Add mloongson-ext and mno-loongson-ext.
* config/mips/mips.md (mul<mode>3, mul<mode>3_mul3_nohilo,
<u>div<mode>3, <u>mod<mode>3, prefetch): Use TARGET_LOONGSON_EXT
instead of TARGET_LOONGSON_3A.
* config/mips/mips.opt (-mloongson-ext): Add option.
* gcc/doc/invoke.texi (-mloongson-ext): Document.
gcc/testsuite/
* gcc.target/mips/mips.exp (mips_option_groups): Add
-mloongson-ext option.
---
gcc/config/mips/mips.c | 5 +++++
gcc/config/mips/mips.h | 7 +++++++
gcc/config/mips/mips.md | 16 ++++++++--------
gcc/config/mips/mips.opt | 4 ++++
gcc/doc/invoke.texi | 7 +++++++
gcc/testsuite/gcc.target/mips/mips.exp | 1 +
6 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index a804f70..019a6dc 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -20178,6 +20178,11 @@ mips_option_override (void)
|| (strcmp (mips_arch_info->name, "loongson3a") == 0)))
target_flags |= MASK_LOONGSON_MMI;
+ /* Default to enable Loongson EXT on Longson 3a target. */
+ if ((target_flags_explicit & MASK_LOONGSON_EXT) == 0
+ && (strcmp (mips_arch_info->name, "loongson3a") == 0))
+ target_flags |= MASK_LOONGSON_EXT;
+
/* .eh_frame addresses should be the same width as a C pointer.
Most MIPS ABIs support only one pointer size, so the assembler
will usually know exactly how big an .eh_frame address is.
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 3563c1d..e0e78ba 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -596,6 +596,12 @@ struct mips_cpu_info {
builtin_define ("__mips_loongson_mmi"); \
} \
\
+ /* Whether Loongson EXT modes are enabled. */ \
+ if (TARGET_LOONGSON_EXT) \
+ { \
+ builtin_define ("__mips_loongson_ext"); \
+ } \
+ \
/* Historical Octeon macro. */ \
if (TARGET_OCTEON) \
builtin_define ("__OCTEON__"); \
@@ -1355,6 +1361,7 @@ struct mips_cpu_info {
%{mginv} %{mno-ginv} \
%{mmsa} %{mno-msa} \
%{mloongson-mmi} %{mno-loongson-mmi} \
+%{mloongson-ext} %{mno-loongson-ext} \
%{msmartmips} %{mno-smartmips} \
%{mmt} %{mno-mt} \
%{mfix-rm7000} %{mno-fix-rm7000} \
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index a88c1c5..4b7a627 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -1599,7 +1599,7 @@
{
rtx lo;
- if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6<D>MUL)
+ if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT || ISA_HAS_R6<D>MUL)
emit_insn (gen_mul<mode>3_mul3_nohilo (operands[0], operands[1],
operands[2]));
else if (ISA_HAS_<D>MUL3)
@@ -1622,11 +1622,11 @@
[(set (match_operand:GPR 0 "register_operand" "=d")
(mult:GPR (match_operand:GPR 1 "register_operand" "d")
(match_operand:GPR 2 "register_operand" "d")))]
- "TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6<D>MUL"
+ "TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT || ISA_HAS_R6<D>MUL"
{
if (TARGET_LOONGSON_2EF)
return "<d>multu.g\t%0,%1,%2";
- else if (TARGET_LOONGSON_3A)
+ else if (TARGET_LOONGSON_EXT)
return "gs<d>multu\t%0,%1,%2";
else
return "<d>mul\t%0,%1,%2";
@@ -3016,11 +3016,11 @@
[(set (match_operand:GPR 0 "register_operand" "=&d")
(any_div:GPR (match_operand:GPR 1 "register_operand" "d")
(match_operand:GPR 2 "register_operand" "d")))]
- "TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6<D>DIV"
+ "TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT || ISA_HAS_R6<D>DIV"
{
if (TARGET_LOONGSON_2EF)
return mips_output_division ("<d>div<u>.g\t%0,%1,%2", operands);
- else if (TARGET_LOONGSON_3A)
+ else if (TARGET_LOONGSON_EXT)
return mips_output_division ("gs<d>div<u>\t%0,%1,%2", operands);
else
return mips_output_division ("<d>div<u>\t%0,%1,%2", operands);
@@ -3032,11 +3032,11 @@
[(set (match_operand:GPR 0 "register_operand" "=&d")
(any_mod:GPR (match_operand:GPR 1 "register_operand" "d")
(match_operand:GPR 2 "register_operand" "d")))]
- "TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6<D>DIV"
+ "TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT || ISA_HAS_R6<D>DIV"
{
if (TARGET_LOONGSON_2EF)
return mips_output_division ("<d>mod<u>.g\t%0,%1,%2", operands);
- else if (TARGET_LOONGSON_3A)
+ else if (TARGET_LOONGSON_EXT)
return mips_output_division ("gs<d>mod<u>\t%0,%1,%2", operands);
else
return mips_output_division ("<d>mod<u>\t%0,%1,%2", operands);
@@ -7136,7 +7136,7 @@
(match_operand 2 "const_int_operand" "n"))]
"ISA_HAS_PREFETCH && TARGET_EXPLICIT_RELOCS"
{
- if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A)
+ if (TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT)
{
/* Loongson 2[ef] and Loongson 3a use load to $0 for prefetching. */
if (TARGET_64BIT)
diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
index 6767c47..a8fe8db 100644
--- a/gcc/config/mips/mips.opt
+++ b/gcc/config/mips/mips.opt
@@ -463,3 +463,7 @@ Enum(mips_cb_setting) String(always) Value(MIPS_CB_ALWAYS)
mloongson-mmi
Target Report Mask(LOONGSON_MMI)
Use Loongson MultiMedia extensions Instructions (MMI) instructions.
+
+mloongson-ext
+Target Report Mask(LOONGSON_EXT)
+Use Loongson EXTension (EXT) instructions.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 3db96f2..bfbfafc 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -918,6 +918,7 @@ Objective-C and Objective-C++ Dialects}.
-mmicromips -mno-micromips @gol
-mmsa -mno-msa @gol
-mloongson-mmi -mno-loongson-mmi @gol
+-mloongson-ext -mno-loongson-ext @gol
-mfpu=@var{fpu-type} @gol
-msmartmips -mno-smartmips @gol
-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
@@ -21050,6 +21051,12 @@ Use (do not use) the MIPS Global INValidate (GINV) instructions.
@opindex mno-loongson-mmi
Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
+@item -mloongson-ext
+@itemx -mno-loongson-ext
+@opindex mloongson-ext
+@opindex mno-loongson-ext
+Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
+
@item -mlong64
@opindex mlong64
Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index 4045c59..70f7a99 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -297,6 +297,7 @@ foreach option {
odd-spreg
msa
loongson-mmi
+ loongson-ext
} {
lappend mips_option_groups $option "-m(no-|)$option"
}
--
1.7.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-04 3:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-03 12:38 [PATCH 1/6] [MIPS] Split Loongson EXTensions (EXT) instructions from loongson3a Paul Hua
2018-09-03 12:38 ` [PATCH 2/6] " Paul Hua
2018-09-04 3:54 ` [PATCH v2 " Paul Hua
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).