From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by sourceware.org (Postfix) with ESMTPS id 6C41E3858416 for ; Fri, 15 Mar 2024 06:50:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C41E3858416 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6C41E3858416 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710485418; cv=none; b=A52B1yAQmHfRmr73/5FtMP6r1rsdOriCji2zrgGQuGyF0dJLDXEJ8PBsC8icwMJ6lJ+mpe3VrB8rBfTJhprp8vgdnQAbparO0KIr7yQePWn+6VloRk9atuuJ9Ni6sgEfUuUY3WISoJtRj0BwGqwAfR7RMV6xM+xBYBufvkYB3UY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710485418; c=relaxed/simple; bh=9czo426fUU2bWAidgfi1bDRq1U8PGFVhZCCtJxuMqKs=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=KZ8uR2tEc13CbY8eN8zDVj86kAue7LcP2KKsmQOeqYBlA9BFiAaAX+ttte2p7jykmSFqGhtSarKtaJUvJkAS//aNIhADjTTziWMiTUBJfh9+VV6jL1FDGRTEQ1RjAzDSOgYR26/wClMFI4trkgE2MIsafakdqajrheYA4zUeFi4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so1450532a12.1 for ; Thu, 14 Mar 2024 23:50:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710485415; x=1711090215; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=e+ZP+Wk9DYDkp/EvEamrr/QrhgI9NRbSWIzRDhbrAAg=; b=IrQ0iDiXfUrDfTUq+rPqj3TT5JOuRF01vVF8zUXa8mMMtzgm0+jD6RJf05alZ61GPG H6m5NIe1NxVR+ngZMIpdIsKpmq1y6/6+ofZmPEGqXhQ2tjWI6AsBqOa0y1YwIusC8pos nN3ceM/HYvIamH+cJ3dqfwfUD0IfXP4pLbhqZvRJohki0rUllQLRwWLRXGwTn+HcL95G iMNjPP3PMhz6gnNt+Alc+tIevN1IzgYAarYDylmEOvEMrBAsBf6RsI7bZrOSx2lRlmcB pENG+xo7pNiMev0bbPS30doHgifkKpl8wvCg83l0pjg43YA1MBfjDuKZiY4/J3KW9coa ZBaA== X-Gm-Message-State: AOJu0YyhqYvOAeU6H/N7foZmFkgwfRV+AGykarA8DrUvCFD8vu3xHiWm Yps7CP7zcE8Xvzc16TsHIYXxexX6I1mc4VJSA6Td9XgSH2dUH8FXdnkefIMq6JM= X-Google-Smtp-Source: AGHT+IFfv1uGR3gDTnVIPt9DipUyMMLV2f8SnmyTUi8clsXjFdbPXU0lGm3SN1S4UcP34F+iNy6mRg== X-Received: by 2002:a05:6a20:b801:b0:1a3:475e:8114 with SMTP id fi1-20020a056a20b80100b001a3475e8114mr2304416pzb.29.1710485414666; Thu, 14 Mar 2024 23:50:14 -0700 (PDT) Received: from localhost.localdomain ([149.248.38.156]) by smtp.gmail.com with ESMTPSA id k5-20020a170902c40500b001dd635551f1sm2952263plk.255.2024.03.14.23.50.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 23:50:14 -0700 (PDT) From: YunQiang Su To: gcc-patches@gcc.gnu.org Subject: [commit] MIPS: Add -m(no-)strict-align option Date: Fri, 15 Mar 2024 14:50:06 +0800 Message-Id: <20240315065006.3660402-1-syq@gcc.gnu.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: We support options -m(no-)unaligned-access 2 years ago, while currently most of other ports prefer -m(no-)strict-align. Let's support -m(no-)strict-align, and keep -m(no-)unaligned-access as alias. gcc * config/mips/mips.opt: Support -mstrict-align, and use TARGET_STRICT_ALIGN as the flag; keep -m(no-)unaligned-access as alias. * config/mips/mips.h: Use TARGET_STRICT_ALIGN. * config/mips/mips.opt.urls: Regenerate. * doc/invoke.texi: Document -m(no-)strict-algin for MIPSr6. --- gcc/config/mips/mips.h | 2 +- gcc/config/mips/mips.opt | 12 ++++++++++-- gcc/config/mips/mips.opt.urls | 6 ++++++ gcc/doc/invoke.texi | 18 ++++++++++++------ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 7145d23c650..6444a68dfd5 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -251,7 +251,7 @@ struct mips_cpu_info { || ISA_HAS_MSA)) /* ISA load/store instructions can handle unaligned address */ -#define ISA_HAS_UNALIGNED_ACCESS (TARGET_UNALIGNED_ACCESS \ +#define ISA_HAS_UNALIGNED_ACCESS (!TARGET_STRICT_ALIGN \ && (mips_isa_rev >= 6)) /* The ISA compression flags that are currently in effect. */ diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt index ce36942aabe..c1abb36212f 100644 --- a/gcc/config/mips/mips.opt +++ b/gcc/config/mips/mips.opt @@ -429,9 +429,17 @@ mtune= Target RejectNegative Joined Var(mips_tune_option) ToLower Enum(mips_arch_opt_value) -mtune=PROCESSOR Optimize the output for PROCESSOR. +mstrict-align +Target Var(TARGET_STRICT_ALIGN) Init(0) +Don't generate code with unaligned load store, only valid for MIPS R6. + munaligned-access -Target Var(TARGET_UNALIGNED_ACCESS) Init(1) -Generate code with unaligned load store, valid for MIPS R6. +Target RejectNegative Alias(mstrict-align) NegativeAlias +Generate code with unaligned load store for R6 (alias of -mno-strict-align). + +mno-unaligned-access +Target RejectNegative Alias(mstrict-align) +Don't generate code with unaligned load store for R6 (alias of -mstrict-align). muninit-const-in-rodata Target Var(TARGET_UNINIT_CONST_IN_RODATA) diff --git a/gcc/config/mips/mips.opt.urls b/gcc/config/mips/mips.opt.urls index 96aba041026..9d166646d65 100644 --- a/gcc/config/mips/mips.opt.urls +++ b/gcc/config/mips/mips.opt.urls @@ -233,9 +233,15 @@ UrlSuffix(gcc/MIPS-Options.html#index-mmadd4) mtune= UrlSuffix(gcc/MIPS-Options.html#index-mtune-10) +mstrict-align +UrlSuffix(gcc/MIPS-Options.html#index-mstrict-align-3) + munaligned-access UrlSuffix(gcc/MIPS-Options.html#index-munaligned-access-1) +mno-unaligned-access +UrlSuffix(gcc/MIPS-Options.html#index-mno-unaligned-access-1) + muninit-const-in-rodata UrlSuffix(gcc/MIPS-Options.html#index-muninit-const-in-rodata) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 85c938d4a14..864768fd2f4 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1143,7 +1143,8 @@ Objective-C and Objective-C++ Dialects}. -mcheck-zero-division -mno-check-zero-division -mdivide-traps -mdivide-breaks -mload-store-pairs -mno-load-store-pairs --munaligned-access -mno-unaligned-access +-mstrict-align -mno-strict-align +-mno-unaligned-access -munaligned-access -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k @@ -28561,14 +28562,19 @@ instructions to enable load/store bonding. This option is enabled by default but only takes effect when the selected architecture is known to support bonding. +@opindex mstrict-align +@opindex mno-strict-align @opindex munaligned-access @opindex mno-unaligned-access -@item -munaligned-access +@item -mstrict-align +@itemx -mno-strict-align +@itemx -munaligned-access @itemx -mno-unaligned-access -Enable (disable) direct unaligned access for MIPS Release 6. -MIPSr6 requires load/store unaligned-access support, -by hardware or trap&emulate. -So @option{-mno-unaligned-access} may be needed by kernel. +Disable (enable) direct unaligned access for MIPS Release 6. +MIPSr6 requires load/store unaligned-access support, by hardware or +trap&emulate. So @option{-mstrict-align} may be needed by kernel. The +options @option{-munaligned-access} and @option{-mno-unaligned-access} +are obsoleted, and only for backward-compatible. @opindex mmemcpy @opindex mno-memcpy -- 2.39.2