From patchwork Sun Feb 28 07:16:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YunQiang Su X-Patchwork-Id: 1445235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=cipunited.onmicrosoft.com header.i=@cipunited.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-cipunited-onmicrosoft-com header.b=PZPkUXYE; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DpF8l3fMzz9sCD for ; Sun, 28 Feb 2021 18:17:40 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC75A385780A; Sun, 28 Feb 2021 07:17:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from APC01-PU1-obe.outbound.protection.outlook.com (mail-eopbgr1320094.outbound.protection.outlook.com [40.107.132.94]) by sourceware.org (Postfix) with ESMTPS id 412633858009 for ; Sun, 28 Feb 2021 07:17:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 412633858009 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cipunited.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yunqiang.su@cipunited.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NoWVL8sWiZVbXuThW1shYtWSul4ajhKikB18jeWYSI4BOxXHliJWMLnohFpcC+TZTyo+N+QXnGCOHLSmonAyApfz8VXPwauJpNoB+thJZP6sipfu0/gyzCGuzTQDtfdASr9cjCKLXC2eZtHlSgn4SeLq7fQHh/83A3DTB4P8+ZSgjqNUNxLZnyvKqqO4+fvwQSHfTWqtSVtSWnKPevDfKeWeTdzyCzRA9g4/28lpocXGHjKorc4BWnxeDv9SsI8fCJGtn89FTKvcUXcr3fsJocC9ETk35RFxK8VuGfyd6T2FB3jsFpKrswLSteD2NWXJptqa3oJQMdswoNyCjQNWzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F2W7D6NCV8B/GIsxHFRttehbvoH40qjtXTAlRewj/ns=; b=kFCyhGfHOO0ddDe6IMSvFNCNLuMtF5/sBYk0/yO4JY9pNzchzN6TRI5nE7NYJXzUoxqBTdnuuE+x714u2qD3ZQWId+W358tPOQ0jYzjR+gKBwr26+kXYgxCgVeXaVHZDn8R1kKycnfODSZ+P7Yy/+skem0rOeAoEN1xzEMPoZNC5SdobXTAUiryWNahHLXG4DJx7wn9mLM61QA281Gu7IDhNa3hDgfqMBBPq6e8glylYJe2tGwel7KNhB6FwzN0sCxbT2o1SUehxOXvsyhTuC0DKhjbiZQI0Nb6fcTwu++gpBrOMduCZg+cfCq1piOMRLkJUsZUBGhmSWmeAbtVtNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cipunited.com; dmarc=pass action=none header.from=cipunited.com; dkim=pass header.d=cipunited.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cipunited.onmicrosoft.com; s=selector1-cipunited-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F2W7D6NCV8B/GIsxHFRttehbvoH40qjtXTAlRewj/ns=; b=PZPkUXYE4DlkFg14zKuBQTzki/ABdtlfT+1LAL2EAVdWQMaNxgh8cKQP0h4kEeiQPab46ICac9RvGx3SwiW/WQIxnGmXTe5qgCVWLXUE8jiz5vGG96sDGYe1lGaBRBltKaunW6YoX41ZuETUOeqI6amxR0qYZX2Lr+E1ZitB0Ik= Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=cipunited.com; Received: from HKAPR04MB3956.apcprd04.prod.outlook.com (2603:1096:203:d5::13) by HKAPR04MB3905.apcprd04.prod.outlook.com (2603:1096:203:dd::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Sun, 28 Feb 2021 07:17:22 +0000 Received: from HKAPR04MB3956.apcprd04.prod.outlook.com ([fe80::b5d5:d70f:ed37:984c]) by HKAPR04MB3956.apcprd04.prod.outlook.com ([fe80::b5d5:d70f:ed37:984c%6]) with mapi id 15.20.3890.028; Sun, 28 Feb 2021 07:17:22 +0000 From: YunQiang Su To: gcc-patches@gcc.gnu.org Subject: [PATCH] MIPS: R6: load/store can process unaligned address Date: Sun, 28 Feb 2021 07:16:57 +0000 Message-Id: <20210228071657.379-1-yunqiang.su@cipunited.com> X-Mailer: git-send-email 2.20.1 X-Originating-IP: [60.247.76.83] X-ClientProxiedBy: HK2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:202:16::13) To HKAPR04MB3956.apcprd04.prod.outlook.com (2603:1096:203:d5::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (60.247.76.83) by HK2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:202:16::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Sun, 28 Feb 2021 07:17:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef6d5aef-896a-4452-1781-08d8dbb8e408 X-MS-TrafficTypeDiagnostic: HKAPR04MB3905: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6DWe/rAHzgeMeFUQrak233ydbMM+dZVqgLAqSJqLVxaEUK3HvKev3ZwQClwMU14azOhXniulas4TamnyK8BQyxkP3JgNGtLKdZSG/0IJDNGZGQVuZSXNq8FNtUhBvirSNG5CvhKMtLmnvDSphkXJVZyeQvykh+nzsthK2zPCGUfKO9xfbm5d5+20OPZLeqYMdt0ZI/0B8Gd9KWmyCvpJ8elP32gf+hPQbnPrASrQfLYyMnJk7U7jyCW4zolH1d+QvaUphM1Z8bxL9T08M8a2SNJSZdUTCIX8uRxjpa5KHfbCZHbKkN9GHnNFvyXg9Ay7T/j0U1jfhEMewoD74cpFIjqeHZuzZhmIbQoJD3h98AFjprc+zB3eKywxwI6OQarPpCeGWfcWZZpb5bvxXiDIjYwZzSbn81D8Mcd1ha7ZLukIOHndCLgMIBFWiPv3ELN/lG9qT8sf7Q3tmDhz1LV8DnArbwkr+/HHOq+i6LeloJPzr9PFUvqc+ROCwusYe2OCPdOEt9ABHTUEQAP8E2A3CZwZHck3Ina6C1/n6feQg3h1ishjc5oBRJnhlXv/Nf0qpEL2iXZmt5SBelNIYJ3bJg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HKAPR04MB3956.apcprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(39830400003)(136003)(376002)(366004)(346002)(396003)(36756003)(1076003)(956004)(6486002)(6916009)(316002)(86362001)(6666004)(2616005)(52116002)(6506007)(66946007)(478600001)(26005)(4326008)(69590400012)(186003)(16526019)(107886003)(83380400001)(5660300002)(2906002)(66556008)(66476007)(8936002)(6512007)(8676002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: /+O1A0EO8ej9iH3BITKn7XmELj3RltPG5C8X86xWzA5xl++zyKfv9Yd5llACHTHot5w0VqxHfMzO+TiPGx0cfKNkSmXmqMTzcSXW1dWVeqzKpqlV3NjnT2P5CfjCAd73EhqTcepePpExTmHvRnS24xoHJTETUnpDETA7//PHV7A4s6x/zpUR97KMARpfZFEUio8KpTnAZppQkh+KtHiLfedsR3fFkRGJo3INgLO1v9p8hvhGw2cnvf5ZbcDOy5bYRo49BIkjSp2phQEJshL44iOfOOQ6tR+GIDHUf1EZZK1bS4JgkkpqyT2QcJfz9lumpJkLwcjVclRALQY7oSMHIe/HpgOq7qA8CbkLYzQXHw2HIurZgV4sbrAahNM6YJUj8bx4GrRw4SfZojJHkXMl5mpbM9/IvMSRqO80VWkgiZ88MzgvVPeofEMEXQ9R7C3JuPq2WfGwlICUGOzKhl9DLfGoLwuIcMtom2WsSKudx64XFLFrTWkEL6oan9ytvvq3ood57GLLuTlF9oc+49500UxJcIjFtvwN6YAMrYrNl5DGz0rTkeWpdEj4X8VjK1Urrf/+10MndwGCDmO4Vm+boJoGjB9rk5hX2a8eeiEA7tlRm+0N8V7Jup1KDl3Fn3KGTLEEY+SiELHTvf08XT7nkBi6OzR3xhjmJk3eHYwVWv4keaPoNeIM5LVHqQS48ENuX/dRX4lT09KuKFx/nbn7Cr8aDU2UBGrIyNVi41n812IcSYZd/Gm22YsHFCcRiD5HiI3juyCHywcjgBbXgjBBu/noaBqRZPUcHBNZ3KPCWsD7oQ8AFZR2mhC6oSXMgiNsFsW048+A4XZA/58s73v43pFZqflzRsvO84esA7YfwSzRZNf1+3SkJwRfP2X3JrGlihwOOyNmhJiW3PgzyFYRDjRxTHfi9U8eZci8HS6LmrkSk5+wzhj8M8ZH5nrASwypf4pIHaWLKoxfGRPM0LnaJ3x7t+7/sw0yTarTP6Ihjvfu+rqk7XDB7fJreg/b3d3QkW2OM6tXmreGkjxwxZ3GZU0hvAlfoavBd+r/mhmhlUQ46zBe9QLnesRxA2QKC2k2UdUUWEfOE4gJLn0CDdMNVw6QwvuHL3JfvFxXVrpbXNzREBhjFj7aOm7UdAVya3tSKGtgoe0OGB0S2AvQr7i7E1NdIH/YjQzLzZ1WEyiG73nR9AHMogBnBqkaiL46mT/Towo8Egn5tOstKdghv1Fb6U/aKFwCHxeHmLGgf8w8z6qtoBz4MPdxiZLOqNr2BYFlox06qEbgoeqxNUVBnwfZX2ln7imVuRqMNk73Qw1Y3gOuVBSUf5qS99y3bFwFstEs X-OriginatorOrg: cipunited.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef6d5aef-896a-4452-1781-08d8dbb8e408 X-MS-Exchange-CrossTenant-AuthSource: HKAPR04MB3956.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2021 07:17:22.1286 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e31cf5b5-ee69-4d5f-9c69-edeeda2458c0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xfCDEfsgymfHzTV5HMNshFo5JE1JAKSDjI96rHQUa7dtT/HgQMn4zs2n2cfpi4UylGyD8k9L2VIkF+HRTzXsc37g9tBth6KxcuYCpUDcdgk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKAPR04MB3905 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_STOCKGEN, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: YunQiang Su , jiaxun.yang@flygoat.com, macro@orcam.me.uk Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" MIPS release 6 requires the lw/ld/sw/sd can work with unaligned address, while it can be implemented by full hardware or trap&emulate. Since it is may be fully done by hardware, we add an option -m(no-)unaligned-access, the kernel may need it. gcc/ChangeLog: * config/mips/mips.h (ISA_HAS_UNALIGNED_ACCESS): (STRICT_ALIGNMENT): R6 can unaligned access. * config/mips/mips.md (movmisalign): Likewise. * config/mips/mips.opt: add -m(no-)unaligned-access * doc/invoke.texi: Likewise. gcc/testsuite/ChangeLog: * gcc.target/mips/mips.exp: add unaligned-access * gcc.target/mips/unaligned-2.c: New test. * gcc.target/mips/unaligned-3.c: New test. --- gcc/config/mips/mips.h | 6 ++- gcc/config/mips/mips.md | 10 ++++ gcc/config/mips/mips.opt | 4 ++ gcc/doc/invoke.texi | 10 ++++ gcc/testsuite/gcc.target/mips/mips.exp | 1 + gcc/testsuite/gcc.target/mips/unaligned-2.c | 53 +++++++++++++++++++++ gcc/testsuite/gcc.target/mips/unaligned-3.c | 53 +++++++++++++++++++++ 7 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/mips/unaligned-2.c create mode 100644 gcc/testsuite/gcc.target/mips/unaligned-3.c diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index b4a60a55d80..38c39f79ee2 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -226,6 +226,10 @@ struct mips_cpu_info { && (mips_isa_rev >= 6 \ || ISA_HAS_MSA)) +/* ISA load/store instructions can handle unaligned address */ +#define ISA_HAS_UNALIGNED_ACCESS (TARGET_UNALIGNED_ACCESS \ + && (mips_isa_rev >= 6)) + /* The ISA compression flags that are currently in effect. */ #define TARGET_COMPRESSION (target_flags & (MASK_MIPS16 | MASK_MICROMIPS)) @@ -1665,7 +1669,7 @@ FP_ASM_SPEC "\ (ISA_HAS_MSA ? BITS_PER_MSA_REG : LONG_DOUBLE_TYPE_SIZE) /* All accesses must be aligned. */ -#define STRICT_ALIGNMENT 1 +#define STRICT_ALIGNMENT (!ISA_HAS_UNALIGNED_ACCESS) /* Define this if you wish to imitate the way many other C compilers handle alignment of bitfields and the structures that contain diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index eef3cfd50a8..40e29c60432 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -4459,6 +4459,16 @@ (define_insn "mov_r" [(set_attr "move_type" "store") (set_attr "mode" "")]) +;; Unaligned direct access +(define_expand "movmisalign" + [(set (match_operand:JOIN_MODE 0) + (match_operand:JOIN_MODE 1))] + "ISA_HAS_UNALIGNED_ACCESS" +{ + if (mips_legitimize_move (mode, operands[0], operands[1])) + DONE; +}) + ;; An instruction to calculate the high part of a 64-bit SYMBOL_ABSOLUTE. ;; The required value is: ;; diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt index 6af8037e9bd..ebb4c616401 100644 --- a/gcc/config/mips/mips.opt +++ b/gcc/config/mips/mips.opt @@ -404,6 +404,10 @@ mtune= Target RejectNegative Joined Var(mips_tune_option) ToLower Enum(mips_arch_opt_value) -mtune=PROCESSOR Optimize the output for PROCESSOR. +munaligned-access +Target Var(TARGET_UNALIGNED_ACCESS) Init(1) +Generate code with unaligned load store, valid for MIPS R6. + muninit-const-in-rodata Target Var(TARGET_UNINIT_CONST_IN_RODATA) Put uninitialized constants in ROM (needs -membedded-data). diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 546e95453c1..27730d1a0de 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1059,6 +1059,7 @@ Objective-C and Objective-C++ Dialects}. -mcheck-zero-division -mno-check-zero-division @gol -mdivide-traps -mdivide-breaks @gol -mload-store-pairs -mno-load-store-pairs @gol +-munaligned-access -mno-unaligned-access @gol -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol -mfix-24k -mno-fix-24k @gol @@ -24967,6 +24968,15 @@ 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. +@item -munaligned-access +@itemx -mno-unaligned-access +@opindex munaligned-access +@opindex 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. + @item -mmemcpy @itemx -mno-memcpy @opindex mmemcpy diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp index 01292316944..cb1ee7d71b5 100644 --- a/gcc/testsuite/gcc.target/mips/mips.exp +++ b/gcc/testsuite/gcc.target/mips/mips.exp @@ -264,6 +264,7 @@ set mips_option_groups { frame-header "-mframe-header-opt|-mno-frame-header-opt" stack-protector "-fstack-protector" stdlib "REQUIRES_STDLIB" + unaligned-access "-m(no-|)unaligned-access" } for { set option 0 } { $option < 32 } { incr option } { diff --git a/gcc/testsuite/gcc.target/mips/unaligned-2.c b/gcc/testsuite/gcc.target/mips/unaligned-2.c new file mode 100644 index 00000000000..8679afac400 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/unaligned-2.c @@ -0,0 +1,53 @@ +/* { dg-options "isa_rev>=6 -mgp64" } */ +/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */ +/* { dg-final { scan-assembler-not "\tsb\t" } } */ +/* { dg-final { scan-assembler-not "\tsh\t" } } */ +/* { dg-final { scan-assembler-not "\tlb\t" } } */ +/* { dg-final { scan-assembler-not "\tlh\t" } } */ +/* { dg-final { scan-assembler-not "\tswl\t" } } */ +/* { dg-final { scan-assembler-not "\tswr\t" } } */ +/* { dg-final { scan-assembler-not "\tlwl\t" } } */ +/* { dg-final { scan-assembler-not "\tlwr\t" } } */ +/* { dg-final { scan-assembler-not "\tsdl\t" } } */ +/* { dg-final { scan-assembler-not "\tsdr\t" } } */ +/* { dg-final { scan-assembler-not "\tldl\t" } } */ +/* { dg-final { scan-assembler-not "\tldr\t" } } */ +/* { dg-final { scan-assembler-times "\tsw\t" 1 } } */ +/* { dg-final { scan-assembler-times "\tlw\t" 1 } } */ +/* { dg-final { scan-assembler-times "\tsd\t" 1 } } */ +/* { dg-final { scan-assembler-times "\tld\t" 1 } } */ +/* { dg-final { scan-assembler-not "\tnop" } } */ + +/* Test to make sure we produce the unaligned load/store for + both 64bit and 32bits sized accesses. */ + +struct s +{ + char c; + int i; + long long l; +} __attribute__ ((packed)) s __attribute__((aligned(1) )); + +NOMIPS16 void +sd (long long l) +{ + s.l = l; +} + +NOMIPS16 long long +ld () +{ + return s.l; +} + +NOMIPS16 void +sw (int i) +{ + s.i = i; +} + +NOMIPS16 int +lw () +{ + return s.i; +} diff --git a/gcc/testsuite/gcc.target/mips/unaligned-3.c b/gcc/testsuite/gcc.target/mips/unaligned-3.c new file mode 100644 index 00000000000..d0fbe19de50 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/unaligned-3.c @@ -0,0 +1,53 @@ +/* { dg-options "isa_rev>=6 -mgp64 -mno-unaligned-access" } */ +/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */ +/* { dg-final { scan-assembler-times "\tsb\t" 12 } } */ +/* { dg-final { scan-assembler-times "\tlbu\t" 12 } } */ +/* { dg-final { scan-assembler-not "\tsh\t" } } */ +/* { dg-final { scan-assembler-not "\tlh\t" } } */ +/* { dg-final { scan-assembler-not "\tsw\t" } } */ +/* { dg-final { scan-assembler-not "\tlw\t" } } */ +/* { dg-final { scan-assembler-not "\tsd\t" } } */ +/* { dg-final { scan-assembler-not "\tld\t" } } */ +/* { dg-final { scan-assembler-not "\tswl\t" } } */ +/* { dg-final { scan-assembler-not "\tswr\t" } } */ +/* { dg-final { scan-assembler-not "\tlwl\t" } } */ +/* { dg-final { scan-assembler-not "\tlwr\t" } } */ +/* { dg-final { scan-assembler-not "\tsdl\t" } } */ +/* { dg-final { scan-assembler-not "\tsdr\t" } } */ +/* { dg-final { scan-assembler-not "\tldl\t" } } */ +/* { dg-final { scan-assembler-not "\tldr\t" } } */ +/* { dg-final { scan-assembler-not "\tnop" } } */ + +/* Test to make sure we produce the unaligned load/store for + both 64bit and 32bits sized accesses. */ + +struct s +{ + char c; + int i; + long long l; +} __attribute__ ((packed)) s __attribute__((aligned(1) )); + +NOMIPS16 void +sd (long long l) +{ + s.l = l; +} + +NOMIPS16 long long +ld () +{ + return s.l; +} + +NOMIPS16 void +sw (int i) +{ + s.i = i; +} + +NOMIPS16 int +lw () +{ + return s.i; +}