diff mbox series

Fix handling of OPT_mgeneral_regs_only in attribute.

Message ID 40227888-c9c9-b2a7-6f8a-93db14725c9f@suse.cz
State New
Headers show
Series Fix handling of OPT_mgeneral_regs_only in attribute. | expand

Commit Message

Martin Liška May 21, 2020, 3:01 p.m. UTC
Hi.

Similarly to:

     case OPT_mstrict_align:
       if (val)
	opts->x_target_flags |= MASK_STRICT_ALIGN;
       else
	opts->x_target_flags &= ~MASK_STRICT_ALIGN;
       return true;

the MASK_GENERAL_REGS_ONLY mask should be handled the same way.

@Sudakshina: The 'opts->x_target_flags |= MASK_STRICT_ALIGN' change is not backported
to all active branches. Can you please do it?

Ready to be installed?

gcc/ChangeLog:

2020-05-21  Martin Liska  <mliska@suse.cz>

	* common/config/aarch64/aarch64-common.c (aarch64_handle_option):
	Properly maask MASK_GENERAL_REGS_ONLY based on val.
---
  gcc/common/config/aarch64/aarch64-common.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

Comments

H.J. Lu May 21, 2020, 4:50 p.m. UTC | #1
On Thu, May 21, 2020 at 9:22 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> Similarly to:
>
>      case OPT_mstrict_align:
>        if (val)
>         opts->x_target_flags |= MASK_STRICT_ALIGN;
>        else
>         opts->x_target_flags &= ~MASK_STRICT_ALIGN;
>        return true;
>
> the MASK_GENERAL_REGS_ONLY mask should be handled the same way.
>
> @Sudakshina: The 'opts->x_target_flags |= MASK_STRICT_ALIGN' change is not backported
> to all active branches. Can you please do it?
>
> Ready to be installed?
>
> gcc/ChangeLog:
>
> 2020-05-21  Martin Liska  <mliska@suse.cz>
>
>         * common/config/aarch64/aarch64-common.c (aarch64_handle_option):
>         Properly maask MASK_GENERAL_REGS_ONLY based on val.
                        ^^^^^ mask
> ---
>   gcc/common/config/aarch64/aarch64-common.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
>
Sudakshina Das May 21, 2020, 5:36 p.m. UTC | #2
Hi Martin

> -----Original Message-----
> From: Martin Liška <mliska@suse.cz>
> Sent: 21 May 2020 16:01
> To: gcc-patches@gcc.gnu.org
> Cc: Sudakshina Das <Sudi.Das@arm.com>
> Subject: [PATCH] Fix handling of OPT_mgeneral_regs_only in attribute.
> 
> Hi.
> 
> Similarly to:
> 
>      case OPT_mstrict_align:
>        if (val)
> 	opts->x_target_flags |= MASK_STRICT_ALIGN;
>        else
> 	opts->x_target_flags &= ~MASK_STRICT_ALIGN;
>        return true;
> 
> the MASK_GENERAL_REGS_ONLY mask should be handled the same way.

My old patch added the -mno-* version of the option and hence needed the change.
Without the _no_ version for mgeneral-regs-only, I would imagine "val" to only ever have
1 as a value. Am I missing something here?

Sudi
> 
> @Sudakshina: The 'opts->x_target_flags |= MASK_STRICT_ALIGN' change is
> not backported to all active branches. Can you please do it?
> 
> Ready to be installed?
> 
> gcc/ChangeLog:
> 
> 2020-05-21  Martin Liska  <mliska@suse.cz>
> 
> 	* common/config/aarch64/aarch64-common.c
> (aarch64_handle_option):
> 	Properly maask MASK_GENERAL_REGS_ONLY based on val.
> ---
>   gcc/common/config/aarch64/aarch64-common.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
Martin Liška May 21, 2020, 6:39 p.m. UTC | #3
Ah, you are right. Please forget about this patch

mgeneral-regs-only
Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save

also contains the RejectNegative keyword.

Martin
diff mbox series

Patch

diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c
index 51bd319d6d3..ef6b34025d9 100644
--- a/gcc/common/config/aarch64/aarch64-common.c
+++ b/gcc/common/config/aarch64/aarch64-common.c
@@ -98,7 +98,10 @@  aarch64_handle_option (struct gcc_options *opts,
       return true;
 
     case OPT_mgeneral_regs_only:
-      opts->x_target_flags |= MASK_GENERAL_REGS_ONLY;
+      if (val)
+	opts->x_target_flags |= MASK_GENERAL_REGS_ONLY;
+      else
+	opts->x_target_flags &= ~MASK_GENERAL_REGS_ONLY;
       return true;
 
     case OPT_mfix_cortex_a53_835769: