* [PATCH] i386: Add a constraint for absolute symboilc address [PR 105576]
@ 2022-05-18 7:31 Hongyu Wang
2022-05-18 9:45 ` Uros Bizjak
0 siblings, 1 reply; 5+ messages in thread
From: Hongyu Wang @ 2022-05-18 7:31 UTC (permalink / raw)
To: ubizjak; +Cc: hongtao.liu, gcc-patches
Hi,
This patch adds a constraint "Ws" to allow absolute symbolic address for either
function or variable. This also works under -mcmodel=large.
Bootstrapped/regtested on x86_64-pc-linux-gnu{-m32,}
Ok for master?
gcc/ChangeLog:
PR target/105576
* config/i386/constraints.md (Ws): New constraint.
* config/i386/i386-protos.h (ix86_symbolic_address_p):
New proto type.
* config/i386/i386.cc (ix86_symbolic_address_p):
New function to ensure a rtx is a symbolic address.
gcc/testsuite/ChangeLog:
PR target/105576
* gcc.target/i386/pr105576.c: New test.
---
gcc/config/i386/constraints.md | 4 ++++
gcc/config/i386/i386-protos.h | 1 +
gcc/config/i386/i386.cc | 7 +++++++
gcc/testsuite/gcc.target/i386/pr105576.c | 11 +++++++++++
4 files changed, 23 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/i386/pr105576.c
diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
index 7361687632f..ec0702be368 100644
--- a/gcc/config/i386/constraints.md
+++ b/gcc/config/i386/constraints.md
@@ -348,6 +348,10 @@ (define_constraint "Z"
instructions)."
(match_operand 0 "x86_64_zext_immediate_operand"))
+(define_constraint "Ws"
+ "A constraint that matches an absolute symbolic address."
+ (match_test "ix86_symbolic_address_p (op)"))
+
;; T prefix is used for different address constraints
;; v - VSIB address
;; s - address with no segment register
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 3596ce81ecf..2b8d063850f 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -337,6 +337,7 @@ extern void x86_output_aligned_bss (FILE *, tree, const char *,
unsigned HOST_WIDE_INT, unsigned);
extern void x86_elf_aligned_decl_common (FILE *, tree, const char *,
unsigned HOST_WIDE_INT, unsigned);
+extern bool ix86_symbolic_address_p (rtx x);
#ifdef RTX_CODE
extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 86752a6516a..76728d10c8d 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -23956,6 +23956,13 @@ ix86_push_rounding (poly_int64 bytes)
return ROUND_UP (bytes, UNITS_PER_WORD);
}
+bool ix86_symbolic_address_p (rtx x)
+{
+ poly_int64 offset;
+ x = strip_offset (x, &offset);
+ return SYMBOL_REF_P (x) || LABEL_REF_P (x);
+}
+
/* Target-specific selftests. */
#if CHECKING_P
diff --git a/gcc/testsuite/gcc.target/i386/pr105576.c b/gcc/testsuite/gcc.target/i386/pr105576.c
new file mode 100644
index 00000000000..06dd860d3f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr105576.c
@@ -0,0 +1,11 @@
+/* PR target/105576 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mcmodel=large" } */
+
+extern int var;
+void *addr(void) { return &var; }
+void addr_via_asm(void)
+{
+ asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(addr));
+ asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(&var));
+}
--
2.18.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i386: Add a constraint for absolute symboilc address [PR 105576]
2022-05-18 7:31 [PATCH] i386: Add a constraint for absolute symboilc address [PR 105576] Hongyu Wang
@ 2022-05-18 9:45 ` Uros Bizjak
2022-05-18 10:14 ` Hongyu Wang
0 siblings, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2022-05-18 9:45 UTC (permalink / raw)
To: Hongyu Wang; +Cc: Hongtao Liu, gcc-patches
On Wed, May 18, 2022 at 9:32 AM Hongyu Wang <hongyu.wang@intel.com> wrote:
>
> Hi,
>
> This patch adds a constraint "Ws" to allow absolute symbolic address for either
> function or variable. This also works under -mcmodel=large.
>
> Bootstrapped/regtested on x86_64-pc-linux-gnu{-m32,}
>
> Ok for master?
Maybe you should use:
asm ("%p0" :: "X"(addr));
asm ("%p0" :: "X"(&var));
instead.
Uros.
> gcc/ChangeLog:
>
> PR target/105576
> * config/i386/constraints.md (Ws): New constraint.
> * config/i386/i386-protos.h (ix86_symbolic_address_p):
> New proto type.
> * config/i386/i386.cc (ix86_symbolic_address_p):
> New function to ensure a rtx is a symbolic address.
>
> gcc/testsuite/ChangeLog:
>
> PR target/105576
> * gcc.target/i386/pr105576.c: New test.
> ---
> gcc/config/i386/constraints.md | 4 ++++
> gcc/config/i386/i386-protos.h | 1 +
> gcc/config/i386/i386.cc | 7 +++++++
> gcc/testsuite/gcc.target/i386/pr105576.c | 11 +++++++++++
> 4 files changed, 23 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/i386/pr105576.c
>
> diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
> index 7361687632f..ec0702be368 100644
> --- a/gcc/config/i386/constraints.md
> +++ b/gcc/config/i386/constraints.md
> @@ -348,6 +348,10 @@ (define_constraint "Z"
> instructions)."
> (match_operand 0 "x86_64_zext_immediate_operand"))
>
> +(define_constraint "Ws"
> + "A constraint that matches an absolute symbolic address."
> + (match_test "ix86_symbolic_address_p (op)"))
> +
> ;; T prefix is used for different address constraints
> ;; v - VSIB address
> ;; s - address with no segment register
> diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
> index 3596ce81ecf..2b8d063850f 100644
> --- a/gcc/config/i386/i386-protos.h
> +++ b/gcc/config/i386/i386-protos.h
> @@ -337,6 +337,7 @@ extern void x86_output_aligned_bss (FILE *, tree, const char *,
> unsigned HOST_WIDE_INT, unsigned);
> extern void x86_elf_aligned_decl_common (FILE *, tree, const char *,
> unsigned HOST_WIDE_INT, unsigned);
> +extern bool ix86_symbolic_address_p (rtx x);
>
> #ifdef RTX_CODE
> extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 86752a6516a..76728d10c8d 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -23956,6 +23956,13 @@ ix86_push_rounding (poly_int64 bytes)
> return ROUND_UP (bytes, UNITS_PER_WORD);
> }
>
> +bool ix86_symbolic_address_p (rtx x)
> +{
> + poly_int64 offset;
> + x = strip_offset (x, &offset);
> + return SYMBOL_REF_P (x) || LABEL_REF_P (x);
> +}
> +
> /* Target-specific selftests. */
>
> #if CHECKING_P
> diff --git a/gcc/testsuite/gcc.target/i386/pr105576.c b/gcc/testsuite/gcc.target/i386/pr105576.c
> new file mode 100644
> index 00000000000..06dd860d3f3
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr105576.c
> @@ -0,0 +1,11 @@
> +/* PR target/105576 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -mcmodel=large" } */
> +
> +extern int var;
> +void *addr(void) { return &var; }
> +void addr_via_asm(void)
> +{
> + asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(addr));
> + asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(&var));
> +}
> --
> 2.18.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i386: Add a constraint for absolute symboilc address [PR 105576]
2022-05-18 9:45 ` Uros Bizjak
@ 2022-05-18 10:14 ` Hongyu Wang
2022-05-18 10:18 ` Uros Bizjak
0 siblings, 1 reply; 5+ messages in thread
From: Hongyu Wang @ 2022-05-18 10:14 UTC (permalink / raw)
To: Uros Bizjak; +Cc: Hongyu Wang, Hongtao Liu, gcc-patches
Oh, I just found that asm ("%p0" :: "i"(addr)); also works on
-mcmodel=large in this case, please ignore this patch. Thanks.
Uros Bizjak via Gcc-patches <gcc-patches@gcc.gnu.org> 于2022年5月18日周三 17:46写道:
>
> On Wed, May 18, 2022 at 9:32 AM Hongyu Wang <hongyu.wang@intel.com> wrote:
> >
> > Hi,
> >
> > This patch adds a constraint "Ws" to allow absolute symbolic address for either
> > function or variable. This also works under -mcmodel=large.
> >
> > Bootstrapped/regtested on x86_64-pc-linux-gnu{-m32,}
> >
> > Ok for master?
>
> Maybe you should use:
>
> asm ("%p0" :: "X"(addr));
> asm ("%p0" :: "X"(&var));
>
> instead.
>
> Uros.
>
> > gcc/ChangeLog:
> >
> > PR target/105576
> > * config/i386/constraints.md (Ws): New constraint.
> > * config/i386/i386-protos.h (ix86_symbolic_address_p):
> > New proto type.
> > * config/i386/i386.cc (ix86_symbolic_address_p):
> > New function to ensure a rtx is a symbolic address.
> >
> > gcc/testsuite/ChangeLog:
> >
> > PR target/105576
> > * gcc.target/i386/pr105576.c: New test.
> > ---
> > gcc/config/i386/constraints.md | 4 ++++
> > gcc/config/i386/i386-protos.h | 1 +
> > gcc/config/i386/i386.cc | 7 +++++++
> > gcc/testsuite/gcc.target/i386/pr105576.c | 11 +++++++++++
> > 4 files changed, 23 insertions(+)
> > create mode 100644 gcc/testsuite/gcc.target/i386/pr105576.c
> >
> > diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
> > index 7361687632f..ec0702be368 100644
> > --- a/gcc/config/i386/constraints.md
> > +++ b/gcc/config/i386/constraints.md
> > @@ -348,6 +348,10 @@ (define_constraint "Z"
> > instructions)."
> > (match_operand 0 "x86_64_zext_immediate_operand"))
> >
> > +(define_constraint "Ws"
> > + "A constraint that matches an absolute symbolic address."
> > + (match_test "ix86_symbolic_address_p (op)"))
> > +
> > ;; T prefix is used for different address constraints
> > ;; v - VSIB address
> > ;; s - address with no segment register
> > diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
> > index 3596ce81ecf..2b8d063850f 100644
> > --- a/gcc/config/i386/i386-protos.h
> > +++ b/gcc/config/i386/i386-protos.h
> > @@ -337,6 +337,7 @@ extern void x86_output_aligned_bss (FILE *, tree, const char *,
> > unsigned HOST_WIDE_INT, unsigned);
> > extern void x86_elf_aligned_decl_common (FILE *, tree, const char *,
> > unsigned HOST_WIDE_INT, unsigned);
> > +extern bool ix86_symbolic_address_p (rtx x);
> >
> > #ifdef RTX_CODE
> > extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
> > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> > index 86752a6516a..76728d10c8d 100644
> > --- a/gcc/config/i386/i386.cc
> > +++ b/gcc/config/i386/i386.cc
> > @@ -23956,6 +23956,13 @@ ix86_push_rounding (poly_int64 bytes)
> > return ROUND_UP (bytes, UNITS_PER_WORD);
> > }
> >
> > +bool ix86_symbolic_address_p (rtx x)
> > +{
> > + poly_int64 offset;
> > + x = strip_offset (x, &offset);
> > + return SYMBOL_REF_P (x) || LABEL_REF_P (x);
> > +}
> > +
> > /* Target-specific selftests. */
> >
> > #if CHECKING_P
> > diff --git a/gcc/testsuite/gcc.target/i386/pr105576.c b/gcc/testsuite/gcc.target/i386/pr105576.c
> > new file mode 100644
> > index 00000000000..06dd860d3f3
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/i386/pr105576.c
> > @@ -0,0 +1,11 @@
> > +/* PR target/105576 */
> > +/* { dg-do compile } */
> > +/* { dg-options "-O2 -mcmodel=large" } */
> > +
> > +extern int var;
> > +void *addr(void) { return &var; }
> > +void addr_via_asm(void)
> > +{
> > + asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(addr));
> > + asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(&var));
> > +}
> > --
> > 2.18.1
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i386: Add a constraint for absolute symboilc address [PR 105576]
2022-05-18 10:14 ` Hongyu Wang
@ 2022-05-18 10:18 ` Uros Bizjak
2022-05-18 10:32 ` Hongyu Wang
0 siblings, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2022-05-18 10:18 UTC (permalink / raw)
To: Hongyu Wang; +Cc: Hongyu Wang, Hongtao Liu, gcc-patches
On Wed, May 18, 2022 at 12:14 PM Hongyu Wang <wwwhhhyyy333@gmail.com> wrote:
>
> Oh, I just found that asm ("%p0" :: "i"(addr)); also works on
> -mcmodel=large in this case, please ignore this patch. Thanks.
-fpic will break compilation with "i" constraint.
Uros.
>
> Uros Bizjak via Gcc-patches <gcc-patches@gcc.gnu.org> 于2022年5月18日周三 17:46写道:
> >
> > On Wed, May 18, 2022 at 9:32 AM Hongyu Wang <hongyu.wang@intel.com> wrote:
> > >
> > > Hi,
> > >
> > > This patch adds a constraint "Ws" to allow absolute symbolic address for either
> > > function or variable. This also works under -mcmodel=large.
> > >
> > > Bootstrapped/regtested on x86_64-pc-linux-gnu{-m32,}
> > >
> > > Ok for master?
> >
> > Maybe you should use:
> >
> > asm ("%p0" :: "X"(addr));
> > asm ("%p0" :: "X"(&var));
> >
> > instead.
> >
> > Uros.
> >
> > > gcc/ChangeLog:
> > >
> > > PR target/105576
> > > * config/i386/constraints.md (Ws): New constraint.
> > > * config/i386/i386-protos.h (ix86_symbolic_address_p):
> > > New proto type.
> > > * config/i386/i386.cc (ix86_symbolic_address_p):
> > > New function to ensure a rtx is a symbolic address.
> > >
> > > gcc/testsuite/ChangeLog:
> > >
> > > PR target/105576
> > > * gcc.target/i386/pr105576.c: New test.
> > > ---
> > > gcc/config/i386/constraints.md | 4 ++++
> > > gcc/config/i386/i386-protos.h | 1 +
> > > gcc/config/i386/i386.cc | 7 +++++++
> > > gcc/testsuite/gcc.target/i386/pr105576.c | 11 +++++++++++
> > > 4 files changed, 23 insertions(+)
> > > create mode 100644 gcc/testsuite/gcc.target/i386/pr105576.c
> > >
> > > diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
> > > index 7361687632f..ec0702be368 100644
> > > --- a/gcc/config/i386/constraints.md
> > > +++ b/gcc/config/i386/constraints.md
> > > @@ -348,6 +348,10 @@ (define_constraint "Z"
> > > instructions)."
> > > (match_operand 0 "x86_64_zext_immediate_operand"))
> > >
> > > +(define_constraint "Ws"
> > > + "A constraint that matches an absolute symbolic address."
> > > + (match_test "ix86_symbolic_address_p (op)"))
> > > +
> > > ;; T prefix is used for different address constraints
> > > ;; v - VSIB address
> > > ;; s - address with no segment register
> > > diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
> > > index 3596ce81ecf..2b8d063850f 100644
> > > --- a/gcc/config/i386/i386-protos.h
> > > +++ b/gcc/config/i386/i386-protos.h
> > > @@ -337,6 +337,7 @@ extern void x86_output_aligned_bss (FILE *, tree, const char *,
> > > unsigned HOST_WIDE_INT, unsigned);
> > > extern void x86_elf_aligned_decl_common (FILE *, tree, const char *,
> > > unsigned HOST_WIDE_INT, unsigned);
> > > +extern bool ix86_symbolic_address_p (rtx x);
> > >
> > > #ifdef RTX_CODE
> > > extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
> > > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> > > index 86752a6516a..76728d10c8d 100644
> > > --- a/gcc/config/i386/i386.cc
> > > +++ b/gcc/config/i386/i386.cc
> > > @@ -23956,6 +23956,13 @@ ix86_push_rounding (poly_int64 bytes)
> > > return ROUND_UP (bytes, UNITS_PER_WORD);
> > > }
> > >
> > > +bool ix86_symbolic_address_p (rtx x)
> > > +{
> > > + poly_int64 offset;
> > > + x = strip_offset (x, &offset);
> > > + return SYMBOL_REF_P (x) || LABEL_REF_P (x);
> > > +}
> > > +
> > > /* Target-specific selftests. */
> > >
> > > #if CHECKING_P
> > > diff --git a/gcc/testsuite/gcc.target/i386/pr105576.c b/gcc/testsuite/gcc.target/i386/pr105576.c
> > > new file mode 100644
> > > index 00000000000..06dd860d3f3
> > > --- /dev/null
> > > +++ b/gcc/testsuite/gcc.target/i386/pr105576.c
> > > @@ -0,0 +1,11 @@
> > > +/* PR target/105576 */
> > > +/* { dg-do compile } */
> > > +/* { dg-options "-O2 -mcmodel=large" } */
> > > +
> > > +extern int var;
> > > +void *addr(void) { return &var; }
> > > +void addr_via_asm(void)
> > > +{
> > > + asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(addr));
> > > + asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(&var));
> > > +}
> > > --
> > > 2.18.1
> > >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i386: Add a constraint for absolute symboilc address [PR 105576]
2022-05-18 10:18 ` Uros Bizjak
@ 2022-05-18 10:32 ` Hongyu Wang
0 siblings, 0 replies; 5+ messages in thread
From: Hongyu Wang @ 2022-05-18 10:32 UTC (permalink / raw)
To: Uros Bizjak; +Cc: Hongyu Wang, Hongtao Liu, gcc-patches
> -fpic will break compilation with "i" constraint.
Ah, yes. But "X" is like no constraint, shouldn't we provide something
similar to "S" in aarch64 and riscv?
I think it is better to constrain the operand to constant symbols
rather than allowing everything.
Uros Bizjak <ubizjak@gmail.com> 于2022年5月18日周三 18:18写道:
>
> On Wed, May 18, 2022 at 12:14 PM Hongyu Wang <wwwhhhyyy333@gmail.com> wrote:
> >
> > Oh, I just found that asm ("%p0" :: "i"(addr)); also works on
> > -mcmodel=large in this case, please ignore this patch. Thanks.
>
> -fpic will break compilation with "i" constraint.
>
> Uros.
>
> >
> > Uros Bizjak via Gcc-patches <gcc-patches@gcc.gnu.org> 于2022年5月18日周三 17:46写道:
> > >
> > > On Wed, May 18, 2022 at 9:32 AM Hongyu Wang <hongyu.wang@intel.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > This patch adds a constraint "Ws" to allow absolute symbolic address for either
> > > > function or variable. This also works under -mcmodel=large.
> > > >
> > > > Bootstrapped/regtested on x86_64-pc-linux-gnu{-m32,}
> > > >
> > > > Ok for master?
> > >
> > > Maybe you should use:
> > >
> > > asm ("%p0" :: "X"(addr));
> > > asm ("%p0" :: "X"(&var));
> > >
> > > instead.
> > >
> > > Uros.
> > >
> > > > gcc/ChangeLog:
> > > >
> > > > PR target/105576
> > > > * config/i386/constraints.md (Ws): New constraint.
> > > > * config/i386/i386-protos.h (ix86_symbolic_address_p):
> > > > New proto type.
> > > > * config/i386/i386.cc (ix86_symbolic_address_p):
> > > > New function to ensure a rtx is a symbolic address.
> > > >
> > > > gcc/testsuite/ChangeLog:
> > > >
> > > > PR target/105576
> > > > * gcc.target/i386/pr105576.c: New test.
> > > > ---
> > > > gcc/config/i386/constraints.md | 4 ++++
> > > > gcc/config/i386/i386-protos.h | 1 +
> > > > gcc/config/i386/i386.cc | 7 +++++++
> > > > gcc/testsuite/gcc.target/i386/pr105576.c | 11 +++++++++++
> > > > 4 files changed, 23 insertions(+)
> > > > create mode 100644 gcc/testsuite/gcc.target/i386/pr105576.c
> > > >
> > > > diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
> > > > index 7361687632f..ec0702be368 100644
> > > > --- a/gcc/config/i386/constraints.md
> > > > +++ b/gcc/config/i386/constraints.md
> > > > @@ -348,6 +348,10 @@ (define_constraint "Z"
> > > > instructions)."
> > > > (match_operand 0 "x86_64_zext_immediate_operand"))
> > > >
> > > > +(define_constraint "Ws"
> > > > + "A constraint that matches an absolute symbolic address."
> > > > + (match_test "ix86_symbolic_address_p (op)"))
> > > > +
> > > > ;; T prefix is used for different address constraints
> > > > ;; v - VSIB address
> > > > ;; s - address with no segment register
> > > > diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
> > > > index 3596ce81ecf..2b8d063850f 100644
> > > > --- a/gcc/config/i386/i386-protos.h
> > > > +++ b/gcc/config/i386/i386-protos.h
> > > > @@ -337,6 +337,7 @@ extern void x86_output_aligned_bss (FILE *, tree, const char *,
> > > > unsigned HOST_WIDE_INT, unsigned);
> > > > extern void x86_elf_aligned_decl_common (FILE *, tree, const char *,
> > > > unsigned HOST_WIDE_INT, unsigned);
> > > > +extern bool ix86_symbolic_address_p (rtx x);
> > > >
> > > > #ifdef RTX_CODE
> > > > extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
> > > > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> > > > index 86752a6516a..76728d10c8d 100644
> > > > --- a/gcc/config/i386/i386.cc
> > > > +++ b/gcc/config/i386/i386.cc
> > > > @@ -23956,6 +23956,13 @@ ix86_push_rounding (poly_int64 bytes)
> > > > return ROUND_UP (bytes, UNITS_PER_WORD);
> > > > }
> > > >
> > > > +bool ix86_symbolic_address_p (rtx x)
> > > > +{
> > > > + poly_int64 offset;
> > > > + x = strip_offset (x, &offset);
> > > > + return SYMBOL_REF_P (x) || LABEL_REF_P (x);
> > > > +}
> > > > +
> > > > /* Target-specific selftests. */
> > > >
> > > > #if CHECKING_P
> > > > diff --git a/gcc/testsuite/gcc.target/i386/pr105576.c b/gcc/testsuite/gcc.target/i386/pr105576.c
> > > > new file mode 100644
> > > > index 00000000000..06dd860d3f3
> > > > --- /dev/null
> > > > +++ b/gcc/testsuite/gcc.target/i386/pr105576.c
> > > > @@ -0,0 +1,11 @@
> > > > +/* PR target/105576 */
> > > > +/* { dg-do compile } */
> > > > +/* { dg-options "-O2 -mcmodel=large" } */
> > > > +
> > > > +extern int var;
> > > > +void *addr(void) { return &var; }
> > > > +void addr_via_asm(void)
> > > > +{
> > > > + asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(addr));
> > > > + asm (".pushsection .xxx,\"aw\"\n\t .dc.a %0\n\t .popsection" :: "Ws"(&var));
> > > > +}
> > > > --
> > > > 2.18.1
> > > >
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-18 10:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 7:31 [PATCH] i386: Add a constraint for absolute symboilc address [PR 105576] Hongyu Wang
2022-05-18 9:45 ` Uros Bizjak
2022-05-18 10:14 ` Hongyu Wang
2022-05-18 10:18 ` Uros Bizjak
2022-05-18 10:32 ` Hongyu Wang
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).